thaytan gst-plugins-bad: gst-plugins-bad/ gst-plugins-bad/ext/resindvd/

[email protected] Thu, 8 Jan 2009 04:42:32 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
--===============5281934815223711287==

CVS Root:       /cvs/gstreamer
Module:         gst-plugins-bad
Changes by:     thaytan
Date:           Thu Jan 08 2009  12:42:32 UTC

Log message:
	* ext/resindvd/resindvdbin.c:
	* ext/resindvd/resindvdsrc.c:
	* ext/resindvd/resindvdsrc.h:
	* ext/resindvd/rsnaudiomunge.c:
	Add support for time based seeking.
	Make setting dvd:// reset to the default device.
	Make the 'audiomunge' element send any new segment start before
	the 'gap filler' buffer it generates, and any segment closes
	after.
	Fixes: #566957

Modified files:
    .               : ChangeLog
    ext/resindvd    : resindvdbin.c resindvdsrc.c resindvdsrc.h
                      rsnaudiomunge.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3865&r2=1.3866
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/resindvd/resindvdbin.c.diff?r1=1.6&r2=1.7
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/resindvd/resindvdsrc.c.diff?r1=1.11&r2=1.12
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/resindvd/resindvdsrc.h.diff?r1=1.5&r2=1.6
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/resindvd/rsnaudiomunge.c.diff?r1=1.2&r2=1.3

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v
retrieving revision 1.3865
retrieving revision 1.3866
diff -u -d -r1.3865 -r1.3866
--- ChangeLog	8 Jan 2009 09:40:20 -0000	1.3865
+++ ChangeLog	8 Jan 2009 12:42:16 -0000	1.3866
@@ -1,3 +1,16 @@
+2009-01-08  Jan Schmidt  <[email protected]>
+
+	* ext/resindvd/resindvdbin.c:
+	* ext/resindvd/resindvdsrc.c:
+	* ext/resindvd/resindvdsrc.h:
+	* ext/resindvd/rsnaudiomunge.c:
+	Add support for time based seeking.
+	Make setting dvd:// reset to the default device.
+	Make the 'audiomunge' element send any new segment start before
+	the 'gap filler' buffer it generates, and any segment closes
+	after.
+	Fixes: #566957
 2009-01-08  Sebastian Dröge  <[email protected]>
 
 	* ext/ladspa/gstladspa.c: (plugin_init):
