/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <errno.h>
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_demux.h>
-#include <vlc_charset.h>
+#include <vlc_fs.h>
/*****************************************************************************
* Module descriptor
static int Open( vlc_object_t * );
static void Close ( vlc_object_t * );
-vlc_module_begin();
- set_shortname("Dump");
- set_category( CAT_INPUT );
- set_subcategory( SUBCAT_INPUT_DEMUX );
- set_description( _("File dumpper") );
- set_capability( "demux2", 0 );
+vlc_module_begin ()
+ set_shortname("Dump")
+ set_category( CAT_INPUT )
+ set_subcategory( SUBCAT_INPUT_DEMUX )
+ set_description( N_("File dumper") )
+ set_capability( "demux", 0 )
add_file( "demuxdump-file", "stream-demux.dump", NULL, FILE_TEXT,
- FILE_LONGTEXT, VLC_FALSE );
- add_bool( "demuxdump-append", 0, NULL, APPEND_TEXT, APPEND_LONGTEXT,
- VLC_FALSE );
- set_callbacks( Open, Close );
- add_shortcut( "dump" );
-vlc_module_end();
+ FILE_LONGTEXT, false )
+ add_bool( "demuxdump-append", false, NULL, APPEND_TEXT, APPEND_LONGTEXT,
+ false )
+ set_callbacks( Open, Close )
+ add_shortcut( "dump" )
+vlc_module_end ()
/*****************************************************************************
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
const char *psz_mode;
- vlc_value_t val;
- vlc_bool_t b_append;
+ bool b_append;
/* Accept only if forced */
- if( strcasecmp( p_demux->psz_demux, "dump" ) )
+ if( !p_demux->b_force )
return VLC_EGENERIC;
- var_Create( p_demux, "demuxdump-append", VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
- var_Get( p_demux, "demuxdump-append", &val );
- b_append = val.b_bool;
+ p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
+ if( !p_sys )
+ return VLC_ENOMEM;
+
+ b_append = var_CreateGetBool( p_demux, "demuxdump-append" );
if ( b_append )
psz_mode = "ab";
else
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
- p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
+
p_sys->i_write = 0;
p_sys->p_file = NULL;
p_sys->psz_file = var_CreateGetString( p_demux, "demuxdump-file" );
if( *p_sys->psz_file == '\0' )
{
msg_Warn( p_demux, "no dump file name given" );
+ free( p_sys->psz_file );
+ free( p_sys );
return VLC_EGENERIC;
}
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 );
free( p_sys );
return VLC_EGENERIC;
}
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
- msg_Info( p_demux ,"closing %s ("I64Fd" 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 )
fclose( p_sys->p_file );
}
free( p_sys->psz_file );
-
free( p_sys );
}
int i_data;
- /* I'm pretty sure that stream_Peek,stream_Read( , NULL ) would be faster*/
i_data = stream_Read( p_demux->s, p_sys->buffer, DUMP_BLOCKSIZE );
if ( i_data <= 0 )
return i_data;
*****************************************************************************/
static int Control( demux_t *p_demux, int i_query, va_list args )
{
- return demux2_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+ return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
}