From d419ecd161634e79dab3ac57d57c4bccba2adcdc Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Thu, 15 Jan 2009 01:07:12 +0200 Subject: [PATCH] OSD: Ensure that OSD content is drawn in filter-added frames Move the OSD drawing calls from filter_video() to higher-level code to ensure that VOs will draw the OSD also in filter-added frames, which are displayed without a separate call to filter_video(). --- libmpcodecs/dec_video.c | 9 +-------- libmpcodecs/dec_video.h | 3 +-- mencoder.c | 14 ++++++++++++-- mplayer.c | 12 +++++++----- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index 8cdc3e7b1d..ef44399e82 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -455,20 +455,13 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size, return mpi; } -int filter_video(sh_video_t *sh_video, void *frame, double pts, - struct osd_state *osd) +int filter_video(sh_video_t *sh_video, void *frame, double pts) { mp_image_t *mpi = frame; unsigned int t2 = GetTimer(); vf_instance_t *vf = sh_video->vfilter; // apply video filters and call the leaf vo/ve int ret = vf->put_image(vf, mpi, pts); - if (ret > 0) { -#ifdef CONFIG_ASS - vf->control(vf, VFCTRL_DRAW_EOSD, NULL); -#endif - vf->control(vf, VFCTRL_DRAW_OSD, osd); - } t2 = GetTimer() - t2; vout_time_usage += t2 * 0.000001; diff --git a/libmpcodecs/dec_video.h b/libmpcodecs/dec_video.h index 463304bde5..606fbe946e 100644 --- a/libmpcodecs/dec_video.h +++ b/libmpcodecs/dec_video.h @@ -12,8 +12,7 @@ int init_best_video_codec(sh_video_t *sh_video, char** video_codec_list, char** void uninit_video(sh_video_t *sh_video); void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size, int drop_frame, double pts); -int filter_video(sh_video_t *sh_video, void *frame, double pts, - struct osd_state *osd); +int filter_video(sh_video_t *sh_video, void *frame, double pts); int get_video_quality_max(sh_video_t *sh_video); void set_video_quality(sh_video_t *sh_video, int quality); diff --git a/mencoder.c b/mencoder.c index 52edeeac88..600afd1276 100644 --- a/mencoder.c +++ b/mencoder.c @@ -1346,7 +1346,13 @@ default: sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SET_OSD_OBJ, osd); {void *decoded_frame = decode_video(sh_video,frame_data.start,frame_data.in_size, skip_flag>0 && (!sh_video->vfilter || sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) != CONTROL_TRUE), MP_NOPTS_VALUE); - blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE, osd);} + blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE); + if (blit_frame) { + struct vf_instance *vf = sh_video->vfilter; + vf->control(vf, VFCTRL_DRAW_EOSD, NULL); + vf->control(vf, VFCTRL_DRAW_OSD, osd); + } + } if (sh_video->vf_initialized < 0) mencoder_exit(1, NULL); @@ -1711,7 +1717,11 @@ static int slowseek(float end_pts, demux_stream_t *d_video, demux_stream_t *d_au int softskip = (vfilter->control(vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) == CONTROL_TRUE); void *decoded_frame = decode_video(sh_video, frame_data->start, frame_data->in_size, !softskip, MP_NOPTS_VALUE); if (decoded_frame) - filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE, osd); + if (filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE)) { + struct vf_instance *vf = sh_video->vfilter; + vf->control(vf, VFCTRL_DRAW_EOSD, NULL); + vf->control(vf, VFCTRL_DRAW_OSD, osd); + } } if (print_info) mp_msg(MSGT_MENCODER, MSGL_STATUS, diff --git a/mplayer.c b/mplayer.c index 5d16cd9e57..cf94ad048f 100644 --- a/mplayer.c +++ b/mplayer.c @@ -2223,8 +2223,7 @@ static double update_video_nocorrect_pts(struct MPContext *mpctx, 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, - mpctx->osd)) + if (filter_video(sh_video, decoded_frame, sh_video->pts)) break; } } @@ -2270,8 +2269,7 @@ static double update_video(struct MPContext *mpctx, int *blit_frame) 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, - mpctx->osd)) + if (filter_video(sh_video, decoded_frame, sh_video->pts)) break; } else if (hit_eof) return -1; @@ -3786,8 +3784,12 @@ if(!mpctx->sh_video) { mpctx->stop_play = PT_NEXT_ENTRY; goto goto_next_file; } - if (blit_frame) + if (blit_frame) { + struct vf_instance *vf = mpctx->sh_video->vfilter; + vf->control(vf, VFCTRL_DRAW_EOSD, NULL); + vf->control(vf, VFCTRL_DRAW_OSD, mpctx->osd); vo_osd_changed(0); + } if (frame_time < 0) mpctx->stop_play = AT_END_OF_FILE; else {