Commit 128f5ba7 authored by Christophe Massiot's avatar Christophe Massiot

Reverse stereo option.

parent dba14611
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio_output.h : audio output interface * audio_output.h : audio output interface
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.74 2002/12/07 23:50:30 massiot Exp $ * $Id: audio_output.h,v 1.75 2003/01/22 18:31:46 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -116,6 +116,7 @@ typedef int32_t vlc_fixed_t; ...@@ -116,6 +116,7 @@ typedef int32_t vlc_fixed_t;
/* Values available for original channels only */ /* Values available for original channels only */
#define AOUT_CHAN_DOLBYSTEREO 0x10000 #define AOUT_CHAN_DOLBYSTEREO 0x10000
#define AOUT_CHAN_DUALMONO 0x20000 #define AOUT_CHAN_DUALMONO 0x20000
#define AOUT_CHAN_REVERSESTEREO 0x40000
#define AOUT_CHAN_PHYSMASK 0xFFFF #define AOUT_CHAN_PHYSMASK 0xFFFF
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* trivial.c : trivial channel mixer plug-in (drops unwanted channels) * trivial.c : trivial channel mixer plug-in (drops unwanted channels)
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: trivial.c,v 1.9 2003/01/14 14:51:02 massiot Exp $ * $Id: trivial.c,v 1.10 2003/01/22 18:31:47 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -134,6 +134,17 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -134,6 +134,17 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 2; p_src += 2;
} }
} }
else if ( p_filter->output.i_original_channels
& AOUT_CHAN_REVERSESTEREO )
{
/* Reverse-stereo mode */
for ( i = p_in_buf->i_nb_samples; i -= 2; )
{
*p_dest++ = p_src[1];
*p_dest++ = p_src[0];
p_src += 2;
}
}
else else
{ {
/* Fake-stereo mode */ /* Fake-stereo mode */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (http://liba52.sf.net/). * (http://liba52.sf.net/).
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: a52tofloat32.c,v 1.11 2003/01/22 09:54:28 massiot Exp $ * $Id: a52tofloat32.c,v 1.12 2003/01/22 18:31:47 massiot Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -278,6 +278,22 @@ static void Duplicate( float * p_out, const float * p_in ) ...@@ -278,6 +278,22 @@ static void Duplicate( float * p_out, const float * p_in )
} }
} }
/*****************************************************************************
* Exchange: helper function to exchange left & right channels
*****************************************************************************/
static void Exchange( float * p_out, const float * p_in )
{
int i;
const float * p_first = p_in + 256;
const float * p_second = p_in;
for ( i = 0; i < 256; i++ )
{
*p_out++ = *p_first++;
*p_out++ = *p_second++;
}
}
/***************************************************************************** /*****************************************************************************
* DoWork: decode an ATSC A/52 frame. * DoWork: decode an ATSC A/52 frame.
*****************************************************************************/ *****************************************************************************/
...@@ -331,6 +347,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -331,6 +347,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
Duplicate( (float *)(p_out_buf->p_buffer + i * i_bytes_per_block), Duplicate( (float *)(p_out_buf->p_buffer + i * i_bytes_per_block),
p_samples ); p_samples );
} }
else if ( p_filter->output.i_original_channels
& AOUT_CHAN_REVERSESTEREO )
{
Exchange( (float *)(p_out_buf->p_buffer + i * i_bytes_per_block),
p_samples );
}
else else
{ {
/* Interleave the *$% samples. */ /* Interleave the *$% samples. */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* common.c : audio output management of common data structures * common.c : audio output management of common data structures
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: common.c,v 1.14 2003/01/20 10:59:29 massiot Exp $ * $Id: common.c,v 1.15 2003/01/22 18:31:47 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -166,17 +166,26 @@ const char * aout_FormatPrintChannels( const audio_sample_format_t * p_format ) ...@@ -166,17 +166,26 @@ const char * aout_FormatPrintChannels( const audio_sample_format_t * p_format )
return "Left"; return "Left";
return "Right"; return "Right";
case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT: case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT:
if ( p_format->i_original_channels & AOUT_CHAN_DOLBYSTEREO ) if ( p_format->i_original_channels & AOUT_CHAN_REVERSESTEREO )
return "Dolby"; {
else if ( p_format->i_original_channels & AOUT_CHAN_DUALMONO ) if ( p_format->i_original_channels & AOUT_CHAN_DOLBYSTEREO )
return "Dual-mono"; return "Dolby/Reverse";
else if ( p_format->i_original_channels == AOUT_CHAN_CENTER ) return "Stereo/Reverse";
return "Stereo/Mono"; }
else if ( !(p_format->i_original_channels & AOUT_CHAN_RIGHT) ) else
return "Stereo/Left"; {
else if ( !(p_format->i_original_channels & AOUT_CHAN_LEFT) ) if ( p_format->i_original_channels & AOUT_CHAN_DOLBYSTEREO )
return "Stereo/Right"; return "Dolby";
return "Stereo"; else if ( p_format->i_original_channels & AOUT_CHAN_DUALMONO )
return "Dual-mono";
else if ( p_format->i_original_channels == AOUT_CHAN_CENTER )
return "Stereo/Mono";
else if ( !(p_format->i_original_channels & AOUT_CHAN_RIGHT) )
return "Stereo/Left";
else if ( !(p_format->i_original_channels & AOUT_CHAN_LEFT) )
return "Stereo/Right";
return "Stereo";
}
case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER: case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER:
return "3F"; return "3F";
case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARCENTER: case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARCENTER:
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* output.c : internal management of output streams for the audio output * output.c : internal management of output streams for the audio output
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: output.c,v 1.30 2003/01/22 09:54:29 massiot Exp $ * $Id: output.c,v 1.31 2003/01/22 18:31:47 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -69,7 +69,12 @@ int aout_OutputNew( aout_instance_t * p_aout, ...@@ -69,7 +69,12 @@ int aout_OutputNew( aout_instance_t * p_aout,
/* The user may have selected a different channels configuration. */ /* The user may have selected a different channels configuration. */
var_Get( p_aout, "audio-channels", &val ); var_Get( p_aout, "audio-channels", &val );
if ( !strcmp( val.psz_string, N_("Both") ) ) if ( !strcmp( val.psz_string, N_("Reverse stereo") ) )
{
p_aout->output.output.i_original_channels |=
AOUT_CHAN_REVERSESTEREO;
}
else if ( !strcmp( val.psz_string, N_("Both") ) )
{ {
p_aout->output.output.i_original_channels = p_aout->output.output.i_original_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
...@@ -113,9 +118,7 @@ int aout_OutputNew( aout_instance_t * p_aout, ...@@ -113,9 +118,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
NULL ); NULL );
} }
else if ( p_aout->output.output.i_physical_channels == else if ( p_aout->output.output.i_physical_channels ==
(AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) )
&& (p_aout->output.output.i_original_channels
& AOUT_CHAN_PHYSMASK) == (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) )
{ {
/* Stereo - create the audio-channels variable. */ /* Stereo - create the audio-channels variable. */
var_Create( p_aout, "audio-channels", VLC_VAR_STRING | VLC_VAR_HASCHOICE ); var_Create( p_aout, "audio-channels", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
...@@ -132,6 +135,8 @@ int aout_OutputNew( aout_instance_t * p_aout, ...@@ -132,6 +135,8 @@ int aout_OutputNew( aout_instance_t * p_aout,
var_Change( p_aout, "audio-channels", VLC_VAR_ADDCHOICE, &val ); var_Change( p_aout, "audio-channels", VLC_VAR_ADDCHOICE, &val );
val.psz_string = N_("Right"); val.psz_string = N_("Right");
var_Change( p_aout, "audio-channels", VLC_VAR_ADDCHOICE, &val ); var_Change( p_aout, "audio-channels", VLC_VAR_ADDCHOICE, &val );
val.psz_string = N_("Reverse stereo");
var_Change( p_aout, "audio-channels", VLC_VAR_ADDCHOICE, &val );
var_AddCallback( p_aout, "audio-channels", aout_ChannelsRestart, var_AddCallback( p_aout, "audio-channels", aout_ChannelsRestart,
NULL ); NULL );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment