[vlc-devel] [PATCH 2/4] vout: display: move is_display_filled handling
Thomas Guillem
thomas at gllm.fr
Tue Dec 10 14:50:54 CET 2019
Move it from vout_display_PlacePicture() to
vout_display_GetDefaultDisplaySize(). That way, callers don't have to handle it
themselves.
PS: Will be re-indented in the next commit.
---
src/video_output/display.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 8f5fbf4745b..1f0c172abb3 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -91,6 +91,9 @@ void vout_display_GetDefaultDisplaySize(unsigned *width, unsigned *height,
const video_format_t *source,
const vout_display_cfg_t *cfg)
{
+ if (cfg->is_display_filled
+ && (cfg->display.width != 0 || cfg->display.height != 0))
+ {
if (cfg->display.width != 0 && cfg->display.height != 0) {
*width = cfg->display.width;
*height = cfg->display.height;
@@ -98,17 +101,21 @@ void vout_display_GetDefaultDisplaySize(unsigned *width, unsigned *height,
*width = cfg->display.width;
*height = (int64_t)source->i_visible_height * source->i_sar_den * cfg->display.width * cfg->display.sar.num /
source->i_visible_width / source->i_sar_num / cfg->display.sar.den;
- } else if (cfg->display.height != 0) {
+ } else {
+ assert(cfg->display.height != 0);
*width = (int64_t)source->i_visible_width * source->i_sar_num * cfg->display.height * cfg->display.sar.den /
source->i_visible_height / source->i_sar_den / cfg->display.sar.num;
*height = cfg->display.height;
- } else if (source->i_sar_num >= source->i_sar_den) {
+ }
+ } else {
+ if (source->i_sar_num >= source->i_sar_den) {
*width = (int64_t)source->i_visible_width * source->i_sar_num * cfg->display.sar.den / source->i_sar_den / cfg->display.sar.num;
*height = source->i_visible_height;
} else {
*width = source->i_visible_width;
*height = (int64_t)source->i_visible_height * source->i_sar_den * cfg->display.sar.num / source->i_sar_num / cfg->display.sar.den;
}
+ }
*width = *width * cfg->zoom.num / cfg->zoom.den;
*height = *height * cfg->zoom.num / cfg->zoom.den;
@@ -139,17 +146,8 @@ void vout_display_PlacePicture(vout_display_place_t *place,
video_format_ApplyRotation(&source_rot, source);
source = &source_rot;
- if (cfg->is_display_filled) {
- display_width = cfg->display.width;
- display_height = cfg->display.height;
- } else {
- vout_display_cfg_t cfg_tmp = *cfg;
-
- cfg_tmp.display.width = 0;
- cfg_tmp.display.height = 0;
- vout_display_GetDefaultDisplaySize(&display_width, &display_height,
- source, &cfg_tmp);
- }
+ vout_display_GetDefaultDisplaySize(&display_width, &display_height,
+ source, cfg);
const unsigned width = source->i_visible_width;
const unsigned height = source->i_visible_height;
--
2.20.1
More information about the vlc-devel
mailing list