Use vf control for reading pts from vf_vo

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20922 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
uau 2006-11-14 14:02:55 +00:00
parent 50208828f7
commit 45200bc6df
3 changed files with 14 additions and 14 deletions

View File

@ -79,6 +79,7 @@ typedef struct vf_seteq_s
#define VFCTRL_SCREENSHOT 14 /* Make a screenshot */
#define VFCTRL_INIT_EOSD 15 /* Select EOSD renderer */
#define VFCTRL_DRAW_EOSD 16 /* Render EOSD */
#define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/
#include "vfcap.h"

View File

@ -21,18 +21,14 @@ extern ass_track_t* ass_track;
extern int sub_visibility;
extern float sub_delay;
typedef struct vf_vo_data_s {
struct vf_priv_s {
double pts;
vo_functions_t *vo;
} vf_vo_data_t;
struct vf_priv_s {
vf_vo_data_t* vf_vo_data;
#ifdef USE_ASS
ass_renderer_t* ass_priv;
#endif
};
#define video_out (vf->priv->vf_vo_data->vo)
#define video_out (vf->priv->vo)
static int query_format(struct vf_instance_s* vf, unsigned int fmt); /* forward declaration */
@ -115,7 +111,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
case VFCTRL_DRAW_EOSD:
{
ass_image_t* images = 0;
double pts = vf->priv->vf_vo_data->pts;
double pts = vf->priv->pts;
if (!vo_config_count || !vf->priv->ass_priv) return CONTROL_FALSE;
if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE)) {
mp_eosd_res_t res;
@ -130,6 +126,11 @@ static int control(struct vf_instance_s* vf, int request, void* data)
return (video_out->control(VOCTRL_DRAW_EOSD, images) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
}
#endif
case VFCTRL_GET_PTS:
{
*(double *)data = vf->priv->pts;
return CONTROL_TRUE;
}
}
// return video_out->control(request,data);
return CONTROL_UNKNOWN;
@ -154,7 +155,7 @@ static int put_image(struct vf_instance_s* vf,
mp_image_t *mpi, double pts){
if(!vo_config_count) return 0; // vo not configured?
// record pts (potentially modified by filters) for main loop
vf->priv->vf_vo_data->pts = pts;
vf->priv->pts = pts;
// first check, maybe the vo/vf plugin implements draw_image using mpi:
if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done.
// nope, fallback to old draw_frame/draw_slice:
@ -203,7 +204,7 @@ static int open(vf_instance_t *vf, char* args){
vf->start_slice=start_slice;
vf->uninit=uninit;
vf->priv=calloc(1, sizeof(struct vf_priv_s));
vf->priv->vf_vo_data=(vf_vo_data_t*)args;
vf->priv->vo = (vo_functions_t *)args;
if(!video_out) return 0; // no vo ?
// if(video_out->preinit(args)) return 0; // preinit failed
return 1;

View File

@ -3084,8 +3084,6 @@ char *tmp;
int gui_no_filename=0;
struct {double pts; vo_functions_t *vo;} vf_vo_data;
srand((int) time(NULL));
InitTimer();
@ -4107,10 +4105,9 @@ sh_video->video_out=video_out;
inited_flags|=INITED_VO;
}
vf_vo_data.vo = video_out;
current_module="init_video_filters";
{
char* vf_arg[] = { "_oldargs_", (char*)&vf_vo_data , NULL };
char* vf_arg[] = { "_oldargs_", (char*)video_out , NULL };
sh_video->vfilter=(void*)vf_open_filter(NULL,"vo",vf_arg);
}
#ifdef HAVE_MENU
@ -4385,7 +4382,8 @@ if(!sh_video) {
eof = 1;
break;
}
sh_video->pts = vf_vo_data.pts;
((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter,
VFCTRL_GET_PTS, &sh_video->pts);
if (sh_video->pts == MP_NOPTS_VALUE) {
mp_msg(MSGT_CPLAYER, MSGL_ERR, "pts after filters MISSING\n");
sh_video->pts = last_pts;