[vlc-commits] transcode: implement the hold_device for filters

Steve Lhomme git at videolan.org
Mon Dec 9 11:51:13 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Nov 12 08:53:05 2019 +0100| [83625692c3a2384d2e877d6d1a9ca48d4856b8ac] | committer: Steve Lhomme

transcode: implement the hold_device for filters

Factorize the code with the get_device for the decoder.

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

 modules/stream_out/transcode/video.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index f1be16c42d..6a3d88abc9 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -60,14 +60,17 @@ static const video_format_t* filtered_video_format( sout_stream_id_sys_t *id,
     return &p_pic->format;
 }
 
+static vlc_decoder_device *TranscodeHoldDecoderDevice(vlc_object_t *o, sout_stream_id_sys_t *id)
+{
+    if (id->dec_dev == NULL)
+        id->dec_dev = vlc_decoder_device_Create( o, NULL );
+    return id->dec_dev ? vlc_decoder_device_Hold(id->dec_dev) : NULL;
+}
+
 static vlc_decoder_device * video_get_decoder_device( decoder_t *p_dec )
 {
     struct decoder_owner *p_owner = dec_get_owner( p_dec );
-    if (p_owner->id->dec_dev == NULL)
-    {
-        p_owner->id->dec_dev = vlc_decoder_device_Create( &p_dec->obj, NULL );
-    }
-    return p_owner->id->dec_dev ? vlc_decoder_device_Hold(p_owner->id->dec_dev) : NULL;
+    return TranscodeHoldDecoderDevice(&p_dec->obj, p_owner->id);
 }
 
 static void debug_format( sout_stream_t *p_stream, const es_format_t *fmt )
@@ -80,6 +83,12 @@ static void debug_format( sout_stream_t *p_stream, const es_format_t *fmt )
              fmt->video.orientation );
 }
 
+static vlc_decoder_device * transcode_video_filter_hold_device(vlc_object_t *o, void *sys)
+{
+    sout_stream_id_sys_t *id = sys;
+    return TranscodeHoldDecoderDevice(o, id);
+}
+
 static int video_update_format_decoder( decoder_t *p_dec, vlc_video_context *vctx )
 {
     struct decoder_owner *p_owner = dec_get_owner( p_dec );
@@ -245,7 +254,7 @@ int transcode_video_init( sout_stream_t *p_stream, const es_format_t *p_fmt,
 
 static const struct filter_video_callbacks transcode_filter_video_cbs =
 {
-    transcode_video_filter_buffer_new, NULL/*TODO*/,
+    transcode_video_filter_buffer_new, transcode_video_filter_hold_device,
 };
 
 /* Take care of the scaling and chroma conversions. */



More information about the vlc-commits mailing list