Index: resindvdbin.c
RCS file: /cvs/gstreamer/gst-plugins-bad/ext/resindvd/resindvdbin.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- resindvdbin.c	27 Sep 2008 01:12:29 -0000	1.6
+++ resindvdbin.c	8 Jan 2009 12:42:17 -0000	1.7
@@ -230,7 +230,10 @@
    */
   if (g_str_has_prefix (uri, "dvd://")) {
     g_free (dvdbin->device);
-    dvdbin->device = g_strdup (uri + 6);
+    if (strlen (uri) > 6)
+      dvdbin->device = g_strdup (uri + 6);
+    else
+      dvdbin->device = g_strdup (DEFAULT_DEVICE);
   }
 #if 0
   /*
Index: resindvdsrc.c
RCS file: /cvs/gstreamer/gst-plugins-bad/ext/resindvd/resindvdsrc.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- resindvdsrc.c	23 Nov 2008 11:16:36 -0000	1.11
+++ resindvdsrc.c	8 Jan 2009 12:42:18 -0000	1.12
@@ -337,6 +337,14 @@
     goto fail;
+  if (dvdnav_set_PGC_positioning_flag (src->dvdnav, 1) != DVDNAV_STATUS_OK) {
+    GST_ELEMENT_ERROR (src, LIBRARY, FAILED,
+        (_("Failed to set PGC based seeking.")), GST_ERROR_SYSTEM);
+    goto fail;
+  }
+  src->first_seek = TRUE;
   src->running = TRUE;
   src->branching = FALSE;
   src->discont = TRUE;
@@ -767,10 +775,16 @@
     case DVDNAV_VTS_CHANGE:{
       dvdnav_vts_change_event_t *event = (dvdnav_vts_change_event_t *) data;
-      if (dvdnav_is_domain_vmgm (src->dvdnav))
+      if (dvdnav_is_domain_vmgm (src->dvdnav)) {
         src->vts_n = 0;
-      else
+      } else {
         src->vts_n = event->new_vtsN;
+        if (src->vts_file) {
+          ifoClose (src->vts_file);
+          src->vts_file = NULL;
+        }
+        src->vts_file = ifoOpen (src->dvdread, src->vts_n);
+      }
       src->in_menu = !dvdnav_is_domain_vtsm (src->dvdnav);
@@ -1873,23 +1887,90 @@
       event, segment);
 }
+/* Find sector from time using time map if available */
+static gint
+rsn_dvdsrc_get_sector_from_time_tmap (resinDvdSrc * src, GstClockTime ts)
+{
+  vts_tmapt_t *vts_tmapt;
+  vts_tmap_t *title_tmap;
+  gint32 title, part, vts_ttn;
+  guint32 entry;
+  if (ts == 0)
+    return 0;
+  if (src->vts_file == NULL)
+    return -1;
+  if (dvdnav_current_title_info (src->dvdnav, &title, &part) !=
+      DVDNAV_STATUS_OK)
+  /* To find the right tmap, we need the title number within this VTS (vts_ttn)
+   * from the VMG tt_srpt table... */
+  if (title < 1 || title >= src->vmg_file->tt_srpt->nr_of_srpts)
+  vts_tmapt = src->vts_file->vts_tmapt;
+  if (vts_tmapt == NULL)
+  vts_ttn = src->vmg_file->tt_srpt->title[title - 1].vts_ttn;
+  if (vts_ttn < 1 || vts_ttn > vts_tmapt->nr_of_tmaps)
+  title_tmap = vts_tmapt->tmap + vts_ttn - 1;
+  entry = ts / (title_tmap->tmu * GST_SECOND);
+  if (entry < title_tmap->nr_of_entries)
+    return title_tmap->map_ent[entry] & 0x7fffffff;
+  return -1;
+}
+/* call with DVD lock held */
+static gboolean
+rsn_dvdsrc_seek_to_time (resinDvdSrc * src, GstClockTime ts)
+  gint sector;
+  dvdnav_status_t res;
+  GST_DEBUG_OBJECT (src, "Time seek requested to ts %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (ts));
+  sector = rsn_dvdsrc_get_sector_from_time_tmap (src, ts);
+  if (sector < 0)
+    return FALSE;
+  src->discont = TRUE;
+  res = dvdnav_sector_search (src->dvdnav, sector, SEEK_SET);
+  if (res != DVDNAV_STATUS_OK)
+  return TRUE;
 static gboolean
 rsn_dvdsrc_do_seek (RsnBaseSrc * bsrc, GstSegment * segment)
 {
   resinDvdSrc *src = RESINDVDSRC (bsrc);
   gboolean ret = FALSE;
-  if (segment->format == rsndvd_format) {
+  if (segment->format == rsndvd_format || src->first_seek) {
     /* The internal format has alread served its purpose of waking
      * everything up and flushing, we just need to step to the next
      * data block (below) so we know our new position */
     ret = TRUE;
+    src->first_seek = FALSE;
   } else {
     /* FIXME: Handle other formats: Time, title, chapter, angle */
     /* HACK to make initial seek work: */
     if (segment->format == GST_FORMAT_TIME) {
-      ret = TRUE;
-      src->discont = TRUE;
+      g_mutex_lock (src->dvd_lock);
+      ret = rsn_dvdsrc_seek_to_time (src, segment->start);
+      g_mutex_unlock (src->dvd_lock);
     } else if (segment->format == title_format) {
       gint titles;
Index: resindvdsrc.h
RCS file: /cvs/gstreamer/gst-plugins-bad/ext/resindvd/resindvdsrc.h,v
retrieving revision 1.5
diff -u -d -r1.5 -r1.6
--- resindvdsrc.h	30 Oct 2008 13:38:19 -0000	1.5
+++ resindvdsrc.h	8 Jan 2009 12:42:18 -0000	1.6
@@ -85,6 +85,7 @@
   gboolean	running;
   gboolean	discont;
+  gboolean	first_seek;
   gboolean	flushing_seek;
   gboolean	need_segment;
   gboolean	active_highlight;
Index: rsnaudiomunge.c
RCS file: /cvs/gstreamer/gst-plugins-bad/ext/resindvd/rsnaudiomunge.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rsnaudiomunge.c	11 Jul 2008 14:06:06 -0000	1.2
+++ rsnaudiomunge.c	8 Jan 2009 12:42:18 -0000	1.3
@@ -311,6 +311,15 @@
        * Otherwise, send the buffer before the newsegment, so that it appears
        * in the closing segment.
        */
+      if (!update) {
+        GST_DEBUG_OBJECT (munge, "Sending newsegment: start %" GST_TIME_FORMAT
+            " stop %" GST_TIME_FORMAT " accum now %" GST_TIME_FORMAT,
+            GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
+            GST_TIME_ARGS (segment->accum));
+        ret = gst_pad_push_event (munge->srcpad, event);
       if (segment->accum >= AUDIO_FILL_THRESHOLD || munge->in_still) {
         g_print ("***********  Sending audio fill: accum = %" GST_TIME_FORMAT
             " still-state=%d\n", GST_TIME_ARGS (segment->accum),
@@ -326,12 +335,15 @@
             GST_TIME_ARGS (segment->accum));
       }
-      GST_DEBUG_OBJECT (munge, "Sending newsegment: start %" GST_TIME_FORMAT
-          " stop %" GST_TIME_FORMAT " accum now %" GST_TIME_FORMAT,
-          GST_TIME_ARGS (start), GST_TIME_ARGS (stop),
-          GST_TIME_ARGS (segment->accum));
+      if (update) {
-      ret = gst_pad_push_event (munge->srcpad, event);
       break;
     }
     case GST_EVENT_CUSTOM_DOWNSTREAM:


--===============5281934815223711287==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
--===============5281934815223711287==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose

--===============5281934815223711287==--