mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-24 16:18:16 +00:00
siren: fix setting caps on the output pad
Also set the caps on the output pad when the input buffers don't have caps.
This commit is contained in:
parent
f874e30998
commit
6e9904fa8a
2 changed files with 18 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue