summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2004-07-27 17:59:58 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2004-07-27 17:59:58 +0000
commit25ba0f3888a1e4c3b92f926ce8828d56e40e3c61 (patch)
tree71f3d297456179c48397f220f571699bb8223e93
parent39009957fcc969ef659981b033aba33d6121f2b2 (diff)
downloadxine-lib-25ba0f3888a1e4c3b92f926ce8828d56e40e3c61.tar.gz
xine-lib-25ba0f3888a1e4c3b92f926ce8828d56e40e3c61.tar.bz2
* use a header for the init functions
* do not use void* in pointer arithmetics, since sizeof(void) is undefined -> I converted the pointers to int16_t* since that is common for audio samples in xine and casted them back to uint8_t* for the arithmetics CVS patchset: 6858 CVS date: 2004/07/27 17:59:58
-rw-r--r--src/post/audio/Makefile.am2
-rw-r--r--src/post/audio/audio_filters.c8
-rw-r--r--src/post/audio/audio_filters.h29
-rw-r--r--src/post/audio/stretch.c19
-rw-r--r--src/post/audio/upmix.c4
5 files changed, 47 insertions, 15 deletions
diff --git a/src/post/audio/Makefile.am b/src/post/audio/Makefile.am
index 5268a1636..b208a71e9 100644
--- a/src/post/audio/Makefile.am
+++ b/src/post/audio/Makefile.am
@@ -1,6 +1,6 @@
include $(top_srcdir)/misc/Makefile.common
-noinst_HEADERS = dsp.h filter.h window.h
+noinst_HEADERS = dsp.h filter.h window.h audio_filters.h
libdir = $(XINE_PLUGINDIR)/post
diff --git a/src/post/audio/audio_filters.c b/src/post/audio/audio_filters.c
index 23621e688..c773dc7a0 100644
--- a/src/post/audio/audio_filters.c
+++ b/src/post/audio/audio_filters.c
@@ -17,7 +17,7 @@
* 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.1 2004/07/26 22:23:34 miguelfreitas Exp $
+ * $Id: audio_filters.c,v 1.2 2004/07/27 17:59:58 mroi Exp $
*
* catalog for audio filter plugins
*/
@@ -27,10 +27,10 @@
#include "xineutils.h"
#include "post.h"
-void *upmix_init_plugin(xine_t *xine, void *data);
-post_info_t upmix_special_info = { XINE_POST_TYPE_AUDIO_FILTER };
+#include "audio_filters.h"
-void *stretch_init_plugin(xine_t *xine, void *data);
+
+post_info_t upmix_special_info = { XINE_POST_TYPE_AUDIO_FILTER };
post_info_t stretch_special_info = { XINE_POST_TYPE_AUDIO_FILTER };
diff --git a/src/post/audio/audio_filters.h b/src/post/audio/audio_filters.h
new file mode 100644
index 000000000..365c13346
--- /dev/null
+++ b/src/post/audio/audio_filters.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2000-2004 the xine project
+ *
+ * This file is part of xine, a free video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * 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.1 2004/07/27 17:59:58 mroi Exp $
+ *
+ * catalog for audio filter plugins
+ */
+
+#include "xine_internal.h"
+
+
+void *upmix_init_plugin(xine_t *xine, void *data);
+void *stretch_init_plugin(xine_t *xine, void *data);
diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c
index 0079111a8..f21378cd2 100644
--- a/src/post/audio/stretch.c
+++ b/src/post/audio/stretch.c
@@ -19,7 +19,7 @@
*
* Time stretch by a given factor, optionally preserving pitch
*
- * $Id: stretch.c,v 1.2 2004/07/26 22:34:00 miguelfreitas Exp $
+ * $Id: stretch.c,v 1.3 2004/07/27 17:59:58 mroi Exp $
*
*/
@@ -31,6 +31,7 @@
#include "dsp.h"
#include "resample.h"
+#include "audio_filters.h"
#define AUDIO_FRAGMENT 120/1000 /* ms of audio */
@@ -218,8 +219,8 @@ struct post_plugin_stretch_s {
int channels;
int bytes_per_frame;
- void *audiofrag; /* audio fragment to work on */
- void *outfrag; /* processed audio fragment */
+ int16_t *audiofrag; /* audio fragment to work on */
+ int16_t *outfrag; /* processed audio fragment */
_ftype_t *w;
int frames_per_frag;
int frames_per_outfrag;
@@ -345,7 +346,7 @@ static void stretch_process_fragment( post_audio_port_t *port,
post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post;
audio_buffer_t *outbuf;
- void *data_out = this->outfrag;
+ int16_t *data_out = this->outfrag;
int num_frames_in = this->num_frames;
int num_frames_out = this->num_frames * this->frames_per_outfrag /
this->frames_per_frag;
@@ -356,7 +357,7 @@ static void stretch_process_fragment( post_audio_port_t *port,
this->outfrag, num_frames_out);
else if( this->channels == 1 )
_x_audio_out_resample_mono(this->audiofrag, num_frames_in,
- this->outfrag, num_frames_out);
+ this->outfrag, num_frames_out);
} else {
if( num_frames_in > num_frames_out )
{
@@ -475,7 +476,7 @@ static void stretch_process_fragment( post_audio_port_t *port,
memcpy( outbuf->mem, data_out,
outbuf->num_frames * this->bytes_per_frame );
num_frames_out -= outbuf->num_frames;
- data_out += outbuf->num_frames * this->bytes_per_frame;
+ (uint8_t *)data_out += outbuf->num_frames * this->bytes_per_frame;
outbuf->vpts = this->pts;
this->pts = 0;
@@ -497,7 +498,7 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen,
post_audio_port_t *port = (post_audio_port_t *)port_gen;
post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post;
- void *data_in;
+ int16_t *data_in;
pthread_mutex_lock (&this->lock);
@@ -583,10 +584,10 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen,
frames_to_copy = buf->num_frames;
/* copy up to one fragment from input buf to our buffer */
- memcpy( this->audiofrag + this->num_frames * this->bytes_per_frame,
+ memcpy( (uint8_t *)this->audiofrag + this->num_frames * this->bytes_per_frame,
data_in, frames_to_copy * this->bytes_per_frame );
- data_in += frames_to_copy * this->bytes_per_frame;
+ (uint8_t *)data_in += frames_to_copy * this->bytes_per_frame;
this->num_frames += frames_to_copy;
buf->num_frames -= frames_to_copy;
diff --git a/src/post/audio/upmix.c b/src/post/audio/upmix.c
index 2fb42a409..7910479aa 100644
--- a/src/post/audio/upmix.c
+++ b/src/post/audio/upmix.c
@@ -23,7 +23,7 @@
* It simply creates output channels to match the speaker arrangement.
* E.g. Converts Stereo into Surround 5.1
*
- * $Id: upmix.c,v 1.15 2004/07/26 22:23:34 miguelfreitas Exp $
+ * $Id: upmix.c,v 1.16 2004/07/27 17:59:58 mroi Exp $
*
*/
@@ -34,6 +34,8 @@
#include "post.h"
#include "dsp.h"
+#include "audio_filters.h"
+
typedef struct post_plugin_upmix_s post_plugin_upmix_t;