[vlc-commits] transcode: video: implement the get_device to provide a decoder device to the decoder

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jul  9 10:07:28 2019 +0200| [277c866ab3d9c922f8b17ec403d70fb2446f2f8f] | committer: Steve Lhomme

transcode: video: implement the get_device to provide a decoder device to the decoder

The decoder device is created with a NULL window. This can work with some
decoder devices but in some case none will be created and we just get NULL.

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

 modules/stream_out/transcode/transcode.h |  1 +
 modules/stream_out/transcode/video.c     | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/modules/stream_out/transcode/transcode.h b/modules/stream_out/transcode/transcode.h
index a704a61f45..1090d57c1b 100644
--- a/modules/stream_out/transcode/transcode.h
+++ b/modules/stream_out/transcode/transcode.h
@@ -129,6 +129,7 @@ struct sout_stream_id_sys_t
              vlc_blender_t   *p_spu_blender;
              spu_t           *p_spu;
              video_format_t  fmt_input_video;
+             vlc_decoder_device *dec_dev;
          };
          struct
          {
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 9fe58696c5..f1be16c42d 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -60,6 +60,16 @@ static const video_format_t* filtered_video_format( sout_stream_id_sys_t *id,
     return &p_pic->format;
 }
 
+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;
+}
+
 static void debug_format( sout_stream_t *p_stream, const es_format_t *fmt )
 {
     msg_Dbg( p_stream, "format now %4.4s/%4.4s %dx%d(%dx%d) ΓΈ%d",
@@ -163,6 +173,7 @@ int transcode_video_init( sout_stream_t *p_stream, const es_format_t *p_fmt,
     static const struct decoder_owner_callbacks dec_cbs =
     {
         .video = {
+            .get_device = video_get_decoder_device,
             .format_update = video_update_format_decoder,
             .queue = decoder_queue_video,
         },
@@ -395,6 +406,8 @@ void transcode_video_clean( sout_stream_t *p_stream,
         filter_DeleteBlend( id->p_spu_blender );
     if( id->p_spu )
         spu_Destroy( id->p_spu );
+    if ( id->dec_dev )
+        vlc_decoder_device_Release( id->dec_dev );
 }
 
 void transcode_video_push_spu( sout_stream_t *p_stream, sout_stream_id_sys_t *id,



More information about the vlc-commits mailing list