Commit 6918810b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Rémi Denis-Courmont

Replace AOUT_FMT_NON_LINEAR with AOUT_FMT_SPDIF and AOUT_FMT_LINEAR

As things stand, we have a format that is neither S/PDIF nor linear,
so change the macros to remove the confusion.
parent d8f5258d
......@@ -67,10 +67,13 @@
&& ((p_first)->i_physical_channels == (p_second)->i_physical_channels)\
&& ((p_first)->i_original_channels == (p_second)->i_original_channels) )
#define AOUT_FMT_LINEAR( p_format ) \
(aout_BitsPerSample((p_format)->i_format) != 0)
#define VLC_CODEC_SPDIFL VLC_FOURCC('s','p','d','i')
#define VLC_CODEC_SPDIFB VLC_FOURCC('s','p','d','b')
#define AOUT_FMT_NON_LINEAR( p_format ) \
#define AOUT_FMT_SPDIF( p_format ) \
( ((p_format)->i_format == VLC_CODEC_SPDIFL) \
|| ((p_format)->i_format == VLC_CODEC_SPDIFB) \
|| ((p_format)->i_format == VLC_CODEC_A52) \
......
......@@ -65,7 +65,7 @@ static int Create( vlc_object_t *p_this )
!= p_filter->fmt_out.audio.i_physical_channels
|| p_filter->fmt_in.audio.i_original_channels
!= p_filter->fmt_out.audio.i_original_channels
|| AOUT_FMT_NON_LINEAR( &p_filter->fmt_in.audio ) )
|| !AOUT_FMT_LINEAR( &p_filter->fmt_in.audio ) )
return VLC_EGENERIC;
p_filter->pf_audio_filter = DoWork;
......
......@@ -63,7 +63,7 @@ static int Open( vlc_object_t * p_this )
p_aout->pf_flush = NULL;
aout_VolumeSoftInit( p_aout );
if( AOUT_FMT_NON_LINEAR( &p_aout->format )
if( AOUT_FMT_SPDIF( &p_aout->format )
&& var_InheritBool( p_this, "spdif" ) )
{
p_aout->format.i_format = VLC_CODEC_SPDIFL;
......
......@@ -238,7 +238,7 @@ static int Open (vlc_object_t *obj)
pcm_format = SND_PCM_FORMAT_U8;
break;
default:
if (AOUT_FMT_NON_LINEAR(&p_aout->format))
if (AOUT_FMT_SPDIF(&p_aout->format))
spdif = var_InheritBool (p_aout, "spdif");
if (HAVE_FPU)
{
......
......@@ -264,7 +264,7 @@ static int Open( vlc_object_t * p_this )
}
/* Check for Digital mode or Analog output mode */
if( AOUT_FMT_NON_LINEAR( &p_aout->format ) && p_sys->b_supports_digital )
if( AOUT_FMT_SPDIF( &p_aout->format ) && p_sys->b_supports_digital )
{
if( OpenSPDIF( p_aout ) )
{
......
......@@ -531,7 +531,7 @@ static void Probe( audio_output_t * p_aout )
var_Set( p_aout, "audio-device", val );
/* Test for SPDIF support */
if ( AOUT_FMT_NON_LINEAR( &p_aout->format ) )
if ( AOUT_FMT_SPDIF( &p_aout->format ) )
{
if( CreateDSBuffer( p_aout, VLC_CODEC_SPDIFL,
p_aout->format.i_physical_channels,
......
......@@ -190,7 +190,7 @@ static int Open( vlc_object_t * p_this )
free( psz_format );
p_aout->format.i_format = format_int[i];
if ( AOUT_FMT_NON_LINEAR( &p_aout->format ) )
if ( AOUT_FMT_SPDIF( &p_aout->format ) )
{
p_aout->format.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->format.i_frame_length = A52_FRAME_NB;
......
......@@ -229,7 +229,7 @@ static void Probe( audio_output_t * p_aout )
}
/* Test for spdif. */
if ( AOUT_FMT_NON_LINEAR( &p_aout->format ) )
if ( AOUT_FMT_SPDIF( &p_aout->format ) )
{
i_format = AFMT_AC3;
......@@ -368,7 +368,7 @@ static int Open( vlc_object_t *p_this )
}
/* Set the output format */
if ( AOUT_FMT_NON_LINEAR( &p_aout->format ) )
if ( AOUT_FMT_SPDIF( &p_aout->format ) )
{
int i_format = AFMT_AC3;
......@@ -388,8 +388,7 @@ static int Open( vlc_object_t *p_this )
aout_PacketInit( p_aout, &p_sys->packet, A52_FRAME_NB );
aout_VolumeNoneInit( p_aout );
}
if ( !AOUT_FMT_NON_LINEAR( &p_aout->format ) )
else
{
unsigned int i_format = AFMT_S16_NE;
unsigned int i_frame_size, i_fragments;
......
......@@ -437,7 +437,7 @@ static void Probe( audio_output_t * p_aout )
}
/* Test for SPDIF support */
if ( AOUT_FMT_NON_LINEAR( &p_aout->format ) )
if ( AOUT_FMT_SPDIF( &p_aout->format ) )
{
if( OpenWaveOut( p_aout,
p_aout->sys->i_wave_device_id,
......
......@@ -103,17 +103,16 @@ static int SplitConversion( const audio_sample_format_t *restrict infmt,
else
{
assert( infmt->i_format != outfmt->i_format );
if( AOUT_FMT_NON_LINEAR( infmt ) )
{
if( AOUT_FMT_NON_LINEAR( outfmt ) )
return -1; /* no indirect non-linear -> non-linear */
/* NOTE: our non-linear -> linear filters always output 32-bits */
midfmt->i_format = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_FI32;
}
else
if( AOUT_FMT_LINEAR( infmt ) )
/* NOTE: Use S16N as intermediate. We have all conversions to S16N,
* and all useful conversions from S16N. TODO: FL32 if HAVE_FPU. */
midfmt->i_format = VLC_CODEC_S16N;
else
if( AOUT_FMT_LINEAR( outfmt ) )
/* NOTE: our non-linear -> linear filters always output 32-bits */
midfmt->i_format = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_FI32;
else
return -1; /* no indirect non-linear -> non-linear */
}
aout_FormatPrepare( midfmt );
......
......@@ -229,7 +229,7 @@ int aout_InputNew( audio_output_t * p_aout, aout_input_t * p_input, const aout_r
char *const ppsz_array[] = { psz_scaletempo, psz_filters, psz_visual };
p_input->p_playback_rate_filter = NULL;
for( i_visual = 0; i_visual < 3 && !AOUT_FMT_NON_LINEAR(&chain_output_format); i_visual++ )
for( i_visual = 0; i_visual < 3 && AOUT_FMT_LINEAR(&chain_output_format); i_visual++ )
{
char *psz_next = NULL;
char *psz_parser = ppsz_array[i_visual];
......@@ -380,7 +380,7 @@ int aout_InputNew( audio_output_t * p_aout, aout_input_t * p_input, const aout_r
}
/* Create resamplers. */
if (!AOUT_FMT_NON_LINEAR(&owner->mixer_format))
if (AOUT_FMT_LINEAR(&owner->mixer_format))
{
chain_output_format.i_rate = (__MAX(p_input->input.i_rate,
owner->mixer_format.i_rate)
......
......@@ -165,7 +165,7 @@ int aout_OutputNew( audio_output_t *p_aout,
/* Choose the mixer format. */
owner->mixer_format = p_aout->format;
if (AOUT_FMT_NON_LINEAR(&p_aout->format))
if (!AOUT_FMT_LINEAR(&p_aout->format))
owner->mixer_format.i_format = p_format->i_format;
else
/* Most audio filters can only deal with single-precision,
......@@ -530,7 +530,7 @@ static block_t *aout_OutputSlice (audio_output_t *p_aout)
prev_date = p_buffer->i_pts + p_buffer->i_length;
}
if( !AOUT_FMT_NON_LINEAR( &p_aout->format ) )
if( AOUT_FMT_LINEAR( &p_aout->format ) )
{
p_buffer = p_fifo->p_first;
......@@ -622,7 +622,7 @@ block_t *aout_PacketNext (audio_output_t *p_aout, mtime_t start_date)
aout_packet_t *p = aout_packet (p_aout);
aout_fifo_t *p_fifo = &p->fifo;
block_t *p_buffer;
const bool b_can_sleek = AOUT_FMT_NON_LINEAR (&p_aout->format);
const bool b_can_sleek = AOUT_FMT_LINEAR (&p_aout->format);
const mtime_t now = mdate ();
const mtime_t threshold =
(b_can_sleek ? start_date : now) - AOUT_MAX_PTS_DELAY;
......
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