Since 3b491c5a500, stats would be hidden if loglevel was lower than info, even if -stats was set. Fixes #6962
Unified · Split
| @@ -133,8 +133,9 @@ This option has been deprecated in favor of private options, try -pixel_format. · 132 unmodified lines | ||
| 133 | 133 | @item -stats |
| 134 | 134 | Print several playback statistics, in particular show the stream |
| 135 | 135 | 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}. | |
| 138 | 139 | |
| 139 | 140 | @item -fast |
| 140 | 141 | Non-spec-compliant optimizations. |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | #include "libavutil/samplefmt.h" |
| 41 | 41 | #include "libavutil/avassert.h" |
| 42 | 42 | #include "libavutil/time.h" |
| 43 | +#include "libavutil/bprint.h" | |
| 43 | 44 | #include "libavformat/avformat.h" |
| 44 | 45 | #include "libavdevice/avdevice.h" |
| 45 | 46 | #include "libswscale/swscale.h" |
| @@ -326,7 +327,7 @@ static int display_disable; · 280 unmodified lines | ||
| 326 | 327 | static int borderless; |
| 327 | 328 | static int alwaysontop; |
| 328 | 329 | static int startup_volume = 100; |
| 329 | −static int show_status = 1; | |
| 330 | +static int show_status = -1; | |
| 330 | 331 | static int av_sync_type = AV_SYNC_AUDIO_MASTER; |
| 331 | 332 | static int64_t start_time = AV_NOPTS_VALUE; |
| 332 | 333 | static int64_t duration = AV_NOPTS_VALUE; |
| @@ -1692,6 +1693,7 @@ display: · 1359 unmodified lines | ||
| 1692 | 1693 | } |
| 1693 | 1694 | is->force_refresh = 0; |
| 1694 | 1695 | if (show_status) { |
| 1696 | + AVBPrint buf; | |
| 1695 | 1697 | static int64_t last_time; |
| 1696 | 1698 | int64_t cur_time; |
| 1697 | 1699 | int aqsize, vqsize, sqsize; |
| @@ -1715,18 +1717,28 @@ display: · 17 unmodified lines | ||
| 1715 | 1717 | av_diff = get_master_clock(is) - get_clock(&is->vidclk); |
| 1716 | 1718 | else if (is->audio_st) |
| 1717 | 1719 | 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 | + | |
| 1729 | 1739 | fflush(stdout); |
| 1740 | + av_bprint_finalize(&buf, NULL); | |
| 1741 | + | |
| 1730 | 1742 | last_time = cur_time; |
| 1731 | 1743 | } |
| 1732 | 1744 | } |