]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/waveout.c
demux: mp4: handle Qt v1 redefined samples tables (fix #12773)
[vlc] / modules / audio_output / waveout.c
index aa2a8f4a77d0110adfdb958ccd3999c516b3b00f..3ce81580b939028b949707ce4e1850ba725fe3f1 100644 (file)
 # include "config.h"
 #endif
 
-#include <stdio.h>
 #include <math.h>
-#include <wchar.h>
 
 #define UNICODE
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_aout.h>
-#include <vlc_charset.h> /* FromWide() */
-#include <vlc_atomic.h>
+#include <vlc_charset.h>              /* FromWide() */
 
-#include "windows_audio_common.h"
+#include "audio_output/windows_audio_common.h"
 
 #define FRAME_SIZE 4096              /* The size is in samples, not in bytes */
 
@@ -137,7 +134,6 @@ struct aout_sys_t
 #define DEVICE_LONG N_("Select special Audio device, or let windows "\
                        "decide (default), change needs VLC restart "\
                        "to apply.")
-#define DEFAULT_AUDIO_DEVICE N_("Default Audio Device")
 
 #define AUDIO_CHAN_TEXT N_("Audio output channels")
 #define AUDIO_CHAN_LONGTEXT N_("Channels available for audio output. " \
@@ -148,7 +144,7 @@ struct aout_sys_t
 
 vlc_module_begin ()
     set_shortname( "WaveOut" )
-    set_description( N_("Win32 waveOut extension output") )
+    set_description( N_("WaveOut audio output") )
     set_capability( "audio output", 50 )
     set_category( CAT_AUDIO )
     set_subcategory( SUBCAT_AUDIO_AOUT )
@@ -158,9 +154,9 @@ vlc_module_begin ()
     add_float( "waveout-volume", 1.0f, VOLUME_TEXT, NULL, true )
          change_float_range(0.0f, 2.0f)
     add_bool( "waveout-float32", true, FLOAT_TEXT, FLOAT_LONGTEXT, true )
-    add_integer ("waveout-audio-channels", 6, AUDIO_CHAN_TEXT,
+    add_integer ("waveout-audio-channels", 9, AUDIO_CHAN_TEXT,
                  AUDIO_CHAN_LONGTEXT, false)
-        change_integer_range(1,6)
+        change_integer_range(1,9)
     set_callbacks( Open, Close )
 vlc_module_end ()
 
@@ -179,12 +175,6 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
     /* Default behaviour is to use software gain */
     p_aout->sys->b_soft = true;
 
-    /*
-      check for configured audio device!
-    */
-    fmt->i_format = var_InheritBool( p_aout, "waveout-float32" )?
-        VLC_CODEC_FL32: VLC_CODEC_S16N;
-
     char *dev = var_GetNonEmptyString( p_aout, "waveout-audio-device");
     uint32_t devid = findDeviceID( dev );
 
@@ -234,6 +224,12 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
 
     if( fmt->i_format != VLC_CODEC_SPDIFL )
     {
+       /*
+         check for configured audio device!
+       */
+       fmt->i_format = var_InheritBool( p_aout, "waveout-float32" )?
+           VLC_CODEC_FL32: VLC_CODEC_S16N;
+
         int max_chan = var_InheritInteger( p_aout, "waveout-audio-channels");
         int i_channels = aout_FormatNbChannels(fmt);
         i_channels = ( i_channels < max_chan )? i_channels: max_chan;
@@ -241,6 +237,15 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
         {
             switch(i_channels)
             {
+                case 9:
+                    fmt->i_physical_channels = AOUT_CHANS_8_1;
+                    break;
+                case 8:
+                    fmt->i_physical_channels = AOUT_CHANS_7_1;
+                    break;
+                case 7:
+                    fmt->i_physical_channels = AOUT_CHANS_7_0;
+                    break;
                 case 6:
                     fmt->i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
                         | AOUT_CHAN_CENTER | AOUT_CHAN_REARLEFT
@@ -497,7 +502,7 @@ static int OpenWaveOut( audio_output_t *p_aout, uint32_t i_device_id, int i_form
                  waveformat.Samples.wValidBitsPerSample);
         msg_Dbg( p_aout,"waveformat.Samples.wSamplesPerBlock = %d",
                  waveformat.Samples.wSamplesPerBlock);
-        msg_Dbg( p_aout,"waveformat.dwChannelMask          = %lx",
+        msg_Dbg( p_aout,"waveformat.dwChannelMask          = %u",
                  waveformat.dwChannelMask);
     }