[vlc-devel] [PATCH 07/12] mosaic_bridge: implement the get_device to provide a decoder device to the decoder
Steve Lhomme
robux4 at ycbcr.xyz
Mon Dec 2 14:26:14 CET 2019
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.
---
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 948b9f8ca5b..b7255344cd1 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, 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,
},
--
2.17.1
More information about the vlc-devel
mailing list