[vlc-devel] [PATCH 5/5] libvlc: provide the source video dimensions when updating the surface dimensions

Steve Lhomme robux4 at ycbcr.xyz
Mon May 27 13:06:50 CEST 2019


The host may decide to match the source video but it cannot do so if the resize
callback settled the window size (which is also the rendering dimension) for
good.
---
 include/vlc/libvlc_media_player.h       | 3 +++
 modules/video_output/win32/direct3d11.c | 2 ++
 modules/video_output/win32/direct3d9.c  | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 7678d73b89..71e2ae19d8 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -662,6 +662,9 @@ typedef struct
     libvlc_video_color_space_t colorspace;              /** video color space */
     libvlc_video_color_primaries_t primaries;       /** video color primaries */
     libvlc_video_transfer_func_t transfer;        /** video transfer function */
+
+    unsigned source_width;                    /** original width of the video */
+    unsigned source_height;                  /** original height of the video */
 } libvlc_video_direct3d_cfg_t;
 
 typedef struct
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 49d487ef1c..7e9b5b5b83 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -268,6 +268,8 @@ static int QueryDisplayFormat(vout_display_t *vd, const video_format_t *fmt)
 
     cfg.width  = sys->area.vdcfg.display.width;
     cfg.height = sys->area.vdcfg.display.height;
+    cfg.source_width  = fmt->i_visible_width;
+    cfg.source_height = fmt->i_visible_height;
 
     switch (fmt->i_chroma)
     {
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 69a4665e3e..41f14be187 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -579,6 +579,8 @@ static int UpdateOutput(vout_display_t *vd, const video_format_t *fmt)
     libvlc_video_direct3d_cfg_t cfg;
     cfg.width  = sys->area.vdcfg.display.width;
     cfg.height = sys->area.vdcfg.display.height;
+    cfg.source_width  = fmt->i_visible_width;
+    cfg.source_height = fmt->i_visible_height;
 
     switch (fmt->i_chroma)
     {
-- 
2.17.1



More information about the vlc-devel mailing list