Commit 2d6a8987 authored by Gyan Doshi's avatar Gyan Doshi

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

Since 3b491c5a, stats would be hidden if loglevel was lower than
info, even if -stats was set.

Fixes #6962
parent a6e56d12
...@@ -133,8 +133,9 @@ This option has been deprecated in favor of private options, try -pixel_format. ...@@ -133,8 +133,9 @@ This option has been deprecated in favor of private options, try -pixel_format.
@item -stats @item -stats
Print several playback statistics, in particular show the stream Print several playback statistics, in particular show the stream
duration, the codec parameters, the current position in the stream and duration, the codec parameters, the current position in the stream and
the audio/video synchronisation drift. It is on by default, to the audio/video synchronisation drift. It is shown by default, unless the
explicitly disable it you need to specify @code{-nostats}. log level is lower than @code{info}. Its display can be forced by manually
specifying this option. To disable it, you need to specify @code{-nostats}.
@item -fast @item -fast
Non-spec-compliant optimizations. Non-spec-compliant optimizations.
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "libavutil/samplefmt.h" #include "libavutil/samplefmt.h"
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "libavutil/time.h" #include "libavutil/time.h"
#include "libavutil/bprint.h"
#include "libavformat/avformat.h" #include "libavformat/avformat.h"
#include "libavdevice/avdevice.h" #include "libavdevice/avdevice.h"
#include "libswscale/swscale.h" #include "libswscale/swscale.h"
...@@ -326,7 +327,7 @@ static int display_disable; ...@@ -326,7 +327,7 @@ static int display_disable;
static int borderless; static int borderless;
static int alwaysontop; static int alwaysontop;
static int startup_volume = 100; static int startup_volume = 100;
static int show_status = 1; static int show_status = -1;
static int av_sync_type = AV_SYNC_AUDIO_MASTER; static int av_sync_type = AV_SYNC_AUDIO_MASTER;
static int64_t start_time = AV_NOPTS_VALUE; static int64_t start_time = AV_NOPTS_VALUE;
static int64_t duration = AV_NOPTS_VALUE; static int64_t duration = AV_NOPTS_VALUE;
...@@ -1692,6 +1693,7 @@ display: ...@@ -1692,6 +1693,7 @@ display:
} }
is->force_refresh = 0; is->force_refresh = 0;
if (show_status) { if (show_status) {
AVBPrint buf;
static int64_t last_time; static int64_t last_time;
int64_t cur_time; int64_t cur_time;
int aqsize, vqsize, sqsize; int aqsize, vqsize, sqsize;
...@@ -1715,18 +1717,28 @@ display: ...@@ -1715,18 +1717,28 @@ display:
av_diff = get_master_clock(is) - get_clock(&is->vidclk); av_diff = get_master_clock(is) - get_clock(&is->vidclk);
else if (is->audio_st) else if (is->audio_st)
av_diff = get_master_clock(is) - get_clock(&is->audclk); av_diff = get_master_clock(is) - get_clock(&is->audclk);
av_log(NULL, AV_LOG_INFO,
"%7.2f %s:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r", av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC);
get_master_clock(is), av_bprintf(&buf,
(is->audio_st && is->video_st) ? "A-V" : (is->video_st ? "M-V" : (is->audio_st ? "M-A" : " ")), "%7.2f %s:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r",
av_diff, get_master_clock(is),
is->frame_drops_early + is->frame_drops_late, (is->audio_st && is->video_st) ? "A-V" : (is->video_st ? "M-V" : (is->audio_st ? "M-A" : " ")),
aqsize / 1024, av_diff,
vqsize / 1024, is->frame_drops_early + is->frame_drops_late,
sqsize, aqsize / 1024,
is->video_st ? is->viddec.avctx->pts_correction_num_faulty_dts : 0, vqsize / 1024,
is->video_st ? is->viddec.avctx->pts_correction_num_faulty_pts : 0); sqsize,
is->video_st ? is->viddec.avctx->pts_correction_num_faulty_dts : 0,
is->video_st ? is->viddec.avctx->pts_correction_num_faulty_pts : 0);
if (show_status == 1 && AV_LOG_INFO > av_log_get_level())
fprintf(stderr, "%s", buf.str);
else
av_log(NULL, AV_LOG_INFO, "%s", buf.str);
fflush(stdout); fflush(stdout);
av_bprint_finalize(&buf, NULL);
last_time = cur_time; last_time = cur_time;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment