[vlc-commits] video_output: initialize the filter chains with their default format

Steve Lhomme git at videolan.org
Tue Jan 19 12:30:00 UTC 2021


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov 20 11:26:18 2020 +0100| [e3da0d143cbc2586167902cb9bffa21d8e3158cc] | committer: Steve Lhomme

video_output: initialize the filter chains with their default format

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e3da0d143cbc2586167902cb9bffa21d8e3158cc
---

 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 42b38b7f5b..d848e2fae1 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1779,6 +1779,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,
     };
@@ -1790,9 +1793,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;
 
@@ -1836,9 +1845,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;
 



More information about the vlc-commits mailing list