diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-03-28 11:32:53 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-04-13 15:11:56 +0200 |
commit | 5d97ba5d9c01e478fce2159af49552e9fffde1c0 (patch) | |
tree | 4109c02659036878ea2ac7027208e58aebcffceb /fftools | |
parent | 0288951174ba60b413dea720427c2b06dced9b73 (diff) | |
download | ffmpeg-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')
-rw-r--r-- | fftools/ffmpeg.c | 43 | ||||
-rw-r--r-- | fftools/ffmpeg_demux.c | 38 |
2 files changed, 38 insertions, 43 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 0a2dc85629..02a7f20554 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -738,46 +738,6 @@ static int reap_filters(int flush) return 0; } -static void print_final_stats(void) -{ - int i, j; - - /* print verbose per-stream stats */ - for (i = 0; i < nb_input_files; i++) { - InputFile *f = input_files[i]; - uint64_t total_packets = 0, total_size = 0; - - av_log(NULL, AV_LOG_VERBOSE, "Input file #%d (%s):\n", - i, f->ctx->url); - - for (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): ", - i, 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 print_report(int is_last_report, int64_t timer_start, int64_t cur_time) { AVBPrint buf, buf_script; @@ -970,9 +930,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti } first_report = 0; - - if (is_last_report) - print_final_stats(); } int ifilter_parameters_from_codecpar(InputFilter *ifilter, AVCodecParameters *par) 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); |