Commit 91f42699 authored by Thomas Guillem's avatar Thomas Guillem

es: replace i_original_channels with i_chan_mode

Rename i_original_channels to i_chan_mode. For now, chan modes can be
DOLBYSTEREO or DUALMONO.

This new value, i_chan_mode, should only be set by demuxes/codecs/packetizers
if there is a special stereo mode to handle.
parent 2090fd53
......@@ -67,7 +67,7 @@
#define AOUT_FMTS_SIMILAR( p_first, p_second ) ( \
((p_first)->i_rate == (p_second)->i_rate) \
&& ((p_first)->i_physical_channels == (p_second)->i_physical_channels)\
&& ((p_first)->i_original_channels == (p_second)->i_original_channels) )
&& ((p_first)->i_chan_mode == (p_second)->i_chan_mode) )
#define AOUT_FMT_LINEAR( p_format ) \
(aout_BitsPerSample((p_format)->i_format) != 0)
......
......@@ -77,9 +77,10 @@ struct audio_format_t
* channels which are available in the buffer, and positions). */
uint16_t i_physical_channels;
/* Describes from which original channels, before downmixing, the
* buffer is derived. */
uint32_t i_original_channels;
/* Describes the chan mode, either set from the input
* (demux/codec/packetizer) or overridden by the user, used by audio
* filters. */
uint16_t i_chan_mode;
/* Optional - for A/52, SPDIF and DTS types : */
/* Bytes used by one compressed frame, depends on bitrate. */
......@@ -134,17 +135,16 @@ struct audio_format_t
#define AOUT_CHANS_5_0_MIDDLE (AOUT_CHANS_4_0_MIDDLE | AOUT_CHAN_CENTER)
#define AOUT_CHANS_6_1_MIDDLE (AOUT_CHANS_5_0_MIDDLE | AOUT_CHAN_REARCENTER | AOUT_CHAN_LFE)
/* Values available for original channels only */
#define AOUT_CHAN_DOLBYSTEREO 0x10000
#define AOUT_CHAN_DUALMONO 0x20000
#define AOUT_CHAN_PHYSMASK 0xFFFF
/* Maximum number of mapped channels (or the maximum of bits set in
* i_physical_channels) */
#define AOUT_CHAN_MAX 9
/* Maximum number of unmapped channels */
#define INPUT_CHAN_MAX 64
/* Values available for i_chan_mode only */
#define AOUT_CHANMODE_DUALMONO 0x1
#define AOUT_CHANMODE_DOLBYSTEREO 0x2
/**
* Picture orientation.
*/
......
......@@ -433,7 +433,6 @@ static int Open (vlc_object_t *obj)
assert (param > 0);
assert (param < (sizeof (channel_maps) / sizeof (channel_maps[0])));
fmt.audio.i_channels = param;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = channel_maps[param - 1];
param = var_InheritInteger (demux, "alsa-samplerate");
......
......@@ -538,7 +538,6 @@ static int InitAudio( demux_t *p_demux )
es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S16L );
fmt.i_id = p_audio->i_id;
fmt.audio.i_channels = 2;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
fmt.audio.i_rate = p_sys->i_sample_rate;
fmt.audio.i_bitspersample = 16;
......
......@@ -847,7 +847,6 @@ static int InitAudio( demux_t *p_demux, sdi_audio_t *p_audio )
es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S16L );
fmt.i_id = p_audio->i_id;
fmt.audio.i_channels = 2;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
fmt.audio.i_rate = p_audio->i_rate;
fmt.audio.i_bitspersample = 16;
......
......@@ -341,8 +341,7 @@ static int Open(vlc_object_t *obj)
}
es_format_Init(&fmt, AUDIO_ES, format);
fmt.audio.i_physical_channels = fmt.audio.i_original_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
fmt.audio.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
fmt.audio.i_channels = ss.channels;
fmt.audio.i_rate = pss->rate;
fmt.audio.i_bitspersample = aout_BitsPerSample(format);
......
......@@ -414,11 +414,6 @@ static int Open(vlc_object_t *p_this)
* buffer, and positions).
*/
audiofmt.audio.i_physical_channels = AOUT_CHAN_RIGHT | AOUT_CHAN_LEFT;
/*
* i_original_channels Describes from which original channels,
* before downmixing, the buffer is derived.
*/
audiofmt.audio.i_original_channels = AOUT_CHAN_RIGHT | AOUT_CHAN_LEFT;
/*
* Please note that it may be completely arbitrary - buffers are not
* obliged to contain a integral number of so-called "frames". It's
......
......@@ -500,7 +500,6 @@ static void *pcmu_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MULAW);
fmt.audio.i_rate = 8000;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt);
}
......@@ -514,7 +513,6 @@ static void *gsm_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_GSM);
fmt.audio.i_rate = 8000;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt);
}
......@@ -528,7 +526,6 @@ static void *pcma_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_ALAW);
fmt.audio.i_rate = 8000;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt);
}
......@@ -542,7 +539,6 @@ static void *l16s_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B);
fmt.audio.i_rate = 44100;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
return codec_init (demux, &fmt);
}
......@@ -553,7 +549,6 @@ static void *l16m_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B);
fmt.audio.i_rate = 44100;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt);
}
......@@ -567,7 +562,6 @@ static void *qcelp_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_QCELP);
fmt.audio.i_rate = 8000;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt);
}
......@@ -580,7 +574,6 @@ static void *mpa_init (demux_t *demux)
es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MPGA);
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
fmt.b_packetized = false;
return codec_init (demux, &fmt);
......
......@@ -143,7 +143,6 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
if (wfe->dwChannelMask & SPEAKER_LOW_FREQUENCY)
fmt->i_physical_channels |= AOUT_CHAN_LFE;
fmt->i_original_channels = fmt->i_physical_channels;
assert(popcount(wfe->dwChannelMask) == wf->nChannels);
if (IsEqualIID(&wfe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))
......
......@@ -80,10 +80,10 @@ static int Create( vlc_object_t *p_this )
/* Validate audio filter format */
if ( p_filter->fmt_in.audio.i_physical_channels != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
|| ! ( p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
|| aout_FormatNbChannels( &p_filter->fmt_out.audio ) <= 2
|| ( p_filter->fmt_in.audio.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO )
!= ( p_filter->fmt_out.audio.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO ) )
|| ! ( p_filter->fmt_in.audio.i_chan_mode & AOUT_CHANMODE_DOLBYSTEREO )
|| p_filter->fmt_out.audio.i_channels <= 2
|| ( p_filter->fmt_in.audio.i_chan_mode & ~AOUT_CHANMODE_DOLBYSTEREO )
!= ( p_filter->fmt_out.audio.i_chan_mode & ~AOUT_CHANMODE_DOLBYSTEREO ) )
{
return VLC_EGENERIC;
}
......
......@@ -472,10 +472,10 @@ static int OpenFilter( vlc_object_t *p_this )
p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
p_filter->fmt_in.audio.i_original_channels =
p_filter->fmt_out.audio.i_original_channels;
p_filter->fmt_in.audio.i_chan_mode =
p_filter->fmt_out.audio.i_chan_mode;
if( p_filter->fmt_in.audio.i_physical_channels == AOUT_CHANS_STEREO
&& (p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO)
&& (p_filter->fmt_in.audio.i_chan_mode & AOUT_CHANMODE_DOLBYSTEREO)
&& !var_InheritBool( p_filter, "headphone-dolby" ) )
{
p_filter->fmt_in.audio.i_physical_channels = AOUT_CHANS_5_0;
......
......@@ -283,9 +283,7 @@ static int OpenFilter( vlc_object_t *p_this )
uint32_t output = p_filter->fmt_out.audio.i_physical_channels;
/* Short circuit the common case of not remixing */
if( input == output
&& p_filter->fmt_in.audio.i_original_channels
== p_filter->fmt_out.audio.i_original_channels )
if( input == output )
return VLC_EGENERIC;
const bool b_input_6_1 = input == AOUT_CHANS_6_1_MIDDLE;
......
......@@ -193,8 +193,7 @@ static int Create( vlc_object_t *p_this )
|| infmt->i_rate != outfmt->i_rate
|| infmt->i_format != VLC_CODEC_FL32 )
return VLC_EGENERIC;
if( infmt->i_physical_channels == outfmt->i_physical_channels
&& infmt->i_original_channels == outfmt->i_original_channels )
if( infmt->i_physical_channels == outfmt->i_physical_channels )
return VLC_EGENERIC;
p_filter->p_sys = NULL;
......
......@@ -469,7 +469,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
sys->chans_to_reorder = SetupChannels (VLC_OBJECT(aout), pcm, &map,
sys->chans_table);
fmt->i_physical_channels = map;
fmt->i_original_channels = map;
channels = popcount (map);
}
else
......
......@@ -231,7 +231,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
}
fmt->i_format = VLC_CODEC_S16N;
fmt->i_original_channels = fmt->i_physical_channels;
return VLC_SUCCESS;
}
......
......@@ -990,7 +990,6 @@ StartPassthrough( JNIEnv *env, audio_output_t *p_aout )
return VLC_EGENERIC;
}
p_sys->fmt.i_frame_length = 1;
p_sys->fmt.i_original_channels = p_sys->fmt.i_physical_channels;
p_sys->fmt.i_channels = aout_FormatNbChannels( &p_sys->fmt );
p_sys->fmt.i_format = VLC_CODEC_SPDIFL;
}
......@@ -1013,8 +1012,7 @@ StartPassthrough( JNIEnv *env, audio_output_t *p_aout )
}
p_sys->fmt.i_bytes_per_frame = 4;
p_sys->fmt.i_frame_length = 1;
p_sys->fmt.i_physical_channels =
p_sys->fmt.i_original_channels = AOUT_CHANS_STEREO;
p_sys->fmt.i_physical_channels = AOUT_CHANS_STEREO;
p_sys->fmt.i_channels = 2;
p_sys->fmt.i_format = VLC_CODEC_SPDIFB;
}
......@@ -1094,7 +1092,6 @@ StartPCM( JNIEnv *env, audio_output_t *p_aout, unsigned i_max_channels )
else
p_sys->fmt.i_physical_channels = AOUT_CHANS_STEREO;
}
p_sys->fmt.i_original_channels = p_sys->fmt.i_physical_channels;
/* Try to create an AudioTrack with the most advanced channel and
* format configuration. If AudioTrack_Create fails, try again with a
......@@ -1162,8 +1159,6 @@ Start( audio_output_t *p_aout, audio_sample_format_t *restrict p_fmt )
aout_FormatPrint( p_aout, "VLC is looking for:", &p_sys->fmt );
p_sys->fmt.i_original_channels = p_sys->fmt.i_physical_channels;
if( AOUT_FMT_LINEAR( &p_sys->fmt ) )
i_ret = StartPCM( env, p_aout, i_max_channels );
else if( b_try_passthrough )
......
......@@ -324,7 +324,7 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
{
/* Fill VLC physical_channels from output layout */
fmt->i_physical_channels = 0;
uint32_t i_original = fmt->i_original_channels & AOUT_CHAN_PHYSMASK;
uint32_t i_original = fmt->i_physical_channels;
AudioChannelLayout *reslayout = NULL;
if (outlayout == NULL)
......@@ -434,7 +434,6 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
end:
free(reslayout);
fmt->i_original_channels = fmt->i_physical_channels;
aout_FormatPrepare(fmt);
msg_Dbg(p_aout, "selected %d physical channels for device output",
......
......@@ -788,8 +788,6 @@ static HRESULT Start( vlc_object_t *obj, aout_stream_sys_t *sys,
}
}
fmt.i_original_channels = fmt.i_physical_channels;
int ret = vlc_clone(&sys->eraser_thread, PlayedDataEraser, (void*) obj,
VLC_THREAD_PRIORITY_LOW);
if( unlikely( ret ) )
......
......@@ -213,7 +213,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
else
{
fmt->i_rate = rate;
fmt->i_original_channels =
fmt->i_physical_channels = channels;
}
aout_FormatPrepare (fmt);
......
......@@ -719,7 +719,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
fmt->i_format = VLC_CODEC_SPDIFL;
fmt->i_bytes_per_frame = 4;
fmt->i_frame_length = 1;
fmt->i_physical_channels = fmt->i_original_channels = AOUT_CHANS_2_0;
fmt->i_physical_channels = AOUT_CHANS_2_0;
fmt->i_channels = 2;
encoding = PA_ENCODING_AC3_IEC61937;
ss.format = PA_SAMPLE_S16NE;
......@@ -728,7 +728,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
fmt->i_format = VLC_CODEC_SPDIFL;
fmt->i_bytes_per_frame = 4;
fmt->i_frame_length = 1;
fmt->i_physical_channels = fmt->i_original_channels = AOUT_CHANS_2_0;
fmt->i_physical_channels = AOUT_CHANS_2_0;
fmt->i_channels = 2;
encoding = PA_ENCODING_EAC3_IEC61937;
ss.format = PA_SAMPLE_S16NE;
......@@ -742,7 +742,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
fmt->i_format = VLC_CODEC_SPDIFL;
fmt->i_bytes_per_frame = 4;
fmt->i_frame_length = 1;
fmt->i_physical_channels = fmt->i_original_channels = AOUT_CHANS_2_0;
fmt->i_physical_channels = AOUT_CHANS_2_0;
fmt->i_channels = 2;
encoding = PA_ENCODING_DTS_IEC61937;
ss.format = PA_SAMPLE_S16NE;
......@@ -844,7 +844,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
}
if (fmt->i_physical_channels & AOUT_CHAN_LFE)
map.map[map.channels++] = PA_CHANNEL_POSITION_LFE;
fmt->i_original_channels = fmt->i_physical_channels;
static_assert(AOUT_CHAN_MAX == 9, "Missing channels");
......
......@@ -174,7 +174,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
goto error;
}
fmt->i_original_channels = fmt->i_physical_channels = chans;
fmt->i_physical_channels = chans;
aout_FormatPrepare (fmt);
aout->time_get = TimeGet;
......
......@@ -428,7 +428,6 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
else
return -1;
audio->i_original_channels = audio->i_physical_channels;
aout_FormatPrepare (audio);
if (wf->nChannels != audio->i_channels)
......
......@@ -215,26 +215,24 @@ static int channels_vlc2a52( const audio_format_t *p_audio, int *p_flags )
switch ( p_audio->i_physical_channels & ~AOUT_CHAN_LFE )
{
case AOUT_CHAN_CENTER:
if ( (p_audio->i_original_channels & AOUT_CHAN_CENTER)
|| (p_audio->i_original_channels
if ( (p_audio->i_physical_channels & AOUT_CHAN_CENTER)
|| (p_audio->i_physical_channels
& (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
i_flags = A52_MONO;
else if ( p_audio->i_original_channels & AOUT_CHAN_LEFT )
else if ( p_audio->i_physical_channels & AOUT_CHAN_LEFT )
i_flags = A52_CHANNEL1;
else
i_flags = A52_CHANNEL2;
break;
case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT:
if ( p_audio->i_original_channels & AOUT_CHAN_DOLBYSTEREO )
if ( p_audio->i_chan_mode & AOUT_CHANMODE_DOLBYSTEREO )
i_flags = A52_DOLBY;
else if ( p_audio->i_original_channels == AOUT_CHAN_CENTER )
i_flags = A52_MONO;
else if ( p_audio->i_original_channels & AOUT_CHAN_DUALMONO )
else if ( p_audio->i_chan_mode & AOUT_CHANMODE_DUALMONO )
i_flags = A52_CHANNEL;
else if ( !(p_audio->i_original_channels & AOUT_CHAN_RIGHT) )
else if ( !(p_audio->i_physical_channels & AOUT_CHAN_RIGHT) )
i_flags = A52_CHANNEL1;
else if ( !(p_audio->i_original_channels & AOUT_CHAN_LEFT) )
else if ( !(p_audio->i_physical_channels & AOUT_CHAN_LEFT) )
i_flags = A52_CHANNEL2;
else
i_flags = A52_STEREO;
......@@ -281,7 +279,6 @@ static int Open( vlc_object_t *p_this )
if( p_dec->fmt_in.i_codec != VLC_CODEC_A52
|| p_dec->fmt_in.audio.i_rate == 0
|| p_dec->fmt_in.audio.i_physical_channels == 0
|| p_dec->fmt_in.audio.i_original_channels == 0
|| p_dec->fmt_in.audio.i_bytes_per_frame == 0
|| p_dec->fmt_in.audio.i_frame_length == 0 )
return VLC_EGENERIC;
......
......@@ -278,8 +278,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_dec->fmt_out.i_codec = VLC_CODEC_S16N;
p_dec->fmt_out.audio.i_rate = p_dec->fmt_in.audio.i_rate;
p_dec->fmt_out.audio.i_channels = i_channels;
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels = pi_channels_maps[i_channels];
p_dec->fmt_out.audio.i_physical_channels = pi_channels_maps[i_channels];
date_Init( &p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1 );
date_Set( &p_sys->end_date, 0 );
......
......@@ -393,7 +393,6 @@ static block_t * Parse( decoder_t *p_dec, int *pi_frame_length, int *pi_bits,
}
p_dec->fmt_out.audio.i_channels = i_channels;
p_dec->fmt_out.audio.i_original_channels = pi_original_channels[i_channels/2-1];
p_dec->fmt_out.audio.i_physical_channels = pi_original_channels[i_channels/2-1];
*pi_frame_length = (p_block->i_buffer - AES3_HEADER_LEN) / ( (4+i_bits) * i_channels / 8 );
......
......@@ -284,19 +284,12 @@ static int DecoderOpen( vlc_object_t *p_this )
else
p_dec->fmt_out.audio.i_physical_channels =
pi_channels_maps[p_dec->fmt_in.audio.i_channels];
if( p_dec->fmt_in.audio.i_original_channels )
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_in.audio.i_original_channels;
else
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_out.audio.i_physical_channels;
}
else
{
/* Unknown channel map, let the aout/filters decide what to do */
p_dec->fmt_out.audio.i_channels = p_dec->fmt_in.audio.i_channels;
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels = 0;
p_dec->fmt_out.audio.i_physical_channels = 0;
}
aout_FormatPrepare( &p_dec->fmt_out.audio );
......
......@@ -258,6 +258,7 @@ int InitAudioDec( vlc_object_t *obj )
p_dec->fmt_out.audio.i_rate = p_dec->fmt_in.audio.i_rate;
if( p_dec->fmt_out.audio.i_rate )
date_Init( &p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1 );
p_dec->fmt_out.audio.i_chan_mode = p_dec->fmt_in.audio.i_chan_mode;
p_dec->pf_decode = DecodeAudio;
p_dec->pf_flush = Flush;
......@@ -607,12 +608,11 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
if( i_channels_src != p_sys->p_context->channels && b_trust )
msg_Err( p_dec, "Channel layout not understood" );
bool dual_mono = false;
/* Detect special dual mono case */
if( i_channels_src == 2 && pi_order_src[0] == AOUT_CHAN_CENTER
&& pi_order_src[1] == AOUT_CHAN_CENTER )
{
dual_mono = true;
p_dec->fmt_out.audio.i_chan_mode |= AOUT_CHANMODE_DUALMONO;
pi_order_src[0] = AOUT_CHAN_LEFT;
pi_order_src[1] = AOUT_CHAN_RIGHT;
}
......@@ -625,16 +625,12 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
if( i_channels_dst != i_channels_src && b_trust )
msg_Warn( p_dec, "%d channels are dropped", i_channels_src - i_channels_dst );
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels = i_layout_dst;
if (dual_mono)
p_dec->fmt_out.audio.i_original_channels |= AOUT_CHAN_DUALMONO;
p_dec->fmt_out.audio.i_physical_channels = i_layout_dst;
}
else
{
msg_Warn( p_dec, "no channel layout found");
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels = 0;
p_dec->fmt_out.audio.i_physical_channels = 0;
p_dec->fmt_out.audio.i_channels = p_sys->p_context->channels;
}
......
......@@ -198,18 +198,16 @@ static int channels_vlc2dca( const audio_format_t *p_audio, int *p_flags )
switch ( p_audio->i_physical_channels & ~AOUT_CHAN_LFE )
{
case AOUT_CHAN_CENTER:
if ( (p_audio->i_original_channels & AOUT_CHAN_CENTER)
|| (p_audio->i_original_channels
if ( (p_audio->i_physical_channels & AOUT_CHAN_CENTER)
|| (p_audio->i_physical_channels
& (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
i_flags = DCA_MONO;
break;
case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT:
if ( p_audio->i_original_channels & AOUT_CHAN_DOLBYSTEREO )
if ( p_audio->i_chan_mode & AOUT_CHANMODE_DOLBYSTEREO )
i_flags = DCA_DOLBY;
else if ( p_audio->i_original_channels == AOUT_CHAN_CENTER )
i_flags = DCA_MONO;
else if ( p_audio->i_original_channels & AOUT_CHAN_DUALMONO )
else if ( p_audio->i_chan_mode & AOUT_CHANMODE_DUALMONO )
i_flags = DCA_CHANNEL;
else
i_flags = DCA_STEREO;
......@@ -256,7 +254,6 @@ static int Open( vlc_object_t *p_this )
if( p_dec->fmt_in.i_codec != VLC_CODEC_DTS
|| p_dec->fmt_in.audio.i_rate == 0
|| p_dec->fmt_in.audio.i_physical_channels == 0
|| p_dec->fmt_in.audio.i_original_channels == 0
|| p_dec->fmt_in.audio.i_bytes_per_frame == 0
|| p_dec->fmt_in.audio.i_frame_length == 0 )
return VLC_EGENERIC;
......
......@@ -458,8 +458,7 @@ static int DecOpen( decoder_t *p_dec )
p_dec->fmt_out.audio.i_channels = p_dec->fmt_in.audio.i_channels;
p_dec->fmt_out.audio.i_bitspersample = 16;//p_dec->fmt_in.audio.i_bitspersample; We request 16
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels =
pi_channels_maps[p_dec->fmt_out.audio.i_channels];
pi_channels_maps[p_dec->fmt_out.audio.i_channels];
p_wf->wFormatTag = WAVE_FORMAT_PCM;
p_wf->nSamplesPerSec = p_dec->fmt_out.audio.i_rate;
......
......@@ -149,21 +149,19 @@ static int Open( vlc_object_t *p_this )
p_dec->fmt_out.audio.i_rate = i_rate;
p_dec->fmt_out.audio.i_channels = i_channels;
p_dec->fmt_out.audio.i_physical_channels
= p_dec->fmt_out.audio.i_original_channels
= mpeg4_asc_channelsbyindex[i_channels];
date_Init( &p_sys->date, i_rate, 1 );
}
else
{
p_dec->fmt_out.audio.i_physical_channels
= p_dec->fmt_out.audio.i_original_channels
= 0;
p_dec->fmt_out.audio.i_physical_channels = 0;
/* Will be initalised from first frame */
p_dec->fmt_out.audio.i_rate = 0;
p_dec->fmt_out.audio.i_channels = 0;
}
p_dec->fmt_out.i_codec = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_S16N;
p_dec->fmt_out.audio.i_chan_mode = p_dec->fmt_in.audio.i_chan_mode;
/* Set the faad config */
cfg = NeAACDecGetCurrentConfiguration( p_sys->hfaad );
......@@ -289,7 +287,6 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_dec->fmt_out.audio.i_rate = i_rate;
p_dec->fmt_out.audio.i_channels = i_channels;
p_dec->fmt_out.audio.i_physical_channels
= p_dec->fmt_out.audio.i_original_channels
= mpeg4_asc_channelsbyindex[i_channels];
date_Init( &p_sys->date, i_rate, 1 );
......@@ -312,7 +309,6 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_dec->fmt_out.audio.i_rate = i_rate;
p_dec->fmt_out.audio.i_channels = i_channels;
p_dec->fmt_out.audio.i_physical_channels
= p_dec->fmt_out.audio.i_original_channels
= mpeg4_asc_channelsbyindex[i_channels];
date_Init( &p_sys->date, i_rate, 1 );
}
......@@ -381,7 +377,6 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_dec->fmt_out.audio.i_rate = i_rate;
p_dec->fmt_out.audio.i_channels = i_channels;
p_dec->fmt_out.audio.i_physical_channels
= p_dec->fmt_out.audio.i_original_channels
= mpeg4_asc_channelsbyindex[i_channels];
date_Init( &p_sys->date, i_rate, 1 );
}
......@@ -501,7 +496,6 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_dec->fmt_out.audio.i_physical_channels, pi_neworder_table );
p_dec->fmt_out.audio.i_original_channels = p_dec->fmt_out.audio.i_physical_channels;
p_dec->fmt_out.audio.i_channels = popcount(p_dec->fmt_out.audio.i_physical_channels);
if( !decoder_UpdateAudioFormat( p_dec ) && p_dec->fmt_out.audio.i_channels > 0 )
......
......@@ -209,8 +209,7 @@ static int DecoderSetOutputFormat( unsigned i_channels, unsigned i_rate,
fmt->i_channels = i_channels;
fmt->i_rate = (i_rate > 0 ) ? i_rate : i_streaminfo_rate;
fmt->i_physical_channels =
fmt->i_original_channels = pi_channels_maps[i_channels];
fmt->i_physical_channels = pi_channels_maps[i_channels];
memcpy( pi_channels_reorder, ppi_reorder[i_channels], i_channels );
fmt->i_bitspersample = i_bitspersample;
......@@ -373,8 +372,7 @@ static void DecoderMetadataCallback( const FLAC__StreamDecoder *decoder,
for( unsigned i=0; i<i_wfxchannels; i++ )
p_sys->rgi_channels_reorder[neworder[i]] = i;
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels = i_vlcmask;
p_dec->fmt_out.audio.i_physical_channels = i_vlcmask;
p_dec->fmt_out.audio.i_channels = i_wfxchannels;
}
......
......@@ -171,9 +171,7 @@ static int Open (vlc_object_t *p_this)
var_InheritInteger (p_this, "synth-sample-rate");;
fluid_synth_set_sample_rate (p_sys->synth, p_dec->fmt_out.audio.i_rate);
p_dec->fmt_out.audio.i_channels = 2;
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_out.audio.i_physical_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
p_dec->fmt_out.audio.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
p_dec->fmt_out.audio.i_bitspersample = 32;
date_Init (&p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1);
......
......@@ -197,12 +197,6 @@ static int DecoderOpen( vlc_object_t *p_this )
else
p_dec->fmt_out.audio.i_physical_channels =
pi_channels_maps[p_dec->fmt_in.audio.i_channels];
if( p_dec->fmt_in.audio.i_original_channels )
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_in.audio.i_original_channels;
else
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_out.audio.i_physical_channels;
aout_FormatPrepare( &p_dec->fmt_out.audio );
p_sys->table = table;
......
......@@ -413,7 +413,6 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
}
p_dec->fmt_out.audio.i_rate = i_rate;
p_dec->fmt_out.audio.i_channels = i_channels;
p_dec->fmt_out.audio.i_original_channels = i_original_channels;
p_dec->fmt_out.audio.i_physical_channels = i_original_channels;
if ( p_sys->i_type == LPCM_AOB )
......
......@@ -249,7 +249,6 @@ static int Open( vlc_object_t *p_this )
&& p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','3') )
|| p_dec->fmt_in.audio.i_rate == 0
|| p_dec->fmt_in.audio.i_physical_channels == 0
|| p_dec->fmt_in.audio.i_original_channels == 0
|| p_dec->fmt_in.audio.i_bytes_per_frame == 0
|| p_dec->fmt_in.audio.i_frame_length == 0 )
return VLC_EGENERIC;
......
......@@ -445,7 +445,6 @@ static int SetOutputType(decoder_t *p_dec, DWORD stream_id, IMFMediaType **resul
p_dec->fmt_out.i_codec = vlc_fourcc_GetCodecAudio(fourcc, p_dec->fmt_out.audio.i_bitspersample);
p_dec->fmt_out.audio.i_physical_channels = pi_channels_maps[p_dec->fmt_out.audio.i_channels];
p_dec->fmt_out.audio.i_original_channels = p_dec->fmt_out.audio.i_physical_channels;
}
*result = output_media_type;
......
......@@ -168,24 +168,21 @@ static int UpdateAudioFormat( decoder_t *p_dec )
switch( frame_info.mode )
{
case MPG123_M_DUAL:
p_dec->fmt_out.audio.i_chan_mode = AOUT_CHANMODE_DUALMONO;
/* fall through */
case MPG123_M_STEREO:
case MPG123_M_JOINT:
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_out.audio.i_physical_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
break;
case MPG123_M_DUAL:
p_dec->fmt_out.audio.i_original_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_DUALMONO;
break;
case MPG123_M_MONO:
p_dec->fmt_out.audio.i_original_channels = AOUT_CHAN_CENTER;
p_dec->fmt_out.audio.i_physical_channels = AOUT_CHAN_CENTER;
break;
default:
return VLC_EGENERIC;
}
p_dec->fmt_out.audio.i_physical_channels =
p_dec->fmt_out.audio.i_original_channels & AOUT_CHAN_PHYSMASK;
aout_FormatPrepare( &p_dec->fmt_out.audio );
/* Date management */
......
......@@ -1077,7 +1077,6 @@ static int Audio_ProcessOutput(decoder_t *p_dec, mc_api_out *p_out,
msg_Warn(p_dec, "need channel extraction: %d -> %d",
p_sys->audio.i_channels, i_channels_dst);
p_dec->fmt_out.audio.i_original_channels =
p_dec->fmt_out.audio.i_physical_channels = i_layout_dst;
aout_FormatPrepare(&p_dec->fmt_out.audio);
......
......@@ -717,8 +717,7 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
| AOUT_CHAN_LFE
};
p_fmt->audio.i_physical_channels =
p_fmt->audio.i_original_channels =
pi_channels_maps[p_fmt->audio.i_channels];
pi_channels_maps[p_fmt->audio.i_channels];
}