assrender: Handle GAP events
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 25 Oct 2012 10:06:15 +0000 (12:06 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 25 Oct 2012 12:05:49 +0000 (14:05 +0200)
ext/assrender/gstassrender.c

index 233733b0618df4bbec48c511afea7929524ce1a1..b471b87e141e6ef7b2d4255bb442781451bda49a 100644 (file)
@@ -1540,6 +1540,23 @@ gst_ass_render_event_text (GstPad * pad, GstObject * parent, GstEvent * event)
       GST_ASS_RENDER_UNLOCK (render);
       break;
     }
+    case GST_EVENT_GAP:{
+      GstClockTime start, duration;
+
+      gst_event_parse_gap (event, &start, &duration);
+      if (GST_CLOCK_TIME_IS_VALID (duration))
+        start += duration;
+      /* we do not expect another buffer until after gap,
+       * so that is our position now */
+      GST_ASS_RENDER_LOCK (render);
+      render->subtitle_segment.position = start;
+
+      /* wake up the video chain, it might be waiting for a text buffer or
+       * a text segment update */
+      GST_ASS_RENDER_BROADCAST (render);
+      GST_ASS_RENDER_UNLOCK (render);
+      break;
+    }
     case GST_EVENT_FLUSH_STOP:
       GST_ASS_RENDER_LOCK (render);
       GST_INFO_OBJECT (render, "text flush stop");