Comment 5 for bug 71017

Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Oh, the patch also:

* Improves gst_dvd_read_src_get_time_for_sector(), which now only iterates through the correct tmap instead of every tmap in the title_set.

My gstreamer bug report has all sorts of details about my progress on this bug, some of which was wrong at first, but here is the most important bit:

"""
Again, the big problem with dvdreadsrc currently is that it doesn't properly
handle cases where the title_set has more than one title. Here's a summary of
how things work with libdvdread, as far as I understand:

* The title number is mapped to the title_set number with
tt_srpt->title[title].title_set_nr

* For feature movies, the feature title is usually the only title in its
title_set, which is why dvdreadsrc generally worked. But for, say, TV serials
with several episodes per DVD, all the episodes usually belong to a single
title_set, including the "play all" title that many DVDs have. In these cases,
dvdreadsrc is "super extra broken".

* ifoOpen and DVDOpenFile take the title_set_nr as an argument; they always
open a title_set, not a single title (although as above, for movies the feature
title is usually the only title in the title_set).

* DVDReadBlocks works relative to the title_set, not the title. A wrong
assumption made in many places in dvdreadsrc is that a title always starts at
sector zero. In fact, it seems this assumption can't even be made for a
title_set with one title.

* cell_playback[cell].first_sector and cell_playback[cell].last_sector are
relative to the title_set, not the title. This is why, by chance anyway, a
multi-title title_set would at least start playing the correct title for title
> 1.

* If a title_set has a vts_tmapt, it will have exactly one tmap per title in
the title_set. As far as I can tell, (tt_srpt->title[title].vts_ttn - 1) gives
the index for the correct tmap for the title, but I need someone to verify
this. (** After testing this on lots of DVDs, I'm now very confident that this is correct. **)

* The times in the tmap are best dealt with relative to the title (which is
what we want to do), but the sectors in tmap.map_ent[] are relative to the
title_set. This "just works" as long as you are using the correct tmap. In
this respect, gst_dvd_read_src_get_sector_from_time() was horibly broken. The
original author(s) thought a nested iteration through
vts_tmapt->tmap[i].map_ent[j] would somehow give the correct sector, which is
utterly wrong, not to mention silly. It seems they got the idea from
ifoPrint_VTS_TMAPT(), but didn't take the time to understand the meaning of the
data structures. This is part of the reason why seeking is so broken.
"""