summaryrefslogtreecommitdiffstats
path: root/gst/law/mulaw-encode.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst/law/mulaw-encode.c')
-rw-r--r--gst/law/mulaw-encode.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c
index f60e0b2e..022e96f1 100644
--- a/gst/law/mulaw-encode.c
+++ b/gst/law/mulaw-encode.c
@@ -75,8 +75,8 @@ mulawenc_getcaps (GstPad * pad)
GstStructure *structure;
const GValue *orate, *ochans;
const GValue *rate, *chans;
- GValue irate = { 0 }, ichans = {
- 0};
+ GValue irate = { 0 };
+ GValue ichans = { 0 };
if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps))
goto done;
@@ -84,22 +84,20 @@ mulawenc_getcaps (GstPad * pad)
structure = gst_caps_get_structure (othercaps, 0);
orate = gst_structure_get_value (structure, "rate");
ochans = gst_structure_get_value (structure, "channels");
- if (!orate || !ochans)
- goto done;
structure = gst_caps_get_structure (base_caps, 0);
rate = gst_structure_get_value (structure, "rate");
chans = gst_structure_get_value (structure, "channels");
- if (!rate || !chans)
- goto done;
- gst_value_intersect (&irate, orate, rate);
- gst_value_intersect (&ichans, ochans, chans);
+ if (orate) {
+ gst_value_intersect (&irate, orate, rate);
+ gst_structure_set_value (structure, "rate", &irate);
+ }
- /* Set the samplerate/channels on the to-be-returned caps */
- structure = gst_caps_get_structure (base_caps, 0);
- gst_structure_set_value (structure, "rate", &irate);
- gst_structure_set_value (structure, "channels", &ichans);
+ if (ochans) {
+ gst_value_intersect (&ichans, ochans, chans);
+ gst_structure_set_value (structure, "channels", &ichans);
+ }
done:
gst_caps_unref (othercaps);