From b3a90202c12619bb32712a5d185d48b6286911e6 Mon Sep 17 00:00:00 2001 From: Olivier Crete Date: Sun, 22 Feb 2009 18:46:03 +0100 Subject: alaw/mulaw: Don't require both, rate and channel, to be set in _getcaps Fixes bug #572358. --- gst/law/alaw-encode.c | 22 ++++++++++------------ gst/law/mulaw-encode.c | 22 ++++++++++------------ 2 files changed, 20 insertions(+), 24 deletions(-) (limited to 'gst/law') diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c index ba8587a2..b98d8e2e 100644 --- a/gst/law/alaw-encode.c +++ b/gst/law/alaw-encode.c @@ -318,8 +318,8 @@ gst_alaw_enc_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; @@ -327,22 +327,20 @@ gst_alaw_enc_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); 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); -- cgit