]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/file.c
qtsound: unify and modernize coding style
[vlc] / modules / audio_output / file.c
index 4138f377cbd801eee4f952bb3e1869f5a3924fcf..ea390f9f4f583d88863539183c5a9823b768cdb3 100644 (file)
@@ -72,17 +72,15 @@ static const int pi_channels_maps[CHANNELS_MAX+1] =
  *****************************************************************************/
 static int     Open        ( vlc_object_t * );
 static void    Close       ( vlc_object_t * );
-static void    Play        ( audio_output_t *, block_t * );
+static void    Play        ( audio_output_t *, block_t *, mtime_t * );
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 #define FORMAT_TEXT N_("Output format")
-#define FORMAT_LONGTEXT N_("One of \"u8\", \"s8\", \"u16\", \"s16\", " \
-    "\"u16_le\", \"s16_le\", \"u16_be\", \"s16_be\", \"fixed32\", " \
-    "\"float32\" or \"spdif\"")
+
 #define CHANNELS_TEXT N_("Number of output channels")
-#define CHANNELS_LONGTEXT N_("By default, all the channels of the incoming " \
+#define CHANNELS_LONGTEXT N_("By default (0), all the channels of the incoming " \
     "will be saved but you can restrict the number of channels here.")
 
 #define WAV_TEXT N_("Add WAVE header")
@@ -90,7 +88,7 @@ static void    Play        ( audio_output_t *, block_t * );
                         "header to the file.")
 
 static const char *const format_list[] = { "u8", "s8", "u16", "s16", "u16_le",
-                                     "s16_le", "u16_be", "s16_be", "fixed32",
+                                     "s16_le", "u16_be", "s16_be",
                                      "float32", "spdif" };
 static const int format_int[] = { VLC_CODEC_U8,
                                   VLC_CODEC_S8,
@@ -99,7 +97,6 @@ static const int format_int[] = { VLC_CODEC_U8,
                                   VLC_CODEC_S16L,
                                   VLC_CODEC_U16B,
                                   VLC_CODEC_S16B,
-                                  VLC_CODEC_FI32,
                                   VLC_CODEC_FL32,
                                   VLC_CODEC_SPDIFL };
 
@@ -112,13 +109,14 @@ vlc_module_begin ()
     set_category( CAT_AUDIO )
     set_subcategory( SUBCAT_AUDIO_AOUT )
 
+    add_savefile( "audiofile-file", "audiofile.wav", FILE_TEXT,
+                  FILE_LONGTEXT, false )
     add_string( "audiofile-format", "s16",
-                FORMAT_TEXT, FORMAT_LONGTEXT, true )
-        change_string_list( format_list, 0, 0 )
+                FORMAT_TEXT, FORMAT_TEXT, true )
+        change_string_list( format_list, format_list )
     add_integer( "audiofile-channels", 0,
                  CHANNELS_TEXT, CHANNELS_LONGTEXT, true )
-    add_savefile( "audiofile-file", "audiofile.wav", FILE_TEXT,
-                  FILE_LONGTEXT, false )
+        change_integer_range( 0, 6 )
     add_bool( "audiofile-wav", true, WAV_TEXT, WAV_LONGTEXT, true )
 
     set_capability( "audio output", 0 )
@@ -194,10 +192,9 @@ static int Open( vlc_object_t * p_this )
     {
         p_aout->format.i_bytes_per_frame = AOUT_SPDIF_SIZE;
         p_aout->format.i_frame_length = A52_FRAME_NB;
-        aout_VolumeNoneInit( p_aout );
     }
-    else
-        aout_VolumeSoftInit( p_aout );
+    p_aout->volume_set = NULL;
+    p_aout->mute_set = NULL;
 
     /* Channels number */
     i_channels = var_CreateGetInteger( p_this, "audiofile-channels" );
@@ -311,7 +308,8 @@ static void Close( vlc_object_t * p_this )
 /*****************************************************************************
  * Play: pretend to play a sound
  *****************************************************************************/
-static void Play( audio_output_t * p_aout, block_t *p_buffer )
+static void Play( audio_output_t * p_aout, block_t *p_buffer,
+                  mtime_t *restrict drift )
 {
     if( fwrite( p_buffer->p_buffer, p_buffer->i_buffer, 1,
                 p_aout->sys->p_file ) != 1 )
@@ -325,5 +323,6 @@ static void Play( audio_output_t * p_aout, block_t *p_buffer )
         p_aout->sys->waveh.DataLength += p_buffer->i_buffer;
     }
 
-    aout_BufferFree( p_buffer );
+    block_Release( p_buffer );
+    (void) drift;
 }