mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 12:17:12 +00:00
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.
This commit is contained in:
parent
7019e0dcfe
commit
4f7a56e0c5
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user