diff options
author | wm4 <wm4@nowhere> | 2014-06-15 20:46:57 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-06-15 20:53:15 +0200 |
commit | 716285782d5e4b264e18e253e9d58980183c76c6 (patch) | |
tree | b03e6e0ead71828f9d68bdebe777a808bee5d26f /video/out/vo.c | |
parent | d88aca6fb2474617136b09c2f281860d6a0a1a38 (diff) | |
download | mpv-716285782d5e4b264e18e253e9d58980183c76c6.tar.bz2 mpv-716285782d5e4b264e18e253e9d58980183c76c6.tar.xz |
video/out: change aspects of OSD handling
Let the VOs draw the OSD on their own, instead of making OSD drawing a
separate VO driver call. Further, let it be the VOs responsibility to
request subtitles with the correct PTS. We also basically allow the VO
to request OSD/subtitles at any time.
OSX changes untested.
Diffstat (limited to 'video/out/vo.c')
-rw-r--r-- | video/out/vo.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/video/out/vo.c b/video/out/vo.c index 76f980ce5a..98601f0324 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -152,7 +152,7 @@ static int event_fd_callback(void *ctx, int fd) } static struct vo *vo_create(struct mpv_global *global, - struct input_ctx *input_ctx, + struct input_ctx *input_ctx, struct osd_state *osd, struct encode_lavc_context *encode_lavc_ctx, char *name, char **args) { @@ -171,6 +171,7 @@ static struct vo *vo_create(struct mpv_global *global, .global = global, .encode_lavc_ctx = encode_lavc_ctx, .input_ctx = input_ctx, + .osd = osd, .event_fd = -1, .monitor_par = 1, .max_video_queue = 1, @@ -198,6 +199,7 @@ error: struct vo *init_best_video_out(struct mpv_global *global, struct input_ctx *input_ctx, + struct osd_state *osd, struct encode_lavc_context *encode_lavc_ctx) { struct m_obj_settings *vo_list = global->opts->vo.video_driver_list; @@ -207,7 +209,7 @@ struct vo *init_best_video_out(struct mpv_global *global, // Something like "-vo name," allows fallback to autoprobing. if (strlen(vo_list[n].name) == 0) goto autoprobe; - struct vo *vo = vo_create(global, input_ctx, encode_lavc_ctx, + struct vo *vo = vo_create(global, input_ctx, osd, encode_lavc_ctx, vo_list[n].name, vo_list[n].attribs); if (vo) return vo; @@ -217,7 +219,7 @@ struct vo *init_best_video_out(struct mpv_global *global, autoprobe: // now try the rest... for (int i = 0; video_out_drivers[i]; i++) { - struct vo *vo = vo_create(global, input_ctx, encode_lavc_ctx, + struct vo *vo = vo_create(global, input_ctx, osd, encode_lavc_ctx, (char *)video_out_drivers[i]->name, NULL); if (vo) return vo; @@ -321,15 +323,6 @@ double vo_get_next_pts(struct vo *vo, int index) return vo->video_queue[index]->pts; } -int vo_redraw_frame(struct vo *vo) -{ - if (vo->config_ok && vo_control(vo, VOCTRL_REDRAW_FRAME, NULL) == true) { - vo->want_redraw = false; - return 0; - } - return -1; -} - bool vo_get_want_redraw(struct vo *vo) { return vo->config_ok && vo->want_redraw; @@ -354,12 +347,6 @@ void vo_new_frame_imminent(struct vo *vo) vo->hasframe = true; } -void vo_draw_osd(struct vo *vo, struct osd_state *osd) -{ - if (vo->config_ok && vo->driver->draw_osd) - vo->driver->draw_osd(vo, osd); -} - void vo_flip_page(struct vo *vo, int64_t pts_us, int duration) { if (!vo->config_ok) @@ -371,6 +358,13 @@ void vo_flip_page(struct vo *vo, int64_t pts_us, int duration) vo->driver->flip_page(vo); } +void vo_redraw(struct vo *vo) +{ + vo->want_redraw = false; + if (vo->config_ok && vo_control(vo, VOCTRL_REDRAW_FRAME, NULL) == true) + vo_flip_page(vo, 0, -1); +} + void vo_check_events(struct vo *vo) { vo_control(vo, VOCTRL_CHECK_EVENTS, NULL); |