summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-04-22 19:36:16 +0200
committerJan Ekström <jeebjp@gmail.com>2018-04-29 02:21:32 +0300
commit8135e25600ace2894df274e6a825cfef525fee77 (patch)
tree372c2642c06ff8dc4ca90517c97495b102d9e700
parentbfc33da250e4fdb6bb57bdf051ad666570ae985f (diff)
downloadmpv-8135e25600ace2894df274e6a825cfef525fee77.tar.bz2
mpv-8135e25600ace2894df274e6a825cfef525fee77.tar.xz
vo: add vo_reconfig2()
1. I want to get away from mp_image_params (maybe). 2. For encoding mode, it's convenient to get the nominal_fps, which is a mp_image field, and not in mp_image_params.
-rw-r--r--player/video.c2
-rw-r--r--video/out/vo.c22
-rw-r--r--video/out/vo.h7
3 files changed, 27 insertions, 4 deletions
diff --git a/player/video.c b/player/video.c
index 7ec05e0f6d..1a85cf511f 100644
--- a/player/video.c
+++ b/player/video.c
@@ -1063,7 +1063,7 @@ void write_video(struct MPContext *mpctx)
info->name, p.w, p.h, extra, mp_imgfmt_to_name(p.imgfmt), sfmt);
MP_VERBOSE(mpctx, "VO: Description: %s\n", info->description);
- int vo_r = vo_reconfig(vo, &p);
+ int vo_r = vo_reconfig2(vo, mpctx->next_frames[0]);
if (vo_r < 0) {
mpctx->error_playing = MPV_ERROR_VO_INIT_FAILED;
goto error;
diff --git a/video/out/vo.c b/video/out/vo.c
index 413d8bc02c..624136bd47 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -571,9 +571,11 @@ static void run_reconfig(void *p)
{
void **pp = p;
struct vo *vo = pp[0];
- struct mp_image_params *params = pp[1];
+ struct mp_image *img = pp[1];
int *ret = pp[2];
+ struct mp_image_params *params = &img->params;
+
struct vo_internal *in = vo->in;
MP_VERBOSE(vo, "reconfig to %s\n", mp_image_params_to_str(params));
@@ -585,7 +587,11 @@ static void run_reconfig(void *p)
talloc_free(vo->params);
vo->params = talloc_dup(vo, params);
- *ret = vo->driver->reconfig(vo, vo->params);
+ if (vo->driver->reconfig2) {
+ *ret = vo->driver->reconfig2(vo, img);
+ } else {
+ *ret = vo->driver->reconfig(vo, vo->params);
+ }
vo->config_ok = *ret >= 0;
if (vo->config_ok) {
check_vo_caps(vo);
@@ -607,7 +613,17 @@ static void run_reconfig(void *p)
int vo_reconfig(struct vo *vo, struct mp_image_params *params)
{
int ret;
- void *p[] = {vo, params, &ret};
+ struct mp_image dummy = {0};
+ mp_image_set_params(&dummy, params);
+ void *p[] = {vo, &dummy, &ret};
+ mp_dispatch_run(vo->in->dispatch, run_reconfig, p);
+ return ret;
+}
+
+int vo_reconfig2(struct vo *vo, struct mp_image *img)
+{
+ int ret;
+ void *p[] = {vo, img, &ret};
mp_dispatch_run(vo->in->dispatch, run_reconfig, p);
return ret;
}
diff --git a/video/out/vo.h b/video/out/vo.h
index 947493268c..851dd16159 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -293,6 +293,12 @@ struct vo_driver {
int (*reconfig)(struct vo *vo, struct mp_image_params *params);
/*
+ * Like reconfig(), but provides the whole mp_image for which the change is
+ * required. (The image doesn't have to have real data.)
+ */
+ int (*reconfig2)(struct vo *vo, struct mp_image *img);
+
+ /*
* Control interface
*/
int (*control)(struct vo *vo, uint32_t request, void *data);
@@ -440,6 +446,7 @@ struct vo {
struct mpv_global;
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 vo_reconfig2(struct vo *vo, struct mp_image *img);
int vo_control(struct vo *vo, int request, void *data);
void vo_control_async(struct vo *vo, int request, void *data);