[vlc-devel] [PATCH 7/7] video_output: read the user aspect-ratio values before creating the display
Steve Lhomme
robux4 at ycbcr.xyz
Tue Sep 1 12:06:38 CEST 2020
---
src/video_output/video_output.c | 7 +++++++
src/video_output/vout_internal.h | 1 +
src/video_output/vout_intf.c | 2 +-
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 383130a7287..9064111295f 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -2216,6 +2216,13 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
}
vlc_mutex_lock(&sys->window_lock);
+ char *psz_ar = var_InheritString(&vout->obj, "aspect-ratio");
+ if (psz_ar) {
+ unsigned num, den;
+ if (GetAspectRatio(psz_ar, &num, &den))
+ ChangeDisplayAspectRatio(sys, num, den);
+ free(psz_ar);
+ }
char *psz_crop = var_InheritString(&vout->obj, "crop");
if (psz_crop) {
unsigned num, den;
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 54eb4a7c0a0..35da512581f 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -108,6 +108,7 @@ bool GetCropMode(const char *crop_str, enum vout_crop_mode *mode,
unsigned *num, unsigned *den,
unsigned *x, unsigned *y,
unsigned *width, unsigned *height );
+bool GetAspectRatio(const char *ar_str, unsigned *num, unsigned *den);
/* TODO to move them to vlc_vout.h */
void vout_ChangeFullscreen(vout_thread_t *, const char *id);
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 12e830d29d5..6446fd916cf 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -523,7 +523,7 @@ static int CropBorderCallback(vlc_object_t *object, char const *cmd,
return VLC_SUCCESS;
}
-static bool GetAspectRatio(const char *ar_str, unsigned *num, unsigned *den)
+bool GetAspectRatio(const char *ar_str, unsigned *num, unsigned *den)
{
if (sscanf(ar_str, "%u:%u", num, den) == 2 &&
(num != 0) == (den != 0))
--
2.26.2
More information about the vlc-devel
mailing list