vlc | branch: master | Steve Lhomme <[email protected]> | Fri Nov 20 09:54:56 2020 +0100| [2077367a7993fc3ea6ec92412607a99fcbeba413] | committer: Steve Lhomme
video_output: do the VoutFixFormat in vout_ChangeSource() And keep the fixed format in sys->original unconditionally. If vout_Request() fails, it doesn't matter if we updated sys->original. The vout is not usable. And the format is cleaned in that case. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2077367a7993fc3ea6ec92412607a99fcbeba413 --- src/video_output/video_output.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index b64286e4ce..42b38b7f5b 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -2192,15 +2192,18 @@ int vout_ChangeSource( vout_thread_t *vout, const video_format_t *original ) { vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout); + video_format_t fixed_original; + VoutFixFormat(&fixed_original, original); + /* TODO: If dimensions are equal or slightly smaller, update the aspect * ratio and crop settings, instead of recreating a display. */ - if (video_format_IsSimilar(original, &sys->original)) { - /* It is assumed that the SPU input matches input already. */ - return 0; - } + bool similar = video_format_IsSimilar(&fixed_original, &sys->original); + video_format_Clean(&sys->original); + sys->original = fixed_original; - return -1; + /* It is assumed that the SPU input matches input already. */ + return similar ? 0 : -1; } static int EnableWindowLocked(vout_thread_sys_t *vout, const video_format_t *original) @@ -2286,23 +2289,17 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input /* don't stop the display and keep sys->original */ return -1; - video_format_t original; - VoutFixFormat(&original, cfg->fmt); - - if (vout_ChangeSource(cfg->vout, &original) == 0) - { - video_format_Clean(&original); + if (vout_ChangeSource(cfg->vout, cfg->fmt) == 0) return 0; - } vlc_mutex_lock(&sys->window_lock); vout_InitSource(vout); - if (EnableWindowLocked(vout, &original) != 0) + if (EnableWindowLocked(vout, &sys->original) != 0) { /* the window was not enabled, nor the display started */ msg_Err(cfg->vout, "failed to enable window"); - video_format_Clean(&original); + video_format_Clean(&sys->original); vlc_mutex_unlock(&sys->window_lock); return -1; } @@ -2313,8 +2310,6 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input vout_ReinitInterlacingSupport(cfg->vout, &sys->private); - sys->original = original; - sys->delay = 0; sys->rate = 1.f; sys->clock = cfg->clock; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
