1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-30 03:32:50 +00:00

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().
This commit is contained in:
Uoti Urpala 2009-01-15 01:07:12 +02:00
parent 2d532689fc
commit d419ecd161
4 changed files with 21 additions and 17 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -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 {