summaryrefslogtreecommitdiff
path: root/src/post/audio/upmix_mono.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/audio/upmix_mono.c')
-rw-r--r--src/post/audio/upmix_mono.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/post/audio/upmix_mono.c b/src/post/audio/upmix_mono.c
index 52b5f497b..43fe3df0d 100644
--- a/src/post/audio/upmix_mono.c
+++ b/src/post/audio/upmix_mono.c
@@ -1,18 +1,18 @@
/*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -68,11 +68,11 @@ struct post_plugin_upmix_mono_s {
/* private data */
int channels;
-
+
upmix_mono_parameters_t params;
xine_post_in_t params_input;
int params_changed;
-
+
pthread_mutex_t lock;
};
@@ -134,7 +134,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre
_x_post_rewire(&this->post);
_x_post_inc_usage(port);
-
+
port->stream = stream;
port->bits = bits;
port->rate = rate;
@@ -142,7 +142,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre
this->channels = _x_ao_mode2channels(mode);
capabilities = port->original_port->get_capabilities(port->original_port);
-
+
if (this->channels == 1 && (capabilities & AO_CAP_MODE_STEREO)) {
xprintf(stream->xine, XINE_VERBOSITY_LOG,
_(LOG_MODULE ": upmixing Mono to Stereo.\n"));
@@ -151,7 +151,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre
if ( this->channels != 1)
xprintf(stream->xine, XINE_VERBOSITY_LOG,
ngettext(LOG_MODULE ": upmixing a single channel from original %d channel stream.\n",
- LOG_MODULE ": upmixing a single channel from original %d channels stream.\n",
+ LOG_MODULE ": upmixing a single channel from original %d channels stream.\n",
this->channels), this->channels);
else {
xprintf(stream->xine, XINE_VERBOSITY_LOG,
@@ -163,15 +163,15 @@ 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);
}
-static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
+static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
audio_buffer_t *buf, xine_stream_t *stream) {
-
+
post_audio_port_t *port = (post_audio_port_t *)port_gen;
post_plugin_upmix_mono_t *this = (post_plugin_upmix_mono_t *)port->post;
-
+
pthread_mutex_lock (&this->lock);
- if (this->channels == 1)
+ if (this->channels == 1)
{
audio_buffer_t *buf0 = port->original_port->get_buffer(port->original_port);
audio_buffer_t *buf1 = port->original_port->get_buffer(port->original_port);
@@ -232,7 +232,7 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
/* free data from origial buffer */
buf->num_frames = 0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */
}
- else if (this->channels && this->params.channel >= 0)
+ else if (this->channels && this->params.channel >= 0)
{
audio_buffer_t *buf0 = port->original_port->get_buffer(port->original_port);
buf0->num_frames = buf->num_frames;
@@ -253,12 +253,12 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
uint8_t *dst0 = (uint8_t *)buf0->mem;
int cur_channel = this->params.channel;
int i, j;
-
+
if( cur_channel >= this->channels )
cur_channel = this->channels-1;
src += cur_channel * step;
-
+
for (i = 0; i < buf->num_frames; i++)
{
for (j = 0; j < this->channels; j++ )
@@ -276,11 +276,11 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
/* free data from origial buffer */
buf->num_frames = 0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */
}
-
+
pthread_mutex_unlock (&this->lock);
-
+
port->original_port->put_buffer(port->original_port, buf, stream);
-
+
return;
}
@@ -303,24 +303,24 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs
xine_post_in_t *input_api;
post_audio_port_t *port;
upmix_mono_parameters_t init_params;
-
+
if (!this || !audio_target || !audio_target[0]) {
free(this);
return NULL;
}
-
+
_x_post_init(&this->post, 1, 0);
init_params.channel = -1;
-
+
pthread_mutex_init (&this->lock, NULL);
set_parameters ((xine_post_t *)&this->post, &init_params);
-
+
port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output);
port->new_port.open = upmix_mono_port_open;
port->new_port.put_buffer = upmix_mono_port_put_buffer;
-
+
input_api = &this->params_input;
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
@@ -352,17 +352,17 @@ static void upmix_mono_class_dispose(post_class_t *class_gen)
void *upmix_mono_init_plugin(xine_t *xine, void *data)
{
post_class_upmix_mono_t *class = (post_class_upmix_mono_t *)malloc(sizeof(post_class_upmix_mono_t));
-
+
if (!class)
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->xine = xine;
-
+
return class;
}