From 282e3202d52a84b868f6972532f10d97ee23c594 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 31 Dec 2014 19:01:28 +0100 Subject: video: pass some VO params as struct Not particularly elegant, but better than adding more and more stuff to the relevant function signatures. --- video/out/vo.c | 24 ++++++++++-------------- video/out/vo.h | 12 ++++++++---- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'video/out') diff --git a/video/out/vo.c b/video/out/vo.c index c2ec6c5813..82da6b5369 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -203,9 +203,7 @@ static void dealloc_vo(struct vo *vo) } static struct vo *vo_create(bool probing, struct mpv_global *global, - struct input_ctx *input_ctx, struct osd_state *osd, - struct encode_lavc_context *encode_lavc_ctx, - char *name, char **args) + struct vo_extra *ex, char *name, char **args) { struct mp_log *log = mp_log_new(NULL, global->log, "vo"); struct m_obj_desc desc; @@ -220,11 +218,12 @@ static struct vo *vo_create(bool probing, struct mpv_global *global, .driver = desc.p, .opts = &global->opts->vo, .global = global, - .encode_lavc_ctx = encode_lavc_ctx, - .input_ctx = input_ctx, - .osd = osd, + .encode_lavc_ctx = ex->encode_lavc_ctx, + .input_ctx = ex->input_ctx, + .osd = ex->osd, .event_fd = -1, .monitor_par = 1, + .extra = *ex, .probing = probing, .in = talloc(vo, struct vo_internal), }; @@ -260,10 +259,7 @@ error: return NULL; } -struct vo *init_best_video_out(struct mpv_global *global, - struct input_ctx *input_ctx, - struct osd_state *osd, - struct encode_lavc_context *encode_lavc_ctx) +struct vo *init_best_video_out(struct mpv_global *global, struct vo_extra *ex) { struct m_obj_settings *vo_list = global->opts->vo.video_driver_list; // first try the preferred drivers, with their optional subdevice param: @@ -273,8 +269,8 @@ struct vo *init_best_video_out(struct mpv_global *global, if (strlen(vo_list[n].name) == 0) goto autoprobe; bool p = !!vo_list[n + 1].name; - struct vo *vo = vo_create(p, global, input_ctx, osd, encode_lavc_ctx, - vo_list[n].name, vo_list[n].attribs); + struct vo *vo = vo_create(p, global, ex, vo_list[n].name, + vo_list[n].attribs); if (vo) return vo; } @@ -283,8 +279,8 @@ struct vo *init_best_video_out(struct mpv_global *global, autoprobe: // now try the rest... for (int i = 0; video_out_drivers[i]; i++) { - struct vo *vo = vo_create(true, global, input_ctx, osd, encode_lavc_ctx, - (char *)video_out_drivers[i]->name, NULL); + char *name = (char *)video_out_drivers[i]->name; + struct vo *vo = vo_create(true, global, ex, name, NULL); if (vo) return vo; } diff --git a/video/out/vo.h b/video/out/vo.h index fa35f65d13..60982c9d65 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -165,6 +165,12 @@ struct osd_state; struct mp_image; struct mp_image_params; +struct vo_extra { + struct input_ctx *input_ctx; + struct osd_state *osd; + struct encode_lavc_context *encode_lavc_ctx; +}; + struct vo_driver { // Encoding functionality, which can be invoked via --o only. bool encode; @@ -273,6 +279,7 @@ struct vo { struct encode_lavc_context *encode_lavc_ctx; struct vo_internal *in; struct mp_vo_opts *opts; + struct vo_extra extra; // --- The following fields are generally only changed during initialization. @@ -297,10 +304,7 @@ struct vo { }; struct mpv_global; -struct vo *init_best_video_out(struct mpv_global *global, - struct input_ctx *input_ctx, - struct osd_state *osd, - struct encode_lavc_context *encode_lavc_ctx); +struct vo *init_best_video_out(struct mpv_global *global, struct vo_extra *ex); int vo_reconfig(struct vo *vo, struct mp_image_params *p, int flags); int vo_control(struct vo *vo, uint32_t request, void *data); -- cgit v1.2.3