summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-31 19:01:28 +0100
committerwm4 <wm4@nowhere>2014-12-31 19:01:28 +0100
commit282e3202d52a84b868f6972532f10d97ee23c594 (patch)
tree120b272348477b68ccb501e2f1231670e2b1d78a
parentf5b314e9e8685098badaf2bfc8f94422c0f9c4fc (diff)
downloadmpv-282e3202d52a84b868f6972532f10d97ee23c594.tar.bz2
mpv-282e3202d52a84b868f6972532f10d97ee23c594.tar.xz
video: pass some VO params as struct
Not particularly elegant, but better than adding more and more stuff to the relevant function signatures.
-rw-r--r--player/main.c9
-rw-r--r--player/video.c9
-rw-r--r--video/out/vo.c24
-rw-r--r--video/out/vo.h12
4 files changed, 30 insertions, 24 deletions
diff --git a/player/main.c b/player/main.c
index 7f334d1128..9ecdbc3ed5 100644
--- a/player/main.c
+++ b/player/main.c
@@ -452,9 +452,12 @@ int mp_initialize(struct MPContext *mpctx)
if (opts->force_vo) {
opts->fixed_vo = 1;
- mpctx->video_out = init_best_video_out(mpctx->global, mpctx->input,
- mpctx->osd,
- mpctx->encode_lavc_ctx);
+ struct vo_extra ex = {
+ .input_ctx = mpctx->input,
+ .osd = mpctx->osd,
+ .encode_lavc_ctx = mpctx->encode_lavc_ctx,
+ };
+ mpctx->video_out = init_best_video_out(mpctx->global, &ex);
if (!mpctx->video_out) {
MP_FATAL(mpctx, "Error opening/initializing "
"the selected video_out (-vo) device.\n");
diff --git a/player/video.c b/player/video.c
index ccd0bbf6c6..3c46bb0ce8 100644
--- a/player/video.c
+++ b/player/video.c
@@ -265,9 +265,12 @@ int reinit_video_chain(struct MPContext *mpctx)
//================== Init VIDEO (codec & libvo) ==========================
if (!opts->fixed_vo || !mpctx->video_out) {
- mpctx->video_out = init_best_video_out(mpctx->global, mpctx->input,
- mpctx->osd,
- mpctx->encode_lavc_ctx);
+ struct vo_extra ex = {
+ .input_ctx = mpctx->input,
+ .osd = mpctx->osd,
+ .encode_lavc_ctx = mpctx->encode_lavc_ctx,
+ };
+ mpctx->video_out = init_best_video_out(mpctx->global, &ex);
if (!mpctx->video_out) {
MP_FATAL(mpctx, "Error opening/initializing "
"the selected video_out (-vo) device.\n");
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);