mpegtsparse: make sure packetsize is set on caps of buffers
authorZaheer Abbas Merali <zaheerabbas@merali.org>
Sun, 20 Sep 2009 12:15:14 +0000 (13:15 +0100)
committerZaheer Abbas Merali <zaheerabbas@merali.org>
Sun, 20 Sep 2009 12:25:53 +0000 (13:25 +0100)
gst/mpegdemux/mpegtspacketizer.c
gst/mpegdemux/mpegtspacketizer.h
gst/mpegdemux/mpegtsparse.c

index 58e379af6305fc8ef396839004a23230ed0c8446..284868e55052b2e8ce5442904294f094a170fbf1 100644 (file)
@@ -1994,8 +1994,15 @@ mpegts_try_discover_packet_size (MpegTSPacketizer * packetizer)
         if (dest[i] == 0x47 && dest[i + packetsize] == 0x47 &&
             dest[i + packetsize * 2] == 0x47 &&
             dest[i + packetsize * 3] == 0x47) {
+          gchar *str;
           packetizer->know_packet_size = TRUE;
           packetizer->packet_size = packetsize;
+          str =
+              g_strdup_printf
+              ("video/mpegts, systemstream=(boolean)true, packetsize=%d",
+              packetsize);
+          packetizer->caps = gst_caps_from_string ((const gchar *) str);
+          g_free (str);
           pos = i;
           break;
         }
index f30231ff27e7bbc06858b18566f4368271ed85e3..7c7552a2e005c16a76d01ded41b0a4ca0aeac21e 100644 (file)
@@ -62,6 +62,7 @@ struct _MpegTSPacketizer {
   gboolean disposed;
   gboolean know_packet_size;
   guint16 packet_size;
+  GstCaps *caps;
 };
 
 struct _MpegTSPacketizerClass {
index dcadc01931a189a767520e3105c8334a9497557a..dab403dd14f70c2e44c8ae8177810742848cdb35 100644 (file)
@@ -773,15 +773,12 @@ mpegts_parse_push (MpegTSParse * parse, MpegTSPacketizerPacket * packet,
   guint16 pid;
   GstBuffer *buffer;
   GstFlowReturn ret;
-  GstCaps *caps;
   GList *srcpads;
 
   pid = packet->pid;
   buffer = packet->buffer;
   /* we have the same caps on all the src pads */
-  caps = gst_static_pad_template_get_caps (&src_template);
-  gst_buffer_set_caps (buffer, caps);
-  gst_caps_unref (caps);
+  gst_buffer_set_caps (buffer, parse->packetizer->caps);
 
   GST_OBJECT_LOCK (parse);
   /* clear tspad->pushed on pads */