[MPlayer-users] libmpdvdkit2 / libdvdread fails if it discovers -dvd-device is a mounted disk

Nathan Collins nathan.collins at gmail.com
Sun Jun 4 09:23:59 CEST 2006


Hi,

I am on Ubuntu (Hoary) GNU/Linux using MPlayer 1.0pre7try2-3.3.5 that
I compiled.  The sources are unmodified, so, in particular, I am using
the mplayer version of libdvdread from the libmpdvdkit2 dir in the
mplayer sources.

I have a ripped DVD in a directory along with some sub titles and text
files:

    $ l /home/nathan/media/storage/3\ Iron\ Full\ Dvd\ Kor-Spa\ \ WS\ Pal
    total 120
    drwxr-xr-x  2 nathan nathan  4096 2004-12-22 16:07
3-Iron.2004.DVDRip.XviD-GaMo.[kLOOFy].(subs.2ya.com)/
    -rw-r--r--  1 nathan nathan  6940 2006-02-10 20:18
3-Iron.2004.DVDRip.XviD-GaMo.[kLOOFy].(subs.2ya.com).rar
    drwxr-xr-x  2 nathan nathan  4096 2006-01-27 21:34 Caratulas/
    -rw-r--r--  1 nathan nathan   199 2006-02-10 22:03 mplayer-command.txt
    drwxr-xr-x  2 nathan nathan  4096 2006-01-27 21:34 VIDEO_TS/

    $ l /home/nathan/media/storage/3\ Iron\ Full\ Dvd\ Kor-Spa\ \ WS\
