qtdemux: Discard 2 byte subpicture packets
authorJan Schmidt <jan@centricular.com>
Mon, 25 Nov 2013 01:13:43 +0000 (12:13 +1100)
committerJan Schmidt <jan@centricular.com>
Mon, 25 Nov 2013 01:24:22 +0000 (12:24 +1100)
As for text subtitles and as suggested in #712643, throw
away the 2 byte terminator packets that some encoders insert.

This will make things better when remuxing and causes generation
of gap events.

gst/isomp4/qtdemux.c

index 8a7bdf6..a8c3fcb 100644 (file)
@@ -3940,12 +3940,11 @@ gst_qtdemux_process_buffer (GstQTDemux * qtdemux, QtDemuxStream * stream,
     if (stream->pending_event && stream->pad)
       gst_pad_push_event (stream->pad, stream->pending_event);
     stream->pending_event = NULL;
-    /* no further processing needed */
-    stream->need_process = FALSE;
   }
 
   if (G_UNLIKELY (stream->subtype != FOURCC_text
-          && stream->subtype != FOURCC_sbtl)) {
+          && stream->subtype != FOURCC_sbtl &&
+          stream->subtype != FOURCC_subp)) {
     return buf;
   }
 
@@ -3957,6 +3956,11 @@ gst_qtdemux_process_buffer (GstQTDemux * qtdemux, QtDemuxStream * stream,
     gst_buffer_unref (buf);
     return NULL;
   }
+  if (stream->subtype == FOURCC_subp) {
+    /* That's all the processing needed for subpictures */
+    gst_buffer_unmap (buf, &map);
+    return buf;
+  }
 
   nsize = GST_READ_UINT16_BE (map.data);
   nsize = MIN (nsize, map.size - 2);
@@ -10157,7 +10161,6 @@ gst_qtdemux_handle_esds (GstQTDemux * qtdemux, QtDemuxStream * stream,
           /* store event and trigger custom processing */
           stream->pending_event =
               gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s);
-          stream->need_process = TRUE;
         } else {
           /* Generic codec_data handler puts it on the caps */
           data_ptr = ptr;
@@ -10989,6 +10992,7 @@ qtdemux_sub_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
     case GST_MAKE_FOURCC ('m', 'p', '4', 's'):
       _codec ("DVD subtitle");
       caps = gst_caps_new_empty_simple ("subpicture/x-dvd");
+      stream->need_process = TRUE;
       break;
     case GST_MAKE_FOURCC ('t', 'e', 'x', 't'):
       _codec ("Quicktime timed text");