[DVDnav-discuss] dvdnav patches from handbrake project

John Stebbins stebbins at jetheaddev.com
Sat May 29 02:52:04 CEST 2010


I've recreated the patches against svn head since there's been a few
changes since I originally created many of them.  New patches can be
found here http://www.stebbins.biz/source/patches/. I'll summarize the
patches again so that all the information is in one place.

* nav-configure-uid0.patch
* read-configure-uid0.patch
These patches remove the special case test for uid=0.
Some package tools run configure as fakeroot.  This triggers code in
configure.ac that detects uid 0 to hardcode the installation path of the
m4 macros to the system aclocal macro dir.  This ignores any DESTDIR the
packaging tools may have set and installation fails since it attempts to
write to a system dir without proper permissions.

* nav-dup-handle.patch
This patch allows you safely to create a duplicate of a dvdnav_t.  This
handle can be used in parallel with the handle it is duplicated from. 
HandBrake uses this to perform a recursive search of dvd menus in order
to find the main feature of a disc.

* nav-forward-seek.patch
This patch guarantees that a request to seek forward always results in
the new position being moved forward.
libdvdnav has a problem in that it is difficult to gracefully recover
from a read error and continue on to subsequent blocks on the disc.  An
application would like to seek forward past the current block after
getting a read error in order to attempt to get past the bad block(s).
But dvdnav_sector_search() does not guarantee that a requested forward
seek will actually move the current position forward.  It truncates down
to the nearest VOBU which will almost always cause a forward seek
request by a single block (or a small number of blocks) to move the
current position backward.  This behaviour puts the application into a
loop of: read failure, attempted forward seek (which results in backward
seek), read failure ...

* nav-log-stderr.patch
Changes log output to stderr.  You may or may not want this.  There is a
comment in the code that indicates the author was uncertain whether he
should use stdout or stderr.  stderr is more appropriate for handbrake.

* nav-missing-menu-abort.patch
This patch prevents an abort when a nav command tries to send you to a
menu that doesn't exist.
Mac the ripper's feature title extraction removes menus from the
resulting image, but does not remove navigation instructions that
attempt to jump to those  menus.  This patch checks that a menu exists
before acting on such instructions.  If the menu does not exist, the it
puts the vm into the stopped state.

* nav-multi-pgc.patch
This patch allow play of multi-pgc titles. Eliminates message "RANDOM or
SHUFFLE titles not handled yet".
The bit tested here does not indicate 'random or shuffle' - it only says
that the title uses multiple PGCs. libdvdnav mostly deals correctly with
mult PGC titles (modulo some weirdness when seeking).

* nav-program-info.patch
Add dvdnav_program_play and dvdnav_current_title_program analogs to
dvdnav_part_play and dvdnav_current_title_info.
We add chapter marks to the output mkv or mp4 files while encoding. 
Using title parts is not reliable for this.  The start of a part does
not necessarily fall strictly inside the main title.  Parts can have an
intro sequence before getting into the title.  So we use program
boundaries instead of part markers to test when we have reached a
chapter point during encoding of the title.   The same would apply to
displaying the current chapter during playback.  The program boundaries
should be checked instead of looking for a part.

* nav-read-name.patch
Prevent display of garbage volume label when the file being scanned is
not a dvd. This is a simple movement of the code that logs the volume
name to after the point that some basic validation of the disc has been
performed.

* nav-reset-deadlock.patch
dvdnav_reset takes a lock, then latter calls dvdnav_clear which tries to
take
the lock again. dead. the unlock that is immediately after dvdnav_clear
should be moved to before it.

* read-block2char.patch
Fixes conversion of disk names to raw disk names.
On darwin and other bsd based systems, dvd_reader.c converts regular device
names to raw device names. e.g. "/dev/disk4" -> "/dev/rdisk4"
The test that determines if the conversion needs to be done is broken.
It is fixed in libdvdread version 0.9.7.

* read-dup-lut-pgc.patch
The is a big invasive patch. Many dvd's are showing up that have titles
that have numerous repeated language unit tables and pgc's. The new
release "Up" is an example.  I believe "Dark Knight" also exhibits this.
When scanning such discs with lsdvd (and other programs that scan all
titles), libdvdread will consume many GB of data for these repeated
elements and gets very slow (e.g hours to read all titles) on OS X due
to reading the duplicate data from uncached raw devices.

This patch detects duplicates and reference counts pgc's and pgcit's. 
When a duplicate is detected, a reference count is incremented instead
of allocating new memory and re-reading the data.

I opted for reference counting instead of simply returning a failure on
duplicate detection because it is perfectly valid to have a title with
such duplicates.  I could easily imagine titles adding duplicates, then
navigating around them.

* read-mingw-large-file.patch
Add large file support for mingw
libdvdread on mingw fails reading at 2G boundary. This means reading
large iso files fails.

* read-raw-device.patch
On windows, use correct path when attempting to open the raw dvd
device.  Also check that it is a dvd device in order to avoid error
message spam.




More information about the DVDnav-discuss mailing list