lavfi: move AVFilterLink.frame_rate to FilterLink

Co-developed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Anton Khirnov 2024-08-06 08:50:21 +02:00 committed by Paul B Mahol
parent b0be4b7aeb
commit 49989556f1
4 changed files with 15 additions and 9 deletions

View File

@ -754,6 +754,7 @@ static int compute_kernel(AVFilterContext *ctx)
static int config_output(AVFilterLink *outlink)
{
FilterLink *l = ff_filter_link(outlink);
AVFilterContext *ctx = outlink->src;
AVFilterLink *inlink = ctx->inputs[0];
ShowFreqsContext *s = ctx->priv;
@ -946,8 +947,8 @@ static int config_output(AVFilterLink *outlink)
av_log(ctx, AV_LOG_DEBUG, "output_sample_count: %d\n", s->output_sample_count);
av_log(ctx, AV_LOG_DEBUG, "output_padding_size: %d\n", s->output_padding_size);
outlink->frame_rate = s->frame_rate;
outlink->time_base = av_inv_q(outlink->frame_rate);
l->frame_rate = s->frame_rate;
outlink->time_base = av_inv_q(l->frame_rate);
ret = compute_kernel(ctx);
if (ret < 0)

View File

@ -158,6 +158,7 @@ static int run_channel_fft(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
static int config_output(AVFilterLink *outlink)
{
FilterLink *l = ff_filter_link(outlink);
AVFilterContext *ctx = outlink->src;
AVFilterLink *inlink = ctx->inputs[0];
ShowSpatialContext *s = ctx->priv;
@ -168,8 +169,8 @@ static int config_output(AVFilterLink *outlink)
outlink->h = s->h;
outlink->sample_aspect_ratio = (AVRational){1,1};
outlink->frame_rate = s->frame_rate;
outlink->time_base = av_inv_q(outlink->frame_rate);
l->frame_rate = s->frame_rate;
outlink->time_base = av_inv_q(l->frame_rate);
s->hop_size = FFMAX(1, av_rescale(inlink->sample_rate, s->frame_rate.den, s->frame_rate.num));
s->win_size = s->frame << av_ceil_log2(s->hop_size);
s->buf_size = s->win_size*2 + 2;

View File

@ -421,6 +421,7 @@ static void draw_sample_cline_gray(uint8_t *buf, int height, ptrdiff_t linesize,
static int config_output(AVFilterLink *outlink)
{
FilterLink *l = ff_filter_link(outlink);
AVFilterContext *ctx = outlink->src;
AVFilterLink *inlink = ctx->inputs[0];
ShowWavesContext *s = ctx->priv;
@ -429,9 +430,9 @@ static int config_output(AVFilterLink *outlink)
int ch;
if (s->single_pic) {
outlink->frame_rate = av_make_q(1, 1);
l->frame_rate = av_make_q(1, 1);
} else {
outlink->frame_rate = s->rate;
l->frame_rate = s->rate;
}
if (!FF_ALLOCZ_TYPED_ARRAY(s->buf_idy, nb_channels))
@ -456,12 +457,12 @@ static int config_output(AVFilterLink *outlink)
return AVERROR(ENOMEM);
outlink->sample_aspect_ratio = (AVRational){1,1};
outlink->time_base = av_inv_q(outlink->frame_rate);
outlink->time_base = av_inv_q(l->frame_rate);
outlink->w = s->w;
outlink->h = s->h;
av_log(ctx, AV_LOG_VERBOSE, "s:%dx%d r:%f n:%f h:%d\n",
s->w, s->h, av_q2d(outlink->frame_rate), av_q2d(s->n), s->step_size);
s->w, s->h, av_q2d(l->frame_rate), av_q2d(s->n), s->step_size);
switch (outlink->format) {
case AV_PIX_FMT_GRAY8:

View File

@ -23,6 +23,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "internal.h"
#include "framesync.h"
@ -165,6 +166,8 @@ static int config_output(AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
MergePlanesContext *s = ctx->priv;
FilterLink *il = ff_filter_link(ctx->inputs[0]);
FilterLink *ol = ff_filter_link(outlink);
InputParam inputsp[4];
FFFrameSyncIn *in;
int ret;
@ -179,7 +182,7 @@ static int config_output(AVFilterLink *outlink)
outlink->w = ctx->inputs[0]->w;
outlink->h = ctx->inputs[0]->h;
outlink->time_base = ctx->inputs[0]->time_base;
outlink->frame_rate = ctx->inputs[0]->frame_rate;
ol->frame_rate = il->frame_rate;
outlink->sample_aspect_ratio = ctx->inputs[0]->sample_aspect_ratio;
s->planewidth[1] =