4#include <udfread/udfread.h>
5#include <udfread/blockinput.h>
16#include "mythconfig.h"
22#elif defined(__FreeBSD__)
24#elif defined(Q_OS_DARWIN)
44 bool SuperMount,
bool AllowEject)
46#if defined(__linux__) && !defined(Q_OS_ANDROID)
48#elif defined(__FreeBSD__)
50#elif defined(Q_OS_DARWIN)
53 return new MythCDROM(par, devicePath, SuperMount, AllowEject);
67 LOG(VB_GENERAL, LOG_ERR, QString(
"Mountpoint '%1' doesn't exist")
89 LOG(VB_MEDIA, LOG_INFO,
"Probable DVD detected.");
95 LOG(VB_MEDIA, LOG_INFO,
"Probable Blu-ray detected.");
99 else if (audio.exists())
101 LOG(VB_MEDIA, LOG_INFO,
"Probable Audio CD detected.");
105 else if (vcd.exists() || svcd.exists())
107 LOG(VB_MEDIA, LOG_INFO,
"Probable VCD/SVCD detected.");
111 else if (bad_dvd.exists())
113 LOG(VB_GENERAL, LOG_ERR,
114 "DVD incorrectly mounted? (ISO9660 instead of UDF)");
118 LOG(VB_GENERAL, LOG_ERR,
119 QString(
"CD/DVD '%1' contained none of\n").arg(
m_mountPath) +
120 QString(
"\t\t\t%1, %2, %3 or %4")
123 LOG(VB_GENERAL, LOG_INFO,
"Searching CD statistically - file by file!");
142 LOG(VB_MEDIA, LOG_INFO,
143 QString(
"SetDeviceSpeed(%1,%2) - not implemented on this OS.")
144 .arg(devicePath).arg(speed));
168static uint32_t
def_size(udfread_block_input *p_gen)
172 return (uint32_t)(
p->m_file->GetRealFileSize() / UDF_BLOCK_SIZE);
175static int def_read(udfread_block_input *p_gen, uint32_t lba,
176 void *buf, uint32_t nblocks,
177 [[maybe_unused]]
int flags)
182 if (
p &&
p->m_file && (
p->m_file->Seek(
static_cast<long long>(lba) * UDF_BLOCK_SIZE, SEEK_SET) != -1))
183 result =
p->m_file->Read(buf, nblocks * UDF_BLOCK_SIZE) / UDF_BLOCK_SIZE;
192 if (path.startsWith(
"bd:"))
194 else if (path.startsWith(
"dvd:"))
205 if (blockInput.m_file->isOpen())
207 udfread *udf = udfread_init();
208 if (udfread_open_input(udf, &blockInput.m_input) == 0)
210 UDFDIR *dir = udfread_opendir(udf,
"/BDMV");
214 LOG(VB_MEDIA, LOG_INFO, QString(
"Found Bluray at %1").arg(path));
219 dir = udfread_opendir(udf,
"/VIDEO_TS");
223 LOG(VB_MEDIA, LOG_INFO, QString(
"Found DVD at %1").arg(path));
228 LOG(VB_MEDIA, LOG_ERR, QString(
"inspectImage - unknown"));
234 udfread_closedir(dir);
242 delete blockInput.m_file;
247 LOG(VB_MEDIA, LOG_ERR, QString(
"inspectImage - unable to open \"%1\"").arg(path));
248 delete blockInput.m_file;
static MythCDROM * get(QObject *par, const QString &devicePath, bool SuperMount, bool AllowEject)
MythCDROM(QObject *par, const QString &DevicePath, bool SuperMount, bool AllowEject)
void setDeviceSpeed(const char *devicePath, int speed) override
static ImageType inspectImage(const QString &path)
void onDeviceMounted() override
Override this to perform any post mount logic.
MythCDROM * GetMythCDROMDarwin(QObject *par, const QString &devicePath, bool SuperMount, bool AllowEject)
MythCDROM * GetMythCDROMFreeBSD(QObject *par, const QString &devicePath, bool SuperMount, bool AllowEject)
MythCDROM * GetMythCDROMLinux(QObject *par, const QString &devicePath, bool SuperMount, bool AllowEject)
static int def_close(udfread_block_input *p_gen)
static constexpr const char * PATHTO_VCD_DETECT
static constexpr const char * PATHTO_DVD_DETECT
static uint32_t def_size(udfread_block_input *p_gen)
static int def_read(udfread_block_input *p_gen, uint32_t lba, void *buf, uint32_t nblocks, int flags)
static constexpr const char * PATHTO_SVCD_DETECT
static constexpr const char * PATHTO_BD_DETECT
static constexpr const char * PATHTO_AUDIO_DETECT
static constexpr const char * PATHTO_BAD_DVD_MOUNT
#define LOG(_MASK_, _LEVEL_, _QSTRING_)