[0.11] gst-plugins-ugly: dvdreadsrc: fix sector seeking

Wim Taymans wtay at kemper.freedesktop.org
Mon Sep 26 10:08:57 PDT 2011


Module: gst-plugins-ugly
Branch: 0.11
Commit: 59ed3b7bf2898adba62bf71148135b3584f16289
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=59ed3b7bf2898adba62bf71148135b3584f16289

Author: Vincent Penquerc'h <vincent.penquerch at collabora.co.uk>
Date:   Fri Sep 16 15:03:54 2011 +0100

dvdreadsrc: fix sector seeking

It was overly complicated, and did not take into account the offset
needed for titles which do not start on a new file.

https://bugzilla.gnome.org/show_bug.cgi?id=659252

---

 ext/dvdread/dvdreadsrc.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/ext/dvdread/dvdreadsrc.c b/ext/dvdread/dvdreadsrc.c
index a53019f..ba36bec 100644
--- a/ext/dvdread/dvdreadsrc.c
+++ b/ext/dvdread/dvdreadsrc.c
@@ -1545,25 +1545,27 @@ static gboolean
 gst_dvd_read_src_goto_sector (GstDvdReadSrc * src, int angle)
 {
   gint seek_to = src->cur_pack;
-  gint chapter, sectors, next, cur, i;
+  gint chapter, next, cur, i;
 
   /* retrieve position */
   src->cur_pack = 0;
+  GST_DEBUG_OBJECT (src, "Goto sector %d, angle %d, within %d chapters",
+      seek_to, angle, src->num_chapters);
+
   for (i = 0; i < src->num_chapters; i++) {
     gint c1, c2;
 
     cur_title_get_chapter_bounds (src, i, &c1, &c2);
+    GST_DEBUG_OBJECT (src, " Looking in chapter %d, bounds: %d %d", i, c1, c2);
 
     for (next = cur = c1; cur < c2;) {
-      if (next != cur) {
-        sectors =
-            src->cur_pgc->cell_playback[cur].last_sector -
-            src->cur_pgc->cell_playback[cur].first_sector;
-        if (src->cur_pack + sectors > seek_to) {
-          chapter = i;
-          goto done;
-        }
-        src->cur_pack += sectors;
+      gint first = src->cur_pgc->cell_playback[cur].first_sector;
+      gint last = src->cur_pgc->cell_playback[cur].last_sector;
+      GST_DEBUG_OBJECT (src, "Cell %d sector bounds: %d %d", cur, first, last);
+      if (seek_to >= first && seek_to <= last) {
+        GST_DEBUG_OBJECT (src, "Seek target found in chapter %d", i);
+        chapter = i;
+        goto done;
       }
       cur = next;
       if (src->cur_pgc->cell_playback[cur].block_type == BLOCK_TYPE_ANGLE_BLOCK)



More information about the gstreamer-commits mailing list