diff options
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/video_out.c | 3 | ||||
-rw-r--r-- | libvo/video_out.h | 2 | ||||
-rw-r--r-- | libvo/vo_x11.c | 6 | ||||
-rw-r--r-- | libvo/vo_xv.c | 9 | ||||
-rw-r--r-- | libvo/x11_common.c | 13 |
5 files changed, 21 insertions, 12 deletions
diff --git a/libvo/video_out.c b/libvo/video_out.c index d2c2f439df..a17fc9aa28 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -330,7 +330,7 @@ void list_video_out(void) mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n"); } -struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11, +struct vo *init_best_video_out(struct MPOpts *opts, struct mp_fifo *key_fifo, struct input_ctx *input_ctx) { @@ -339,7 +339,6 @@ struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11, struct vo *vo = talloc_ptrtype(NULL, vo); struct vo initial_values = { .opts = opts, - .x11 = x11, .key_fifo = key_fifo, .input_ctx = input_ctx, .event_fd = -1, diff --git a/libvo/video_out.h b/libvo/video_out.h index 62bbf89975..203e6b47b7 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -297,7 +297,7 @@ struct vo { char *window_title; }; -struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11, +struct vo *init_best_video_out(struct MPOpts *opts, struct mp_fifo *key_fifo, struct input_ctx *input_ctx); int vo_config(struct vo *vo, uint32_t width, uint32_t height, diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c index cee2b0bf0c..75cd7e4415 100644 --- a/libvo/vo_x11.c +++ b/libvo/vo_x11.c @@ -585,10 +585,8 @@ static int query_format(uint32_t format) static void uninit(void) { - if (!myximage) - return; - - freeMyXImage(); + if (myximage) + freeMyXImage(); #ifdef CONFIG_XF86VM vo_vm_close(); diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index df9bb69aa1..65581dac35 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -595,9 +595,13 @@ static int preinit(struct vo *vo, const char *arg) strarg_t ck_method_arg = { 0, NULL }; struct xvctx *ctx = talloc_zero(vo, struct xvctx); vo->priv = ctx; - struct vo_x11_state *x11 = vo->x11; int xv_adaptor = -1; + if (!vo_init(vo)) + return -1; + + struct vo_x11_state *x11 = vo->x11; + const opt_t subopts[] = { /* name arg type arg var test */ @@ -618,9 +622,6 @@ static int preinit(struct vo *vo, const char *arg) /* modify colorkey settings according to the given options */ xv_setup_colorkeyhandling(vo, ck_method_arg.str, ck_src_arg.str); - if (!vo_init(vo)) - return -1; - /* check for Xvideo extension */ unsigned int ver, rel, req, ev, err; if (Success != XvQueryExtension(x11->display, &ver, &rel, &req, &ev, &err)) { diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 9f580ba47a..65140359f2 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -383,7 +383,6 @@ void update_xinerama_info(struct vo *vo) { int vo_init(struct vo *vo) { struct MPOpts *opts = vo->opts; - struct vo_x11_state *x11 = vo->x11; // int mScreen; int depth, bpp; unsigned int mask; @@ -396,6 +395,12 @@ int vo_init(struct vo *vo) XWindowAttributes attribs; char *dispName; + if (vo->x11) + return 1; + + vo->x11 = vo_x11_init_state(); + struct vo_x11_state *x11 = vo->x11; + if (vo_rootwin) WinID = 0; // use root window @@ -422,6 +427,8 @@ int vo_init(struct vo *vo) { mp_msg(MSGT_VO, MSGL_ERR, "vo: couldn't open the X11 display (%s)!\n", dispName); + talloc_free(x11); + vo->x11 = NULL; return 0; } x11->screen = DefaultScreen(x11->display); // screen ID @@ -524,6 +531,8 @@ int vo_init(struct vo *vo) void vo_uninit(struct vo_x11_state *x11) { + if (!x11) + return; if (!x11->display) { mp_msg(MSGT_VO, MSGL_V, @@ -765,6 +774,8 @@ void vo_x11_uninit(struct vo *vo) x11->last_video_height = 0; x11->size_changed_during_fs = false; } + vo_uninit(x11); + vo->x11 = NULL; } static int check_resize(struct vo *vo) |