[vlc-commits] sout: sdi: implement the get_device to provide a decoder device to the decoder
Steve Lhomme
git at videolan.org
Mon Dec 9 11:51:10 CET 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jul 9 09:40:05 2019 +0200| [81512e0382f289de5104e213373e044095d73f8c] | committer: Steve Lhomme
sout: sdi: 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=81512e0382f289de5104e213373e044095d73f8c
---
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 a93c13d32d..b3495d0944 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->obj, 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 b06058d7eb..1eb624e12a 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;
More information about the vlc-commits
mailing list