[vlc-commits] video_output: do the format cleaning in vout_Request and vout_GetDevice
Steve Lhomme
git at videolan.org
Wed Oct 9 10:15:56 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Sep 27 10:00:04 2019 +0200| [9de1d440d3918e64975662c7e73c24ae2c5d0109] | committer: Steve Lhomme
video_output: do the format cleaning in vout_Request and vout_GetDevice
vout_GetDevice doesn't need to check the DPB, it only needs to get a decoder
device from a usable window. Only the display needs to DPB size (for now, since
it creates the decoder pool from it).
Only stop the current display if a new one is going to be created.
In vout_GetDevice we don't care about the current display. So we don't need to
use sys->original, we use a locally cleaned video format instead.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9de1d440d3918e64975662c7e73c24ae2c5d0109
---
src/video_output/video_output.c | 77 +++++++++++++++++++++++------------------
1 file changed, 43 insertions(+), 34 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index ed41524438..26f95a02a1 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1926,41 +1926,14 @@ vout_thread_t *vout_Hold(vout_thread_t *vout)
return vout;
}
-static int VoutEnableWindow(const vout_configuration_t *cfg, vlc_decoder_device **pp_dec_device)
+static int VoutEnableWindow(const vout_configuration_t *cfg, const video_format_t *original,
+ vlc_decoder_device **pp_dec_device)
{
vout_thread_t *vout = cfg->vout;
vout_thread_sys_t *sys = vout->p;
assert(!sys->dummy);
assert(vout != NULL);
- assert(cfg->fmt != NULL);
-
- if (!VoutCheckFormat(cfg->fmt))
- return -1;
-
- video_format_t original;
- VoutFixFormat(&original, cfg->fmt);
-
- /* 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)) {
- if (cfg->dpb_size <= sys->dpb_size) {
- video_format_Clean(&original);
- /* It is assumed that the SPU input matches input already. */
- if (pp_dec_device)
- *pp_dec_device = sys->dec_device ? vlc_decoder_device_Hold( sys->dec_device ) : NULL;
- return 0;
- }
- msg_Warn(vout, "DPB need to be increased");
- }
-
- if (sys->display != NULL)
- vout_StopDisplay(vout);
-
- vout_ReinitInterlacingSupport(vout);
-
- sys->original = original;
vlc_mutex_lock(&sys->window_lock);
if (!sys->window_enabled) {
@@ -1974,13 +1947,12 @@ static int VoutEnableWindow(const vout_configuration_t *cfg, vlc_decoder_device
#endif
};
- VoutGetDisplayCfg(vout, &original, &sys->display_cfg);
- vout_SizeWindow(vout, &sys->original, &wcfg.width, &wcfg.height);
+ VoutGetDisplayCfg(vout, original, &sys->display_cfg);
+ vout_SizeWindow(vout, original, &wcfg.width, &wcfg.height);
if (vout_window_Enable(sys->display_cfg.window, &wcfg)) {
vlc_mutex_unlock(&sys->window_lock);
msg_Err(vout, "window enabling failed");
- video_format_Clean(&sys->original);
return -1;
}
sys->window_enabled = true;
@@ -2003,10 +1975,36 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
vout_thread_sys_t *sys = vout->p;
assert(cfg->clock != NULL);
+ assert(cfg->fmt != NULL);
- if (VoutEnableWindow(cfg, NULL) != 0)
+ if (!VoutCheckFormat(cfg->fmt))
return -1;
+ video_format_t original;
+ VoutFixFormat(&original, cfg->fmt);
+
+ /* 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)) {
+ if (cfg->dpb_size <= sys->dpb_size) {
+ video_format_Clean(&original);
+ /* It is assumed that the SPU input matches input already. */
+ return 0;
+ }
+ msg_Warn(vout, "DPB need to be increased");
+ }
+
+ if (VoutEnableWindow(cfg, &original, NULL) != 0)
+ return -1;
+
+ vout_ReinitInterlacingSupport(vout);
+
+ if (sys->display != NULL)
+ vout_StopDisplay(vout);
+
+ sys->original = original;
+
sys->delay = 0;
sys->rate = 1.f;
sys->clock = cfg->clock;
@@ -2041,8 +2039,19 @@ error:
vlc_decoder_device *vout_GetDevice(const vout_configuration_t *cfg)
{
+ assert(cfg->fmt != NULL);
+
+ if (!VoutCheckFormat(cfg->fmt))
+ return NULL;
+
+ video_format_t original;
+ VoutFixFormat(&original, cfg->fmt);
+
vlc_decoder_device *dec_device = NULL;
- if (VoutEnableWindow(cfg, &dec_device) != 0)
+ int res = VoutEnableWindow(cfg, &original, &dec_device);
+ video_format_Clean(&original);
+ if (res != 0)
return NULL;
+
return dec_device;
}
More information about the vlc-commits
mailing list