[gst-cvs] gst-plugins-bad: modplug: Allow 32 bit depth, modplugs native format.

Sebastian Dröge slomo at kemper.freedesktop.org
Mon Jan 4 01:24:08 PST 2010


Module: gst-plugins-bad
Branch: master
Commit: 212cf43774565e989ed16350cc83698847e48fcc
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=212cf43774565e989ed16350cc83698847e48fcc

Author: Kaj-Michael Lang <milang at tal.org>
Date:   Tue Dec 29 16:07:59 2009 +0200

modplug: Allow 32 bit depth, modplugs native format.

Fixes bug #605720.

---

 ext/modplug/gstmodplug.cc |   24 +++++++++++++-----------
 ext/modplug/gstmodplug.h  |    2 +-
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/ext/modplug/gstmodplug.cc b/ext/modplug/gstmodplug.cc
index b928ccd..9dfe7fc 100644
--- a/ext/modplug/gstmodplug.cc
+++ b/ext/modplug/gstmodplug.cc
@@ -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,
diff --git a/ext/modplug/gstmodplug.h b/ext/modplug/gstmodplug.h
index b08af24..0c02eb2 100644
--- a/ext/modplug/gstmodplug.h
+++ b/ext/modplug/gstmodplug.h
@@ -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;





More information about the Gstreamer-commits mailing list