gst/law/: Fix negotiation to deal with ANY/EMPTY caps instead of leaking.

Original commit message from CVS:
* gst/law/alaw-decode.c: (alawdec_getcaps):
* gst/law/alaw-encode.c: (alawenc_getcaps), (gst_alawenc_chain):
* gst/law/mulaw-decode.c: (mulawdec_getcaps):
* gst/law/mulaw-encode.c: (mulawenc_getcaps):
Fix negotiation to deal with ANY/EMPTY caps instead of leaking.
This commit is contained in:
Wim Taymans 2006-07-24 14:16:06 +00:00
parent 26e4a48271
commit 4304e0f438
5 changed files with 23 additions and 10 deletions

View file

@ -1,3 +1,11 @@
2006-07-24 Wim Taymans <wim@fluendo.com>
* gst/law/alaw-decode.c: (alawdec_getcaps):
* gst/law/alaw-encode.c: (alawenc_getcaps), (gst_alawenc_chain):
* gst/law/mulaw-decode.c: (mulawdec_getcaps):
* gst/law/mulaw-encode.c: (mulawenc_getcaps):
Fix negotiation to deal with ANY/EMPTY caps instead of leaking.
2006-07-24 Stefan Kost,,, <set EMAIL_ADDRESS environment variable> 2006-07-24 Stefan Kost,,, <set EMAIL_ADDRESS environment variable>
* gst/wavparse/gstwavparse.c: (gst_wavparse_reset), * gst/wavparse/gstwavparse.c: (gst_wavparse_reset),

View file

@ -90,14 +90,16 @@ alawdec_getcaps (GstPad * pad)
} }
/* now intersect rate and channels from peer caps */ /* now intersect rate and channels from peer caps */
othercaps = gst_pad_peer_get_caps (otherpad); othercaps = gst_pad_peer_get_caps (otherpad);
if (othercaps && (!gst_caps_is_empty (othercaps)) if (othercaps) {
&& (!gst_caps_is_any (othercaps))) {
GstStructure *structure; GstStructure *structure;
const GValue *orate, *ochans; const GValue *orate, *ochans;
const GValue *rate, *chans; const GValue *rate, *chans;
GValue irate = { 0 }, ichans = { GValue irate = { 0 }, ichans = {
0}; 0};
if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps))
goto done;
structure = gst_caps_get_structure (othercaps, 0); structure = gst_caps_get_structure (othercaps, 0);
orate = gst_structure_get_value (structure, "rate"); orate = gst_structure_get_value (structure, "rate");
ochans = gst_structure_get_value (structure, "channels"); ochans = gst_structure_get_value (structure, "channels");
@ -118,10 +120,9 @@ alawdec_getcaps (GstPad * pad)
gst_structure_set_value (structure, "rate", &irate); gst_structure_set_value (structure, "rate", &irate);
gst_structure_set_value (structure, "channels", &ichans); gst_structure_set_value (structure, "channels", &ichans);
done:
gst_caps_unref (othercaps); gst_caps_unref (othercaps);
} }
done:
return base_caps; return base_caps;
} }

View file

@ -139,6 +139,9 @@ alawenc_getcaps (GstPad * pad)
GValue irate = { 0 }, ichans = { GValue irate = { 0 }, ichans = {
0}; 0};
if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps))
goto done;
structure = gst_caps_get_structure (othercaps, 0); structure = gst_caps_get_structure (othercaps, 0);
orate = gst_structure_get_value (structure, "rate"); orate = gst_structure_get_value (structure, "rate");
ochans = gst_structure_get_value (structure, "channels"); ochans = gst_structure_get_value (structure, "channels");
@ -159,9 +162,9 @@ alawenc_getcaps (GstPad * pad)
gst_structure_set_value (structure, "rate", &irate); gst_structure_set_value (structure, "rate", &irate);
gst_structure_set_value (structure, "channels", &ichans); gst_structure_set_value (structure, "channels", &ichans);
done:
gst_caps_unref (othercaps); gst_caps_unref (othercaps);
} }
done:
return base_caps; return base_caps;
} }

View file

@ -72,10 +72,8 @@ mulawdec_getcaps (GstPad * pad)
GValue irate = { 0 }, ichans = { GValue irate = { 0 }, ichans = {
0}; 0};
if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps)) { if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps))
gst_caps_unref (othercaps);
goto done; goto done;
}
structure = gst_caps_get_structure (othercaps, 0); structure = gst_caps_get_structure (othercaps, 0);
orate = gst_structure_get_value (structure, "rate"); orate = gst_structure_get_value (structure, "rate");
@ -97,9 +95,9 @@ mulawdec_getcaps (GstPad * pad)
gst_structure_set_value (structure, "rate", &irate); gst_structure_set_value (structure, "rate", &irate);
gst_structure_set_value (structure, "channels", &ichans); gst_structure_set_value (structure, "channels", &ichans);
done:
gst_caps_unref (othercaps); gst_caps_unref (othercaps);
} }
done:
return base_caps; return base_caps;
} }

View file

@ -72,6 +72,9 @@ mulawenc_getcaps (GstPad * pad)
GValue irate = { 0 }, ichans = { GValue irate = { 0 }, ichans = {
0}; 0};
if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps))
goto done;
structure = gst_caps_get_structure (othercaps, 0); structure = gst_caps_get_structure (othercaps, 0);
orate = gst_structure_get_value (structure, "rate"); orate = gst_structure_get_value (structure, "rate");
ochans = gst_structure_get_value (structure, "channels"); ochans = gst_structure_get_value (structure, "channels");
@ -92,9 +95,9 @@ mulawenc_getcaps (GstPad * pad)
gst_structure_set_value (structure, "rate", &irate); gst_structure_set_value (structure, "rate", &irate);
gst_structure_set_value (structure, "channels", &ichans); gst_structure_set_value (structure, "channels", &ichans);
done:
gst_caps_unref (othercaps); gst_caps_unref (othercaps);
} }
done:
return base_caps; return base_caps;
} }