[FFmpeg-cvslog] avfilter/avfilter: add sample_count_in and sample_count_out

Paul B Mahol git at videolan.org
Thu Aug 5 16:47:47 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Jun  3 15:22:41 2020 +0200| [c317862c883bdec40292f709add3ba30f606c6a3] | committer: Paul B Mahol

avfilter/avfilter: add sample_count_in and sample_count_out

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c317862c883bdec40292f709add3ba30f606c6a3
---

 libavfilter/avfilter.c | 2 ++
 libavfilter/avfilter.h | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 24de8ebee3..e0847c724b 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1013,6 +1013,7 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
 
     link->frame_blocked_in = link->frame_wanted_out = 0;
     link->frame_count_in++;
+    link->sample_count_in += frame->nb_samples;
     filter_unblock(link->dst);
     ret = ff_framequeue_add(&link->fifo, frame);
     if (ret < 0) {
@@ -1372,6 +1373,7 @@ static void consume_update(AVFilterLink *link, const AVFrame *frame)
     ff_inlink_process_commands(link, frame);
     link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame);
     link->frame_count_out++;
+    link->sample_count_out += frame->nb_samples;
 }
 
 int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index b82f72d040..a71745283c 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -584,6 +584,11 @@ struct AVFilterLink {
      */
     int64_t frame_count_in, frame_count_out;
 
+    /**
+     * Number of past samples sent through the link.
+     */
+    int64_t sample_count_in, sample_count_out;
+
     /**
      * A pointer to a FFFramePool struct.
      */



More information about the ffmpeg-cvslog mailing list