[vlc-commits] Replace AOUT_FMT_NON_LINEAR with AOUT_FMT_SPDIF and AOUT_FMT_LINEAR
Rémi Denis-Courmont
git at videolan.org
Mon Aug 8 17:33:23 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi.denis-courmont at nokia.com> | Mon Aug 8 18:22:38 2011 +0300| [6918810baa3bdb6324e1554eacc6a2686c1a0490] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6918810baa3bdb6324e1554eacc6a2686c1a0490
---
include/vlc_aout.h | 5 ++++-
modules/audio_filter/resampler/ugly.c | 2 +-
modules/audio_output/adummy.c | 2 +-
modules/audio_output/alsa.c | 2 +-
modules/audio_output/auhal.c | 2 +-
modules/audio_output/directx.c | 2 +-
modules/audio_output/file.c | 2 +-
modules/audio_output/oss.c | 7 +++----
modules/audio_output/waveout.c | 2 +-
src/audio_output/filters.c | 15 +++++++--------
src/audio_output/input.c | 4 ++--
src/audio_output/output.c | 6 +++---
12 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index 885e341..7a9d6e8 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -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) \
diff --git a/modules/audio_filter/resampler/ugly.c b/modules/audio_filter/resampler/ugly.c
index 616d836..3eef48e 100644
--- a/modules/audio_filter/resampler/ugly.c
+++ b/modules/audio_filter/resampler/ugly.c
@@ -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;
diff --git a/modules/audio_output/adummy.c b/modules/audio_output/adummy.c
index 048b9ec..fcd62ed 100644
--- a/modules/audio_output/adummy.c
+++ b/modules/audio_output/adummy.c
@@ -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;
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index e44e2f7..af0e6e7 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -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)
{
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 6e12887..b07b4c7 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -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 ) )
{
diff --git a/modules/audio_output/directx.c b/modules/audio_output/directx.c
index 7a555cf..012d622 100644
--- a/modules/audio_output/directx.c
+++ b/modules/audio_output/directx.c
@@ -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,
diff --git a/modules/audio_output/file.c b/modules/audio_output/file.c
index 2bcca29..4138f37 100644
--- a/modules/audio_output/file.c
+++ b/modules/audio_output/file.c
@@ -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;
diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c
index 5041048..4078564 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -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;
diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c
index d7d0d7a..3d10416 100644
--- a/modules/audio_output/waveout.c
+++ b/modules/audio_output/waveout.c
@@ -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,
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index aeb0d4e..bd80e22 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -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 );
diff --git a/src/audio_output/input.c b/src/audio_output/input.c
index a6c6f95..72fcba4 100644
--- a/src/audio_output/input.c
+++ b/src/audio_output/input.c
@@ -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)
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 83f0601..7531f71 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -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;
More information about the vlc-commits
mailing list