[MPlayer-dev-eng] [PATCH] Add more ID_DVD_* style messages to dvdnav://
Mike Castle
dalgoda+mplayer at gmail.com
Sun Feb 13 23:30:43 CET 2011
I have some questions about this proposed patch that I'd like to see discussed.
As I mentioned in an earlier post, the problem I'm trying to solve is
that, as part of copy protection schemes, some discs are purposefully
pressed to have bad sectors and libdvdread will simply lock up
processing them, whereas libdvdnav is more successful. I guess I
should clarify that, since dvdnav is built on top of dvdread: it does
work, it's just that some calls into libdvdread invokes this problem.
The way I approached this patch was to get the output of the following
commands as nearly identical as I could:
mplayer -identify -frames 0 -ao null -vo null dvd:// dvd://1 dvd://2
2> /dev/null | grep ^ID_ | sort -u > dvd.txt
mplayer -identify -frames 0 -ao null -vo null dvdnav:// dvdnav://1
dvdnav://2 2> /dev/null | grep ^ID_ | sort -u > dvdnav.txt
This patch is pretty good at achieving that goal, but there are some
differences.
First, dvd: gives us ID_DVD_DISC_ID=. However, that comes from
dvd_reader API DVDDiscID(), and I could find no corresponding API in
dvdnav. And since it is built up of items extracted from DVD meta
information and that the whole problem I'm having is that locking up,
I've decided not to try to provide that here.
Second, when using -identify, stream_dvd.c will loop over all of the
tracks by default, where as in stream_dvdnav.c, it ONLY does that on
track ``0'' (i.e., when using dvdnav:// ). That is why I aggregated
the results of {://, ://1, ://2} to get the output data. I figure a
tool that uses mplayer to extract metadata would do something like:
num_tracks=$(mplayer -identify dvdnav:// | grep ID_DVD_TITLES | sed
s/ID_DVD_TITLES=//)
tracks=$(printf 'dvdnav://%d ' $(seq 1 $num_tracks)) # dvdnav://1
dvdnav://2 ... dvdnav://$num_tracks
random_output=$(mplayer -identify $tracks)
not as great as just one call to mplayer but it'll work, I think.
Thirdly, I noticed that the preexisting ID_DVD_TITLE_NN_LENGTH is
_way_ off. dvd: and dvdnav: use two different ways to calculate the
numbers, and this may demonstrate a bug in dvdnav. Some examples
follow (first line dvd:, second dvdnav:)
-ID_DVD_TITLE_10_LENGTH=32.000
+ID_DVD_TITLE_10_LENGTH=27.000
-ID_DVD_TITLE_35_LENGTH=60.033
+ID_DVD_TITLE_35_LENGTH=545.466
-ID_DVD_TITLE_36_LENGTH=244.800
+ID_DVD_TITLE_36_LENGTH=1113.133
Now, in another location, both dvd: and dvdnav: also dump ID_LENGTH
which is supposed to contain the same information as
ID_DVD_TITLE_NN_LENGTH, and it is correct in both locations. As
noted, this is an existing issue, just one I noticed while doing this.
I think on some discs, the chapter information from dvdnav is
completely out of whack while the from dvdread is correct.
Next, some information is now duplicated. For example, in the raw
output we'll now see something like:
Title: 'THE_THREE_MUSKETEERS'
ID_DVD_VOLUME_ID=THE_THREE_MUSKETEERS
I think this is OK. After all, some scripts will parse the old
format, but I think having both will make it easier to port scripts
from using dvd:// to dvdnav://
Next, since in order to dump the ANGLE information, we must actively
loop over all of the titles, we have to save/restore the initial
state. I don't know if it's safe to assume it will always be in
title==0 (i.e, menu) when identify() is called in stream_dvdnav.c, so
we have the little if/else there at the end. If we know it will
always be in a menu that could be simplified. Also, for some reason,
probably a misunderstanding of the API on my part, I have to call
dvdnav_menu_call() twice. Reading the effects of this after the first
call, the part is 0, then the second call sets the part to 3.
Finally, in looking at all of this, I noticed that the for-loop in
identify() had a fencepost error. If preferred, I can break that out
into a separate patch.
Sorry if this is a bit rambling, several interruptions while drafting
it (toddler in the house).
mrc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stream_dvdnav.patch
Type: text/x-diff
Size: 2971 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20110213/d36a4c5c/attachment.patch>
More information about the MPlayer-dev-eng
mailing list