Pal/VIDEO_TS
    total 4549592
    -rw-r--r--  1 nathan nathan      24576 2006-01-27 22:00 VIDEO_TS.BUP
    -rw-r--r--  1 nathan nathan      24576 2006-01-27 22:00 VIDEO_TS.IFO
    -rw-r--r--  1 nathan nathan   39241728 2006-02-03 10:43 VIDEO_TS.VOB
    -rw-r--r--  1 nathan nathan      69632 2006-02-01 23:34 VTS_01_0.BUP
    -rw-r--r--  1 nathan nathan      69632 2006-02-01 23:34 VTS_01_0.IFO
    -rw-r--r--  1 nathan nathan   37408768 2006-02-03 23:50 VTS_01_0.VOB
    -rw-r--r--  1 nathan nathan 1073620992 2006-02-07 01:42 VTS_01_1.VOB
    -rw-r--r--  1 nathan nathan 1073483776 2006-02-07 01:39 VTS_01_2.VOB
    -rw-r--r--  1 nathan nathan 1073555456 2006-02-05 13:15 VTS_01_3.VOB
    -rw-r--r--  1 nathan nathan  678868992 2006-02-08 07:38 VTS_01_4.VOB
    -rw-r--r--  1 nathan nathan      12288 2006-01-29 16:53 VTS_02_0.BUP
    -rw-r--r--  1 nathan nathan      12288 2006-01-29 16:53 VTS_02_0.IFO
    -rw-r--r--  1 nathan nathan   11100160 2006-02-02 19:06 VTS_02_1.VOB
    -rw-r--r--  1 nathan nathan      16384 2006-02-01 17:28 VTS_03_0.BUP
    -rw-r--r--  1 nathan nathan      16384 2006-02-01 17:28 VTS_03_0.IFO
    -rw-r--r--  1 nathan nathan      10240 2006-02-01 17:28 VTS_03_0.VOB
    -rw-r--r--  1 nathan nathan   10659840 2006-02-03 23:02 VTS_03_1.VOB
    -rw-r--r--  1 nathan nathan      16384 2006-01-30 16:34 VTS_04_0.BUP
    -rw-r--r--  1 nathan nathan      16384 2006-01-30 16:34 VTS_04_0.IFO
    -rw-r--r--  1 nathan nathan      10240 2006-01-30 16:34 VTS_04_0.VOB
    -rw-r--r--  1 nathan nathan    7641088 2006-02-03 01:00 VTS_04_1.VOB
    -rw-r--r--  1 nathan nathan      18432 2006-02-01 14:03 VTS_05_0.BUP
    -rw-r--r--  1 nathan nathan      18432 2006-02-01 14:03 VTS_05_0.IFO
    -rw-r--r--  1 nathan nathan      10240 2006-02-01 14:03 VTS_05_0.VOB
    -rw-r--r--  1 nathan nathan   60676096 2006-02-04 00:00 VTS_05_1.VOB
    -rw-r--r--  1 nathan nathan      18432 2006-01-29 18:38 VTS_06_0.BUP
    -rw-r--r--  1 nathan nathan      18432 2006-01-29 18:38 VTS_06_0.IFO
    -rw-r--r--  1 nathan nathan      10240 2006-01-29 18:38 VTS_06_0.VOB
    -rw-r--r--  1 nathan nathan   66322432 2006-02-03 22:51 VTS_06_1.VOB
    -rw-r--r--  1 nathan nathan      18432 2006-01-30 06:34 VTS_07_0.BUP
    -rw-r--r--  1 nathan nathan      18432 2006-01-30 06:34 VTS_07_0.IFO
    -rw-r--r--  1 nathan nathan      10240 2006-01-30 06:39 VTS_07_0.VOB
    -rw-r--r--  1 nathan nathan   62666752 2006-02-03 23:37 VTS_07_1.VOB
    -rw-r--r--  1 nathan nathan      18432 2006-02-01 11:03 VTS_08_0.BUP
    -rw-r--r--  1 nathan nathan      18432 2006-02-01 11:03 VTS_08_0.IFO
    -rw-r--r--  1 nathan nathan      10240 2006-02-01 11:03 VTS_08_0.VOB
    -rw-r--r--  1 nathan nathan   43882496 2006-02-04 00:18 VTS_08_1.VOB
    -rw-r--r--  1 nathan nathan      18432 2006-02-02 00:22 VTS_09_0.BUP
    -rw-r--r--  1 nathan nathan      18432 2006-02-02 00:22 VTS_09_0.IFO
    -rw-r--r--  1 nathan nathan      10240 2006-02-02 00:22 VTS_09_0.VOB
    -rw-r--r--  1 nathan nathan   85424128 2006-02-03 23:35 VTS_09_1.VOB
    -rw-r--r--  1 nathan nathan      20480 2006-02-01 22:59 VTS_10_0.BUP
    -rw-r--r--  1 nathan nathan      20480 2006-02-01 22:59 VTS_10_0.IFO
    -rw-r--r--  1 nathan nathan      10240 2006-02-01 22:59 VTS_10_0.VOB
    -rw-r--r--  1 nathan nathan  151318528 2006-02-04 00:06 VTS_10_1.VOB
    -rw-r--r--  1 nathan nathan      22528 2006-02-01 21:38 VTS_11_0.BUP
    -rw-r--r--  1 nathan nathan      22528 2006-02-01 21:38 VTS_11_0.IFO
    -rw-r--r--  1 nathan nathan      10240 2006-02-01 21:38 VTS_11_0.VOB
    -rw-r--r--  1 nathan nathan  177563648 2006-02-04 00:14 VTS_11_1.VOB

If I play it like this it works just fine:

    $ mplayer -dvd-device /home/nathan/media/storage/3\ Iron\ Full\
Dvd\ Kor-Spa\ \ WS\ Pal dvd://1
    MPlayer 1.0pre7try2-3.3.5 (C) 2000-2005 MPlayer Team
    CPU: Advanced Micro Devices Athlon Thunderbird (Family: 6, Stepping: 4)
    Detected cache-line size is 64 bytes
    CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 0 SSE2: 0
    Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx


    Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
    Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your
