]> git.sesse.net Git - vlc/commitdiff
Replace AOUT_FMT_NON_LINEAR with AOUT_FMT_SPDIF and AOUT_FMT_LINEAR
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Mon, 8 Aug 2011 15:22:38 +0000 (18:22 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 8 Aug 2011 15:33:05 +0000 (18:33 +0300)
As things stand, we have a format that is neither S/PDIF nor linear,
so change the macros to remove the confusion.

12 files changed:
include/vlc_aout.h
modules/audio_filter/resampler/ugly.c
modules/audio_output/adummy.c
modules/audio_output/alsa.c
modules/audio_output/auhal.c
modules/audio_output/directx.c
modules/audio_output/file.c
modules/audio_output/oss.c
modules/audio_output/waveout.c
src/audio_output/filters.c
src/audio_output/input.c
src/audio_output/output.c

index 885e341acbf1c1baf049247dd4dc4e01372befa0..7a9d6e8ea3aa4faa80bc6b8acebb271acbc5ee91 100644 (file)
       && ((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)       \
index 616d836ca8dae5a32ce6ff8ce68727b1f8464bed..3eef48ecc50b6b384e0bb4d5caa5c23fd4accaf1 100644 (file)
@@ -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;
index 048b9ec4fbdd6ecb34d95051cf026b7ed03bf2ac..fcd62edefbf364649cd07888e96905207765ab93 100644 (file)
@@ -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;
index e44e2f74cab36de7649b740cf0a5964d760bfd4d..af0e6e71ca5a387e8b2d974daa85cf1328f829e1 100644 (file)
@@ -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)
             {
index 6e12887176dece6c5f5cce9a13f65edf8c2bb90f..b07b4c7fbafa0ba7877c7695dd0a885b0138b021 100644 (file)
@@ -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 ) )
         {
index 7a555cf9081b6a50dfd80f6af34b98a2bb05644b..012d6225b5c73585da05454a6dff95474930f306 100644 (file)
@@ -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,
index 2bcca29efae24ee911e3b242a2232afce49f3bbb..4138f377cbd801eee4f952bb3e1869f5a3924fcf 100644 (file)
@@ -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;
index 504104837535ce1a3d6613ac28ac8fcc3dcf4ddb..40785644be04f19b780842c3871a2dd31ebc64c3 100644 (file)
@@ -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;
index d7d0d7ab8d23b01c405135680a75dc990010d068..3d10416da3e1d8f67c1d4f8c9d7a0c3634a22dd3 100644 (file)
@@ -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,
index aeb0d4ea3dbc80017948b71a2155561caa4cfba7..bd80e2261cd937760e13611c7c92b972dc94064b 100644 (file)
@@ -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 );
index a6c6f952ca2231e0b9c2c17a58ade096da93c2f2..72fcba4464a033361344d91120ed01466f412fae 100644 (file)
@@ -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)
index 83f0601ac6bc287905fe4614fe5dc2f1bbfa2828..7531f716371a73d2ea86bbdc80dbedde7b9e1dba 100644 (file)
@@ -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;