diff options
author | wm4 <wm4@nowhere> | 2014-10-27 16:17:46 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-27 16:17:55 +0100 |
commit | fcc360ccad4d611609c098db004cfbd58c8cd895 (patch) | |
tree | 6b0bb2341d374e59da71327693a4731a978c086b | |
parent | a95ce07273a7ee4b0f8db0d5de236d9708ddcd0d (diff) | |
download | mpv-fcc360ccad4d611609c098db004cfbd58c8cd895.tar.bz2 mpv-fcc360ccad4d611609c098db004cfbd58c8cd895.tar.xz |
x11: fix display FPS detection for interlaced modes
In interlaced modes, we output fields, not complete frames, so the
framerate doubles.
The method to calculate this was borrowed from xrandr code.
Hopefully fixes #1224.
-rw-r--r-- | video/out/x11_common.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 0ce669df6f..04f475ec5f 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -365,10 +365,15 @@ static void xrandr_read(struct vo_x11_state *x11) continue; if (x11->num_displays >= MAX_DISPLAYS) continue; + double vTotal = m.vTotal; + if (m.modeFlags & RR_DoubleScan) + vTotal *= 2; + if (m.modeFlags & RR_Interlace) + vTotal /= 2; struct xrandr_display d = { .rc = { crtc->x, crtc->y, crtc->x + crtc->width, crtc->y + crtc->height }, - .fps = m.dotClock / (m.hTotal * (double)m.vTotal), + .fps = m.dotClock / (m.hTotal * vTotal), }; int num = x11->num_displays++; MP_VERBOSE(x11, "Display %d: [%d, %d, %d, %d] @ %f FPS\n", |