summaryrefslogtreecommitdiffstats
path: root/player
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 /player
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 'player')
-rw-r--r--player/command.c6
-rw-r--r--player/sub.c2
-rw-r--r--player/video.c8
3 files changed, 9 insertions, 7 deletions
diff --git a/player/command.c b/player/command.c
index 0bee671e88..f2f73059ef 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2512,8 +2512,8 @@ static int mp_property_vd_imgparams(void *ctx, struct m_property *prop,
if (!vd)
return M_PROPERTY_UNAVAILABLE;
struct mp_codec_params *c = vd->header->codec;
- if (vd->vfilter->override_params.imgfmt) {
- return property_imgparams(vd->vfilter->override_params, action, arg);
+ if (vd->vfilter->input_params.imgfmt) {
+ return property_imgparams(vd->vfilter->input_params, action, arg);
} else if (c->disp_w && c->disp_h) {
// Simplistic fallback for stupid scripts querying "width"/"height"
// before the first frame is decoded.
@@ -2779,7 +2779,7 @@ static int mp_property_aspect(void *ctx, struct m_property *prop,
if (mpctx->d_video && aspect <= 0) {
struct dec_video *d_video = mpctx->d_video;
struct mp_codec_params *c = d_video->header->codec;
- struct mp_image_params *params = &d_video->vfilter->override_params;
+ struct mp_image_params *params = &d_video->vfilter->input_params;
if (params && params->p_w > 0 && params->p_h > 0) {
int d_w, d_h;
mp_image_params_get_dsize(params, &d_w, &d_h);
diff --git a/player/sub.c b/player/sub.c
index 0492be4bc8..c20df53c60 100644
--- a/player/sub.c
+++ b/player/sub.c
@@ -78,7 +78,7 @@ static bool update_subtitle(struct MPContext *mpctx, double video_pts, int order
return true;
if (mpctx->d_video) {
- struct mp_image_params params = mpctx->d_video->vfilter->override_params;
+ struct mp_image_params params = mpctx->d_video->vfilter->input_params;
if (params.imgfmt)
sub_control(dec_sub, SD_CTRL_SET_VIDEO_PARAMS, &params);
}
diff --git a/player/video.c b/player/video.c
index 33f3b4b970..9ec7eacb74 100644
--- a/player/video.c
+++ b/player/video.c
@@ -84,10 +84,10 @@ static int try_filter(struct MPContext *mpctx, struct mp_image_params params,
vf->label = talloc_strdup(vf, label);
- if (video_reconfig_filters(d_video, &params) < 0) {
+ if (vf_reconfig(d_video->vfilter, &params) < 0) {
vf_remove_filter(d_video->vfilter, vf);
// restore
- video_reconfig_filters(d_video, &params);
+ vf_reconfig(d_video->vfilter, &params);
return -1;
}
return 0;
@@ -107,7 +107,7 @@ static void filter_reconfig(struct MPContext *mpctx,
set_allowed_vo_formats(d_video->vfilter, mpctx->video_out);
- if (video_reconfig_filters(d_video, &params) < 0) {
+ if (vf_reconfig(d_video->vfilter, &params) < 0) {
// Most video filters don't work with hardware decoding, so this
// might be the reason why filter reconfig failed.
if (!probe_only &&
@@ -119,6 +119,8 @@ static void filter_reconfig(struct MPContext *mpctx,
mp_image_unrefp(&d_video->waiting_decoded_mpi);
d_video->decoder_output = (struct mp_image_params){0};
MP_VERBOSE(mpctx, "hwdec falback due to filters.\n");
+ } else {
+ MP_FATAL(mpctx, "Cannot initialize video filters.\n");
}
return;
}