summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_vo.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-18 06:28:47 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-23 13:46:39 +0300
commit7521aac66509d18666b7737160153986cc1437ac (patch)
tree753deecae845a29694223461e6d3a397137966b1 /libmpcodecs/vf_vo.c
parent26039a38e3d5a2305e0ec93481df07c2717aa06d (diff)
downloadmpv-7521aac66509d18666b7737160153986cc1437ac.tar.bz2
mpv-7521aac66509d18666b7737160153986cc1437ac.tar.xz
Move global vo_config_count to vo struct
Remove the global and Add a corresponding field to the vo struct, plus another which tells whether the LAST config call was successful.The latter value which tells whether the VO should be properly configured at the moment seems a better match for the semantics actually needed in most places where the old value was used. The 'count' field with the old semantics is not currently used by anything, but I'm leaving it there for vo drivers which would need those semantics if converted to use the struct. Existing uses of the global outside old vo drivers are either converted to use the struct field or moved inside the vo_xyz() calls (instead of "if (vo_config_count) vo_flip_page(..." just call vo_flip_page which will now do nothing if not configured). The removal of the check in mpcommon.c/update_subtitles() is less trivial than the others, but I think it shouldn't cause problems.
Diffstat (limited to 'libmpcodecs/vf_vo.c')
-rw-r--r--libmpcodecs/vf_vo.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c
index 5074148a8c..4543f821b6 100644
--- a/libmpcodecs/vf_vo.c
+++ b/libmpcodecs/vf_vo.c
@@ -68,7 +68,6 @@ static int config(struct vf_instance_s* vf,
ass_configure(vf->priv->ass_priv, width, height, !!(vf->default_caps & VFCAP_EOSD_UNSCALED));
#endif
- ++vo_config_count;
return 1;
}
@@ -86,26 +85,26 @@ static int control(struct vf_instance_s* vf, int request, void* data)
return vo_control(video_out, VOCTRL_SET_DEINTERLACE, data) == VO_TRUE;
}
case VFCTRL_DRAW_OSD:
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
vo_draw_osd(video_out);
return CONTROL_TRUE;
case VFCTRL_FLIP_PAGE:
{
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
vo_flip_page(video_out);
return CONTROL_TRUE;
}
case VFCTRL_SET_EQUALIZER:
{
vf_equalizer_t *eq=data;
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
struct voctrl_set_equalizer_args param = {eq->item, eq->value};
return vo_control(video_out, VOCTRL_SET_EQUALIZER, &param) == VO_TRUE;
}
case VFCTRL_GET_EQUALIZER:
{
vf_equalizer_t *eq=data;
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
struct voctrl_get_equalizer_args param = {eq->item, &eq->value};
return vo_control(video_out, VOCTRL_GET_EQUALIZER, &param) == VO_TRUE;
}
@@ -122,7 +121,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
{
mp_eosd_images_t images = {NULL, 2};
double pts = vf->priv->pts;
- if (!vo_config_count || !vf->priv->ass_priv) return CONTROL_FALSE;
+ if (!video_out->config_ok || !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;
memset(&res, 0, sizeof(res));
@@ -162,13 +161,13 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
static void get_image(struct vf_instance_s* vf,
mp_image_t *mpi){
- if(vo_directrendering && vo_config_count)
+ if(vo_directrendering && video_out->config_ok)
vo_control(video_out, VOCTRL_GET_IMAGE, mpi);
}
static int put_image(struct vf_instance_s* vf,
mp_image_t *mpi, double pts){
- if(!vo_config_count) return 0; // vo not configured?
+ if(!video_out->config_ok) return 0; // vo not configured?
// record pts (potentially modified by filters) for main loop
vf->priv->pts = pts;
// first check, maybe the vo/vf plugin implements draw_image using mpi:
@@ -187,13 +186,13 @@ static int put_image(struct vf_instance_s* vf,
static void start_slice(struct vf_instance_s* vf,
mp_image_t *mpi) {
- if(!vo_config_count) return; // vo not configured?
+ if(!video_out->config_ok) return; // vo not configured?
vo_control(video_out, VOCTRL_START_SLICE,mpi);
}
static void draw_slice(struct vf_instance_s* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
- if(!vo_config_count) return; // vo not configured?
+ if(!video_out->config_ok) return; // vo not configured?
vo_draw_slice(video_out, src,stride,w,h,x,y);
}