From 22d8d77b131796c280bebc4c49b18dc4066446b2 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 23 Aug 2019 13:41:54 +0900 Subject: [PATCH] d3d11videosink: Use pixel aspect ratio to setup window draw area ... instead of calculated display ratio from given PAR and DAR. d3d11window calculates output display ratio to decide padding area per window resize event. In the formula, actual PAR is required to handle both 1:1 PAR and non-1:1 PAR. --- sys/d3d11/gstd3d11videosink.c | 3 ++- sys/d3d11/gstd3d11window.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/d3d11/gstd3d11videosink.c b/sys/d3d11/gstd3d11videosink.c index 275295fe17..1f1c425912 100644 --- a/sys/d3d11/gstd3d11videosink.c +++ b/sys/d3d11/gstd3d11videosink.c @@ -348,7 +348,8 @@ gst_d3d11_video_sink_set_caps (GstBaseSink * sink, GstCaps * caps) GST_OBJECT_UNLOCK (self); if (!gst_d3d11_window_prepare (self->window, GST_VIDEO_SINK_WIDTH (self), - GST_VIDEO_SINK_HEIGHT (self), num, den, self->dxgi_format, caps)) { + GST_VIDEO_SINK_HEIGHT (self), video_par_n, video_par_d, + self->dxgi_format, caps)) { GST_ERROR_OBJECT (self, "cannot create swapchain"); return FALSE; } diff --git a/sys/d3d11/gstd3d11window.c b/sys/d3d11/gstd3d11window.c index 3f4c54b0b0..2362149554 100644 --- a/sys/d3d11/gstd3d11window.c +++ b/sys/d3d11/gstd3d11window.c @@ -508,7 +508,7 @@ gst_d3d11_window_on_resize (GstD3D11Device * device, GstD3D11Window * window) src_ratio = (gdouble) width / height; dst_ratio = - (gdouble) window->surface_width / window->surface_height * aspect_ratio; + (gdouble) window->surface_width / window->surface_height / aspect_ratio; src_rect.x = 0; src_rect.y = 0; -- 2.34.1