[vlc-devel] [PATCH 14/26] sout:encoder: add a function to delete the given encoder

Steve Lhomme robux4 at ycbcr.xyz
Mon Jan 18 08:32:53 UTC 2021


---
 include/vlc_sout.h                |  1 +
 src/libvlccore.sym                |  1 +
 src/missing.c                     |  6 ++++++
 src/stream_output/stream_output.c | 11 +++++++++++
 4 files changed, 19 insertions(+)

diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index fe490ab342b..b467e083796 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -231,6 +231,7 @@ VLC_API encoder_t * sout_EncoderCreate( vlc_object_t *, size_t, enum es_format_c
 #define sout_EncoderCreate(o,s,c) sout_EncoderCreate(VLC_OBJECT(o),s,c)
 
 VLC_API int sout_EncoderOpen(encoder_t *, const char *name, bool strict);
+VLC_API void sout_EncoderDelete(encoder_t *);
 
 /****************************************************************************
  * Announce handler
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 231b63d8ecc..74eabffc014 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -338,6 +338,7 @@ sout_AnnounceRegisterSDP
 sout_AnnounceUnRegister
 sout_EncoderCreate
 sout_EncoderOpen
+sout_EncoderDelete
 sout_MuxAddStream
 sout_MuxDelete
 sout_MuxDeleteStream
diff --git a/src/missing.c b/src/missing.c
index df8c7bfbed7..ad33b6ac3d3 100644
--- a/src/missing.c
+++ b/src/missing.c
@@ -112,6 +112,12 @@ int sout_EncoderOpen( encoder_t *p_encoder, const char *name, bool strict )
     vlc_assert_unreachable ();
 }
 
+void sout_EncoderDelete( encoder_t *p_encoder )
+{
+    VLC_UNUSED (p_encoder);
+    vlc_assert_unreachable ();
+}
+
 noreturn sout_input_t *sout_MuxAddStream(sout_mux_t *mux,
                                          const es_format_t *fmt)
 {
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 18ec15da1ec..5f35ac2514e 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -1083,3 +1083,14 @@ int sout_EncoderOpen(encoder_t *p_encoder, const char *name, bool strict)
         vlc_fourcc_GetCodec( p_encoder->fmt_in.i_cat, p_encoder->fmt_out.i_codec );
     return VLC_SUCCESS;
 }
+
+void sout_EncoderDelete(encoder_t *p_enc)
+{
+    if( p_enc->p_module )
+        module_unneed( p_enc, p_enc->p_module );
+
+    es_format_Clean( &p_enc->fmt_in );
+    es_format_Clean( &p_enc->fmt_out );
+
+    vlc_object_delete(p_enc);
+}
-- 
2.29.2



More information about the vlc-devel mailing list