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

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 24 12:07:56 2019 +0200| [1f3a624462a24a64fbabae908ed691d0ba28f43d] | committer: Steve Lhomme

mosaic_bridge: 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=1f3a624462a24a64fbabae908ed691d0ba28f43d
---

 modules/stream_out/mosaic_bridge.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 948b9f8ca5..b1b386f757 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -64,6 +64,7 @@ typedef struct
 struct decoder_owner
 {
     decoder_t dec;
+    vlc_decoder_device *dec_dev;
     sout_stream_t *p_stream;
 };
 
@@ -251,6 +252,16 @@ static int Open( vlc_object_t *p_this )
     return VLC_SUCCESS;
 }
 
+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->dec_dev == NULL )
+    {
+        p_owner->dec_dev = vlc_decoder_device_Create(&p_dec->obj, NULL);
+    }
+    return p_owner->dec_dev ? vlc_decoder_device_Hold(p_owner->dec_dev) : NULL;
+}
+
 /*****************************************************************************
  * Close
  *****************************************************************************/
@@ -273,6 +284,12 @@ static void Close( vlc_object_t * p_this )
 
 static void ReleaseDecoder( decoder_t *p_dec )
 {
+    struct decoder_owner *p_owner = dec_get_owner( p_dec );
+    if ( p_owner->dec_dev )
+    {
+        vlc_decoder_device_Release( p_owner->dec_dev );
+        p_owner->dec_dev = NULL;
+    }
     decoder_Destroy( p_dec );
 }
 
@@ -326,6 +343,7 @@ static void *Add( 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,
         },



More information about the vlc-commits mailing list