system startup scripts.
    Opening joystick device /dev/input/js0
    Playing dvd://1.
    libdvdread: Couldn't find device name.
    Reading disc structure, please wait...
    There are 11 titles on this DVD.
    There are 8 chapters in this DVD title.
    There are 1 angles in this DVD title.
    DVD successfully opened.
    MPEG-PS file format detected.
    VIDEO:  MPEG2  720x576  (aspect 3)  25.000 fps  9200.0 kbps (1150.0 kbyte/s)
    ==========================================================================
    Opening audio decoder: [liba52] AC3 decoding with liba52
    Using 3DNowEx optimized IMDCT transform
    AC3: 5.1 (3f+2r+lfe)  48000 Hz  448.0 kbit/s
    Using MMX optimized resampler
    AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
    Selected audio codec: [a52] afm:liba52 (AC3-liba52)
    ==========================================================================
    vo: X11 running at 1280x1024 with depth 24 and 32 bpp (":0.0" =>
local display)
    ==========================================================================
    Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
    VDec: vo config request - 720 x 576 (preferred csp: Mpeg PES)
    Could not find matching colorspace - retrying with -vf scale...
    Opening video filter: [scale]
    The selected video_out device is incompatible with this codec.
    VDecoder init failed :(
    Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
    Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG-1 or 2 (libmpeg2))
    ==========================================================================
    Checking audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
    AF_pre: 48000Hz/2ch/s16le
    AO: [oss] 48000Hz 2ch s16le (2 bps)
    Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
    Starting playback...
    VDec: vo config request - 720 x 576 (preferred csp: Planar YV12)
    VDec: using Planar YV12 as output csp (no 0)
    Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
    VO: [xv] 720x576 => 1024x576 Planar YV12
    A:   1.0 V:   1.0 A-V:  0.018 ct:  0.044  19/ 19 25% 30%  2.7% 0 0
    Exiting... (Quit)

So, I put that dir
(/home/nathan/media/storage/3\ Iron\ Full\ Dvd\ Kor-Spa\ \ WS\ Pal)
on a DVD-R with growisofs.  If I try to play the DVD it fails:

    $ mplayer dvd://1
    MPlayer 1.0pre7try2-3.3.5 (C) 2000-2005 MPlayer Team
    CPU: Advanced Micro Devices Athlon Thunderbird (Family: 6, Stepping: 4)
    Detected cache-line size is 64 bytes
    CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 0 SSE2: 0
    Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx


    Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
    Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your
system startup scripts.
    Opening joystick device /dev/input/js0
    Playing dvd://1.
    Reading disc structure, please wait...
    libdvdread: Can't open file VIDEO_TS.IFO.
    Can't open VMG info!


    Exiting... (End of file)

No worries, right? Maybe I can just mount the DVD and play the files:

    $ mplayer -dvd-device /media/cdrom dvd://1
    MPlayer 1.0pre7try2-3.3.5 (C) 2000-2005 MPlayer Team
    CPU: Advanced Micro Devices Athlon Thunderbird (Family: 6, Stepping: 4)
    Detected cache-line size is 64 bytes
    CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 0 SSE2: 0
    Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx


    Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
    Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your
system startup scripts.
    Opening joystick device /dev/input/js0
    Playing dvd://1.
    libdvdread: Attempting to use device /dev/hdc mounted on
/media/cdrom0 for CSS authentication
    Reading disc structure, please wait...
    libdvdread: Can't open file VIDEO_TS.IFO.
    Can't open VMG info!


    Exiting... (End of file)

    $ l /media/cdrom
    lrwxrwxrwx  1 root root 6 2005-06-18 20:09 /media/cdrom -> cdrom0/


Hmmmm...  Notice above that livdvdread is telling us that it knows
/media/cdrom0 is a mount point.  So, I tried adding a little more
indirection with a symlink to /media/cdrom.  No luck there.
Eventually, after looking into libdvdread a little,
 I tried symlinking the individual files (as in the post
titled ``problems playing growisofs disk'' from mplayer-users on
2004-11-13):

    $ l /home/nathan/can_i_fool_libdvdread
    total 12
    lrwxrwxrwx  1 nathan nathan 65 2006-05-31 04:21
3-Iron.2004.DVDRip.XviD-GaMo.[kLOOFy].(subs.2ya.com) ->
/media/cdrom/3-Iron.2004.DVDRip.XviD-GaMo.[kLOOFy].(subs.2ya.com)/
    lrwxrwxrwx  1 nathan nathan 69 2006-05-31 04:21
3-Iron.2004.DVDRip.XviD-GaMo.[kLOOFy].(subs.2ya.com).rar ->
/media/cdrom/3-Iron.2004.DVDRip.XviD-GaMo.[kLOOFy].(subs.2ya.com).rar
    lrwxrwxrwx  1 nathan nathan 22 2006-05-31 04:21 Caratulas ->
/media/cdrom/Caratulas/
    lrwxrwxrwx  1 nathan nathan 32 2006-05-31 04:21
