[vlc-commits] filters: provide the decoder device to filter so they can create a video context
Steve Lhomme
git at videolan.org
Mon Dec 2 13:42:31 CET 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 24 13:58:07 2019 +0200| [6d4126139998010a1588c36c174995f57d8e1c1c] | committer: Steve Lhomme
filters: provide the decoder device to filter so they can create a video context
Typically used when a CPU to GPU converter is used. It cannot deduce the decoder
device or the video context from the input. Since we are pushing the video
context we don't want to get it from the output/environment either.
When the callback is not provided, a NULL decoder device is returned.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6d4126139998010a1588c36c174995f57d8e1c1c
---
include/vlc_filter.h | 9 +++++++++
modules/hw/d3d11/d3d11_surface.c | 2 +-
modules/hw/d3d9/dxa9.c | 2 +-
modules/stream_out/mosaic_bridge.c | 2 +-
modules/stream_out/sdi/SDIStream.cpp | 2 +-
modules/stream_out/transcode/video.c | 2 +-
modules/video_chroma/chain.c | 9 ++++++++-
modules/video_filter/canvas.c | 2 +-
modules/video_filter/edgedetection.c | 2 +-
src/misc/filter_chain.c | 11 ++++++++++-
src/video_output/display.c | 9 ++++++++-
src/video_output/video_output.c | 4 ++--
12 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 6cc923e9d0..2979224527 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -40,6 +40,7 @@
struct filter_video_callbacks
{
picture_t *(*buffer_new)(filter_t *);
+ vlc_decoder_device * (*hold_device)(vlc_object_t *, void *sys);
};
struct filter_subpicture_callbacks
@@ -192,6 +193,14 @@ static inline void filter_ChangeViewpoint( filter_t *p_filter,
p_filter->pf_change_viewpoint( p_filter, vp );
}
+static inline vlc_decoder_device * filter_HoldDecoderDevice( filter_t *p_filter )
+{
+ if ( !p_filter->owner.video || !p_filter->owner.video->hold_device )
+ return NULL;
+
+ return p_filter->owner.video->hold_device( VLC_OBJECT(p_filter), p_filter->owner.sys );
+}
+
/**
* This function will drain, then flush an audio filter.
*/
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 3989a0a37b..649f8a2a48 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -511,7 +511,7 @@ static filter_t *CreateCPUtoGPUFilter( vlc_object_t *p_this, const es_format_t *
if (unlikely(p_filter == NULL))
return NULL;
- static const struct filter_video_callbacks cbs = { NewBuffer };
+ static const struct filter_video_callbacks cbs = { NewBuffer, NULL /*TODO*/ };
p_filter->b_allow_fmt_out_change = false;
p_filter->owner.video = &cbs;
p_filter->owner.sys = p_this;
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index 0f5700b9e8..9c9c07a660 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -203,7 +203,7 @@ static filter_t *CreateFilter( vlc_object_t *p_this, const es_format_t *p_fmt_in
if (unlikely(p_filter == NULL))
return NULL;
- static const struct filter_video_callbacks cbs = { NewBuffer };
+ static const struct filter_video_callbacks cbs = { NewBuffer, NULL/*TODO*/ };
p_filter->b_allow_fmt_out_change = false;
p_filter->owner.video = &cbs;
p_filter->owner.sys = p_this;
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 6b1f8c0a0c..f378d447f8 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -298,7 +298,7 @@ static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
/* Create user specified video filters */
static const struct filter_video_callbacks cbs =
{
- video_new_buffer_filter,
+ video_new_buffer_filter, NULL/*TODO*/,
};
psz_chain = var_GetNonEmptyString( p_stream, CFG_PREFIX "vfilter" );
diff --git a/modules/stream_out/sdi/SDIStream.cpp b/modules/stream_out/sdi/SDIStream.cpp
index 2798b51061..2b736f976f 100644
--- a/modules/stream_out/sdi/SDIStream.cpp
+++ b/modules/stream_out/sdi/SDIStream.cpp
@@ -500,7 +500,7 @@ static picture_t *transcode_video_filter_buffer_new(filter_t *p_filter)
static const struct filter_video_callbacks transcode_filter_video_cbs =
{
- transcode_video_filter_buffer_new,
+ transcode_video_filter_buffer_new, NULL,
};
filter_chain_t * VideoDecodedStream::VideoFilterCreate(const es_format_t *p_srcfmt)
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 1853fc6c52..f58652725f 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -234,7 +234,7 @@ int transcode_video_init( sout_stream_t *p_stream, const es_format_t *p_fmt,
static const struct filter_video_callbacks transcode_filter_video_cbs =
{
- transcode_video_filter_buffer_new,
+ transcode_video_filter_buffer_new, NULL/*TODO*/,
};
/* Take care of the scaling and chroma conversions. */
diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index ab523397a2..f812729cac 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -140,9 +140,16 @@ static picture_t *BufferChainNew( filter_t *p_filter )
#define CHAIN_LEVEL_MAX 2
+static vlc_decoder_device * HoldChainDecoderDevice(vlc_object_t *o, void *sys)
+{
+ VLC_UNUSED(o);
+ filter_t *p_chain_parent = sys;
+ return filter_HoldDecoderDevice( p_chain_parent );
+}
+
static const struct filter_video_callbacks filter_video_chain_cbs =
{
- BufferChainNew,
+ BufferChainNew, HoldChainDecoderDevice,
};
/*****************************************************************************
diff --git a/modules/video_filter/canvas.c b/modules/video_filter/canvas.c
index 5fcf9b43b2..5ae294d672 100644
--- a/modules/video_filter/canvas.c
+++ b/modules/video_filter/canvas.c
@@ -141,7 +141,7 @@ static picture_t *video_chain_new( filter_t *p_filter )
static const struct filter_video_callbacks canvas_cbs =
{
- video_chain_new,
+ video_chain_new, NULL,
};
/*****************************************************************************
diff --git a/modules/video_filter/edgedetection.c b/modules/video_filter/edgedetection.c
index e9ed9c7380..2f158dac0e 100644
--- a/modules/video_filter/edgedetection.c
+++ b/modules/video_filter/edgedetection.c
@@ -79,7 +79,7 @@ vlc_module_end ()
static const struct filter_video_callbacks filter_video_edge_cbs =
{
- new_frame,
+ new_frame, NULL,
};
/*****************************************************************************
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index bbf1c19f38..153e02b4d8 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -123,9 +123,18 @@ static picture_t *filter_chain_VideoBufferNew( filter_t *filter )
return pic;
}
+static vlc_decoder_device * filter_chain_HoldDecoderDevice(vlc_object_t *o, void *sys)
+{
+ filter_chain_t *chain = sys;
+ if (!chain->parent_video_owner.video->hold_device)
+ return NULL;
+
+ return chain->parent_video_owner.video->hold_device(o, chain->parent_video_owner.sys);
+}
+
static const struct filter_video_callbacks filter_chain_video_cbs =
{
- filter_chain_VideoBufferNew,
+ filter_chain_VideoBufferNew, filter_chain_HoldDecoderDevice,
};
#undef filter_chain_NewVideo
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 96bbb9e2cd..e76759a65e 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -288,8 +288,15 @@ typedef struct {
picture_pool_t *pool;
} vout_display_priv_t;
+static vlc_decoder_device * DisplayHoldDecoderDevice(vlc_object_t *o, void *sys)
+{
+ vout_display_t *vd = sys;
+ vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
+ return osys->src_vctx ? vlc_video_context_HoldDevice(osys->src_vctx) : NULL;
+}
+
static const struct filter_video_callbacks vout_display_filter_cbs = {
- VideoBufferNew,
+ VideoBufferNew, DisplayHoldDecoderDevice,
};
static int VoutDisplayCreateRender(vout_display_t *vd)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 0bbf45a765..9f4df44c40 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1522,10 +1522,10 @@ static int vout_Start(vout_thread_t *vout, vlc_video_context *vctx, const vout_c
video_format_Copy(&sys->filter.src_fmt, &sys->original);
static const struct filter_video_callbacks static_cbs = {
- VoutVideoFilterStaticNewPicture,
+ VoutVideoFilterStaticNewPicture, NULL/*TODO*/,
};
static const struct filter_video_callbacks interactive_cbs = {
- VoutVideoFilterInteractiveNewPicture,
+ VoutVideoFilterInteractiveNewPicture, NULL/*TODO*/,
};
filter_owner_t owner = {
.video = &static_cbs,
More information about the vlc-commits
mailing list