1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-27 23:43:28 +02:00

fftools/ffmpeg: move printing verbose demuxing stats to ffmpeg_demux

This is a more appropriate place for this.
This commit is contained in:
Anton Khirnov 2023-03-28 11:32:53 +02:00
parent 0288951174
commit 5d97ba5d9c
2 changed files with 38 additions and 43 deletions

View File

@ -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)

View File

@ -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);