[vlc-commits] modules: make the decoder owners use the decoder_Destroy()

Steve Lhomme git at videolan.org
Mon Feb 18 17:02:49 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 18 14:51:05 2019 +0100| [9f5ebc6eb6dae30a8b84e9a7fd3e03971d17c6d8] | committer: Steve Lhomme

modules: make the decoder owners use the decoder_Destroy()

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

 modules/stream_out/mosaic_bridge.c       | 12 ++----------
 modules/stream_out/sdi/SDIStream.cpp     | 12 ++----------
 modules/stream_out/transcode/transcode.c |  7 +------
 3 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index bd2bd13e5d..9608422748 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -319,7 +319,7 @@ static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
     if( !p_sys->p_decoder->p_module )
     {
         msg_Err( p_stream, "cannot find decoder" );
-        vlc_object_release( p_sys->p_decoder );
+        decoder_Destroy( p_sys->p_decoder );
         return NULL;
     }
 
@@ -429,15 +429,7 @@ static void Del( sout_stream_t *p_stream, void *id )
     if( !p_sys->b_inited )
         return;
 
-    if( p_sys->p_decoder != NULL )
-    {
-        if( p_sys->p_decoder->p_module )
-            module_unneed( p_sys->p_decoder, p_sys->p_decoder->p_module );
-        if( p_sys->p_decoder->p_description )
-            vlc_meta_Delete( p_sys->p_decoder->p_description );
-
-        vlc_object_release( p_sys->p_decoder );
-    }
+    decoder_Destroy( p_sys->p_decoder );
 
     /* Destroy user specified video filters */
     if( p_sys->p_vf2 )
diff --git a/modules/stream_out/sdi/SDIStream.cpp b/modules/stream_out/sdi/SDIStream.cpp
index 9e657f4aa1..5202bd331c 100644
--- a/modules/stream_out/sdi/SDIStream.cpp
+++ b/modules/stream_out/sdi/SDIStream.cpp
@@ -183,15 +183,9 @@ AbstractDecodedStream::~AbstractDecodedStream()
 
     struct decoder_owner *p_owner;
     p_owner = container_of(p_decoder, struct decoder_owner, dec);
-    if(p_decoder->p_module)
-        module_unneed(p_decoder, p_decoder->p_module);
-    es_format_Clean(&p_owner->dec.fmt_in);
-    es_format_Clean(&p_owner->dec.fmt_out);
     es_format_Clean(&p_owner->decoder_out);
     es_format_Clean(&p_owner->last_fmt_update);
-    if(p_decoder->p_description)
-        vlc_meta_Delete(p_decoder->p_description);
-    vlc_object_release(p_decoder);
+    decoder_Destroy( p_decoder );
 }
 
 bool AbstractDecodedStream::init(const es_format_t *p_fmt)
@@ -225,11 +219,9 @@ bool AbstractDecodedStream::init(const es_format_t *p_fmt)
     if(!p_decoder->p_module)
     {
         msg_Err(p_stream, "cannot find %s for %4.4s", category, (char *)&p_fmt->i_codec);
-        es_format_Clean(&p_decoder->fmt_in);
-        es_format_Clean(&p_decoder->fmt_out);
         es_format_Clean(&p_owner->decoder_out);
         es_format_Clean(&p_owner->last_fmt_update);
-        vlc_object_release(p_decoder);
+        decoder_Destroy( p_decoder );
         p_decoder = NULL;
         return false;
     }
diff --git a/modules/stream_out/transcode/transcode.c b/modules/stream_out/transcode/transcode.c
index feee667993..786d649513 100644
--- a/modules/stream_out/transcode/transcode.c
+++ b/modules/stream_out/transcode/transcode.c
@@ -496,12 +496,7 @@ static void DeleteSoutStreamID( sout_stream_id_sys_t *id )
 {
     if( id )
     {
-        if( id->p_decoder )
-        {
-            es_format_Clean( &id->p_decoder->fmt_in );
-            es_format_Clean( &id->p_decoder->fmt_out );
-            vlc_object_release( id->p_decoder );
-        }
+        decoder_Destroy( id->p_decoder );
 
         vlc_mutex_destroy(&id->fifo.lock);
         free( id );



More information about the vlc-commits mailing list