mpegtsparse: make sure packetsize is set on caps of buffers

This commit is contained in:
Zaheer Abbas Merali 2009-09-20 13:15:14 +01:00
parent bdf11016fa
commit ec100c87c7
3 changed files with 9 additions and 4 deletions

View file

@ -1994,8 +1994,15 @@ mpegts_try_discover_packet_size (MpegTSPacketizer * packetizer)
if (dest[i] == 0x47 && dest[i + packetsize] == 0x47 && if (dest[i] == 0x47 && dest[i + packetsize] == 0x47 &&
dest[i + packetsize * 2] == 0x47 && dest[i + packetsize * 2] == 0x47 &&
dest[i + packetsize * 3] == 0x47) { dest[i + packetsize * 3] == 0x47) {
gchar *str;
packetizer->know_packet_size = TRUE; packetizer->know_packet_size = TRUE;
packetizer->packet_size = packetsize; 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; pos = i;
break; break;
} }

View file

@ -62,6 +62,7 @@ struct _MpegTSPacketizer {
gboolean disposed; gboolean disposed;
gboolean know_packet_size; gboolean know_packet_size;
guint16 packet_size; guint16 packet_size;
GstCaps *caps;
}; };
struct _MpegTSPacketizerClass { struct _MpegTSPacketizerClass {

View file

@ -773,15 +773,12 @@ mpegts_parse_push (MpegTSParse * parse, MpegTSPacketizerPacket * packet,
guint16 pid; guint16 pid;
GstBuffer *buffer; GstBuffer *buffer;
GstFlowReturn ret; GstFlowReturn ret;
GstCaps *caps;
GList *srcpads; GList *srcpads;
pid = packet->pid; pid = packet->pid;
buffer = packet->buffer; buffer = packet->buffer;
/* we have the same caps on all the src pads */ /* we have the same caps on all the src pads */
caps = gst_static_pad_template_get_caps (&src_template); gst_buffer_set_caps (buffer, parse->packetizer->caps);
gst_buffer_set_caps (buffer, caps);
gst_caps_unref (caps);
GST_OBJECT_LOCK (parse); GST_OBJECT_LOCK (parse);
/* clear tspad->pushed on pads */ /* clear tspad->pushed on pads */