]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugins-ugly0-10.git/blobdiff - ext/dvdread/dvdreadsrc.c
dvdreadsrc: fix sector search for packed titles
[glsdk/gst-plugins-ugly0-10.git] / ext / dvdread / dvdreadsrc.c
index a63fa3509213b15ed446ec6929e10c937480d3bf..a53019f9fd41dcdede6b7e670281c04c88423d94 100644 (file)
@@ -620,7 +620,7 @@ gst_dvd_read_src_get_next_cell (GstDvdReadSrc * src, pgc_t * pgc, gint cell)
   while (pgc->cell_playback[cell].block_mode != BLOCK_MODE_LAST_CELL)
     ++cell;
 
-  return cell + 1;              /* really +1? (tpm) */
+  return cell + 1;
 }
 
 /* Returns true if the pack is a NAV pack */
@@ -682,23 +682,21 @@ gst_dvd_read_src_get_time_for_sector (GstDvdReadSrc * src, guint sector)
 static gint
 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;
 
   sector = 0;
-  for (i = 0; i < src->vts_tmapt->nr_of_tmaps; ++i) {
-    for (j = 0; j < src->vts_tmapt->tmap[i].nr_of_entries; ++j) {
-      GstClockTime entry_time;
+  for (j = 0; j < src->vts_tmapt->tmap[src->ttn - 1].nr_of_entries; ++j) {
+    GstClockTime entry_time;
 
-      entry_time = src->vts_tmapt->tmap[i].tmu * (j + 1) * GST_SECOND;
-      if (entry_time <= ts) {
-        sector = src->vts_tmapt->tmap[i].map_ent[j] & 0x7fffffff;
-      }
-      if (entry_time >= ts) {
-        return sector;
-      }
+    entry_time = src->vts_tmapt->tmap[src->ttn - 1].tmu * (j + 1) * GST_SECOND;
+    if (entry_time <= ts) {
+      sector = src->vts_tmapt->tmap[src->ttn - 1].map_ent[j] & 0x7fffffff;
+    }
+    if (entry_time >= ts) {
+      return sector;
     }
   }
 
@@ -724,7 +722,7 @@ gst_dvd_read_src_read (GstDvdReadSrc * src, gint angle, gint new_seek,
   GstSegment *seg;
   guint8 oneblock[DVD_VIDEO_LB_LEN];
   dsi_t dsi_pack;
-  guint next_vobu, next_ilvu_start, cur_output_size;
+  guint next_vobu, cur_output_size;
   gint len;
   gint retries;
   gint64 next_time;
@@ -811,7 +809,6 @@ nav_retry:
 
   /* determine where we go next. These values are the ones we
    * mostly care about */
-  next_ilvu_start = src->cur_pack + dsi_pack.sml_agli.data[angle].address;
   cur_output_size = dsi_pack.dsi_gi.vobu_ea + 1;
 
   /* If we're not at the end of this cell, we can determine the next