Skip to content

Commit

Permalink
Enable the detection of a DVD & Bluray discs by reading the UDF forma…
Browse files Browse the repository at this point in the history
…t data direct from the drive using libudf

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information
Lawrence Rust authored and stuartm committed Jan 28, 2011
1 parent 830c5d7 commit 67674bf
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mythtv/configure
Expand Up @@ -1330,6 +1330,7 @@ MYTHTV_CONFIG_LIST='
libfftw3
libmpeg2external
libxml2
libudf
lirc
mheg
opengl_video
Expand Down Expand Up @@ -1952,6 +1953,7 @@ enable iptv
enable ivtv
enable lamemp3
enable libxml2
enable libudf
enable lirc
enable mheg
enable mythtranscode
Expand Down Expand Up @@ -4029,6 +4031,11 @@ int main(void) {
}
EOF

enabled libudf && check_cc <<EOF || disable libudf
#include <cdio/udf.h>
int main(void){ return UDF_BLOCKSIZE > 0 ? 0 : 1; }
EOF

enabled x11 && check_lib X11/Xlib.h XQueryExtension -lX11 || disable x11
enabled xrandr && check_lib X11/extensions/Xrandr.h XRRSelectInput -lXrandr || disable xrandr
enabled xv && check_lib X11/extensions/Xv.h XvPutStill -lXv || disable xv
Expand Down Expand Up @@ -4765,6 +4772,10 @@ if enabled libxml2; then
fi
fi

if enabled libudf; then
append CCONFIG "using_libudf"
fi

if enabled x11; then
if [ -d $x11_path ] ; then
append CONFIG_INCLUDEPATH "$x11_path"
Expand Down
5 changes: 5 additions & 0 deletions mythtv/libs/libmythbase/libmythbase.pro
Expand Up @@ -100,6 +100,11 @@ use_hidesyms {
QMAKE_CXXFLAGS += -fvisibility=hidden
}

using_libudf {
DEFINES += USING_LIBUDF
LIBS += -ludf
}

mingw:LIBS += -lpthread -lws2_32

QT += xml sql network
Expand Down
29 changes: 29 additions & 0 deletions mythtv/libs/libmythbase/mythcdrom-linux.cpp
Expand Up @@ -14,6 +14,9 @@
#include "mythcdrom-linux.h"
#include "mythconfig.h" // for HAVE_BIGENDIAN
#include "mythverbose.h"
#ifdef USING_LIBUDF
#include <cdio/udf.h>
#endif

#define LOC QString("MythCDROMLinux:")
#define LOC_ERR QString("MythCDROMLinux, Error: ")
Expand Down Expand Up @@ -484,7 +487,33 @@ MediaStatus MythCDROMLinux::checkMedia()
}

VERBOSE(VB_MEDIA, QString("Volume ID: %1").arg(m_VolumeID));
#ifdef USING_LIBUDF
// Check for a DVD/BD disk by reading the UDF root dir.
// This allows DVD's to play immediately upon insertion without
// calling mount, which either needs pmount or changes to fstab.
udf_t *pUdf = udf_open(m_DevicePath.toAscii());
if (NULL != pUdf)
{
udf_dirent_t *pUdfRoot = udf_get_root(pUdf, true, 0);
if (NULL != pUdfRoot)
{
if (NULL != udf_fopen(pUdfRoot, "VIDEO_TS"))
m_MediaType = MEDIATYPE_DVD;
else if (NULL != udf_fopen(pUdfRoot, "BDMV"))
m_MediaType = MEDIATYPE_BD;

udf_dirent_free(pUdfRoot);
}
udf_close(pUdf);

if (MEDIATYPE_DATA != m_MediaType)
{
// pretend we're NOTMOUNTED so setStatus emits a signal
m_Status = MEDIASTAT_NOTMOUNTED;
return setStatus(MEDIASTAT_USEABLE, OpenedHere);
}
}
#endif
// the base class's onDeviceMounted will do fine
// grained detection of the type of data on this disc
if (isMounted())
Expand Down

0 comments on commit 67674bf

Please sign in to comment.