[vlc-devel] [PATCH 09/12] sout: sdi: implement the get_device to provide a decoder device to the decoder
Steve Lhomme
robux4 at ycbcr.xyz
Mon Dec 2 14:26:16 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/sdi/SDIStream.cpp | 26 ++++++++++++++++++++++++++
modules/stream_out/sdi/SDIStream.hpp | 2 ++
2 files changed, 28 insertions(+)
diff --git a/modules/stream_out/sdi/SDIStream.cpp b/modules/stream_out/sdi/SDIStream.cpp
index a93c13d32d2..4e10baa7302 100644
--- a/modules/stream_out/sdi/SDIStream.cpp
+++ b/modules/stream_out/sdi/SDIStream.cpp
@@ -215,6 +215,7 @@ struct decoder_owner
bool b_error;
es_format_t last_fmt_update;
es_format_t decoder_out;
+ vlc_decoder_device *dec_dev;
};
AbstractDecodedStream::AbstractDecodedStream(vlc_object_t *p_obj,
@@ -455,6 +456,7 @@ void VideoDecodedStream::setCallbacks()
{
static struct decoder_owner_callbacks dec_cbs;
memset(&dec_cbs, 0, sizeof(dec_cbs));
+ dec_cbs.video.get_device = VideoDecCallback_get_device;
dec_cbs.video.format_update = VideoDecCallback_update_format;
dec_cbs.video.queue = VideoDecCallback_queue;
dec_cbs.video.queue_cc = captionsOutputBuffer ? VideoDecCallback_queue_cc : NULL;
@@ -482,6 +484,30 @@ void VideoDecodedStream::VideoDecCallback_queue_cc(decoder_t *p_dec, block_t *p_
static_cast<VideoDecodedStream *>(p_owner->id)->QueueCC(p_block);
}
+vlc_decoder_device * VideoDecodedStream::VideoDecCallback_get_device(decoder_t *p_dec)
+{
+ struct decoder_owner *p_owner;
+ p_owner = container_of(p_dec, struct decoder_owner, 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;
+}
+
+void VideoDecodedStream::ReleaseDecoder()
+{
+ AbstractDecodedStream::ReleaseDecoder();
+
+ struct decoder_owner *p_owner;
+ p_owner = container_of(p_decoder, struct decoder_owner, dec);
+ if (p_owner->dec_dev)
+ {
+ vlc_decoder_device_Release(p_owner->dec_dev);
+ p_owner->dec_dev = NULL;
+ }
+}
+
int VideoDecodedStream::VideoDecCallback_update_format(decoder_t *p_dec,
vlc_video_context *)
{
diff --git a/modules/stream_out/sdi/SDIStream.hpp b/modules/stream_out/sdi/SDIStream.hpp
index b06058d7eb1..1eb624e12ae 100644
--- a/modules/stream_out/sdi/SDIStream.hpp
+++ b/modules/stream_out/sdi/SDIStream.hpp
@@ -168,8 +168,10 @@ namespace sdi_sout
static void VideoDecCallback_queue(decoder_t *, picture_t *);
static void VideoDecCallback_queue_cc( decoder_t *, block_t *,
const decoder_cc_desc_t * );
+ static vlc_decoder_device * VideoDecCallback_get_device(decoder_t *);
static int VideoDecCallback_update_format(decoder_t *, vlc_video_context *);
filter_chain_t * VideoFilterCreate(const es_format_t *, vlc_video_context *);
+ virtual void ReleaseDecoder();
void Output(picture_t *);
void QueueCC(block_t *);
filter_chain_t *p_filters_chain;
--
2.17.1
More information about the vlc-devel
mailing list