*****************************************************************************/
#include <errno.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <vlc/vlc.h>
#include <vlc_aout.h>
#include <vlc_codecs.h> /* WAVEHEADER */
VLC_FOURCC('s','p','i','f') };
#define FILE_TEXT N_("Output file")
-#define FILE_LONGTEXT N_("File to which the audio samples will be written to.")
+#define FILE_LONGTEXT N_("File to which the audio samples will be written to. (\"-\" for stdout")
vlc_module_begin();
set_description( _("File audio output") );
if( !psz_name || !*psz_name )
{
msg_Err( p_aout, "you need to specify an output file name" );
- if( psz_name ) free( psz_name );
+ free( psz_name );
return VLC_EGENERIC;
}
return VLC_EGENERIC;
}
- p_aout->output.p_sys->p_file = utf8_fopen( psz_name, "wb" );
+ if( !strcmp( psz_name, "-" ) )
+ p_aout->output.p_sys->p_file = stdout;
+ else
+ p_aout->output.p_sys->p_file = utf8_fopen( psz_name, "wb" );
+
free( psz_name );
if ( p_aout->output.p_sys->p_file == NULL )
{
{
msg_Err( p_aout, "cannot understand the format string (%s)",
psz_format );
- fclose( p_aout->output.p_sys->p_file );
+ if( p_aout->output.p_sys->p_file != stdout )
+ fclose( p_aout->output.p_sys->p_file );
free( p_aout->output.p_sys );
return VLC_EGENERIC;
}
}
}
- fclose( p_aout->output.p_sys->p_file );
+ if( p_aout->output.p_sys->p_file != stdout )
+ fclose( p_aout->output.p_sys->p_file );
free( p_aout->output.p_sys );
}