summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-15 20:46:57 +0200
committerwm4 <wm4@nowhere>2014-06-15 20:53:15 +0200
commit716285782d5e4b264e18e253e9d58980183c76c6 (patch)
treeb03e6e0ead71828f9d68bdebe777a808bee5d26f /player
parentd88aca6fb2474617136b09c2f281860d6a0a1a38 (diff)
downloadmpv-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 'player')
-rw-r--r--player/main.c1
-rw-r--r--player/playloop.c41
-rw-r--r--player/screenshot.c2
-rw-r--r--player/video.c1
4 files changed, 12 insertions, 33 deletions
diff --git a/player/main.c b/player/main.c
index b7e683ad05..ee78fccbaf 100644
--- a/player/main.c
+++ b/player/main.c
@@ -435,6 +435,7 @@ int mp_initialize(struct MPContext *mpctx)
if (opts->force_vo) {
opts->fixed_vo = 1;
mpctx->video_out = init_best_video_out(mpctx->global, mpctx->input,
+ mpctx->osd,
mpctx->encode_lavc_ctx);
if (!mpctx->video_out) {
MP_FATAL(mpctx, "Error opening/initializing "
diff --git a/player/playloop.c b/player/playloop.c
index c06c40bd73..96326da57c 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -132,26 +132,6 @@ end:
mp_notify(mpctx, mpctx->opts->pause ? MPV_EVENT_PAUSE : MPV_EVENT_UNPAUSE, 0);
}
-static void draw_osd(struct MPContext *mpctx)
-{
- struct vo *vo = mpctx->video_out;
-
- osd_set_vo_pts(mpctx->osd, mpctx->video_pts);
- vo_draw_osd(vo, mpctx->osd);
-}
-
-static bool redraw_osd(struct MPContext *mpctx)
-{
- struct vo *vo = mpctx->video_out;
- if (vo_redraw_frame(vo) < 0)
- return false;
-
- draw_osd(mpctx);
-
- vo_flip_page(vo, 0, -1);
- return true;
-}
-
void add_step_frame(struct MPContext *mpctx, int dir)
{
if (!mpctx->d_video)
@@ -630,13 +610,11 @@ static bool handle_osd_redraw(struct MPContext *mpctx)
if (!mpctx->video_out || !mpctx->video_out->config_ok)
return false;
bool want_redraw = vo_get_want_redraw(mpctx->video_out) |
- (osd_query_and_reset_want_redraw(mpctx->osd) &&
- mpctx->video_out->driver->draw_osd);
- if (want_redraw) {
- if (redraw_osd(mpctx))
- return true;
- }
- return false;
+ osd_query_and_reset_want_redraw(mpctx->osd);
+ if (!want_redraw)
+ return false;
+ vo_redraw(mpctx->video_out);
+ return true;
}
static void handle_metadata_update(struct MPContext *mpctx)
@@ -890,7 +868,7 @@ void handle_force_window(struct MPContext *mpctx, bool reconfig)
.d_w = w, .d_h = h,
};
vo_reconfig(vo, &p, 0);
- redraw_osd(mpctx);
+ vo_redraw(vo);
mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL);
}
}
@@ -1103,9 +1081,7 @@ void run_playloop(struct MPContext *mpctx)
//=================== FLIP PAGE (VIDEO BLT): ======================
- MP_STATS(mpctx, "vo draw frame");
- vo_new_frame_imminent(vo);
mpctx->video_pts = mpctx->video_next_pts;
mpctx->last_vo_pts = mpctx->video_pts;
mpctx->playback_pts = mpctx->video_pts;
@@ -1113,8 +1089,9 @@ void run_playloop(struct MPContext *mpctx)
update_subtitles(mpctx);
update_osd_msg(mpctx);
- MP_STATS(mpctx, "draw OSD");
- draw_osd(mpctx);
+ MP_STATS(mpctx, "vo draw frame");
+
+ vo_new_frame_imminent(vo);
MP_STATS(mpctx, "vo sleep");
diff --git a/player/screenshot.c b/player/screenshot.c
index 1c3177cff7..30eceedafc 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -304,7 +304,7 @@ static void add_subs(struct MPContext *mpctx, struct mp_image *image)
.display_par = sar / dar,
};
- osd_draw_on_image(mpctx->osd, res, osd_get_vo_pts(mpctx->osd),
+ osd_draw_on_image(mpctx->osd, res, mpctx->video_pts,
OSD_DRAW_SUB_ONLY, image);
}
diff --git a/player/video.c b/player/video.c
index 50f0956f1e..e0aeaadf9e 100644
--- a/player/video.c
+++ b/player/video.c
@@ -187,6 +187,7 @@ int reinit_video_chain(struct MPContext *mpctx)
//================== Init VIDEO (codec & libvo) ==========================
if (!opts->fixed_vo || !(mpctx->initialized_flags & INITIALIZED_VO)) {
mpctx->video_out = init_best_video_out(mpctx->global, mpctx->input,
+ mpctx->osd,
mpctx->encode_lavc_ctx);
if (!mpctx->video_out) {
MP_FATAL(mpctx, "Error opening/initializing "