X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess_filter%2Frecord.c;h=2b6bd78076d18176c21b506374efcbb74ed875bf;hb=refs%2Ftags%2F0.9.0-test2;hp=90457dced851d472781fc41c3320e09a7e715767;hpb=449fd28aaf007c6411251dae9d0dbfdc65b135d1;p=vlc diff --git a/modules/access_filter/record.c b/modules/access_filter/record.c index 90457dced8..2b6bd78076 100644 --- a/modules/access_filter/record.c +++ b/modules/access_filter/record.c @@ -29,7 +29,8 @@ # include "config.h" #endif -#include +#include +#include #include #include @@ -52,8 +53,8 @@ static int Open ( vlc_object_t * ); static void Close( vlc_object_t * ); vlc_module_begin(); - set_shortname( _("Record") ); - set_description( _("Record") ); + set_shortname( N_("Record") ); + set_description( N_("Record") ); set_category( CAT_INPUT ); set_subcategory( SUBCAT_INPUT_ACCESS_FILTER ); set_capability( "access_filter", 0 ); @@ -107,7 +108,7 @@ static inline void PreUpdateFlags( access_t *p_access ) static inline void PostUpdateFlags( access_t *p_access ) { access_t *p_src = p_access->p_source; - /* */ + p_access->info = p_src->info; p_access->p_sys->i_update_sav = p_access->info.i_update; } @@ -123,17 +124,15 @@ static int Open( vlc_object_t *p_this ) access_sys_t *p_sys; char *psz; - /* */ p_access->pf_read = p_src->pf_read ? Read : NULL; p_access->pf_block = p_src->pf_block ? Block : NULL; p_access->pf_seek = p_src->pf_seek ? Seek : NULL; p_access->pf_control = Control; - /* */ p_access->info = p_src->info; - /* */ p_access->p_sys = p_sys = malloc( sizeof( access_t ) ); + if( !p_sys ) return VLC_ENOMEM; /* */ p_sys->f = NULL; @@ -153,8 +152,7 @@ static int Open( vlc_object_t *p_this ) if( *psz == '\0' ) { free( psz ); - if( p_access->p_libvlc->psz_homedir ) /* XXX: This should never happen */ - psz = strdup( p_access->p_libvlc->psz_homedir ); + psz = strdup( config_GetHomeDir() ); } p_sys->psz_path = psz; msg_Dbg( p_access, "Record access filter path %s", psz ); @@ -193,15 +191,12 @@ static block_t *Block( access_t *p_access ) access_t *p_src = p_access->p_source; block_t *p_block; - /* */ PreUpdateFlags( p_access ); - /* */ p_block = p_src->pf_block( p_src ); if( p_block && p_block->i_buffer ) Dump( p_access, p_block->p_buffer, p_block->i_buffer ); - /* */ PostUpdateFlags( p_access ); return p_block; @@ -215,16 +210,12 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) access_t *p_src = p_access->p_source; int i_ret; - /* */ PreUpdateFlags( p_access ); - /* */ i_ret = p_src->pf_read( p_src, p_buffer, i_len ); - if( i_ret > 0 ) Dump( p_access, p_buffer, i_ret ); - /* */ PostUpdateFlags( p_access ); return i_ret; @@ -238,13 +229,10 @@ static int Control( access_t *p_access, int i_query, va_list args ) access_t *p_src = p_access->p_source; int i_ret; - /* */ PreUpdateFlags( p_access ); - /* */ i_ret = p_src->pf_control( p_src, i_query, args ); - /* */ PostUpdateFlags( p_access ); return i_ret; @@ -258,13 +246,10 @@ static int Seek( access_t *p_access, int64_t i_pos ) access_t *p_src = p_access->p_source; int i_ret; - /* */ PreUpdateFlags( p_access ); - /* */ i_ret = p_src->pf_seek( p_src, i_pos ); - /* */ PostUpdateFlags( p_access ); return i_ret; @@ -330,12 +315,11 @@ static void Dump( access_t *p_access, uint8_t *p_buffer, int i_buffer ) access_sys_t *p_sys = p_access->p_sys; int i_write; - /* */ if( !p_sys->b_dump ) { if( p_sys->f ) { - msg_Dbg( p_access, "dumped "I64Fd" kb (%s)", + msg_Dbg( p_access, "dumped %"PRId64" kb (%s)", p_sys->i_size/1024, p_sys->psz_file ); Notify( p_access, false ); @@ -351,7 +335,6 @@ static void Dump( access_t *p_access, uint8_t *p_buffer, int i_buffer ) return; } - /* */ if( !p_sys->f ) { input_thread_t *p_input; @@ -448,7 +431,6 @@ static void Dump( access_t *p_access, uint8_t *p_buffer, int i_buffer ) p_sys->i_size = 0; } - /* */ if( ( i_write = fwrite( p_buffer, 1, i_buffer, p_sys->f ) ) > 0 ) p_sys->i_size += i_write; }