dvdread: Work around basesrc initial seek
authorJan Schmidt <jan@centricular.com>
Tue, 12 May 2015 11:52:24 +0000 (21:52 +1000)
committerJan Schmidt <jan@centricular.com>
Tue, 12 May 2015 11:52:24 +0000 (21:52 +1000)
Ignore the initial seek basesrc sends, as it
breaks starting from another chapter by
immediately seeking back to the start of the title

ext/dvdread/dvdreadsrc.c
ext/dvdread/dvdreadsrc.h

index e0584ef..52c0d22 100644 (file)
@@ -115,6 +115,7 @@ gst_dvd_read_src_init (GstDvdReadSrc * src)
   src->dvd_title = NULL;
 
   src->location = g_strdup ("/dev/dvd");
+  src->first_seek = TRUE;
   src->new_seek = TRUE;
   src->new_cell = TRUE;
   src->change_cell = FALSE;
@@ -1239,6 +1240,13 @@ gst_dvd_read_src_do_seek (GstBaseSrc * basesrc, GstSegment * s)
   GST_DEBUG_OBJECT (src, "Seeking to %s: %12" G_GINT64_FORMAT,
       gst_format_get_name (s->format), s->position);
 
+  /* Ignore the first seek to 0, as it breaks starting playback
+   * from another chapter by seeking back to sector 0 */
+  if (src->first_seek && s->format == GST_FORMAT_BYTES && s->start == 0) {
+    src->first_seek = FALSE;
+    return TRUE;
+  }
+
   if (s->format == sector_format || s->format == GST_FORMAT_BYTES
       || s->format == GST_FORMAT_TIME) {
     guint old;
index 4fa6372..fbca0ee 100644 (file)
@@ -48,6 +48,7 @@ struct _GstDvdReadSrc {
   /* location */
   gchar           *location;
 
+  gboolean         first_seek;
   gboolean         new_seek;
   gboolean         change_cell;