# include "config.h"
#endif
-#include <errno.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
-#include <vlc_charset.h>
+#include <vlc_fs.h>
/*****************************************************************************
* Module descriptor
char *psz_file;
FILE *p_file;
uint64_t i_write;
+
+ uint8_t buffer[DUMP_BLOCKSIZE];
};
/*
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
const char *psz_mode;
- vlc_value_t val;
bool b_append;
/* Accept only if forced */
if( !p_sys )
return VLC_ENOMEM;
- var_Create( p_demux, "demuxdump-append", VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
- var_Get( p_demux, "demuxdump-append", &val );
- b_append = val.b_bool;
+ b_append = var_CreateGetBool( p_demux, "demuxdump-append" );
if ( b_append )
psz_mode = "ab";
else
msg_Info( p_demux, "dumping raw stream to standard output" );
p_sys->p_file = stdout;
}
- else if( ( p_sys->p_file = utf8_fopen( p_sys->psz_file, psz_mode ) ) == NULL )
+ else if( ( p_sys->p_file = vlc_fopen( p_sys->psz_file, psz_mode ) ) == NULL )
{
msg_Err( p_demux, "cannot create `%s' for writing", p_sys->psz_file );
free( p_sys->psz_file );
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
- msg_Info( p_demux ,"closing %s (%"PRId64" Kbytes dumped)", p_sys->psz_file,
+ msg_Info( p_demux ,"closing %s (%"PRId64" KiB dumped)", p_sys->psz_file,
p_sys->i_write / 1024 );
if( p_sys->p_file != stdout )
{
demux_sys_t *p_sys = p_demux->p_sys;
- const uint8_t *p_peek;
int i_data;
- i_data = stream_Peek( p_demux->s, &p_peek, DUMP_BLOCKSIZE );
+ i_data = stream_Read( p_demux->s, p_sys->buffer, DUMP_BLOCKSIZE );
if ( i_data <= 0 )
return i_data;
- i_data = fwrite( p_peek, 1, i_data, p_sys->p_file );
+ i_data = fwrite( p_sys->buffer, 1, i_data, p_sys->p_file );
if( i_data == 0 )
{
msg_Dbg( p_demux, "dumped %d bytes", i_data );
#endif
- stream_Read( p_demux->s, NULL, i_data );
p_sys->i_write += i_data;
return 1;