summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-11-21 15:45:15 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-11-21 15:45:15 +0000
commit5cb4a14316d4b3ae853d2b8a1f103f2229a9a0ba (patch)
tree895c203a3a09d971592800a4a952c16201aa721e /gst
parentb1e0560a5124c137852763e4b0809b0ceb97c9ed (diff)
downloadgst-plugins-bad-5cb4a14316d4b3ae853d2b8a1f103f2229a9a0ba.tar.gz
gst-plugins-bad-5cb4a14316d4b3ae853d2b8a1f103f2229a9a0ba.tar.bz2
gst-plugins-bad-5cb4a14316d4b3ae853d2b8a1f103f2229a9a0ba.zip
gst/speexresample/gstspeexresample.c: Add a "filter-length" property that maps to the quality values for compatibilty...
Original commit message from CVS: * gst/speexresample/gstspeexresample.c: (gst_speex_resample_class_init), (gst_speex_resample_set_property), (gst_speex_resample_get_property): Add a "filter-length" property that maps to the quality values for compatibilty with audioresample.
Diffstat (limited to 'gst')
-rw-r--r--gst/speexresample/gstspeexresample.c81
1 files changed, 80 insertions, 1 deletions
diff --git a/gst/speexresample/gstspeexresample.c b/gst/speexresample/gstspeexresample.c
index 010991d6..4c6dbffe 100644
--- a/gst/speexresample/gstspeexresample.c
+++ b/gst/speexresample/gstspeexresample.c
@@ -59,7 +59,8 @@ GST_DEBUG_CATEGORY (speex_resample_debug);
enum
{
PROP_0,
- PROP_QUALITY
+ PROP_QUALITY,
+ PROP_FILTER_LENGTH
};
#define SUPPORTED_CAPS \
@@ -169,6 +170,14 @@ gst_speex_resample_class_init (GstSpeexResampleClass * klass)
SPEEX_RESAMPLER_QUALITY_DEFAULT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ /* FIXME 0.11: Remove this property, it's just for compatibility
+ * with old audioresample
+ */
+ g_object_class_install_property (gobject_class, PROP_FILTER_LENGTH,
+ g_param_spec_int ("filter-length", "Filter length",
+ "DEPRECATED, DON'T USE THIS! " "Length of the resample filter", 0,
+ G_MAXINT, 64, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
GST_BASE_TRANSFORM_CLASS (klass)->start =
GST_DEBUG_FUNCPTR (gst_speex_resample_start);
GST_BASE_TRANSFORM_CLASS (klass)->stop =
@@ -1158,6 +1167,39 @@ gst_speex_resample_set_property (GObject * object, guint prop_id,
resample->channels, resample->inrate, resample->outrate,
resample->quality, resample->fp);
break;
+ case PROP_FILTER_LENGTH:{
+ gint filter_length = g_value_get_int (value);
+
+ if (filter_length <= 8)
+ resample->quality = 0;
+ else if (filter_length <= 16)
+ resample->quality = 1;
+ else if (filter_length <= 32)
+ resample->quality = 2;
+ else if (filter_length <= 48)
+ resample->quality = 3;
+ else if (filter_length <= 64)
+ resample->quality = 4;
+ else if (filter_length <= 80)
+ resample->quality = 5;
+ else if (filter_length <= 96)
+ resample->quality = 6;
+ else if (filter_length <= 128)
+ resample->quality = 7;
+ else if (filter_length <= 160)
+ resample->quality = 8;
+ else if (filter_length <= 192)
+ resample->quality = 9;
+ else
+ resample->quality = 10;
+
+ GST_DEBUG_OBJECT (resample, "new quality %d", resample->quality);
+
+ gst_speex_resample_update_state (resample, resample->width,
+ resample->channels, resample->inrate, resample->outrate,
+ resample->quality, resample->fp);
+ break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1176,6 +1218,43 @@ gst_speex_resample_get_property (GObject * object, guint prop_id,
case PROP_QUALITY:
g_value_set_int (value, resample->quality);
break;
+ case PROP_FILTER_LENGTH:
+ switch (resample->quality) {
+ case 0:
+ g_value_set_int (value, 8);
+ break;
+ case 1:
+ g_value_set_int (value, 16);
+ break;
+ case 2:
+ g_value_set_int (value, 32);
+ break;
+ case 3:
+ g_value_set_int (value, 48);
+ break;
+ case 4:
+ g_value_set_int (value, 64);
+ break;
+ case 5:
+ g_value_set_int (value, 80);
+ break;
+ case 6:
+ g_value_set_int (value, 96);
+ break;
+ case 7:
+ g_value_set_int (value, 128);
+ break;
+ case 8:
+ g_value_set_int (value, 160);
+ break;
+ case 9:
+ g_value_set_int (value, 192);
+ break;
+ case 10:
+ g_value_set_int (value, 256);
+ break;
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;