X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess_output%2Ffile.c;h=b002f11bc4c77a607132e5c023eaa0963fdeb14c;hb=f8fad963aca75b817fc5a1f7b6c7705a2f449e6a;hp=b26db480e7abebf5328154fc396a31de70fd56ec;hpb=298f0e468edf5cbbf05d852bb58c7ef762a6a571;p=vlc diff --git a/modules/access_output/file.c b/modules/access_output/file.c index b26db480e7..b002f11bc4 100644 --- a/modules/access_output/file.c +++ b/modules/access_output/file.c @@ -1,7 +1,7 @@ /***************************************************************************** * file.c ***************************************************************************** - * Copyright (C) 2001, 2002 VideoLAN + * Copyright (C) 2001, 2002 the VideoLAN team * $Id$ * * Authors: Laurent Aimar @@ -51,6 +51,9 @@ #ifndef STDOUT_FILENO # define STDOUT_FILENO 1 #endif +#ifndef O_LARGEFILE +# define O_LARGEFILE 0 +#endif /***************************************************************************** * Module descriptor @@ -58,10 +61,21 @@ static int Open ( vlc_object_t * ); static void Close( vlc_object_t * ); +#define SOUT_CFG_PREFIX "sout-file-" +#define APPEND_TEXT N_("Append to file") +#define APPEND_LONGTEXT N_( "Append to file if it exists instead " \ + "of replacing it.") + vlc_module_begin(); - set_description( _("File stream ouput") ); + set_description( _("File stream output") ); + set_shortname( N_("File" )); set_capability( "sout access", 50 ); + set_category( CAT_SOUT ); + set_subcategory( SUBCAT_SOUT_ACO ); add_shortcut( "file" ); + add_shortcut( "stream" ); + add_bool( SOUT_CFG_PREFIX "append", 0, NULL, APPEND_TEXT,APPEND_LONGTEXT, + VLC_TRUE ); set_callbacks( Open, Close ); vlc_module_end(); @@ -69,6 +83,10 @@ vlc_module_end(); /***************************************************************************** * Exported prototypes *****************************************************************************/ +static const char *ppsz_sout_options[] = { + "append", NULL +}; + static int Write( sout_access_out_t *, block_t * ); static int Seek ( sout_access_out_t *, off_t ); static int Read ( sout_access_out_t *, block_t * ); @@ -85,6 +103,9 @@ static int Open( vlc_object_t *p_this ) { sout_access_out_t *p_access = (sout_access_out_t*)p_this; int i_flags; + vlc_value_t val; + + sout_CfgParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg ); if( !( p_access->p_sys = malloc( sizeof( sout_access_out_sys_t ) ) ) ) { @@ -97,8 +118,10 @@ static int Open( vlc_object_t *p_this ) msg_Err( p_access, "no file name specified" ); return VLC_EGENERIC; } - i_flags = O_RDWR|O_CREAT; - if( sout_cfg_find_value( p_access->p_cfg, "append" ) ) + i_flags = O_RDWR|O_CREAT|O_LARGEFILE; + + var_Get( p_access, SOUT_CFG_PREFIX "append", &val ); + if( val.b_bool ) { i_flags |= O_APPEND; } @@ -125,6 +148,11 @@ static int Open( vlc_object_t *p_this ) p_access->pf_seek = Seek; msg_Dbg( p_access, "file access output opened (`%s')", p_access->psz_name ); + + /* Update pace control flag */ + if( p_access->psz_access && !strcmp( p_access->psz_access, "stream" ) ) + p_access->p_sout->i_out_pace_nocontrol++; + return VLC_SUCCESS; } @@ -144,6 +172,10 @@ static void Close( vlc_object_t * p_this ) } free( p_access->p_sys ); + /* Update pace control flag */ + if( p_access->psz_access && !strcmp( p_access->psz_access, "stream" ) ) + p_access->p_sout->i_out_pace_nocontrol--; + msg_Dbg( p_access, "file access output closed" ); }