/*****************************************************************************
* record.c: record stream output module
*****************************************************************************
- * Copyright (C) 2008 the VideoLAN team
+ * Copyright (C) 2008-2009 the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
M( "raw", "mpc", 1, VLC_CODEC_MUSEPACK7, VLC_CODEC_MUSEPACK8 ),
M( "raw", "ape", 1, VLC_CODEC_APE ),
- M( "wav", "wav", 1, VLC_CODEC_U8, VLC_CODEC_S16L,
+ M( "wav", "wav", 1, VLC_CODEC_U8, VLC_CODEC_S16L,
VLC_CODEC_S24L, VLC_CODEC_S32L, VLC_CODEC_FL32 ),
//M( "ffmpeg{mux=flac}", "flac", 1, VLC_CODEC_FLAC ), BROKEN
- M( "ogg", "ogg", INT_MAX, VLC_CODEC_VORBIS, VLC_CODEC_SPEEX, VLC_CODEC_FLAC,
- VLC_CODEC_SUBT, VLC_CODEC_THEORA, VLC_CODEC_DIRAC ),
+ M( "ogg", "ogg", INT_MAX, VLC_CODEC_VORBIS, VLC_CODEC_SPEEX, VLC_CODEC_FLAC,
+ VLC_CODEC_SUBT, VLC_CODEC_THEORA, VLC_CODEC_DIRAC ),
M( "asf", "asf", 127, VLC_CODEC_WMA1, VLC_CODEC_WMA2, VLC_CODEC_WMAP, VLC_CODEC_WMAL, VLC_CODEC_WMAS,
VLC_CODEC_WMV1, VLC_CODEC_WMV2, VLC_CODEC_WMV3, VLC_CODEC_VC1 ),
M( "ts", "ts", 8000, VLC_CODEC_MPGV,
VLC_CODEC_H264,
VLC_CODEC_MPGA, VLC_CODEC_DVD_LPCM, VLC_CODEC_A52,
- VLC_CODEC_DTS, VLC_CODEC_MP4A,
+ VLC_CODEC_DTS, VLC_CODEC_MP4A,
VLC_CODEC_DVBS, VLC_CODEC_TELETEXT ),
M( NULL, NULL, 0, 0 )
const char *psz_muxer, const char *psz_prefix, const char *psz_extension )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
- char *psz_output;
+ char *psz_file = NULL;
+ char *psz_output = NULL;
int i_count;
- if( asprintf( &psz_output, "std{access=file,mux='%s',dst='%s%s%s'}",
- psz_muxer, psz_prefix, psz_extension ? "." : "", psz_extension ? psz_extension : "" ) < 0 )
- return -1;
+ if( asprintf( &psz_file, "%s%s%s",
+ psz_prefix, psz_extension ? "." : "", psz_extension ? psz_extension : "" ) < 0 )
+ {
+ psz_file = NULL;
+ goto error;
+ }
+
+ if( asprintf( &psz_output, "std{access=file,mux='%s',dst='%s'}",
+ psz_muxer, psz_file ) < 0 )
+ {
+ psz_output = NULL;
+ goto error;
+ }
/* Create the output */
msg_Dbg( p_stream, "Using record output `%s'", psz_output );
- p_sys->p_out = sout_StreamNew( p_stream->p_sout, psz_output );
- free( psz_output );
+ p_sys->p_out = sout_StreamNew( p_stream->p_sout, psz_output );
if( !p_sys->p_out )
- return -1;
+ goto error;
/* Add es */
i_count = 0;
i_count++;
}
+ if( psz_file && psz_extension )
+ var_SetString( p_stream->p_libvlc, "record-file", psz_file );
+
+ free( psz_file );
+ free( psz_output );
+
return i_count;
+
+error:
+
+ free( psz_file );
+ free( psz_output );
+ return -1;
+
}
static void OutputStart( sout_stream_t *p_stream )