summaryrefslogtreecommitdiffstats
path: root/libvo
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 /libvo
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 'libvo')
-rw-r--r--libvo/old_vo_defines.h1
-rw-r--r--libvo/video_out.c17
-rw-r--r--libvo/video_out.h4
-rw-r--r--libvo/vo_xv.c2
4 files changed, 17 insertions, 7 deletions
diff --git a/libvo/old_vo_defines.h b/libvo/old_vo_defines.h
index 285758038e..ef52e52256 100644
--- a/libvo/old_vo_defines.h
+++ b/libvo/old_vo_defines.h
@@ -9,5 +9,6 @@
#define IS_OLD_VO 1
#define vo_ontop global_vo->opts->vo_ontop
+#define vo_config_count global_vo->config_count
#endif
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 3a6b57347a..6cab65d25f 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -35,8 +35,6 @@ int vo_depthonscreen=0;
int vo_screenwidth=0;
int vo_screenheight=0;
-int vo_config_count=0;
-
// requested resolution/bpp: (-x -y -bpp options)
int vo_dx=0;
int vo_dy=0;
@@ -260,6 +258,8 @@ int vo_control(struct vo *vo, uint32_t request, void *data)
int vo_draw_frame(struct vo *vo, uint8_t *src[])
{
+ if (!vo->config_ok)
+ return 0;
return vo->driver->draw_frame(vo, src);
}
@@ -270,16 +270,22 @@ int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int
void vo_draw_osd(struct vo *vo)
{
+ if (!vo->config_ok)
+ return;
vo->driver->draw_osd(vo);
}
void vo_flip_page(struct vo *vo)
{
+ if (!vo->config_ok)
+ return;
vo->driver->flip_page(vo);
}
void vo_check_events(struct vo *vo)
{
+ if (!vo->config_ok)
+ return;
vo->driver->check_events(vo);
}
@@ -371,8 +377,11 @@ int vo_config(struct vo *vo, uint32_t width, uint32_t height,
vo_dheight = d_height;
}
- return vo->driver->config(vo, width, height, d_width, d_height, flags,
- title, format);
+ int ret = vo->driver->config(vo, width, height, d_width, d_height, flags,
+ title, format);
+ vo->config_ok = (ret == 0);
+ vo->config_count += vo->config_ok;
+ return ret;
}
#if defined(HAVE_FBDEV)||defined(HAVE_VESA)
diff --git a/libvo/video_out.h b/libvo/video_out.h
index c1ba46e59f..1870af17d3 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -207,6 +207,8 @@ struct vo_old_functions {
};
struct vo {
+ int config_ok; // Last config call was successful?
+ int config_count; // Total number of successful config calls
const struct vo_driver *driver;
void *priv;
struct MPOpts *opts;
@@ -233,8 +235,6 @@ extern const struct vo_driver *video_out_drivers[];
extern int vo_flags;
-extern int vo_config_count;
-
extern int xinerama_screen;
extern int xinerama_x;
extern int xinerama_y;
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index b324912658..bc8a5015e7 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -867,7 +867,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_GUISUPPORT:
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
- if (!vo_config_count || !vo_fs)
+ if (!vo->config_ok || !vo_fs)
return VO_FALSE;
return VO_TRUE;
case VOCTRL_FULLSCREEN: