19 LOG(VB_PLAYBACK, LOG_INFO, QString(
"DVDInfo: Trying %1").arg(Filename));
20 QString name = Filename;
21 if (name.startsWith(
"dvd:"))
24 while (name.startsWith(
"//"))
28 QByteArray fname = name.toLocal8Bit();
29 dvdnav_status_t res = dvdnav_open(&
m_nav, fname.constData());
30 if (res == DVDNAV_STATUS_ERR)
32 m_lastError = tr(
"Failed to open device at %1").arg(fname.constData());
44 LOG(VB_PLAYBACK, LOG_INFO, QString(
"DVDInfo: Finishing."));
49 return m_nav !=
nullptr;
55 const QString &Filename,
56 const QString &LogPrefix)
58 const char* dvdname =
nullptr;
59 const char* dvdserial =
nullptr;
61 if (dvdnav_get_title_string(Nav, &dvdname) == DVDNAV_STATUS_ERR)
62 LOG(VB_GENERAL, LOG_ERR, LogPrefix +
"Failed to get name.");
63 if (dvdnav_get_serial_string(Nav, &dvdserial) == DVDNAV_STATUS_ERR)
64 LOG(VB_GENERAL, LOG_ERR, LogPrefix +
"Failed to get serial number.");
66 Name = QString(dvdname);
67 Serialnum = QString(dvdserial);
69 if (
Name.isEmpty() && Serialnum.isEmpty())
72 if ((
MythFileStat(Filename.toLocal8Bit(), &stat) == 0) && S_ISDIR(stat.st_mode))
80 LOG(VB_PLAYBACK, LOG_DEBUG, LogPrefix + QString(
"Generated dvd name '%1'")
84 QString ifo = Filename + QString(
"/VIDEO_TS/VTS_01_0.IFO");
91 auto crc =
static_cast<uint32_t
>(
crc32(0L,
Z_NULL, 0));
94 crc =
static_cast<uint32_t
>(
crc32(crc, buf.data(),
static_cast<uint>(
read)));
97 Serialnum = QString(
"%1__gen").arg(crc, 0, 16, QChar(
'0'));
98 LOG(VB_PLAYBACK, LOG_DEBUG, LogPrefix + QString(
"Generated serial number '%1'")
103 LOG(VB_GENERAL, LOG_ERR, LogPrefix + QString(
"Unable to open %2 to generate serial number")
114 return !(
Name.isEmpty() && SerialNumber.isEmpty());