dvdreadsrc: fix sector search for packed titles

Some DVD titles are packed in a single set, and we need to use
the correct table to map times to sectors.

https://bugzilla.gnome.org/show_bug.cgi?id=659252
This commit is contained in:
Vincent Penquerc'h 2011-09-16 13:42:53 +01:00 committed by Sebastian Dröge
parent 56bd24365a
commit 20464efc8e

View file

@ -682,23 +682,21 @@ gst_dvd_read_src_get_time_for_sector (GstDvdReadSrc * src, guint sector)
static gint static gint
gst_dvd_read_src_get_sector_from_time (GstDvdReadSrc * src, GstClockTime ts) gst_dvd_read_src_get_sector_from_time (GstDvdReadSrc * src, GstClockTime ts)
{ {
gint sector, i, j; gint sector, j;
if (src->vts_tmapt == NULL || src->vts_tmapt->nr_of_tmaps == 0) if (src->vts_tmapt == NULL || src->vts_tmapt->nr_of_tmaps < src->ttn)
return -1; return -1;
sector = 0; sector = 0;
for (i = 0; i < src->vts_tmapt->nr_of_tmaps; ++i) { for (j = 0; j < src->vts_tmapt->tmap[src->ttn - 1].nr_of_entries; ++j) {
for (j = 0; j < src->vts_tmapt->tmap[i].nr_of_entries; ++j) { GstClockTime entry_time;
GstClockTime entry_time;
entry_time = src->vts_tmapt->tmap[i].tmu * (j + 1) * GST_SECOND; entry_time = src->vts_tmapt->tmap[src->ttn - 1].tmu * (j + 1) * GST_SECOND;
if (entry_time <= ts) { if (entry_time <= ts) {
sector = src->vts_tmapt->tmap[i].map_ent[j] & 0x7fffffff; sector = src->vts_tmapt->tmap[src->ttn - 1].map_ent[j] & 0x7fffffff;
} }
if (entry_time >= ts) { if (entry_time >= ts) {
return sector; return sector;
}
} }
} }