summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-11-22 14:15:12 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-11-22 14:15:12 +0200
commit4c552b2e420ba4cb6d888b12360c7bf63e7cd03a (patch)
tree0bbd2f0627a3abef249c9ad499cd84b1ad560384 /mplayer.c
parentac8e40b4ff9318c1d607f7158131e091897d07e7 (diff)
downloadmpv-4c552b2e420ba4cb6d888b12360c7bf63e7cd03a.tar.bz2
mpv-4c552b2e420ba4cb6d888b12360c7bf63e7cd03a.tar.xz
core: Do OSD/subtitle updates at a more accurate point
OSD contents such as video position and non-libass subtitles were updated just before feeding a video frame through filters. The updates were done at that point mainly for the benefit of vf_expand OSD rendering functionality, which draws the OSD contents when the frame passes through that filter. However this gave the wrong results for VO-drawn OSD if the filter chain or VO had any delay or timestamp manipulation: the OSD contents should reflect the most recent contents that were _output_ after any filtering, not the last frame that was fed _into_ the filtering machinery. This issue became more important after vo_vdpau started buffering frames by default. Move the OSD updates to be done just before the OSD is drawn, using the most accurate available information. This fixes the common case but worsens vf_expand OSD behavior (adding extra latency). A special case could be added to fall back to the previous behavior when vf_expand OSD is being used; however I don't consider that a high priority at the moment especially when other problems with vf_expand OSD would still remain. This has little effect on libass-rendered subtitles either way, because both vf_ass and VO libass rendering use timestamps from the filter chain and do not rely on separate position updates.
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/mplayer.c b/mplayer.c
index 4f79242c54..763b0de347 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2314,11 +2314,6 @@ static double update_video_nocorrect_pts(struct MPContext *mpctx,
mp_dvdnav_save_smpi(mpctx, in_size, packet, decoded_frame);
#endif
if (decoded_frame) {
- // These updates are done here for vf_expand OSD/subtitles
- update_subtitles(mpctx, &mpctx->opts, sh_video, sh_video->pts,
- mpctx->video_offset, mpctx->d_sub, 0);
- update_teletext(sh_video, mpctx->demuxer, 0);
- update_osd_msg(mpctx);
current_module = "filter video";
if (filter_video(sh_video, decoded_frame, sh_video->pts))
break;
@@ -2399,11 +2394,6 @@ static double update_video(struct MPContext *mpctx, int *blit_frame)
framedrop_type, pts);
if (decoded_frame) {
determine_frame_pts(mpctx);
- // These updates are done here for vf_expand OSD/subtitles
- update_subtitles(mpctx, &mpctx->opts, sh_video, sh_video->pts,
- mpctx->video_offset, mpctx->d_sub, 0);
- update_teletext(sh_video, mpctx->demuxer, 0);
- update_osd_msg(mpctx);
current_module = "filter video";
if (filter_video(sh_video, decoded_frame, sh_video->pts))
if (!video_out->config_ok)
@@ -4048,6 +4038,11 @@ if(!mpctx->sh_video) {
goto goto_next_file;
}
if (blit_frame) {
+ struct sh_video *sh_video = mpctx->sh_video;
+ update_subtitles(mpctx, &mpctx->opts, sh_video, sh_video->pts,
+ mpctx->video_offset, mpctx->d_sub, 0);
+ update_teletext(sh_video, mpctx->demuxer, 0);
+ update_osd_msg(mpctx);
struct vf_instance *vf = mpctx->sh_video->vfilter;
vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
vf->control(vf, VFCTRL_DRAW_OSD, mpctx->osd);