gst/audioconvert/gstaudioconvert.c: fixate nicely even when the peer is not negotiating

Original commit message from CVS:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_fixate):
fixate nicely even when the peer is not negotiating
This commit is contained in:
Benjamin Otte 2004-05-26 14:47:23 +00:00
parent 4f845c50ce
commit b95a7dca6a
2 changed files with 22 additions and 11 deletions

View file

@ -1,3 +1,8 @@
2004-05-26 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_fixate):
fixate nicely even when the peer is not negotiating
2004-05-25 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/audioconvert/gstaudioconvert.c:

View file

@ -492,23 +492,29 @@ gst_audio_convert_fixate (GstPad * pad, const GstCaps * caps)
GstAudioConvert *this =
GST_AUDIO_CONVERT (gst_object_get_parent (GST_OBJECT (pad)));
GstPad *otherpad = (pad == this->sink ? this->src : this->sink);
GstAudioConvertCaps ac_caps =
GstAudioConvertCaps try, ac_caps =
(pad == this->sink ? this->srccaps : this->sinkcaps);
GstCaps *copy;
GstCaps *copy = gst_caps_copy (caps);
/* only fixate when we're proxying, so we don't fixate to some crap the other side doesn't want */
if (!GST_PAD_IS_NEGOTIATING (otherpad))
return NULL;
if (!GST_PAD_IS_NEGOTIATING (otherpad)) {
try.channels = 2;
try.width = 16;
try.depth = 16;
try.endianness = G_BYTE_ORDER;
} else {
try.channels = ac_caps.channels;
try.width = ac_caps.is_int ? ac_caps.width : 16;
try.depth = ac_caps.is_int ? ac_caps.depth : 16;
try.endianness = ac_caps.is_int ? ac_caps.endianness : G_BYTE_ORDER;
}
copy = gst_caps_copy (caps);
if (_fixate_caps_to_int (&copy, "channels", ac_caps.channels))
if (_fixate_caps_to_int (&copy, "channels", try.channels))
return copy;
if (_fixate_caps_to_int (&copy, "width", ac_caps.is_int ? ac_caps.width : 16))
if (_fixate_caps_to_int (&copy, "width", try.width))
return copy;
if (_fixate_caps_to_int (&copy, "depth", ac_caps.is_int ? ac_caps.depth : 16))
if (_fixate_caps_to_int (&copy, "depth", try.depth))
return copy;
if (_fixate_caps_to_int (&copy, "endianness",
ac_caps.is_int ? ac_caps.endianness : G_BYTE_ORDER))
if (_fixate_caps_to_int (&copy, "endianness", try.endianness))
return copy;