summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-07-27 21:09:24 +0200
committerwm4 <wm4@nowhere>2015-07-27 21:09:24 +0200
commit51ca8a4b3e87cf0ab8c5a7925de8739e29617f49 (patch)
tree8916806fed7a0c9e409441bb8fa81665aa6c4884 /video
parent5c8dd832bbf636f6849d47d8e50dba433d8f5af3 (diff)
downloadmpv-51ca8a4b3e87cf0ab8c5a7925de8739e29617f49.tar.bz2
mpv-51ca8a4b3e87cf0ab8c5a7925de8739e29617f49.tar.xz
vo_rpi: determine and return display refresh rate
Reverse engineered from tvservice.c.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_rpi.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/video/out/vo_rpi.c b/video/out/vo_rpi.c
index f144deb4b7..cd9a0aef17 100644
--- a/video/out/vo_rpi.c
+++ b/video/out/vo_rpi.c
@@ -62,6 +62,7 @@ struct priv {
DISPMANX_RESOURCE_HANDLE_T window_back;
DISPMANX_UPDATE_HANDLE_T update;
uint32_t w, h;
+ double display_fps;
struct osd_part osd_parts[MAX_OSD_PARTS];
double osd_pts;
@@ -296,6 +297,26 @@ static int update_display_size(struct vo *vo)
return -1;
}
+ p->display_fps = 0;
+ TV_GET_STATE_RESP_T tvstate;
+ TV_DISPLAY_STATE_T tvstate_disp;
+ if (!vc_tv_get_state(&tvstate) && !vc_tv_get_display_state(&tvstate_disp)) {
+ if (tvstate_disp.state & (VC_HDMI_HDMI | VC_HDMI_DVI)) {
+ p->display_fps = tvstate_disp.display.hdmi.frame_rate;
+
+ HDMI_PROPERTY_PARAM_T param = {
+ .property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE,
+ };
+ if (!vc_tv_hdmi_get_property(&param) &&
+ param.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC)
+ p->display_fps = p->display_fps / 1.001;
+ } else {
+ p->display_fps = tvstate_disp.display.sdtv.frame_rate;
+ }
+ }
+
+ vo_event(vo, VO_EVENT_WIN_STATE);
+
vc_dispmanx_update_submit_sync(p->update);
p->update = vc_dispmanx_update_start(10);
@@ -537,6 +558,9 @@ static int control(struct vo *vo, uint32_t request, void *data)
resize(vo);
}
return VO_TRUE;
+ case VOCTRL_GET_DISPLAY_FPS:
+ *(double *)data = p->display_fps;
+ return VO_TRUE;
}
return VO_NOTIMPL;