aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_demux.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-03-28 11:32:53 +0200
committerAnton Khirnov <anton@khirnov.net>2023-04-13 15:11:56 +0200
commit5d97ba5d9c01e478fce2159af49552e9fffde1c0 (patch)
tree4109c02659036878ea2ac7027208e58aebcffceb /fftools/ffmpeg_demux.c
parent0288951174ba60b413dea720427c2b06dced9b73 (diff)
downloadffmpeg-5d97ba5d9c01e478fce2159af49552e9fffde1c0.tar.gz
fftools/ffmpeg: move printing verbose demuxing stats to ffmpeg_demux
This is a more appropriate place for this.
Diffstat (limited to 'fftools/ffmpeg_demux.c')
-rw-r--r--fftools/ffmpeg_demux.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index 354d3165c9..8fafbc3354 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -480,6 +480,41 @@ int ifile_get_packet(InputFile *f, AVPacket **pkt)
return 0;
}
+static void demux_final_stats(Demuxer *d)
+{
+ InputFile *f = &d->f;
+ uint64_t total_packets = 0, total_size = 0;
+
+ av_log(NULL, AV_LOG_VERBOSE, "Input file #%d (%s):\n",
+ f->index, f->ctx->url);
+
+ for (int j = 0; j < f->nb_streams; j++) {
+ InputStream *ist = f->streams[j];
+ enum AVMediaType type = ist->par->codec_type;
+
+ total_size += ist->data_size;
+ total_packets += ist->nb_packets;
+
+ av_log(NULL, AV_LOG_VERBOSE, " Input stream #%d:%d (%s): ",
+ f->index, j, av_get_media_type_string(type));
+ av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" packets read (%"PRIu64" bytes); ",
+ ist->nb_packets, ist->data_size);
+
+ if (ist->decoding_needed) {
+ av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames decoded",
+ ist->frames_decoded);
+ if (type == AVMEDIA_TYPE_AUDIO)
+ av_log(NULL, AV_LOG_VERBOSE, " (%"PRIu64" samples)", ist->samples_decoded);
+ av_log(NULL, AV_LOG_VERBOSE, "; ");
+ }
+
+ av_log(NULL, AV_LOG_VERBOSE, "\n");
+ }
+
+ av_log(NULL, AV_LOG_VERBOSE, " Total: %"PRIu64" packets (%"PRIu64" bytes) demuxed\n",
+ total_packets, total_size);
+}
+
static void ist_free(InputStream **pist)
{
InputStream *ist = *pist;
@@ -512,6 +547,9 @@ void ifile_close(InputFile **pf)
thread_stop(d);
+ if (f->ctx)
+ demux_final_stats(d);
+
for (int i = 0; i < f->nb_streams; i++)
ist_free(&f->streams[i]);
av_freep(&f->streams);