History

ffplay: always show stats at all log levels if requested by user

Since 3b491c5a500, stats would be hidden if loglevel was lower than info, even if -stats was set. Fixes #6962

Gyan Doshi committed 6 years ago

Commit 2d6a8981 parent a6e56d12 files · +27 −14Browse files

Unified · Split

2 files
  1. doc/ffplay.texi +3 −2
  2. fftools/ffplay.c +24 −12
doc/ffplay.texi+3−2
@@ -133,8 +133,9 @@ This option has been deprecated in favor of private options, try -pixel_format. · 132 unmodified lines
133133 @item -stats
134134 Print several playback statistics, in particular show the stream
135135 duration, the codec parameters, the current position in the stream and
136−the audio/video synchronisation drift. It is on by default, to
137−explicitly disable it you need to specify @code{-nostats}.
136+the audio/video synchronisation drift. It is shown by default, unless the
137+log level is lower than @code{info}. Its display can be forced by manually
138+specifying this option. To disable it, you need to specify @code{-nostats}.
138139
139140 @item -fast
140141 Non-spec-compliant optimizations.
fftools/ffplay.c+24−12
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 #include "libavutil/samplefmt.h"
4141 #include "libavutil/avassert.h"
4242 #include "libavutil/time.h"
43+#include "libavutil/bprint.h"
4344 #include "libavformat/avformat.h"
4445 #include "libavdevice/avdevice.h"
4546 #include "libswscale/swscale.h"
@@ -326,7 +327,7 @@ static int display_disable; · 280 unmodified lines
326327 static int borderless;
327328 static int alwaysontop;
328329 static int startup_volume = 100;
329−static int show_status = 1;
330+static int show_status = -1;
330331 static int av_sync_type = AV_SYNC_AUDIO_MASTER;
331332 static int64_t start_time = AV_NOPTS_VALUE;
332333 static int64_t duration = AV_NOPTS_VALUE;
@@ -1692,6 +1693,7 @@ display: · 1359 unmodified lines
16921693 }
16931694 is->force_refresh = 0;
16941695 if (show_status) {
1696+ AVBPrint buf;
16951697 static int64_t last_time;
16961698 int64_t cur_time;
16971699 int aqsize, vqsize, sqsize;
@@ -1715,18 +1717,28 @@ display: · 17 unmodified lines
17151717 av_diff = get_master_clock(is) - get_clock(&is->vidclk);
17161718 else if (is->audio_st)
17171719 av_diff = get_master_clock(is) - get_clock(&is->audclk);
1718− av_log(NULL, AV_LOG_INFO,
1719− "%7.2f %s:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r",
1720− get_master_clock(is),
1721− (is->audio_st && is->video_st) ? "A-V" : (is->video_st ? "M-V" : (is->audio_st ? "M-A" : " ")),
1722− av_diff,
1723− is->frame_drops_early + is->frame_drops_late,
1724− aqsize / 1024,
1725− vqsize / 1024,
1726− sqsize,
1727− is->video_st ? is->viddec.avctx->pts_correction_num_faulty_dts : 0,
1728− is->video_st ? is->viddec.avctx->pts_correction_num_faulty_pts : 0);
1720+
1721+ av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
1722+ av_bprintf(&buf,
1723+ "%7.2f %s:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r",
1724+ get_master_clock(is),
1725+ (is->audio_st && is->video_st) ? "A-V" : (is->video_st ? "M-V" : (is->audio_st ? "M-A" : " ")),
1726+ av_diff,
1727+ is->frame_drops_early + is->frame_drops_late,
1728+ aqsize / 1024,
1729+ vqsize / 1024,
1730+ sqsize,
1731+ is->video_st ? is->viddec.avctx->pts_correction_num_faulty_dts : 0,
1732+ is->video_st ? is->viddec.avctx->pts_correction_num_faulty_pts : 0);
1733+
1734+ if (show_status == 1 && AV_LOG_INFO > av_log_get_level())
1735+ fprintf(stderr, "%s", buf.str);
1736+ else
1737+ av_log(NULL, AV_LOG_INFO, "%s", buf.str);
1738+
17291739 fflush(stdout);
1740+ av_bprint_finalize(&buf, NULL);
1741+
17301742 last_time = cur_time;
17311743 }
17321744 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t