diff options
author | Paul B Mahol <onemda@gmail.com> | 2023-02-06 14:57:50 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2023-02-12 13:32:00 +0100 |
commit | e506ea3ce1de0c782b2b833398240c8e19a02bb4 (patch) | |
tree | 09a019d09e096300024c435d15c3485d319bad04 /libavfilter/f_ebur128.c | |
parent | 78f46065d861eb8487124e92ab46a459426eb89c (diff) | |
download | ffmpeg-e506ea3ce1de0c782b2b833398240c8e19a02bb4.tar.gz |
avfilter: use ff_inlink_make_frame_writable()
Diffstat (limited to 'libavfilter/f_ebur128.c')
-rw-r--r-- | libavfilter/f_ebur128.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c index 8afab37fdb..38e7e0b295 100644 --- a/libavfilter/f_ebur128.c +++ b/libavfilter/f_ebur128.c @@ -618,13 +618,13 @@ static int gate_update(struct integrator *integ, double power, static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) { - int i, ch, idx_insample; + int i, ch, idx_insample, ret; AVFilterContext *ctx = inlink->dst; EBUR128Context *ebur128 = ctx->priv; const int nb_channels = ebur128->nb_channels; const int nb_samples = insamples->nb_samples; const double *samples = (double *)insamples->data[0]; - AVFrame *pic = ebur128->outpicref; + AVFrame *pic; #if CONFIG_SWRESAMPLE if (ebur128->peak_mode & PEAK_MODE_TRUE_PEAKS && ebur128->idx_insample == 0) { @@ -821,7 +821,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) y_loudness_lu_graph = lu_to_y(ebur128, loudness_3000 - ebur128->target); y_loudness_lu_gauge = lu_to_y(ebur128, gauge_value); - av_frame_make_writable(pic); + ret = ff_inlink_make_frame_writable(outlink, &ebur128->outpicref); + if (ret < 0) { + av_frame_free(&insamples); + ebur128->insamples = NULL; + return ret; + } + pic = ebur128->outpicref; /* draw the graph using the short-term loudness */ p = pic->data[0] + ebur128->graph.y*pic->linesize[0] + ebur128->graph.x*3; for (y = 0; y < ebur128->graph.h; y++) { |