ext/mad/gstid3tag.c: When acting as a muxer, set caps on outgoing buffers and set caps on source pad (fixes #323658)....

Original commit message from CVS:
Patch by: Alexander Lancaster  <alexl at users sourceforge net>
* ext/mad/gstid3tag.c: (gst_id3_tag_get_caps), (gst_id3_tag_init),
(gst_id3_tag_sink_event), (gst_id3_tag_src_link),
(gst_id3_tag_chain):
When acting as a muxer, set caps on outgoing buffers and set caps
on source pad (fixes #323658). Remove unused application/x-gst-tags
cruft from the 0.6 days.
This commit is contained in:
Alexander Lancaster 2006-04-22 18:49:01 +00:00 committed by Tim-Philipp Müller
parent 84d42edc7f
commit 1ecb957e9b
2 changed files with 18 additions and 5 deletions

View file

@ -1,3 +1,14 @@
2006-04-22 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Alexander Lancaster <alexl at users sourceforge net>
* ext/mad/gstid3tag.c: (gst_id3_tag_get_caps), (gst_id3_tag_init),
(gst_id3_tag_sink_event), (gst_id3_tag_src_link),
(gst_id3_tag_chain):
When acting as a muxer, set caps on outgoing buffers and set caps
on source pad (fixes #323658). Remove unused application/x-gst-tags
cruft from the 0.6 days.
2006-04-21 Tim-Philipp Müller <tim at centricular dot net> 2006-04-21 Tim-Philipp Müller <tim at centricular dot net>
* ext/mad/gstmad.c: (gst_mad_convert_sink), (gst_mad_convert_src), * ext/mad/gstmad.c: (gst_mad_convert_sink), (gst_mad_convert_src),

View file

@ -318,8 +318,7 @@ gst_id3_tag_get_caps (GstPad * pad)
GstCaps *caps = gst_caps_copy (tag->found_caps); GstCaps *caps = gst_caps_copy (tag->found_caps);
if (CAN_BE_MUXER (tag)) { if (CAN_BE_MUXER (tag)) {
gst_caps_append (caps, gst_caps_append (caps, gst_caps_from_string ("application/x-id3"));
gst_caps_from_string ("application/x-gst-tags; application/x-id3"));
} }
return caps; return caps;
} else { } else {
@ -366,6 +365,9 @@ gst_id3_tag_init (GTypeInstance * instance, gpointer g_class)
if (GST_ID3_TAG_GET_CLASS (tag)->type == GST_ID3_TAG_PARSE_MUX) { if (GST_ID3_TAG_GET_CLASS (tag)->type == GST_ID3_TAG_PARSE_MUX) {
/* only the muxer class here, all other use sometimes pads */ /* only the muxer class here, all other use sometimes pads */
gst_id3_tag_add_src_pad (tag); gst_id3_tag_add_src_pad (tag);
gst_pad_use_fixed_caps (tag->srcpad);
gst_pad_set_caps (tag->srcpad,
gst_static_pad_template_get_caps (&id3_tag_src_id3_template_factory));
} }
/* FIXME: for the alli^H^H^H^Hspider - gst_id3_tag_add_src_pad (tag); */ /* FIXME: for the alli^H^H^H^Hspider - gst_id3_tag_add_src_pad (tag); */
tag->parse_mode = GST_ID3_TAG_PARSE_BASE; tag->parse_mode = GST_ID3_TAG_PARSE_BASE;
@ -1001,6 +1003,7 @@ gst_id3_tag_sink_event (GstPad * pad, GstEvent * event)
tag_buffer = gst_buffer_new_and_alloc (128); tag_buffer = gst_buffer_new_and_alloc (128);
if (128 != id3_tag_render (id3, tag_buffer->data)) if (128 != id3_tag_render (id3, tag_buffer->data))
g_assert_not_reached (); g_assert_not_reached ();
gst_buffer_set_caps (tag_buffer, GST_PAD_CAPS (tag->srcpad));
gst_pad_push (tag->srcpad, tag_buffer); gst_pad_push (tag->srcpad, tag_buffer);
id3_tag_delete (id3); id3_tag_delete (id3);
} }
@ -1139,9 +1142,6 @@ gst_id3_tag_src_link (GstPad * pad, GstPad * peer)
if (strcmp (mimetype, "application/x-id3") == 0) { if (strcmp (mimetype, "application/x-id3") == 0) {
tag->parse_mode = GST_ID3_TAG_PARSE_MUX; tag->parse_mode = GST_ID3_TAG_PARSE_MUX;
GST_LOG_OBJECT (tag, "mux operation, using application/x-id3 output"); GST_LOG_OBJECT (tag, "mux operation, using application/x-id3 output");
} else if (strcmp (mimetype, "application/x-gst-tags") == 0) {
tag->parse_mode = GST_ID3_TAG_PARSE_ANY;
GST_LOG_OBJECT (tag, "fast operation, just outputting tags");
} else { } else {
tag->parse_mode = GST_ID3_TAG_PARSE_DEMUX; tag->parse_mode = GST_ID3_TAG_PARSE_DEMUX;
GST_LOG_OBJECT (tag, "demux operation, extracting tags"); GST_LOG_OBJECT (tag, "demux operation, extracting tags");
@ -1383,6 +1383,7 @@ gst_id3_tag_chain (GstPad * pad, GstBuffer * buffer)
id3_tag_render (id3, GST_BUFFER_DATA (tag_buffer)); id3_tag_render (id3, GST_BUFFER_DATA (tag_buffer));
g_assert (estimated >= tag->v2tag_size_new); g_assert (estimated >= tag->v2tag_size_new);
GST_BUFFER_SIZE (tag_buffer) = tag->v2tag_size_new; GST_BUFFER_SIZE (tag_buffer) = tag->v2tag_size_new;
gst_buffer_set_caps (tag_buffer, GST_PAD_CAPS (tag->srcpad));
gst_pad_push (tag->srcpad, tag_buffer); gst_pad_push (tag->srcpad, tag_buffer);
id3_tag_delete (id3); id3_tag_delete (id3);
} }
@ -1434,6 +1435,7 @@ gst_id3_tag_chain (GstPad * pad, GstBuffer * buffer)
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
buffer = sub; buffer = sub;
} }
gst_buffer_set_caps (buffer, GST_PAD_CAPS (tag->srcpad));
gst_pad_push (tag->srcpad, buffer); gst_pad_push (tag->srcpad, buffer);
} }
return GST_FLOW_OK; return GST_FLOW_OK;