diff options
Diffstat (limited to 'src/post/audio')
-rw-r--r-- | src/post/audio/Makefile.am | 10 | ||||
-rw-r--r-- | src/post/audio/audio_filters.c | 20 | ||||
-rw-r--r-- | src/post/audio/audio_filters.h | 6 | ||||
-rw-r--r-- | src/post/audio/stretch.c | 46 | ||||
-rw-r--r-- | src/post/audio/upmix.c | 36 | ||||
-rw-r--r-- | src/post/audio/upmix_mono.c | 32 | ||||
-rw-r--r-- | src/post/audio/volnorm.c | 34 |
7 files changed, 56 insertions, 128 deletions
diff --git a/src/post/audio/Makefile.am b/src/post/audio/Makefile.am index 9cb93dd5a..c2df5c21d 100644 --- a/src/post/audio/Makefile.am +++ b/src/post/audio/Makefile.am @@ -1,14 +1,12 @@ include $(top_srcdir)/misc/Makefile.common -noinst_HEADERS = dsp.h filter.h window.h audio_filters.h +AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) +AM_LDFLAGS = $(xineplug_ldflags) -libdir = $(XINE_PLUGINDIR)/post +noinst_HEADERS = dsp.h filter.h window.h audio_filters.h -lib_LTLIBRARIES = xineplug_post_audio_filters.la +xinepost_LTLIBRARIES = xineplug_post_audio_filters.la xineplug_post_audio_filters_la_SOURCES = \ upmix.c upmix_mono.c filter.c window.c stretch.c volnorm.c audio_filters.c xineplug_post_audio_filters_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) -lm -xineplug_post_audio_filters_la_CFLAGS = $(VISIBILITY_FLAG) -xineplug_post_audio_filters_la_LDFLAGS = -avoid-version -module - diff --git a/src/post/audio/audio_filters.c b/src/post/audio/audio_filters.c index 3d56a793b..517591b71 100644 --- a/src/post/audio/audio_filters.c +++ b/src/post/audio/audio_filters.c @@ -15,17 +15,15 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * $Id: audio_filters.c,v 1.7 2006/07/10 22:08:44 dgp85 Exp $ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * catalog for audio filter plugins */ -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "audio_filters.h" @@ -38,9 +36,9 @@ static const post_info_t volnorm_special_info = { XINE_POST_TYPE_AUDIO_FILTER const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "upmix", XINE_VERSION_CODE, &upmix_special_info, &upmix_init_plugin }, - { PLUGIN_POST, 9, "upmix_mono", XINE_VERSION_CODE, &upmix_mono_special_info, &upmix_mono_init_plugin }, - { PLUGIN_POST, 9, "stretch", XINE_VERSION_CODE, &stretch_special_info, &stretch_init_plugin }, - { PLUGIN_POST, 9, "volnorm", XINE_VERSION_CODE, &volnorm_special_info, &volnorm_init_plugin }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } + { PLUGIN_POST, 10, "upmix", XINE_VERSION_CODE, &upmix_special_info, &upmix_init_plugin }, + { PLUGIN_POST, 10, "upmix_mono", XINE_VERSION_CODE, &upmix_mono_special_info, &upmix_mono_init_plugin }, + { PLUGIN_POST, 10, "stretch", XINE_VERSION_CODE, &stretch_special_info, &stretch_init_plugin }, + { PLUGIN_POST, 10, "volnorm", XINE_VERSION_CODE, &volnorm_special_info, &volnorm_init_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/audio/audio_filters.h b/src/post/audio/audio_filters.h index 111367006..8a0202751 100644 --- a/src/post/audio/audio_filters.h +++ b/src/post/audio/audio_filters.h @@ -15,14 +15,12 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * $Id: audio_filters.h,v 1.3 2006/02/05 20:38:37 miguelfreitas Exp $ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * catalog for audio filter plugins */ -#include "xine_internal.h" +#include <xine/xine_internal.h> void *upmix_init_plugin(xine_t *xine, void *data); diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c index a1e921e03..bc079fd8d 100644 --- a/src/post/audio/stretch.c +++ b/src/post/audio/stretch.c @@ -15,21 +15,18 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Time stretch by a given factor, optionally preserving pitch - * - * $Id: stretch.c,v 1.8 2006/01/27 07:46:12 tmattern Exp $ - * */ #include <stdio.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "dsp.h" -#include "resample.h" +#include <xine/resample.h> #include "audio_filters.h" @@ -225,6 +222,8 @@ struct post_plugin_stretch_s { int frames_per_frag; int frames_per_outfrag; int num_frames; /* current # of frames on audiofrag */ + + int16_t last_sample[RESAMPLE_MAX_CHANNELS]; int64_t pts; /* pts for audiofrag */ @@ -305,7 +304,7 @@ static int stretch_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, /* force updating on stretch_port_put_buffer */ this->params_changed = 1; - return port->original_port->open(port->original_port, stream, bits, rate, mode); + return (port->original_port->open) (port->original_port, stream, bits, rate, mode); } static void stretch_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream ) { @@ -353,12 +352,16 @@ static void stretch_process_fragment( post_audio_port_t *port, if( !this->params.preserve_pitch ) { if( this->channels == 2 ) - _x_audio_out_resample_stereo(this->audiofrag, num_frames_in, + _x_audio_out_resample_stereo(this->last_sample, this->audiofrag, num_frames_in, this->outfrag, num_frames_out); else if( this->channels == 1 ) - _x_audio_out_resample_mono(this->audiofrag, num_frames_in, + _x_audio_out_resample_mono(this->last_sample, this->audiofrag, num_frames_in, this->outfrag, num_frames_out); } else { + if (this->channels == 2) + memcpy (this->last_sample, &this->audiofrag[(num_frames_in - 1) * 2], 2 * sizeof (this->last_sample[0])); + else if (this->channels == 1) + memcpy (this->last_sample, &this->audiofrag[num_frames_in - 1], sizeof (this->last_sample[0])); if( num_frames_in > num_frames_out ) { /* @@ -656,21 +659,6 @@ static post_plugin_t *stretch_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *stretch_get_identifier(post_class_t *class_gen) -{ - return "stretch"; -} - -static char *stretch_get_description(post_class_t *class_gen) -{ - return "Time stretch by a given factor, optionally preserving pitch"; -} - -static void stretch_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *stretch_init_plugin(xine_t *xine, void *data) { @@ -680,9 +668,9 @@ void *stretch_init_plugin(xine_t *xine, void *data) return NULL; class->post_class.open_plugin = stretch_open_plugin; - class->post_class.get_identifier = stretch_get_identifier; - class->post_class.get_description = stretch_get_description; - class->post_class.dispose = stretch_class_dispose; + class->post_class.identifier = "stretch"; + class->post_class.description = N_("Time stretch by a given factor, optionally preserving pitch"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/audio/upmix.c b/src/post/audio/upmix.c index 76c9afe58..30fbb452b 100644 --- a/src/post/audio/upmix.c +++ b/src/post/audio/upmix.c @@ -15,23 +15,20 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Upmix audio filter for xine. * (c) 2004 James Courtier-Dutton (James@superbug.demon.co.uk) * This is an up-mix audio filter post plugin. * It simply creates output channels to match the speaker arrangement. * E.g. Converts Stereo into Surround 5.1 - * - * $Id: upmix.c,v 1.17 2006/01/27 07:46:12 tmattern Exp $ - * */ #include <stdio.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "dsp.h" #include "audio_filters.h" @@ -57,7 +54,7 @@ typedef struct{ } biquad_t; /* S-parameters for designing 4th order Butterworth filter */ -static biquad_t s_param[2] = {{{1.0,0.0,0.0},{1.0,0.765367,1.0}}, +static const biquad_t s_param[2] = {{{1.0,0.0,0.0},{1.0,0.765367,1.0}}, {{1.0,0.0,0.0},{1.0,1.847759,1.0}}}; /* Data for specific instances of this filter */ @@ -203,7 +200,7 @@ static int upmix_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, pthread_mutex_unlock (&this->lock); - return port->original_port->open(port->original_port, stream, bits, rate, mode ); + return (port->original_port->open) (port->original_port, stream, bits, rate, mode ); } #if 0 @@ -417,21 +414,6 @@ static post_plugin_t *upmix_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *upmix_get_identifier(post_class_t *class_gen) -{ - return "upmix"; -} - -static char *upmix_get_description(post_class_t *class_gen) -{ - return "upmix"; -} - -static void upmix_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *upmix_init_plugin(xine_t *xine, void *data) { @@ -441,9 +423,9 @@ void *upmix_init_plugin(xine_t *xine, void *data) return NULL; class->post_class.open_plugin = upmix_open_plugin; - class->post_class.get_identifier = upmix_get_identifier; - class->post_class.get_description = upmix_get_description; - class->post_class.dispose = upmix_class_dispose; + class->post_class.identifier = "upmix"; + class->post_class.description = N_("upmix"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/audio/upmix_mono.c b/src/post/audio/upmix_mono.c index ddb52b018..53fd23109 100644 --- a/src/post/audio/upmix_mono.c +++ b/src/post/audio/upmix_mono.c @@ -15,15 +15,12 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Upmix audio filter for xine. * (c) 2004 James Courtier-Dutton (James@superbug.demon.co.uk) * This is an up-mix audio filter post plugin. * It simply converts Mono into Stereo. - * - * $Id: upmix_mono.c,v 1.5 2006/01/27 07:46:12 tmattern Exp $ - * */ #include <stdio.h> @@ -34,8 +31,8 @@ #define LOG */ -#include "xineutils.h" -#include "post.h" +#include <xine/xineutils.h> +#include <xine/post.h> #include "audio_filters.h" @@ -159,7 +156,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre } } - return port->original_port->open(port->original_port, stream, bits, rate, mode); + return (port->original_port->open) (port->original_port, stream, bits, rate, mode); } static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, @@ -332,21 +329,6 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs return &this->post; } -static char *upmix_mono_get_identifier(post_class_t *class_gen) -{ - return "upmix_mono"; -} - -static char *upmix_mono_get_description(post_class_t *class_gen) -{ - return "converts Mono into Stereo"; -} - -static void upmix_mono_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *upmix_mono_init_plugin(xine_t *xine, void *data) { @@ -356,9 +338,9 @@ void *upmix_mono_init_plugin(xine_t *xine, void *data) return NULL; class->post_class.open_plugin = upmix_mono_open_plugin; - class->post_class.get_identifier = upmix_mono_get_identifier; - class->post_class.get_description = upmix_mono_get_description; - class->post_class.dispose = upmix_mono_class_dispose; + class->post_class.identifier = "upmix_mono"; + class->post_class.description = N_("converts Mono into Stereo"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; diff --git a/src/post/audio/volnorm.c b/src/post/audio/volnorm.c index 9bddf6087..4fb2a0411 100644 --- a/src/post/audio/volnorm.c +++ b/src/post/audio/volnorm.c @@ -15,22 +15,19 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Volume normalization audio filter for xine. Ported by Jason Tackaberry * from MPlayer's af_volnorm, which is copyright 2004 by Alex Beregszaszi * & Pierre Lombard. - * - * $Id: volnorm.c,v 1.1 2006/02/05 20:38:37 miguelfreitas Exp $ - * */ #include <stdio.h> #include <math.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "dsp.h" #include "audio_filters.h" @@ -184,7 +181,7 @@ static int volnorm_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream, port->rate = rate; port->mode = mode; - return port->original_port->open(port->original_port, stream, bits, rate, mode ); + return (port->original_port->open) (port->original_port, stream, bits, rate, mode ); } static void volnorm_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream ) { @@ -450,21 +447,6 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static char *volnorm_get_identifier(post_class_t *class_gen) -{ - return "volnorm"; -} - -static char *volnorm_get_description(post_class_t *class_gen) -{ - return "Normalize volume"; -} - -static void volnorm_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - /* plugin class initialization function */ void *volnorm_init_plugin(xine_t *xine, void *data) { @@ -474,9 +456,9 @@ void *volnorm_init_plugin(xine_t *xine, void *data) return NULL; class->post_class.open_plugin = volnorm_open_plugin; - class->post_class.get_identifier = volnorm_get_identifier; - class->post_class.get_description = volnorm_get_description; - class->post_class.dispose = volnorm_class_dispose; + class->post_class.identifier = "volnorm"; + class->post_class.description = N_("Normalize volume"); + class->post_class.dispose = default_post_class_dispose; class->xine = xine; |