summaryrefslogtreecommitdiffstats
path: root/gst/law
diff options
context:
space:
mode:
authorOlivier Crete <tester@tester.ca>2009-02-22 18:46:03 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-02-22 18:46:03 +0100
commitb3a90202c12619bb32712a5d185d48b6286911e6 (patch)
tree4073d012934b2df8b74c52d11af3aae46420110e /gst/law
parent6756475fd3af29844a77bcb08d9943070daf6f9e (diff)
alaw/mulaw: Don't require both, rate and channel, to be set in _getcaps
Fixes bug #572358.
Diffstat (limited to 'gst/law')
-rw-r--r--gst/law/alaw-encode.c22
-rw-r--r--gst/law/mulaw-encode.c22
2 files changed, 20 insertions, 24 deletions
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);