summaryrefslogtreecommitdiff
path: root/gst/siren
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-09-04 17:32:34 +0200
committerWim Taymans <wim@metal.(none)>2009-09-04 17:32:34 +0200
commit6e9904fa8a6ea55c911775f426fe8e4d024ed368 (patch)
tree861eccf2206635b5a541efab3a06ea2efecf662d /gst/siren
parentf874e30998683eed73eea65a657452293595469f (diff)
downloadgstreamer-plugins-bad-6e9904fa8a6ea55c911775f426fe8e4d024ed368.tar.gz
siren: fix setting caps on the output pad
Also set the caps on the output pad when the input buffers don't have caps.
Diffstat (limited to 'gst/siren')
-rw-r--r--gst/siren/gstsirendec.c10
-rw-r--r--gst/siren/gstsirenenc.c10
2 files changed, 18 insertions, 2 deletions
diff --git a/gst/siren/gstsirendec.c b/gst/siren/gstsirendec.c
index d6eb35ed6..45cfe05b0 100644
--- a/gst/siren/gstsirendec.c
+++ b/gst/siren/gstsirendec.c
@@ -218,6 +218,7 @@ gst_siren_dec_chain (GstPad * pad, GstBuffer * buf)
gboolean discont;
GstClockTime timestamp;
guint64 distance;
+ GstCaps *outcaps;
dec = GST_SIREN_DEC (GST_PAD_PARENT (pad));
@@ -248,9 +249,16 @@ gst_siren_dec_chain (GstPad * pad, GstBuffer * buf)
GST_LOG_OBJECT (dec, "we have %u frames, %u in, %u out", num_frames, in_size,
out_size);
+ /* set output caps when needed */
+ if ((outcaps = GST_PAD_CAPS (dec->srcpad)) == NULL) {
+ outcaps = gst_static_pad_template_get_caps (&srctemplate);
+ gst_pad_set_caps (dec->srcpad, outcaps);
+ gst_caps_unref (outcaps);
+ }
+
/* get a buffer */
ret = gst_pad_alloc_buffer_and_set_caps (dec->srcpad, -1,
- out_size, GST_PAD_CAPS (dec->srcpad), &out_buf);
+ out_size, outcaps, &out_buf);
if (ret != GST_FLOW_OK)
goto alloc_failed;
diff --git a/gst/siren/gstsirenenc.c b/gst/siren/gstsirenenc.c
index 9b6a2a8b2..f42f16ee1 100644
--- a/gst/siren/gstsirenenc.c
+++ b/gst/siren/gstsirenenc.c
@@ -220,6 +220,7 @@ gst_siren_enc_chain (GstPad * pad, GstBuffer * buf)
gboolean discont;
GstClockTime timestamp;
guint64 distance;
+ GstCaps *outcaps;
enc = GST_SIREN_ENC (GST_PAD_PARENT (pad));
@@ -252,9 +253,16 @@ gst_siren_enc_chain (GstPad * pad, GstBuffer * buf)
GST_LOG_OBJECT (enc, "we have %u frames, %u in, %u out", num_frames, in_size,
out_size);
+ /* set output caps when needed */
+ if ((outcaps = GST_PAD_CAPS (enc->srcpad)) == NULL) {
+ outcaps = gst_static_pad_template_get_caps (&srctemplate);
+ gst_pad_set_caps (enc->srcpad, outcaps);
+ gst_caps_unref (outcaps);
+ }
+
/* get a buffer */
ret = gst_pad_alloc_buffer_and_set_caps (enc->srcpad, -1,
- out_size, GST_PAD_CAPS (enc->srcpad), &out_buf);
+ out_size, outcaps, &out_buf);
if (ret != GST_FLOW_OK)
goto alloc_failed;