[mythtv] [PATCH] Potential display aspect ratio patch for non-4:3
Mike Wilcox
mike at trouble.org.uk
Tue Feb 10 08:21:20 EST 2004
Chris Pinkham wrote:
>I shortened the above to this by eliminating some of the temp variables.
>
> if (GetDisplayAspect() > (XJ_aspect * 0.97))
> {
> float pixNeeded = h_mm * XJ_aspect * ((float)dispw / w_mm);
>
> dispxoff += (dispwoff - (int)pixNeeded) / 2;
> dispwoff = (int)pixNeeded;
> }
>
>Seems to work correctly. I changed the "16:9 video on non-16:9 display"
>accordingly as well with this:
>
> if ((GetDisplayAspect() * 0.97) < XJ_aspect)
> {
> float pixNeeded = (w_mm / XJ_aspect) * ((float)disph / h_mm);
>
> dispyoff += (disphoff - (int)pixNeeded) / 2;
> disphoff = (int)pixNeeded;
> }
>
>I'm going to do some more testing and will commit this when I commit
>some other stuff I've been working on.
>
>
This change, along with one made in videoout_xv.cpp causes a problem
when using a frontend that isn't a full-screen device (ie, displayed in
a window smaller than fullscreen), or (probably) when using Xinerama.
In my case, where I have a window of size 1200x904 on a 1600x1200
display, applying this algorithm to a 16:9 video results in an output
size of 1200x903 - and a displayed video that is *much* too tall.
I *think* the base of the problem is that videoout_xv is a little loose
with setting the height, width and aspect when the output is not full
screen - it assumes the display has an aspect that matches the video,
which causes the above code to always fill the window, irrespective of
window & video aspect. I can't tell if the aspect is being used as a
sentinel for something else though...
The solution would be to calculate the window's aspect, based on the
full display size, and works for me. Something like this, probably with
a little more paranoia, and repeated in _viaslice and _xvmc:
*** ./libs/libmythtv/videoout_xv.cpp 5 Feb 2004 22:50:45 -0000 1.96
--- ./libs/libmythtv/videoout_xv.cpp 10 Feb 2004 12:53:09 -0000
***************
*** 224,236 ****
usingXinerama =
(XineramaQueryExtension(data->XJ_disp, &event_base,
&error_base) &&
XineramaIsActive(data->XJ_disp));
! if (w_mm == 0 || h_mm == 0 || usingXinerama ||
! gContext->GetNumSetting("GuiSizeForTV", 0))
{
w_mm = (int)(300 * XJ_aspect);
h_mm = 300;
data->display_aspect = XJ_aspect;
}
else
data->display_aspect = (float)w_mm/h_mm;
--- 224,242 ----
usingXinerama =
(XineramaQueryExtension(data->XJ_disp, &event_base,
&error_base) &&
XineramaIsActive(data->XJ_disp));
! if (w_mm == 0 || h_mm == 0 || usingXinerama)
{
w_mm = (int)(300 * XJ_aspect);
h_mm = 300;
data->display_aspect = XJ_aspect;
}
+ else if (gContext->GetNumSetting("GuiSizeForTV", 0)) {
+ int w = DisplayWidth(data->XJ_disp, XJ_screen_num);
+ int h = DisplayHeight(data->XJ_disp, XJ_screen_num);
+ w_mm = w_mm * gContext->GetNumSetting("GuiWidth", w) / w;
+ h_mm = h_mm * gContext->GetNumSetting("GuiHeight", h) / h;
+ data->display_aspect = (float)w_mm/h_mm;
+ }
else
data->display_aspect = (float)w_mm/h_mm;
Cheers,
Mike
More information about the mythtv-dev
mailing list