[FFmpeg-cvslog] avfilter/avf_showspectrum: do not use ff_outlink_get_status() on inlink
Paul B Mahol
git at videolan.org
Tue May 30 03:36:52 EEST 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon May 29 23:30:56 2023 +0200| [51a1124a684ae8b9c9f56a2b958ae09847964525] | committer: Paul B Mahol
avfilter/avf_showspectrum: do not use ff_outlink_get_status() on inlink
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=51a1124a684ae8b9c9f56a2b958ae09847964525
---
libavfilter/avf_showspectrum.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/libavfilter/avf_showspectrum.c b/libavfilter/avf_showspectrum.c
index 6c3d0e8c2b..23269dbb4c 100644
--- a/libavfilter/avf_showspectrum.c
+++ b/libavfilter/avf_showspectrum.c
@@ -109,6 +109,7 @@ typedef struct ShowSpectrumContext {
float dmin, dmax;
uint64_t samples;
int (*plot_channel)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
+ int eof;
float opacity_factor;
@@ -1543,8 +1544,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) {
if (s->old_pts < outpicref->pts || s->sliding == FULLFRAME ||
- (ff_outlink_get_status(inlink) == AVERROR_EOF &&
- ff_inlink_queued_samples(inlink) <= s->hop_size)) {
+ (s->eof && ff_inlink_queued_samples(inlink) <= s->hop_size)) {
AVFrame *clone;
if (s->legend) {
@@ -1600,7 +1600,7 @@ static int activate(AVFilterContext *ctx)
FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
- if (s->outpicref) {
+ if (s->outpicref && ff_inlink_queued_samples(inlink) > 0) {
AVFrame *fin;
ret = ff_inlink_consume_samples(inlink, s->hop_size, s->hop_size, &fin);
@@ -1627,8 +1627,7 @@ static int activate(AVFilterContext *ctx)
}
}
- if (ff_outlink_get_status(inlink) == AVERROR_EOF &&
- s->sliding == FULLFRAME &&
+ if (s->eof && s->sliding == FULLFRAME &&
s->xpos > 0 && s->outpicref) {
if (s->orientation == VERTICAL) {
@@ -1656,11 +1655,15 @@ static int activate(AVFilterContext *ctx)
return 0;
}
- if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
- if (status == AVERROR_EOF) {
- ff_outlink_set_status(outlink, status, s->pts);
- return 0;
- }
+ if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) {
+ s->eof = status == AVERROR_EOF;
+ ff_filter_set_ready(ctx, 100);
+ return 0;
+ }
+
+ if (s->eof) {
+ ff_outlink_set_status(outlink, AVERROR_EOF, s->pts);
+ return 0;
}
if (ff_inlink_queued_samples(inlink) >= s->hop_size) {
More information about the ffmpeg-cvslog
mailing list