mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-09 05:38:58 +00:00
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.
This commit is contained in:
parent
5830b42dc5
commit
d36adc543b
1 changed files with 80 additions and 1 deletions
|
@ -59,7 +59,8 @@ GST_DEBUG_CATEGORY (speex_resample_debug);
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_QUALITY
|
PROP_QUALITY,
|
||||||
|
PROP_FILTER_LENGTH
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SUPPORTED_CAPS \
|
#define SUPPORTED_CAPS \
|
||||||
|
@ -169,6 +170,14 @@ gst_speex_resample_class_init (GstSpeexResampleClass * klass)
|
||||||
SPEEX_RESAMPLER_QUALITY_DEFAULT,
|
SPEEX_RESAMPLER_QUALITY_DEFAULT,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
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_BASE_TRANSFORM_CLASS (klass)->start =
|
||||||
GST_DEBUG_FUNCPTR (gst_speex_resample_start);
|
GST_DEBUG_FUNCPTR (gst_speex_resample_start);
|
||||||
GST_BASE_TRANSFORM_CLASS (klass)->stop =
|
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->channels, resample->inrate, resample->outrate,
|
||||||
resample->quality, resample->fp);
|
resample->quality, resample->fp);
|
||||||
break;
|
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:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -1176,6 +1218,43 @@ gst_speex_resample_get_property (GObject * object, guint prop_id,
|
||||||
case PROP_QUALITY:
|
case PROP_QUALITY:
|
||||||
g_value_set_int (value, resample->quality);
|
g_value_set_int (value, resample->quality);
|
||||||
break;
|
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:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue