summaryrefslogtreecommitdiffstats
path: root/video/filter/vf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-14 00:18:31 +0100
committerwm4 <wm4@nowhere>2016-01-14 00:18:31 +0100
commitbf13bd0d47e5fc6761c51c6ba7056968e60bf4cd (patch)
treea031821a03564128a5e0dabb0a33361fd56b0e07 /video/filter/vf.c
parentdd973da108165ebb95e856dbc82326cb35fb45a5 (diff)
downloadmpv-bf13bd0d47e5fc6761c51c6ba7056968e60bf4cd.tar.bz2
mpv-bf13bd0d47e5fc6761c51c6ba7056968e60bf4cd.tar.xz
video: refactor: handle video format fixups closer to decoder
Instead of handling this on filter chain reinit, do it directly after the decoder. This makes the code less entangled. In particular, this gets rid of the really weird "override params" concept in the video filter code. The last_format/fixed_formats have some redundance with decoder_output, but unfortunately the latter has a slightly different use.
Diffstat (limited to 'video/filter/vf.c')
-rw-r--r--video/filter/vf.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c
index dd5b560df3..35de0f23a7 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -211,13 +211,8 @@ void vf_print_filter_chain(struct vf_chain *c, int msglevel,
if (!mp_msg_test(c->log, msglevel))
return;
- char b[128] = {0};
-
- mp_snprintf_cat(b, sizeof(b), "%s", mp_image_params_to_str(&c->input_params));
- mp_msg(c->log, msglevel, " [vd] %s\n", b);
-
for (vf_instance_t *f = c->first; f; f = f->next) {
- b[0] = '\0';
+ char b[128] = {0};
mp_snprintf_cat(b, sizeof(b), " [%s] ", f->info->name);
mp_snprintf_cat(b, sizeof(b), "%s", mp_image_params_to_str(&f->fmt_out));
if (f->autoinserted)
@@ -392,7 +387,6 @@ int vf_filter_frame(struct vf_chain *c, struct mp_image *img)
return -1;
}
assert(mp_image_params_equal(&img->params, &c->input_params));
- vf_fix_img_params(img, &c->override_params);
return vf_do_filter(c->first, img);
}
@@ -585,10 +579,7 @@ static int vf_reconfig_wrapper(struct vf_instance *vf,
return r;
}
-// override_params is used to forcibly change the parameters of input images,
-// while params has to match the input images exactly.
-int vf_reconfig(struct vf_chain *c, const struct mp_image_params *params,
- const struct mp_image_params *override_params)
+int vf_reconfig(struct vf_chain *c, const struct mp_image_params *params)
{
int r = 0;
vf_seek_reset(c);
@@ -599,9 +590,8 @@ int vf_reconfig(struct vf_chain *c, const struct mp_image_params *params,
vf = next;
}
c->input_params = *params;
- c->first->fmt_in = *override_params;
- c->override_params = *override_params;
- struct mp_image_params cur = c->override_params;
+ c->first->fmt_in = *params;
+ struct mp_image_params cur = *params;
uint8_t unused[IMGFMT_END - IMGFMT_START];
update_formats(c, c->first, unused);
@@ -621,10 +611,8 @@ int vf_reconfig(struct vf_chain *c, const struct mp_image_params *params,
MP_ERR(c, "Image formats incompatible or invalid.\n");
mp_msg(c->log, loglevel, "Video filter chain:\n");
vf_print_filter_chain(c, loglevel, failing);
- if (r < 0) {
- c->input_params = c->override_params = c->output_params =
- (struct mp_image_params){0};
- }
+ if (r < 0)
+ c->input_params = c->output_params = (struct mp_image_params){0};
return r;
}