modplug: Allow 32 bit depth, modplugs native format.

Fixes bug #605720.
This commit is contained in:
Kaj-Michael Lang 2009-12-29 16:07:59 +02:00 committed by Sebastian Dröge
parent 24965dc415
commit 212cf43774
2 changed files with 14 additions and 12 deletions

View file

@ -88,7 +88,15 @@ static GstStaticPadTemplate modplug_src_template_factory =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int,"
GST_STATIC_CAPS (
"audio/x-raw-int,"
" endianness = (int) BYTE_ORDER,"
" signed = (boolean) true,"
" width = (int) 32,"
" depth = (int) 32,"
" rate = (int) { 8000, 11025, 22050, 44100 },"
" channels = (int) 2; "
"audio/x-raw-int,"
" endianness = (int) BYTE_ORDER,"
" signed = (boolean) true,"
" width = (int) 16,"
@ -248,7 +256,7 @@ gst_modplug_init (GstModPlug * modplug, GstModPlugClass * klass)
modplug->oversamp = DEFAULT_OVERSAMP;
modplug->noise_reduction = DEFAULT_NOISE_REDUCTION;
modplug->_16bit = TRUE;
modplug->bits = 16;
modplug->channel = 2;
modplug->frequency = 44100;
}
@ -448,7 +456,6 @@ gst_modplug_load_song (GstModPlug * modplug)
{
GstCaps *newcaps, *othercaps;
GstStructure *structure;
gint depth;
GST_DEBUG_OBJECT (modplug, "Setting caps");
@ -467,23 +474,18 @@ gst_modplug_load_song (GstModPlug * modplug)
/* set up modplug to output the negotiated format */
structure = gst_caps_get_structure (newcaps, 0);
gst_structure_get_int (structure, "depth", &depth);
modplug->_16bit = (depth == 16);
gst_structure_get_int (structure, "depth", &modplug->bits);
gst_structure_get_int (structure, "channels", &modplug->channel);
gst_structure_get_int (structure, "rate", &modplug->frequency);
modplug->read_samples = 1152;
modplug->read_bytes = modplug->read_samples * modplug->channel * depth / 8;
modplug->read_bytes = modplug->read_samples * modplug->channel * modplug->bits / 8;
GST_DEBUG_OBJECT (modplug, "Loading song");
modplug->mSoundFile = new CSoundFile;
if (modplug->_16bit)
modplug->mSoundFile->SetWaveConfig (modplug->frequency, 16,
modplug->channel);
else
modplug->mSoundFile->SetWaveConfig (modplug->frequency, 8,
modplug->mSoundFile->SetWaveConfig (modplug->frequency, modplug->bits,
modplug->channel);
modplug->mSoundFile->SetWaveConfigEx (modplug->surround, !modplug->oversamp,

View file

@ -55,7 +55,7 @@ struct _GstModPlug {
gint surround_depth;
gint surround_delay;
gboolean noise_reduction;
gboolean _16bit;
gint bits;
gboolean oversamp;
gint channel;
gint frequency;