diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | gst/modplug/gstmodplug.cc | 53 |
2 files changed, 34 insertions, 24 deletions
@@ -1,3 +1,8 @@ +2007-08-21 Stefan Kost <ensonic@users.sf.net> + + * gst/modplug/gstmodplug.cc: + Don't use NULL caps for srcpad is not yet connected. + 2007-08-20 Zaheer Abbas Merali <zaheerabbas at merali dot org> * configure.ac: diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc index 5459b42e..b930153f 100644 --- a/gst/modplug/gstmodplug.cc +++ b/gst/modplug/gstmodplug.cc @@ -93,27 +93,24 @@ enum #define DEFAULT_OVERSAMP TRUE #define DEFAULT_NOISE_REDUCTION TRUE -#define SRC_CAPS \ - "audio/x-raw-int," \ - " endianness = (int) BYTE_ORDER," \ - " signed = (boolean) true," \ - " width = (int) 16," \ - " depth = (int) 16," \ - " rate = (int) { 8000, 11025, 22050, 44100 }," \ - " channels = (int) 2; " \ - "audio/x-raw-int," \ - " endianness = (int) BYTE_ORDER," \ - " signed = (boolean) false," \ - " width = (int) 8," \ - " depth = (int) 8," \ - " rate = (int) { 8000, 11025, 22050, 44100 }, " \ - " channels = (int) [ 1, 2 ]" - static GstStaticPadTemplate modplug_src_template_factory = -GST_STATIC_PAD_TEMPLATE ("src", + GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (SRC_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 }," + " channels = (int) 2; " + "audio/x-raw-int," + " endianness = (int) BYTE_ORDER," + " signed = (boolean) false," + " width = (int) 8," + " depth = (int) 8," + " rate = (int) { 8000, 11025, 22050, 44100 }, " + " channels = (int) [ 1, 2 ]")); static GstStaticPadTemplate modplug_sink_template_factory = GST_STATIC_PAD_TEMPLATE ("sink", @@ -459,14 +456,18 @@ gst_modplug_load_song (GstModPlug * modplug) GstStructure *structure; gint depth; - GST_DEBUG_OBJECT (modplug, "Loading song"); - - modplug->mSoundFile = new CSoundFile; + GST_DEBUG_OBJECT (modplug, "Setting caps"); /* negotiate srcpad caps */ - othercaps = gst_pad_get_allowed_caps (modplug->srcpad); - newcaps = gst_caps_copy_nth (othercaps, 0); - gst_caps_unref (othercaps); + if (othercaps = gst_pad_get_allowed_caps (modplug->srcpad)) { + newcaps = gst_caps_copy_nth (othercaps, 0); + gst_caps_unref (othercaps); + } else { + GST_WARNING ("no allowed caps on srcpad, no peer linked"); + /* FIXME: this can be done in a better way */ + newcaps = + gst_caps_copy_nth (gst_pad_get_pad_template_caps (modplug->srcpad), 0); + } gst_pad_fixate_caps (modplug->srcpad, newcaps); gst_pad_set_caps (modplug->srcpad, newcaps); @@ -480,6 +481,10 @@ gst_modplug_load_song (GstModPlug * modplug) modplug->read_samples = 1152; modplug->read_bytes = modplug->read_samples * modplug->channel * depth / 8; + GST_DEBUG_OBJECT (modplug, "Loading song"); + + modplug->mSoundFile = new CSoundFile; + if (modplug->_16bit) modplug->mSoundFile->SetWaveConfig (modplug->frequency, 16, modplug->channel); |