From 4f7a56e0c57af29cec84675cbad7ff3f91d696d0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 1 Feb 2018 09:20:25 +0100 Subject: video: fix passing down FPS to vf_vapoursynth To make this less of a mess, remove one of the redundant container_fps fields. Part of #5470. --- player/command.c | 4 ++-- player/core.h | 2 -- player/video.c | 16 +++++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 06c5e388ca..0ebdb29d96 100644 --- a/player/command.c +++ b/player/command.c @@ -2500,7 +2500,7 @@ static int get_frame_count(struct MPContext *mpctx) if (!mpctx->vo_chain) return -1; double len = get_time_length(mpctx); - double fps = mpctx->vo_chain->container_fps; + double fps = mpctx->vo_chain->filter->container_fps; if (len < 0 || fps <= 0) return 0; @@ -2949,7 +2949,7 @@ static int mp_property_fps(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - float fps = mpctx->vo_chain ? mpctx->vo_chain->container_fps : 0; + float fps = mpctx->vo_chain ? mpctx->vo_chain->filter->container_fps : 0; if (fps < 0.1 || !isfinite(fps)) return M_PROPERTY_UNAVAILABLE;; return m_property_float_ro(action, arg, fps); diff --git a/player/core.h b/player/core.h index 8a77690de6..b11341bedb 100644 --- a/player/core.h +++ b/player/core.h @@ -168,8 +168,6 @@ struct track { struct vo_chain { struct mp_log *log; - double container_fps; - struct mp_output_chain *filter; //struct vf_chain *vf; diff --git a/player/video.c b/player/video.c index 619c73e3f1..27998c96a8 100644 --- a/player/video.c +++ b/player/video.c @@ -244,7 +244,6 @@ void reinit_video_chain_src(struct MPContext *mpctx, struct track *track) vo_c->vo = mpctx->video_out; vo_c->filter = mp_output_chain_create(mpctx->filter_root, MP_OUTPUT_CHAIN_VIDEO); - vo_c->filter->container_fps = vo_c->container_fps; mp_output_chain_set_vo(vo_c->filter, vo_c->vo); vo_c->filter->update_subtitles = filter_update_subtitles; vo_c->filter->update_subtitles_ctx = mpctx; @@ -256,7 +255,7 @@ void reinit_video_chain_src(struct MPContext *mpctx, struct track *track) goto err_out; vo_c->dec_src = track->dec->f->pins[0]; - vo_c->container_fps = track->dec->fps; + vo_c->filter->container_fps = track->dec->fps; vo_c->is_coverart = !!track->stream->attached_picture; track->vo_c = vo_c; @@ -266,8 +265,10 @@ void reinit_video_chain_src(struct MPContext *mpctx, struct track *track) } #if HAVE_ENCODING - if (mpctx->encode_lavc_ctx) - encode_lavc_set_video_fps(mpctx->encode_lavc_ctx, vo_c->container_fps); + if (mpctx->encode_lavc_ctx) { + encode_lavc_set_video_fps(mpctx->encode_lavc_ctx, + vo_c->filter->container_fps); + } #endif if (!recreate_video_filters(mpctx)) @@ -318,7 +319,7 @@ static void check_framedrop(struct MPContext *mpctx, struct vo_chain *vo_c) mpctx->audio_status == STATUS_PLAYING && !ao_untimed(mpctx->ao) && vo_c->track && vo_c->track->dec && (opts->frame_dropping & 2)) { - float fps = vo_c->container_fps; + float fps = vo_c->filter->container_fps; // it's a crappy heuristic; avoid getting upset by incorrect fps if (fps <= 20 || fps >= 500) return; @@ -906,10 +907,11 @@ static void schedule_frame(struct MPContext *mpctx, struct vo_frame *frame) // Determine the mpctx->past_frames[0] frame duration. static void calculate_frame_duration(struct MPContext *mpctx) { + struct vo_chain *vo_c = mpctx->vo_chain; assert(mpctx->num_past_frames >= 1 && mpctx->num_next_frames >= 1); - double demux_duration = mpctx->vo_chain->container_fps > 0 - ? 1.0 / mpctx->vo_chain->container_fps : -1; + double demux_duration = vo_c->filter->container_fps > 0 + ? 1.0 / vo_c->filter->container_fps : -1; double duration = demux_duration; if (mpctx->num_next_frames >= 2) { -- cgit v1.2.3