mplayer-command.txt -> /media/cdrom/mplayer-command.txt
    lrwxrwxrwx  1 nathan nathan 21 2006-05-31 04:21 VIDEO_TS ->
/media/cdrom/VIDEO_TS/

    $ mplayer -dvd-device /home/nathan/can_i_fool_libdvdread dvd://1
    MPlayer 1.0pre7try2-3.3.5 (C) 2000-2005 MPlayer Team
    CPU: Advanced Micro Devices Athlon Thunderbird (Family: 6, Stepping: 4)
    Detected cache-line size is 64 bytes
    CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 0 SSE2: 0
    Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx


    Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
    Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your
system startup scripts.
    Opening joystick device /dev/input/js0
    Playing dvd://1.
    libdvdread: Couldn't find device name.
    Reading disc structure, please wait...
    There are 11 titles on this DVD.
    There are 8 chapters in this DVD title.
    There are 1 angles in this DVD title.
    DVD successfully opened.
    MPEG-PS file format detected.
    VIDEO:  MPEG2  720x576  (aspect 3)  25.000 fps  9200.0 kbps (1150.0 kbyte/s)
    ==========================================================================
    Opening audio decoder: [liba52] AC3 decoding with liba52
    Using 3DNowEx optimized IMDCT transform
    AC3: 5.1 (3f+2r+lfe)  48000 Hz  448.0 kbit/s
    Using MMX optimized resampler
    AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
    Selected audio codec: [a52] afm:liba52 (AC3-liba52)
    ==========================================================================
    vo: X11 running at 1280x1024 with depth 24 and 32 bpp (":0.0" =>
local display)
    ==========================================================================
    Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
    VDec: vo config request - 720 x 576 (preferred csp: Mpeg PES)
    Could not find matching colorspace - retrying with -vf scale...
    Opening video filter: [scale]
    The selected video_out device is incompatible with this codec.
    VDecoder init failed :(
    Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
    Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG-1 or 2 (libmpeg2))
    ==========================================================================
    Checking audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
    AF_pre: 48000Hz/2ch/s16le
    AO: [oss] 48000Hz 2ch s16le (2 bps)
    Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
    Starting playback...
    VDec: vo config request - 720 x 576 (preferred csp: Planar YV12)
    VDec: using Planar YV12 as output csp (no 0)
    Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
    VO: [xv] 720x576 => 1024x576 Planar YV12
    A:   0.5 V:   0.5 A-V:  0.031 ct:  0.023   7/  7 ??% ??% ??,?% 0 0
    Exiting... (Quit)

Okay, that works just fine.  I couldn't find much documentation for
libdvdread, but the header file libmpdvdkit2/dvd_reader.c in the
mplayer source has some helpful comments:

    /**
     * dvd = DVDOpen(path);
     *
     * Opens a block device of a DVD-ROM file, or an image file, or a directory
     * name for a mounted DVD or HD copy of a DVD.  Returns 0 if we
can't get any
     * of those methods to work.
     *
     * If the given file is a block device, or is the mountpoint for a block
     * device, then that device is used for CSS authentication using libdvdcss.
     * If no device is available, then no CSS authentication is performed,
     * and we hope that the image is decrypted.
     *
     * If the path given is a directory, then the files in that
directory may be in
     * any one of these formats:
     *
     *   path/VIDEO_TS/VTS_01_1.VOB
     *   path/video_ts/vts_01_1.vob
     *   path/VTS_01_1.VOB
     *   path/vts_01_1.vob
     */
    dvd_reader_t *DVDOpen( const char * );

I have looked at the code in libmpdvdkit2/dvd_reader.c.  I don't
really understand how it works, but there is a bunch of code in
DVDOpen that determines if path is a block device or mountpoint, as
the comment in the header file tells us it should.  At any rate, there
is a little check near the end that returns if DVDOpen determined that
path is a mountpoint.  I commented that out which forces DVDOpen to
always assume that path is a ``regular'' file:

    $ diff -U5  ../MPlayer-1.0pre7try2/libmpdvdkit2/dvd_reader.c
../MPlayer-1.0pre7try2.modified-libdvdread/libmpdvdkit2/dvd_reader.c
    --- ../MPlayer-1.0pre7try2/libmpdvdkit2/dvd_reader.c    2005-03-10
