]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/transcode/spu.c
transcode: destroy spu on transcode_spu_close
[vlc] / modules / stream_out / transcode / spu.c
index 85f45d3238d61ef8bfb829f954e9624e639eee0d..3f1540bbd3c519c21430020ed10e5cfd482bf63a 100644 (file)
@@ -99,8 +99,9 @@ int transcode_spu_new( sout_stream_t *p_stream, sout_stream_id_t *id )
     return VLC_SUCCESS;
 }
 
-void transcode_spu_close( sout_stream_id_t *id)
+void transcode_spu_close( sout_stream_t *p_stream, sout_stream_id_t *id)
 {
+    sout_stream_sys_t *p_sys = p_stream->p_sys;
     /* Close decoder */
     if( id->p_decoder->p_module )
         module_unneed( id->p_decoder, id->p_decoder->p_module );
@@ -110,6 +111,12 @@ void transcode_spu_close( sout_stream_id_t *id)
     /* Close encoder */
     if( id->p_encoder->p_module )
         module_unneed( id->p_encoder, id->p_encoder->p_module );
+
+    if( p_sys->p_spu )
+    {
+        spu_Destroy( p_sys->p_spu );
+        p_sys->p_spu = NULL;
+    }
 }
 
 int transcode_spu_process( sout_stream_t *p_stream,
@@ -179,7 +186,7 @@ bool transcode_spu_add( sout_stream_t *p_stream, es_format_t *p_fmt,
 
         if( !id->id )
         {
-            transcode_spu_close( id );
+            transcode_spu_close( p_stream, id );
             return false;
         }
     }