mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
gst/audiofx/audiopanorama.c: Use a function array for process methods, add more docs and define the startindex of enums.
Original commit message from CVS: Patch by: Sebastian Dröge <slomo circular-chaos org> * gst/audiofx/audiopanorama.c: (gst_audio_panorama_class_init), (gst_audio_panorama_set_process_function): Use a function array for process methods, add more docs and define the startindex of enums.
This commit is contained in:
parent
36dfafcda9
commit
703a0d00d8
2 changed files with 49 additions and 50 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2007-01-16 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
|
Patch by: Sebastian Dröge <slomo circular-chaos org>
|
||||||
|
|
||||||
|
* gst/audiofx/audiopanorama.c: (gst_audio_panorama_class_init),
|
||||||
|
(gst_audio_panorama_set_process_function):
|
||||||
|
Use a function array for process methods, add more docs and define the
|
||||||
|
startindex of enums.
|
||||||
|
|
||||||
2007-01-14 Tim-Philipp Müller <tim at centricular dot net>
|
2007-01-14 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
Patch by: Mark Nauwelaerts <manauw at skynet be>
|
Patch by: Mark Nauwelaerts <manauw at skynet be>
|
||||||
|
|
|
@ -73,8 +73,9 @@ enum
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
METHOD_PSYCHOACOUSTIC,
|
METHOD_PSYCHOACOUSTIC = 0,
|
||||||
METHOD_SIMPLE
|
METHOD_SIMPLE,
|
||||||
|
NUM_METHODS
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GST_TYPE_AUDIO_PANORAMA_METHOD (gst_audio_panorama_method_get_type ())
|
#define GST_TYPE_AUDIO_PANORAMA_METHOD (gst_audio_panorama_method_get_type ())
|
||||||
|
@ -163,6 +164,27 @@ static void gst_audio_panorama_transform_s2s_float_simple (GstAudioPanorama *
|
||||||
static GstFlowReturn gst_audio_panorama_transform (GstBaseTransform * base,
|
static GstFlowReturn gst_audio_panorama_transform (GstBaseTransform * base,
|
||||||
GstBuffer * inbuf, GstBuffer * outbuf);
|
GstBuffer * inbuf, GstBuffer * outbuf);
|
||||||
|
|
||||||
|
|
||||||
|
/* Table with processing functions: [channels][format][method] */
|
||||||
|
static GstAudioPanoramaProcessFunc panorama_process_functions[2][2][2] = {
|
||||||
|
{
|
||||||
|
{(GstAudioPanoramaProcessFunc) gst_audio_panorama_transform_m2s_int,
|
||||||
|
(GstAudioPanoramaProcessFunc)
|
||||||
|
gst_audio_panorama_transform_m2s_int_simple},
|
||||||
|
{(GstAudioPanoramaProcessFunc) gst_audio_panorama_transform_m2s_float,
|
||||||
|
(GstAudioPanoramaProcessFunc)
|
||||||
|
gst_audio_panorama_transform_m2s_float_simple}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{(GstAudioPanoramaProcessFunc) gst_audio_panorama_transform_s2s_int,
|
||||||
|
(GstAudioPanoramaProcessFunc)
|
||||||
|
gst_audio_panorama_transform_s2s_int_simple},
|
||||||
|
{(GstAudioPanoramaProcessFunc) gst_audio_panorama_transform_s2s_float,
|
||||||
|
(GstAudioPanoramaProcessFunc)
|
||||||
|
gst_audio_panorama_transform_s2s_float_simple}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* GObject vmethod implementations */
|
/* GObject vmethod implementations */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -194,7 +216,8 @@ gst_audio_panorama_class_init (GstAudioPanoramaClass * klass)
|
||||||
* GstAudioPanorama:method
|
* GstAudioPanorama:method
|
||||||
*
|
*
|
||||||
* Panning method: psychoacoustic mode keeps the same perceived loudness,
|
* Panning method: psychoacoustic mode keeps the same perceived loudness,
|
||||||
* while simple mode just controls the volume of one channel.
|
* while simple mode just controls the volume of one channel. It's merely
|
||||||
|
* a matter of taste which method should be chosen.
|
||||||
*
|
*
|
||||||
* Since: 0.10.6
|
* Since: 0.10.6
|
||||||
**/
|
**/
|
||||||
|
@ -230,57 +253,24 @@ gst_audio_panorama_init (GstAudioPanorama * filter,
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_audio_panorama_set_process_function (GstAudioPanorama * filter)
|
gst_audio_panorama_set_process_function (GstAudioPanorama * filter)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gint channel_index, format_index, method_index;
|
||||||
|
|
||||||
/* set processing function */
|
/* set processing function */
|
||||||
switch (filter->channels) {
|
channel_index = filter->channels - 1;
|
||||||
case 1:
|
if (channel_index > 1 || channel_index < 0) {
|
||||||
if (!filter->format_float) {
|
filter->process = NULL;
|
||||||
if (filter->method == METHOD_SIMPLE) {
|
return FALSE;
|
||||||
filter->process = (GstAudioPanoramaProcessFunc)
|
|
||||||
gst_audio_panorama_transform_m2s_int_simple;
|
|
||||||
} else {
|
|
||||||
filter->process = (GstAudioPanoramaProcessFunc)
|
|
||||||
gst_audio_panorama_transform_m2s_int;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (filter->method == METHOD_SIMPLE) {
|
|
||||||
filter->process = (GstAudioPanoramaProcessFunc)
|
|
||||||
gst_audio_panorama_transform_m2s_float_simple;
|
|
||||||
} else {
|
|
||||||
filter->process = (GstAudioPanoramaProcessFunc)
|
|
||||||
gst_audio_panorama_transform_m2s_float;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (!filter->format_float) {
|
|
||||||
if (filter->method == METHOD_SIMPLE) {
|
|
||||||
filter->process = (GstAudioPanoramaProcessFunc)
|
|
||||||
gst_audio_panorama_transform_s2s_int_simple;
|
|
||||||
} else {
|
|
||||||
filter->process = (GstAudioPanoramaProcessFunc)
|
|
||||||
gst_audio_panorama_transform_s2s_int;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (filter->method == METHOD_SIMPLE) {
|
|
||||||
filter->process = (GstAudioPanoramaProcessFunc)
|
|
||||||
gst_audio_panorama_transform_s2s_float_simple;
|
|
||||||
} else {
|
|
||||||
filter->process = (GstAudioPanoramaProcessFunc)
|
|
||||||
gst_audio_panorama_transform_s2s_float;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret = TRUE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ret = FALSE;
|
|
||||||
filter->process = NULL;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
format_index = (filter->format_float) ? 1 : 0;
|
||||||
|
|
||||||
|
method_index = filter->method;
|
||||||
|
if (method_index >= NUM_METHODS || method_index < 0)
|
||||||
|
method_index = METHOD_PSYCHOACOUSTIC;
|
||||||
|
|
||||||
|
filter->process =
|
||||||
|
panorama_process_functions[channel_index][format_index][method_index];
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue