Commit 0aae30a7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

voc: use vlc_obj_malloc()

parent 0fb43ae1
......@@ -37,14 +37,13 @@
* Module descriptor
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
vlc_module_begin ()
set_description( N_("VOC demuxer") )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_DEMUX )
set_capability( "demux", 10 )
set_callbacks( Open, Close )
set_callbacks( Open, NULL )
vlc_module_end ()
/*****************************************************************************
......@@ -76,7 +75,6 @@ static const char ct_header[] = "Creative Voice File\x1a";
static int Open( vlc_object_t * p_this )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys;
const uint8_t *p_buf;
uint16_t i_data_offset, i_version;
......@@ -108,8 +106,8 @@ static int Open( vlc_object_t * p_this )
if( vlc_stream_Read( p_demux->s, NULL, i_data_offset ) < i_data_offset )
return VLC_EGENERIC;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
if( p_sys == NULL )
demux_sys_t *p_sys = vlc_obj_malloc( p_this, sizeof (*p_sys) );
if( unlikely(p_sys == NULL) )
return VLC_ENOMEM;
p_sys->i_silence_countdown = p_sys->i_block_start = p_sys->i_block_end =
......@@ -122,6 +120,7 @@ static int Open( vlc_object_t * p_this )
es_format_Init( &p_sys->fmt, AUDIO_ES, 0 );
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys;
return VLC_SUCCESS;
}
......@@ -521,16 +520,6 @@ static int Demux( demux_t *p_demux )
return VLC_DEMUXER_SUCCESS;
}
/*****************************************************************************
* Close: frees unused data
*****************************************************************************/
static void Close ( vlc_object_t * p_this )
{
demux_sys_t *p_sys = ((demux_t *)p_this)->p_sys;
free( p_sys );
}
/*****************************************************************************
* Control:
*****************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment