From 9a4a0725e10c13546e9d43ab10c88d884349a5bf Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 9 Mar 2004 21:09:11 +0000 Subject: ext/mikmod/gstmikmod.*: make mikmod's loop function not loop infinitely and call gst_element_yield anymore Original commit message from CVS: * ext/mikmod/gstmikmod.c: (gst_mikmod_init), (gst_mikmod_loop), (gst_mikmod_change_state): * ext/mikmod/gstmikmod.h: make mikmod's loop function not loop infinitely and call gst_element_yield anymore * gst/modplug/gstmodplug.cc: fix pad negotiation --- gst/modplug/gstmodplug.cc | 60 ++++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 40 deletions(-) (limited to 'gst/modplug/gstmodplug.cc') diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc index 12151afb..9ebd8563 100644 --- a/gst/modplug/gstmodplug.cc +++ b/gst/modplug/gstmodplug.cc @@ -74,7 +74,21 @@ GST_STATIC_PAD_TEMPLATE ( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS) + GST_STATIC_CAPS ( + "audio/x-raw-int, " + "endianness = (int) BYTE_ORDER, " + "signed = (boolean) TRUE, " + "width = (int) 16, " + "depth = (int) 16, " + "rate = (int) { 8000, 11025, 22050, 44100 }, " /* FIXME? */ + "channels = (int) [ 1, 2 ]; " + "audio/x-raw-int, " + "signed = (boolean) FALSE, " + "width = (int) 8, " + "depth = (int) 8, " + "rate = (int) { 8000, 11025, 22050, 44100 }, " /* FIXME? */ + "channels = (int) [ 1, 2 ]" + ) ); static GstStaticPadTemplate modplug_sink_template_factory = @@ -426,43 +440,6 @@ gst_modplug_update_metadata (GstModPlug *modplug) } #endif - -static GstPadLinkReturn -modplug_negotiate (GstModPlug *modplug) -{ - GstPadLinkReturn ret = GST_PAD_LINK_OK; - gboolean sign; - modplug->length = 1152 * modplug->channel; - - if (modplug->_16bit) - { - modplug->length *= 2; - modplug->bitsPerSample = 16; - sign = TRUE; - } - else { - modplug->bitsPerSample = 8; - sign = FALSE; - } - - if ((ret = gst_pad_try_set_caps (modplug->srcpad, - gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_BYTE_ORDER, - "signed", G_TYPE_BOOLEAN, sign, - "width", G_TYPE_INT, modplug->bitsPerSample, - "depth", G_TYPE_INT, modplug->bitsPerSample, - "rate", G_TYPE_INT, modplug->frequency, - "channels", G_TYPE_INT, modplug->channel, - NULL))) <= 0) { - return ret; - } - - gst_modplug_setup (modplug); - - return ret; -} - - static GstPadLinkReturn gst_modplug_srclink (GstPad *pad, const GstCaps *caps) { @@ -479,7 +456,10 @@ gst_modplug_srclink (GstPad *pad, const GstCaps *caps) gst_structure_get_int (structure, "channels", &modplug->channel); gst_structure_get_int (structure, "rate", &modplug->frequency); - return modplug_negotiate(modplug); + modplug->length = 1152 * modplug->channel * depth / 8; + gst_modplug_setup (modplug); + + return GST_PAD_LINK_OK; } static void @@ -574,7 +554,7 @@ gst_modplug_loop (GstElement *element) modplug->mSoundFile = new CSoundFile; if (!GST_PAD_CAPS (modplug->srcpad) && - modplug_negotiate (modplug) <= 0) { + GST_PAD_LINK_FAILED (gst_pad_renegotiate (modplug->srcpad))) { GST_ELEMENT_ERROR (modplug, CORE, NEGOTIATION, (NULL), (NULL)); return; } -- cgit v1.2.1