1
mirror of https://code.videolan.org/videolan/vlc synced 2024-07-21 07:24:15 +02:00

aout: channel mask can be 0

Audio outputs don't need the channel mask for S/PDIF or HDMI passthrough.
This will be convenient for Dolby Atmos that can have a higher channel count
that can't be mapped.
This commit is contained in:
Thomas Guillem 2016-10-05 15:41:25 +02:00
parent 5be7804abb
commit 9d54fab3d5
20 changed files with 63 additions and 3 deletions

View File

@ -55,6 +55,9 @@ static void Flush(audio_output_t *aout, bool wait)
static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
{
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
if (AOUT_FMT_SPDIF(fmt) && var_InheritBool(aout, "spdif"))
{
fmt->i_format = VLC_CODEC_SPDIFL;

View File

@ -287,6 +287,9 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
snd_pcm_format_t pcm_format; /* ALSA sample format */
bool spdif = false;
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
switch (fmt->i_format)
{
case VLC_CODEC_FL64:

View File

@ -163,6 +163,9 @@ static int Start (audio_output_t *aout, audio_sample_format_t *fmt)
char format[5] = "S16N";
unsigned channels;
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
if (sys->setup != NULL)
{
channels = aout_FormatNbChannels(fmt);

View File

@ -121,6 +121,9 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
aout_sys_t *p_sys = p_aout->sys;
OSStatus error = 0;
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
// prepare the format description for our output
AudioStreamBasicDescription streamDescription;
streamDescription.mSampleRate = fmt->i_rate;

View File

@ -895,6 +895,9 @@ Start( audio_output_t *p_aout, audio_sample_format_t *restrict p_fmt )
bool b_spdif;
int i_at_format;
if (aout_FormatNbChannels(p_fmt) == 0)
return VLC_EGENERIC;
if( p_sys->at_dev == AT_DEV_HDMI )
{
b_spdif = true;

View File

@ -138,6 +138,9 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
{
struct aout_sys_t *p_sys = NULL;
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
p_sys = p_aout->sys;
p_sys->au_component = NULL;
p_sys->au_unit = NULL;

View File

@ -320,6 +320,9 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
bool b_start_digital = false;
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
p_sys = p_aout->sys;
p_sys->b_digital = false;
p_sys->au_component = NULL;

View File

@ -593,6 +593,9 @@ static void OutputStop( audio_output_t *aout )
static HRESULT Start( vlc_object_t *obj, aout_stream_sys_t *sys,
audio_sample_format_t *restrict pfmt )
{
if( aout_FormatNbChannels( pfmt ) == 0 )
return E_FAIL;
#if !VLC_WINSTORE_APP
/* Set DirectSound Cooperative level, ie what control we want over Windows
* sound device. In our case, DSSCL_EXCLUSIVE means that we can modify the

View File

@ -135,6 +135,9 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
const char * const * ppsz_compare = format_list;
int i_channels, i = 0;
if( aout_FormatNbChannels( fmt ) == 0 )
return VLC_EGENERIC;
psz_name = var_InheritString( p_aout, "audiofile-file" );
if( !psz_name )
{

View File

@ -121,6 +121,9 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
unsigned int i;
int i_error;
if( aout_FormatNbChannels( fmt ) == 0 )
return VLC_EGENERIC;
p_sys->latency = 0;
p_sys->paused = VLC_TS_INVALID;

View File

@ -135,6 +135,9 @@ static int Start ( audio_output_t *p_aout, audio_sample_format_t *fmt )
vlc_value_t val, text;
audio_sample_format_t format = *fmt;
if( aout_FormatNbChannels( fmt ) == 0 )
return VLC_EGENERIC;
psz_mode = var_InheritString( p_aout, "kai-audio-device" );
if( !psz_mode )
psz_mode = ( char * )ppsz_kai_audio_device[ 0 ]; // "auto"

View File

@ -379,6 +379,9 @@ static int aout_get_native_sample_rate(audio_output_t *aout)
*****************************************************************************/
static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
{
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
SLresult result;
aout_sys_t *sys = aout->sys;

View File

@ -90,6 +90,9 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
{
aout_sys_t* sys = aout->sys;
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
/* Open the device */
const char *device = sys->device;
if (device == NULL)

View File

@ -698,6 +698,9 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
struct pa_sample_spec ss;
pa_encoding_t encoding = PA_ENCODING_INVALID;
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
switch (fmt->i_format)
{
case VLC_CODEC_FL64:

View File

@ -66,6 +66,9 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
{
aout_sys_t *sys = aout->sys;
if (aout_FormatNbChannels(fmt) == 0)
return VLC_EGENERIC;
sys->hdl = sio_open (NULL, SIO_PLAY, 0 /* blocking */);
if (sys->hdl == NULL)
{

View File

@ -196,6 +196,9 @@ Start( audio_output_t *p_aout, audio_sample_format_t *restrict p_fmt )
{
aout_sys_t *p_sys = p_aout->sys;
if( aout_FormatNbChannels( p_fmt ) == 0 )
return VLC_EGENERIC;
aout_FormatPrint( p_aout, "Tizen audio is looking for:", p_fmt );
/* Sample rate: tizen accept rate between 8000 and 48000 Hz */

View File

@ -167,6 +167,9 @@ vlc_module_end ()
*****************************************************************************/
static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
{
if( aout_FormatNbChannels( fmt ) == 0 )
return VLC_EGENERIC;
p_aout->time_get = WaveOutTimeGet;
p_aout->play = Play;
p_aout->pause = WaveOutPause;

View File

@ -87,7 +87,10 @@ unsigned int aout_BitsPerSample( vlc_fourcc_t i_format )
*****************************************************************************/
void aout_FormatPrepare( audio_sample_format_t * p_format )
{
p_format->i_channels = aout_FormatNbChannels( p_format );
unsigned i_channels = aout_FormatNbChannels( p_format );
if( i_channels > 0 )
p_format->i_channels = i_channels;
p_format->i_bitspersample = aout_BitsPerSample( p_format->i_format );
if( p_format->i_bitspersample > 0 )
{
@ -213,7 +216,7 @@ const char * aout_FormatPrintChannels( const audio_sample_format_t * p_format )
return "3F2M3R/LFE";
}
return "ERROR";
return AOUT_FMT_LINEAR( p_format ) ? "ERROR" : "Unknown-chan-mask";
}
#undef aout_FormatPrint

View File

@ -46,7 +46,8 @@ int aout_DecNew( audio_output_t *p_aout,
const aout_request_vout_t *p_request_vout )
{
/* Sanitize audio format */
if( p_format->i_channels != aout_FormatNbChannels( p_format ) )
unsigned i_channels = aout_FormatNbChannels( p_format );
if( i_channels != p_format->i_channels && AOUT_FMT_LINEAR( p_format ) )
{
msg_Err( p_aout, "incompatible audio channels count with layout mask" );
return -1;

View File

@ -461,6 +461,11 @@ aout_filters_t *aout_FiltersNew (vlc_object_t *obj,
}
return filters;
}
if (aout_FormatNbChannels(infmt) == 0 || aout_FormatNbChannels(outfmt) == 0)
{
msg_Warn (obj, "No channel mask, cannot setup filters");
goto error;
}
/* parse user filter lists */
if (var_InheritBool (obj, "audio-time-stretch"))