18:40:28.000000000 -0800
    +++ ../MPlayer-1.0pre7try2.modified-libdvdread/libmpdvdkit2/dvd_reader.c
       2006-05-31 05:11:53.000000000 -0700
    @@ -427,11 +427,11 @@
            free( path_copy );

             /**
              * If we've opened a drive, just use that.
              */
    -        if( auth_drive ) return auth_drive;
    +        /*if( auth_drive ) return auth_drive;*/ /* Pretend file
is never a drive */

             /**
              * Otherwise, we now try to open the directory tree instead.
              */
             return DVDOpenPath( path );

My modified mplayer still fails to play the DVD directly, but I guess
that is to be expected since the DVD is not a regular directory.
However, it plays the mounted DVD just fine:

    $ ./mplayer -dvd-device /media/cdrom dvd://1
    MPlayer 1.0pre7try2-3.3.5 (C) 2000-2005 MPlayer Team
    CPU: Advanced Micro Devices Athlon Thunderbird (Family: 6, Stepping: 4)
    Detected cache-line size is 64 bytes
    CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 0 SSE2: 0
    Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx


    Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
    Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your
system startup scripts.
    Playing dvd://1.
    libdvdread: Attempting to use device /dev/hdc mounted on
/media/cdrom0 for CSS authentication
    Reading disc structure, please wait...
    There are 11 titles on this DVD.
    There are 8 chapters in this DVD title.
    There are 1 angles in this DVD title.
    DVD successfully opened.
    MPEG-PS file format detected.
    VIDEO:  MPEG2  720x576  (aspect 3)  25.000 fps  9200.0 kbps (1150.0 kbyte/s)
    ==========================================================================
    Opening audio decoder: [liba52] AC3 decoding with liba52
    Using 3DNowEx optimized IMDCT transform
    AC3: 5.1 (3f+2r+lfe)  48000 Hz  448.0 kbit/s
    Using MMX optimized resampler
    AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
    Selected audio codec: [a52] afm:liba52 (AC3-liba52)
    ==========================================================================
    vo: X11 running at 1280x1024 with depth 24 and 32 bpp (":0.0" =>
local display)
    ==========================================================================
    Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
    VDec: vo config request - 720 x 576 (preferred csp: Mpeg PES)
    Could not find matching colorspace - retrying with -vf scale...
    Opening video filter: [scale]
    The selected video_out device is incompatible with this codec.
    VDecoder init failed :(
    Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
    Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG-1 or 2 (libmpeg2))
    ==========================================================================
    Checking audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
    AF_pre: 48000Hz/2ch/s16le
    AO: [oss] 48000Hz 2ch s16le (2 bps)
    Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
    Starting playback...
    VDec: vo config request - 720 x 576 (preferred csp: Planar YV12)
    VDec: using Planar YV12 as output csp (no 0)
    Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
    VO: [xv] 720x576 => 1024x576 Planar YV12
    A:   1.0 V:   1.0 A-V:  0.020 ct:  0.043  19/ 19 25% 28%  3.3% 0 0
    Exiting... (Quit)


Okay, so what is the point: Is this a bug?  For all I know the DVD in
question isn't properly set up (file layout or whatever), since I have
other burnt DVDs that play just fine in mplayer.  However, it plays
just fine as long as libdvdread doesn't think the files are on a DVD!
So, I think I should be able to play it without making all those
symlinks (not that making symlinks is hard, but it was pretty hard to
guess to try it).  Would it make sense to have libdvdread only treat
the file as a DVD if you specified the device directly (as in
-dvd-device /dev/dvd), instead of following symlinks and checking for
mount points and all that?  Or maybe libdvdread could try again,
opening it as a ``regular'' file, if it failed to open the DVD as a
device?  Or maybe even an mplayer command line switch or libdvdread
environment variable that told libdvdread not to treat mount points
differently?  I worry that most people would never discover the
switch/environment variable though.

Thanks for your time.

-nathan

p.s.

I am sending this to the mplayer list because mplayer is using
modified libdvdread code in libmpdvdkit2/.  I can try compiling
mplayer against a vanilla libdvdread, and then directing my questions
to the libdvdread mailing list, if that would be better.



More information about the MPlayer-users mailing list