[vlc-commits] ttml: use vlc_obj_calloc() and simplify

Rémi Denis-Courmont git at videolan.org
Fri Sep 25 15:53:57 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Sep 25 16:45:02 2020 +0300| [89c947f523ac3ea0bf63e08d8ec6cfd6e5a7b38a] | committer: Rémi Denis-Courmont

ttml: use vlc_obj_calloc() and simplify

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89c947f523ac3ea0bf63e08d8ec6cfd6e5a7b38a
---

 modules/codec/ttml/substtml.c | 13 +------------
 modules/codec/ttml/ttml.c     |  2 +-
 modules/codec/ttml/ttml.h     |  1 -
 3 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c
index 16c92ec12a..0a6b5d5653 100644
--- a/modules/codec/ttml/substtml.c
+++ b/modules/codec/ttml/substtml.c
@@ -1376,7 +1376,7 @@ int tt_OpenDecoder( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     /* Allocate the memory needed to store the decoder's structure */
-    p_dec->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) );
+    p_dec->p_sys = p_sys = vlc_obj_calloc( p_this, 1, sizeof( *p_sys ) );
     if( unlikely( p_sys == NULL ) )
         return VLC_ENOMEM;
 
@@ -1390,14 +1390,3 @@ int tt_OpenDecoder( vlc_object_t *p_this )
 
     return VLC_SUCCESS;
 }
-
-/*****************************************************************************
- * tt_CloseDecoder: clean up the decoder
- *****************************************************************************/
-void tt_CloseDecoder( vlc_object_t *p_this )
-{
-    decoder_t *p_dec = (decoder_t *)p_this;
-    decoder_sys_t *p_sys = p_dec->p_sys;
-
-    free( p_sys );
-}
diff --git a/modules/codec/ttml/ttml.c b/modules/codec/ttml/ttml.c
index 374ef60eb0..8c776edaf1 100644
--- a/modules/codec/ttml/ttml.c
+++ b/modules/codec/ttml/ttml.c
@@ -44,7 +44,7 @@ vlc_module_begin ()
     set_capability( "spu decoder", 10 )
     set_shortname( N_("TTML decoder"))
     set_description( N_("TTML subtitles decoder") )
-    set_callbacks( tt_OpenDecoder, tt_CloseDecoder )
+    set_callback( tt_OpenDecoder )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_SCODEC )
     add_integer( "ttml-align", 0, ALIGN_TEXT, ALIGN_LONGTEXT, false )
diff --git a/modules/codec/ttml/ttml.h b/modules/codec/ttml/ttml.h
index 607ed18014..74ac7c1a41 100644
--- a/modules/codec/ttml/ttml.h
+++ b/modules/codec/ttml/ttml.h
@@ -22,7 +22,6 @@ int tt_OpenDemux( vlc_object_t* p_this );
 void tt_CloseDemux( vlc_object_t* p_demux );
 
 int  tt_OpenDecoder   ( vlc_object_t * );
-void tt_CloseDecoder  ( vlc_object_t * );
 
 enum
 {



More information about the vlc-commits mailing list