summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-30 11:06:55 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-30 14:46:17 +0300
commitbfcb3a7a8130be478103beb1923567f5e5d86c67 (patch)
treee8a376f6cebf586fff714f1b49b83c0e695b0cdb /libvo
parent32e52b8fd0b917a40a9192770cc1a41aa31b34d0 (diff)
downloadmpv-bfcb3a7a8130be478103beb1923567f5e5d86c67.tar.bz2
mpv-bfcb3a7a8130be478103beb1923567f5e5d86c67.tar.xz
input: Move key filedescriptor list to context struct
The context variable is now passed to VOs too as it's now needed to add a callback on the X filedescriptor.
Diffstat (limited to 'libvo')
-rw-r--r--libvo/video_out.c14
-rw-r--r--libvo/video_out.h4
-rw-r--r--libvo/vo_xv.c6
3 files changed, 16 insertions, 8 deletions
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 78f1f71743..42354c5f34 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -294,11 +294,18 @@ void list_video_out(void)
}
struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11,
- struct mp_fifo *key_fifo)
+ struct mp_fifo *key_fifo,
+ struct input_ctx *input_ctx)
{
char **vo_list = opts->video_driver_list;
int i;
struct vo *vo = talloc_ptrtype(NULL, vo);
+ struct vo initial_values = {
+ .opts = opts,
+ .x11 = x11,
+ .key_fifo = key_fifo,
+ .input_ctx = input_ctx,
+ };
// first try the preferred drivers, with their optional subdevice param:
if (vo_list && vo_list[0])
while (vo_list[0][0]) {
@@ -317,8 +324,7 @@ struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11,
const vo_info_t *info = video_driver->info;
if (!strcmp(info->short_name, name)) {
// name matches, try it
- *vo = (struct vo){.opts = opts, .x11 = x11,
- .key_fifo = key_fifo};
+ *vo = initial_values;
vo->driver = video_driver;
if (!vo_preinit(vo, vo_subdevice)) {
free(name);
@@ -336,7 +342,7 @@ struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11,
vo_subdevice = NULL;
for (i = 0; video_out_drivers[i]; i++) {
const struct vo_driver *video_driver = video_out_drivers[i];
- *vo = (struct vo){.opts = opts, .x11 = x11, key_fifo = key_fifo};
+ *vo = initial_values;
vo->driver = video_driver;
if (!vo_preinit(vo, vo_subdevice))
return vo; // success!
diff --git a/libvo/video_out.h b/libvo/video_out.h
index a62a9b335b..4e9f3abeae 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -214,6 +214,7 @@ struct vo {
struct MPOpts *opts;
struct vo_x11_state *x11;
struct mp_fifo *key_fifo;
+ struct input_ctx *input_ctx;
// requested position/resolution
int dx;
@@ -223,7 +224,8 @@ struct vo {
};
struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11,
- struct mp_fifo *key_fifo);
+ struct mp_fifo *key_fifo,
+ struct input_ctx *input_ctx);
int vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
char *title, uint32_t format);
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 29374ed0e6..01313a30bd 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -711,7 +711,7 @@ static void uninit(struct vo *vo)
vo_vm_close(vo);
#endif
if (ctx->event_fd_registered)
- mp_input_rm_key_fd(ConnectionNumber(vo->x11->display));
+ mp_input_rm_key_fd(vo->input_ctx, ConnectionNumber(vo->x11->display));
// uninit() shouldn't get called unless initialization went past vo_init()
vo_x11_uninit(vo);
}
@@ -844,8 +844,8 @@ static int preinit(struct vo *vo, const char *arg)
ctx->fo = XvListImageFormats(x11->display, x11->xv_port, (int *) &ctx->formats);
- mp_input_add_key_fd(ConnectionNumber(x11->display), 1, x11_fd_callback,
- NULL, vo);
+ mp_input_add_key_fd(vo->input_ctx, ConnectionNumber(x11->display), 1,
+ x11_fd_callback, NULL, vo);
ctx->event_fd_registered = 1;
return 0;