From b95a7dca6aca94cbbdd60285b00344abe17bb216 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 26 May 2004 14:47:23 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 +++++ gst/audioconvert/gstaudioconvert.c | 28 +++++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c774791dc..4588480824 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-05-26 Benjamin Otte + + * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_fixate): + fixate nicely even when the peer is not negotiating + 2004-05-25 Benjamin Otte * gst/audioconvert/gstaudioconvert.c: diff --git a/gst/audioconvert/gstaudioconvert.c b/gst/audioconvert/gstaudioconvert.c index 970dd784aa..e61da8c294 100644 --- a/gst/audioconvert/gstaudioconvert.c +++ b/gst/audioconvert/gstaudioconvert.c @@ -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 (©, "channels", ac_caps.channels)) + if (_fixate_caps_to_int (©, "channels", try.channels)) return copy; - if (_fixate_caps_to_int (©, "width", ac_caps.is_int ? ac_caps.width : 16)) + if (_fixate_caps_to_int (©, "width", try.width)) return copy; - if (_fixate_caps_to_int (©, "depth", ac_caps.is_int ? ac_caps.depth : 16)) + if (_fixate_caps_to_int (©, "depth", try.depth)) return copy; - if (_fixate_caps_to_int (©, "endianness", - ac_caps.is_int ? ac_caps.endianness : G_BYTE_ORDER)) + if (_fixate_caps_to_int (©, "endianness", try.endianness)) return copy;