From 20d957de0364ae121b557fed440a0d50b0c0d06b Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 3 Mar 2002 00:53:24 +0000 Subject: [PATCH] get up-to-date with the gst_caps_debug api improved capsnego in mad improved capsnego in adder improved capsnego in i... Original commit message from CVS: * get up-to-date with the gst_caps_debug api * improved capsnego in mad * improved capsnego in adder * improved capsnego in intfloat plugins * unbroke capsnego in stereomono plugins * fix cothread stack allocation within the main thread in new cothreads --- common | 2 +- ext/lame/gstlame.c | 2 +- ext/mad/gstmad.c | 38 ++++++++++++++++++++++---------------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/common b/common index 7b9a18016e..2adced54d8 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 7b9a18016ec2fe74c23382856a0f480da259f971 +Subproject commit 2adced54d821c7870fd4d9e5e19482418a64c931 diff --git a/ext/lame/gstlame.c b/ext/lame/gstlame.c index d07d4cf358..ae4be60135 100644 --- a/ext/lame/gstlame.c +++ b/ext/lame/gstlame.c @@ -356,7 +356,7 @@ gst_lame_sinkconnect (GstPad *pad, GstCaps *caps) gst_caps_debug (caps); GST_INFO (GST_CAT_CAPS, "dumping caps of own pad %s:%s\n", GST_DEBUG_PAD_NAME (pad)); */ - gst_caps_debug (gst_pad_get_caps (pad)); + gst_caps_debug (gst_pad_get_caps (pad), "original caps on sink pad"); /* check if the supplied caps of the peer element are compatible with our own use gst_pad_get_caps because if caps aren't set yet we need the template */ if (!gst_caps_check_compatibility (caps, gst_pad_get_caps (pad))) { diff --git a/ext/mad/gstmad.c b/ext/mad/gstmad.c index fc8dd930cb..f0b59d2df8 100644 --- a/ext/mad/gstmad.c +++ b/ext/mad/gstmad.c @@ -61,6 +61,9 @@ struct _GstMad { guint framecount; gint vbr_average; /* average bitrate */ gulong vbr_rate; /* average * framecount */ + + /* caps */ + gboolean caps_set; }; struct _GstMadClass { @@ -454,25 +457,28 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer) *outdata++ = scale(*right_ch++) & 0xffff; } } - if (GST_PAD_CAPS (mad->srcpad) == NULL) { - gst_pad_try_set_caps (mad->srcpad, - gst_caps_new ( - "mad_src", - "audio/raw", - gst_props_new ( - "format", GST_PROPS_STRING ("int"), - "law", GST_PROPS_INT (0), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (16), - "depth", GST_PROPS_INT (16), + if (mad->caps_set == FALSE) { + if (!gst_pad_try_set_caps (mad->srcpad, + gst_caps_new ( + "mad_src", + "audio/raw", + gst_props_new ( + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT (0), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_BOOLEAN (TRUE), + "width", GST_PROPS_INT (16), + "depth", GST_PROPS_INT (16), #if MAD_VERSION_MINOR <= 12 - "rate", GST_PROPS_INT (mad->header.sfreq), + "rate", GST_PROPS_INT (mad->header.sfreq), #else - "rate", GST_PROPS_INT (mad->header.samplerate), + "rate", GST_PROPS_INT (mad->header.samplerate), #endif - "channels", GST_PROPS_INT (nchannels), - NULL))); + "channels", GST_PROPS_INT (nchannels), + NULL)))) { + gst_element_error (GST_ELEMENT (mad), "could not set caps on source pad, aborting..."); + } + mad->caps_set = TRUE; } gst_pad_push (mad->srcpad, outbuffer);