[vlc-commits] aes: use vlc_obj_malloc() and simplify
Rémi Denis-Courmont
git at videolan.org
Fri Sep 25 15:53:46 CEST 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Sep 25 16:29:53 2020 +0300| [1939950e68406db119ef868178bfad68de1a8618] | committer: Rémi Denis-Courmont
aes: use vlc_obj_malloc() and simplify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1939950e68406db119ef868178bfad68de1a8618
---
modules/codec/aes3.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/modules/codec/aes3.c b/modules/codec/aes3.c
index 982fd460a1..cc77214586 100644
--- a/modules/codec/aes3.c
+++ b/modules/codec/aes3.c
@@ -37,7 +37,6 @@
*****************************************************************************/
static int OpenDecoder ( vlc_object_t * );
static int OpenPacketizer( vlc_object_t * );
-static void Close ( vlc_object_t * );
vlc_module_begin ()
@@ -45,12 +44,12 @@ vlc_module_begin ()
set_subcategory( SUBCAT_INPUT_ACODEC )
set_description( N_("AES3/SMPTE 302M audio decoder") )
set_capability( "audio decoder", 100 )
- set_callbacks( OpenDecoder, Close )
+ set_callback( OpenDecoder )
add_submodule ()
set_description( N_("AES3/SMPTE 302M audio packetizer") )
set_capability( "packetizer", 100 )
- set_callbacks( OpenPacketizer, Close )
+ set_callback( OpenPacketizer )
vlc_module_end ()
@@ -95,15 +94,6 @@ static int OpenPacketizer( vlc_object_t *p_this )
return Open( p_dec, true );
}
-/*****************************************************************************
- * Close : aes3 decoder destruction
- *****************************************************************************/
-static void Close( vlc_object_t *p_this )
-{
- decoder_t *p_dec = (decoder_t*)p_this;
- free( p_dec->p_sys );
-}
-
static const uint8_t reverse[256] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0,
0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
@@ -271,7 +261,7 @@ static int Open( decoder_t *p_dec, bool b_packetizer )
return VLC_EGENERIC;
/* Allocate the memory needed to store the decoder's structure */
- p_dec->p_sys = p_sys = malloc( sizeof(decoder_sys_t) );
+ p_sys = vlc_obj_malloc( VLC_OBJECT(p_dec), sizeof(*p_sys) );
if( unlikely( !p_sys ) )
return VLC_EGENERIC;
@@ -297,6 +287,7 @@ static int Open( decoder_t *p_dec, bool b_packetizer )
p_dec->pf_decode = Decode;
}
p_dec->pf_flush = Flush;
+ p_dec->p_sys = p_sys;
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list