[vlc-devel] [PATCH v2 16/18] video_output: initialize the filter chains with their default format
Steve Lhomme
robux4 at ycbcr.xyz
Tue Nov 24 11:46:39 CET 2020
By default the filter chains do nothing and are meant to output the same format
as the decoder output. Now they can never exist without specifying their output
format so we can detect changes, even when the filter chain was never used.
---
src/video_output/video_output.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index f2e69ad703e..8fb9b44764b 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1773,6 +1773,9 @@ static int vout_Start(vout_thread_sys_t *vout, vlc_video_context *vctx, const vo
video_format_Copy(&sys->filter.src_fmt, &sys->original);
sys->filter.src_vctx = vctx ? vlc_video_context_Hold(vctx) : NULL;
+ es_format_t fmt_target;
+ es_format_InitFromVideo(&fmt_target, &sys->original);
+
static const struct filter_video_callbacks static_cbs = {
VoutVideoFilterStaticNewPicture, VoutHoldDecoderDevice,
};
@@ -1784,9 +1787,15 @@ static int vout_Start(vout_thread_sys_t *vout, vlc_video_context *vctx, const vo
.sys = vout,
};
sys->filter.chain_static = filter_chain_NewVideo(&vout->obj, true, &owner);
+ if (unlikely(sys->filter.chain_static == NULL))
+ goto error;
+ filter_chain_Reset(sys->filter.chain_static, &fmt_target, vctx, &fmt_target);
owner.video = &interactive_cbs;
sys->filter.chain_interactive = filter_chain_NewVideo(&vout->obj, true, &owner);
+ if (unlikely(sys->filter.chain_interactive == NULL))
+ goto error;
+ filter_chain_Reset(sys->filter.chain_interactive, &fmt_target, vctx, &fmt_target);
vout_display_cfg_t dcfg;
@@ -1830,9 +1839,10 @@ static int vout_Start(vout_thread_sys_t *vout, vlc_video_context *vctx, const vo
vlc_mutex_lock(&sys->display_lock);
vlc_mutex_unlock(&sys->window_lock);
- int err = vout_StartDisplayLocked(vout, &sys->original, vctx, &dcfg,
+ int err = vout_StartDisplayLocked(vout, &fmt_target.video, vctx, &dcfg,
&dar, &crop, x, y, h, w);
vlc_mutex_unlock(&sys->display_lock);
+ es_format_Clean(&fmt_target);
if (err != VLC_SUCCESS)
goto error;
--
2.26.2
More information about the vlc-devel
mailing list