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 @@ ...@@ -67,7 +67,7 @@
#define AOUT_FMTS_SIMILAR( p_first, p_second ) ( \ #define AOUT_FMTS_SIMILAR( p_first, p_second ) ( \
((p_first)->i_rate == (p_second)->i_rate) \ ((p_first)->i_rate == (p_second)->i_rate) \
&& ((p_first)->i_physical_channels == (p_second)->i_physical_channels)\ && ((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 ) \ #define AOUT_FMT_LINEAR( p_format ) \
(aout_BitsPerSample((p_format)->i_format) != 0) (aout_BitsPerSample((p_format)->i_format) != 0)
......
...@@ -77,9 +77,10 @@ struct audio_format_t ...@@ -77,9 +77,10 @@ struct audio_format_t
* channels which are available in the buffer, and positions). */ * channels which are available in the buffer, and positions). */
uint16_t i_physical_channels; uint16_t i_physical_channels;
/* Describes from which original channels, before downmixing, the /* Describes the chan mode, either set from the input
* buffer is derived. */ * (demux/codec/packetizer) or overridden by the user, used by audio
uint32_t i_original_channels; * filters. */
uint16_t i_chan_mode;
/* Optional - for A/52, SPDIF and DTS types : */ /* Optional - for A/52, SPDIF and DTS types : */
/* Bytes used by one compressed frame, depends on bitrate. */ /* Bytes used by one compressed frame, depends on bitrate. */
...@@ -134,17 +135,16 @@ struct audio_format_t ...@@ -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_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) #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 /* Maximum number of mapped channels (or the maximum of bits set in
* i_physical_channels) */ * i_physical_channels) */
#define AOUT_CHAN_MAX 9 #define AOUT_CHAN_MAX 9
/* Maximum number of unmapped channels */ /* Maximum number of unmapped channels */
#define INPUT_CHAN_MAX 64 #define INPUT_CHAN_MAX 64
/* Values available for i_chan_mode only */
#define AOUT_CHANMODE_DUALMONO 0x1
#define AOUT_CHANMODE_DOLBYSTEREO 0x2
/** /**
* Picture orientation. * Picture orientation.
*/ */
......
...@@ -433,7 +433,6 @@ static int Open (vlc_object_t *obj) ...@@ -433,7 +433,6 @@ static int Open (vlc_object_t *obj)
assert (param > 0); assert (param > 0);
assert (param < (sizeof (channel_maps) / sizeof (channel_maps[0]))); assert (param < (sizeof (channel_maps) / sizeof (channel_maps[0])));
fmt.audio.i_channels = param; fmt.audio.i_channels = param;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = channel_maps[param - 1]; fmt.audio.i_physical_channels = channel_maps[param - 1];
param = var_InheritInteger (demux, "alsa-samplerate"); param = var_InheritInteger (demux, "alsa-samplerate");
......
...@@ -538,7 +538,6 @@ static int InitAudio( demux_t *p_demux ) ...@@ -538,7 +538,6 @@ static int InitAudio( demux_t *p_demux )
es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S16L ); es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S16L );
fmt.i_id = p_audio->i_id; fmt.i_id = p_audio->i_id;
fmt.audio.i_channels = 2; fmt.audio.i_channels = 2;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO; fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
fmt.audio.i_rate = p_sys->i_sample_rate; fmt.audio.i_rate = p_sys->i_sample_rate;
fmt.audio.i_bitspersample = 16; fmt.audio.i_bitspersample = 16;
......
...@@ -847,7 +847,6 @@ static int InitAudio( demux_t *p_demux, sdi_audio_t *p_audio ) ...@@ -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 ); es_format_Init( &fmt, AUDIO_ES, VLC_CODEC_S16L );
fmt.i_id = p_audio->i_id; fmt.i_id = p_audio->i_id;
fmt.audio.i_channels = 2; fmt.audio.i_channels = 2;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO; fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
fmt.audio.i_rate = p_audio->i_rate; fmt.audio.i_rate = p_audio->i_rate;
fmt.audio.i_bitspersample = 16; fmt.audio.i_bitspersample = 16;
......
...@@ -341,8 +341,7 @@ static int Open(vlc_object_t *obj) ...@@ -341,8 +341,7 @@ static int Open(vlc_object_t *obj)
} }
es_format_Init(&fmt, AUDIO_ES, format); es_format_Init(&fmt, AUDIO_ES, format);
fmt.audio.i_physical_channels = fmt.audio.i_original_channels = fmt.audio.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
fmt.audio.i_channels = ss.channels; fmt.audio.i_channels = ss.channels;
fmt.audio.i_rate = pss->rate; fmt.audio.i_rate = pss->rate;
fmt.audio.i_bitspersample = aout_BitsPerSample(format); fmt.audio.i_bitspersample = aout_BitsPerSample(format);
......
...@@ -414,11 +414,6 @@ static int Open(vlc_object_t *p_this) ...@@ -414,11 +414,6 @@ static int Open(vlc_object_t *p_this)
* buffer, and positions). * buffer, and positions).
*/ */
audiofmt.audio.i_physical_channels = AOUT_CHAN_RIGHT | AOUT_CHAN_LEFT; 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 * Please note that it may be completely arbitrary - buffers are not
* obliged to contain a integral number of so-called "frames". It's * obliged to contain a integral number of so-called "frames". It's
......
...@@ -500,7 +500,6 @@ static void *pcmu_init (demux_t *demux) ...@@ -500,7 +500,6 @@ static void *pcmu_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MULAW); es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MULAW);
fmt.audio.i_rate = 8000; fmt.audio.i_rate = 8000;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER; fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt); return codec_init (demux, &fmt);
} }
...@@ -514,7 +513,6 @@ static void *gsm_init (demux_t *demux) ...@@ -514,7 +513,6 @@ static void *gsm_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_GSM); es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_GSM);
fmt.audio.i_rate = 8000; fmt.audio.i_rate = 8000;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER; fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt); return codec_init (demux, &fmt);
} }
...@@ -528,7 +526,6 @@ static void *pcma_init (demux_t *demux) ...@@ -528,7 +526,6 @@ static void *pcma_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_ALAW); es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_ALAW);
fmt.audio.i_rate = 8000; fmt.audio.i_rate = 8000;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER; fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt); return codec_init (demux, &fmt);
} }
...@@ -542,7 +539,6 @@ static void *l16s_init (demux_t *demux) ...@@ -542,7 +539,6 @@ static void *l16s_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B); es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B);
fmt.audio.i_rate = 44100; fmt.audio.i_rate = 44100;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO; fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
return codec_init (demux, &fmt); return codec_init (demux, &fmt);
} }
...@@ -553,7 +549,6 @@ static void *l16m_init (demux_t *demux) ...@@ -553,7 +549,6 @@ static void *l16m_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B); es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_S16B);
fmt.audio.i_rate = 44100; fmt.audio.i_rate = 44100;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER; fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt); return codec_init (demux, &fmt);
} }
...@@ -567,7 +562,6 @@ static void *qcelp_init (demux_t *demux) ...@@ -567,7 +562,6 @@ static void *qcelp_init (demux_t *demux)
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_QCELP); es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_QCELP);
fmt.audio.i_rate = 8000; fmt.audio.i_rate = 8000;
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHAN_CENTER; fmt.audio.i_physical_channels = AOUT_CHAN_CENTER;
return codec_init (demux, &fmt); return codec_init (demux, &fmt);
} }
...@@ -580,7 +574,6 @@ static void *mpa_init (demux_t *demux) ...@@ -580,7 +574,6 @@ static void *mpa_init (demux_t *demux)
es_format_t fmt; es_format_t fmt;
es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MPGA); es_format_Init (&fmt, AUDIO_ES, VLC_CODEC_MPGA);
fmt.audio.i_original_channels =
fmt.audio.i_physical_channels = AOUT_CHANS_STEREO; fmt.audio.i_physical_channels = AOUT_CHANS_STEREO;
fmt.b_packetized = false; fmt.b_packetized = false;
return codec_init (demux, &fmt); return codec_init (demux, &fmt);
......
...@@ -143,7 +143,6 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf, ...@@ -143,7 +143,6 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
if (wfe->dwChannelMask & SPEAKER_LOW_FREQUENCY) if (wfe->dwChannelMask & SPEAKER_LOW_FREQUENCY)
fmt->i_physical_channels |= AOUT_CHAN_LFE; fmt->i_physical_channels |= AOUT_CHAN_LFE;
fmt->i_original_channels = fmt->i_physical_channels;
assert(popcount(wfe->dwChannelMask) == wf->nChannels); assert(popcount(wfe->dwChannelMask) == wf->nChannels);
if (IsEqualIID(&wfe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)) if (IsEqualIID(&wfe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))
......
...@@ -80,10 +80,10 @@ static int Create( vlc_object_t *p_this ) ...@@ -80,10 +80,10 @@ static int Create( vlc_object_t *p_this )
/* Validate audio filter format */ /* Validate audio filter format */
if ( p_filter->fmt_in.audio.i_physical_channels != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) 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 ) || ! ( p_filter->fmt_in.audio.i_chan_mode & AOUT_CHANMODE_DOLBYSTEREO )
|| aout_FormatNbChannels( &p_filter->fmt_out.audio ) <= 2 || p_filter->fmt_out.audio.i_channels <= 2
|| ( p_filter->fmt_in.audio.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO ) || ( p_filter->fmt_in.audio.i_chan_mode & ~AOUT_CHANMODE_DOLBYSTEREO )
!= ( p_filter->fmt_out.audio.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO ) ) != ( p_filter->fmt_out.audio.i_chan_mode & ~AOUT_CHANMODE_DOLBYSTEREO ) )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
......
...@@ -472,10 +472,10 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -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_in.audio.i_format = VLC_CODEC_FL32;
p_filter->fmt_out.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_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
p_filter->fmt_in.audio.i_original_channels = p_filter->fmt_in.audio.i_chan_mode =
p_filter->fmt_out.audio.i_original_channels; p_filter->fmt_out.audio.i_chan_mode;
if( p_filter->fmt_in.audio.i_physical_channels == AOUT_CHANS_STEREO 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" ) ) && !var_InheritBool( p_filter, "headphone-dolby" ) )
{ {
p_filter->fmt_in.audio.i_physical_channels = AOUT_CHANS_5_0; p_filter->fmt_in.audio.i_physical_channels = AOUT_CHANS_5_0;
......
...@@ -283,9 +283,7 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -283,9 +283,7 @@ static int OpenFilter( vlc_object_t *p_this )
uint32_t output = p_filter->fmt_out.audio.i_physical_channels; uint32_t output = p_filter->fmt_out.audio.i_physical_channels;
/* Short circuit the common case of not remixing */ /* Short circuit the common case of not remixing */
if( input == output if( input == output )
&& p_filter->fmt_in.audio.i_original_channels
== p_filter->fmt_out.audio.i_original_channels )
return VLC_EGENERIC; return VLC_EGENERIC;
const bool b_input_6_1 = input == AOUT_CHANS_6_1_MIDDLE; const bool b_input_6_1 = input == AOUT_CHANS_6_1_MIDDLE;
......
...@@ -193,8 +193,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -193,8 +193,7 @@ static int Create( vlc_object_t *p_this )
|| infmt->i_rate != outfmt->i_rate || infmt->i_rate != outfmt->i_rate
|| infmt->i_format != VLC_CODEC_FL32 ) || infmt->i_format != VLC_CODEC_FL32 )
return VLC_EGENERIC; return VLC_EGENERIC;
if( infmt->i_physical_channels == outfmt->i_physical_channels if( infmt->i_physical_channels == outfmt->i_physical_channels )
&& infmt->i_original_channels == outfmt->i_original_channels )
return VLC_EGENERIC; return VLC_EGENERIC;
p_filter->p_sys = NULL; p_filter->p_sys = NULL;
......
...@@ -469,7 +469,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt) ...@@ -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_to_reorder = SetupChannels (VLC_OBJECT(aout), pcm, &map,
sys->chans_table); sys->chans_table);
fmt->i_physical_channels = map; fmt->i_physical_channels = map;
fmt->i_original_channels = map;
channels = popcount (map); channels = popcount (map);
} }
else else
......
...@@ -231,7 +231,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt) ...@@ -231,7 +231,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
} }
fmt->i_format = VLC_CODEC_S16N; fmt->i_format = VLC_CODEC_S16N;
fmt->i_original_channels = fmt->i_physical_channels;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -990,7 +990,6 @@ StartPassthrough( JNIEnv *env, audio_output_t *p_aout ) ...@@ -990,7 +990,6 @@ StartPassthrough( JNIEnv *env, audio_output_t *p_aout )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_sys->fmt.i_frame_length = 1; 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_channels = aout_FormatNbChannels( &p_sys->fmt );
p_sys->fmt.i_format = VLC_CODEC_SPDIFL; p_sys->fmt.i_format = VLC_CODEC_SPDIFL;
} }
...@@ -1013,8 +1012,7 @@ StartPassthrough( JNIEnv *env, audio_output_t *p_aout ) ...@@ -1013,8 +1012,7 @@ StartPassthrough( JNIEnv *env, audio_output_t *p_aout )
} }
p_sys->fmt.i_bytes_per_frame = 4; p_sys->fmt.i_bytes_per_frame = 4;
p_sys->fmt.i_frame_length = 1; p_sys->fmt.i_frame_length = 1;
p_sys->fmt.i_physical_channels = p_sys->fmt.i_physical_channels = AOUT_CHANS_STEREO;
p_sys->fmt.i_original_channels = AOUT_CHANS_STEREO;
p_sys->fmt.i_channels = 2; p_sys->fmt.i_channels = 2;
p_sys->fmt.i_format = VLC_CODEC_SPDIFB; p_sys->fmt.i_format = VLC_CODEC_SPDIFB;
} }
...@@ -1094,7 +1092,6 @@ StartPCM( JNIEnv *env, audio_output_t *p_aout, unsigned i_max_channels ) ...@@ -1094,7 +1092,6 @@ StartPCM( JNIEnv *env, audio_output_t *p_aout, unsigned i_max_channels )
else else
p_sys->fmt.i_physical_channels = AOUT_CHANS_STEREO; 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 /* Try to create an AudioTrack with the most advanced channel and
* format configuration. If AudioTrack_Create fails, try again with a * 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 ) ...@@ -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 ); 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 ) ) if( AOUT_FMT_LINEAR( &p_sys->fmt ) )
i_ret = StartPCM( env, p_aout, i_max_channels ); i_ret = StartPCM( env, p_aout, i_max_channels );
else if( b_try_passthrough ) else if( b_try_passthrough )
......
...@@ -324,7 +324,7 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt, ...@@ -324,7 +324,7 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
{ {
/* Fill VLC physical_channels from output layout */ /* Fill VLC physical_channels from output layout */
fmt->i_physical_channels = 0; 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; AudioChannelLayout *reslayout = NULL;
if (outlayout == NULL) if (outlayout == NULL)
...@@ -434,7 +434,6 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt, ...@@ -434,7 +434,6 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
end: end:
free(reslayout); free(reslayout);
fmt->i_original_channels = fmt->i_physical_channels;
aout_FormatPrepare(fmt); aout_FormatPrepare(fmt);
msg_Dbg(p_aout, "selected %d physical channels for device output", 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, ...@@ -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, int ret = vlc_clone(&sys->eraser_thread, PlayedDataEraser, (void*) obj,
VLC_THREAD_PRIORITY_LOW); VLC_THREAD_PRIORITY_LOW);
if( unlikely( ret ) ) if( unlikely( ret ) )
......
...@@ -213,7 +213,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt) ...@@ -213,7 +213,6 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
else else
{ {
fmt->i_rate = rate; fmt->i_rate = rate;
fmt->i_original_channels =
fmt->i_physical_channels = channels; fmt->i_physical_channels = channels;
} }
aout_FormatPrepare (fmt); aout_FormatPrepare (fmt);
......
...@@ -719,7 +719,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict 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_format = VLC_CODEC_SPDIFL;
fmt->i_bytes_per_frame = 4; fmt->i_bytes_per_frame = 4;
fmt->i_frame_length = 1; 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; fmt->i_channels = 2;
encoding = PA_ENCODING_AC3_IEC61937; encoding = PA_ENCODING_AC3_IEC61937;
ss.format = PA_SAMPLE_S16NE; ss.format = PA_SAMPLE_S16NE;
...@@ -728,7 +728,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt) ...@@ -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_format = VLC_CODEC_SPDIFL;
fmt->i_bytes_per_frame = 4; fmt->i_bytes_per_frame = 4;
fmt->i_frame_length = 1; 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; fmt->i_channels = 2;
encoding = PA_ENCODING_EAC3_IEC61937; encoding = PA_ENCODING_EAC3_IEC61937;
ss.format = PA_SAMPLE_S16NE; ss.format = PA_SAMPLE_S16NE;
...@@ -742,7 +742,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt) ...@@ -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_format = VLC_CODEC_SPDIFL;
fmt->i_bytes_per_frame = 4; fmt->i_bytes_per_frame = 4;
fmt->i_frame_length = 1; 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; fmt->i_channels = 2;
encoding = PA_ENCODING_DTS_IEC61937; encoding = PA_ENCODING_DTS_IEC61937;
ss.format = PA_SAMPLE_S16NE; ss.format = PA_SAMPLE_S16NE;
...@@ -844,7 +844,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt) ...@@ -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) if (fmt->i_physical_channels & AOUT_CHAN_LFE)
map.map[map.channels++] = PA_CHANNEL_POSITION_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"); 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) ...@@ -174,7 +174,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
goto error; goto error;
} }
fmt->i_original_channels = fmt->i_physical_channels = chans; fmt->i_physical_channels = chans;
aout_FormatPrepare (fmt); aout_FormatPrepare (fmt);
aout->time_get = TimeGet; aout->time_get = TimeGet;
......
...@@ -428,7 +428,6 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf, ...@@ -428,7 +428,6 @@ static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
else else
return -1; return -1;
audio->i_original_channels = audio->i_physical_channels;
aout_FormatPrepare (audio); aout_FormatPrepare (audio);
if (wf->nChannels != audio->i_channels) if (wf->nChannels != audio->i_channels)
......
...@@ -215,26 +215,24 @@ static int channels_vlc2a52( const audio_format_t *p_audio, int *p_flags ) ...@@ -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 ) switch ( p_audio->i_physical_channels & ~AOUT_CHAN_LFE )
{ {
case AOUT_CHAN_CENTER: case AOUT_CHAN_CENTER:
if ( (p_audio->i_original_channels & AOUT_CHAN_CENTER) if ( (p_audio->i_physical_channels & AOUT_CHAN_CENTER)
|| (p_audio->i_original_channels || (p_audio->i_physical_channels
& (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) ) & (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
i_flags = A52_MONO; 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; i_flags = A52_CHANNEL1;
else else
i_flags = A52_CHANNEL2; i_flags = A52_CHANNEL2;
break; break;
case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT: 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; i_flags = A52_DOLBY;
else if ( p_audio->i_original_channels == AOUT_CHAN_CENTER ) else if ( p_audio->i_chan_mode & AOUT_CHANMODE_DUALMONO )
i_flags = A52_MONO;
else if ( p_audio->i_original_channels & AOUT_CHAN_DUALMONO )
i_flags = A52_CHANNEL; 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; 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; i_flags = A52_CHANNEL2;
else else
i_flags = A52_STEREO; i_flags = A52_STEREO;
...@@ -281,7 +279,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -281,7 +279,6 @@ static int Open( vlc_object_t *p_this )
if( p_dec->fmt_in.i_codec != VLC_CODEC_A52 if( p_dec->fmt_in.i_codec != VLC_CODEC_A52
|| p_dec->fmt_in.audio.i_rate == 0 || p_dec->fmt_in.audio.i_rate == 0
|| p_dec->fmt_in.audio.i_physical_channels == 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_bytes_per_frame == 0
|| p_dec->fmt_in.audio.i_frame_length == 0 ) || p_dec->fmt_in.audio.i_frame_length == 0 )
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -278,8 +278,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -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.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_rate = p_dec->fmt_in.audio.i_rate;
p_dec->fmt_out.audio.i_channels = i_channels; p_dec->fmt_out.audio.i_channels = i_channels;
p_dec->fmt_out.audio.i_physical_channels = p_dec->fmt_out.audio.i_physical_channels = pi_channels_maps[i_channels];
p_dec->fmt_out.audio.i_original_channels = pi_channels_maps[i_channels];
date_Init( &p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1 ); date_Init( &p_sys->end_date, p_dec->fmt_out.audio.i_rate, 1 );
date_Set( &p_sys->end_date, 0 );