mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
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.
This commit is contained in:
parent
ac8e40b4ff
commit
4c552b2e42
15
mplayer.c
15
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);
|
||||
|
Loading…
Reference in New Issue
Block a user