Commit f22f873e authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '20a5956b'

* commit '20a5956b':
  dump: split audio and video probing on multiple lines

Conflicts:
	libavcodec/utils.c
	libavformat/dump.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents bb44f7d5 20a5956b
...@@ -2948,6 +2948,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) ...@@ -2948,6 +2948,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
const char *profile = NULL; const char *profile = NULL;
const AVCodec *p; const AVCodec *p;
int bitrate; int bitrate;
int new_line = 0;
AVRational display_aspect_ratio; AVRational display_aspect_ratio;
if (!buf || buf_size <= 0) if (!buf || buf_size <= 0)
...@@ -2985,8 +2986,11 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) ...@@ -2985,8 +2986,11 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
if (enc->pix_fmt != AV_PIX_FMT_NONE) { if (enc->pix_fmt != AV_PIX_FMT_NONE) {
char detail[256] = "("; char detail[256] = "(";
const char *colorspace_name; const char *colorspace_name;
av_strlcat(buf, "\n ", buf_size);
snprintf(buf + strlen(buf), buf_size - strlen(buf), snprintf(buf + strlen(buf), buf_size - strlen(buf),
", %s", "%s", enc->pix_fmt == AV_PIX_FMT_NONE ? "none" :
av_get_pix_fmt_name(enc->pix_fmt)); av_get_pix_fmt_name(enc->pix_fmt));
if (enc->bits_per_raw_sample && if (enc->bits_per_raw_sample &&
enc->bits_per_raw_sample <= av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth_minus1) enc->bits_per_raw_sample <= av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth_minus1)
...@@ -3004,10 +3008,14 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) ...@@ -3004,10 +3008,14 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
av_strlcatf(buf, buf_size, "%s)", detail); av_strlcatf(buf, buf_size, "%s)", detail);
} }
} }
if (enc->width) { if (enc->width) {
av_strlcat(buf, new_line ? "\n " : ", ", buf_size);
snprintf(buf + strlen(buf), buf_size - strlen(buf), snprintf(buf + strlen(buf), buf_size - strlen(buf),
", %dx%d", "%dx%d",
enc->width, enc->height); enc->width, enc->height);
if (enc->sample_aspect_ratio.num) { if (enc->sample_aspect_ratio.num) {
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
enc->width * enc->sample_aspect_ratio.num, enc->width * enc->sample_aspect_ratio.num,
...@@ -3031,11 +3039,11 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) ...@@ -3031,11 +3039,11 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
} }
break; break;
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
av_strlcat(buf, "\n ", buf_size);
if (enc->sample_rate) { if (enc->sample_rate) {
snprintf(buf + strlen(buf), buf_size - strlen(buf), snprintf(buf + strlen(buf), buf_size - strlen(buf),
", %d Hz", enc->sample_rate); "%d Hz, ", enc->sample_rate);
} }
av_strlcat(buf, ", ", buf_size);
av_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout); av_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout);
if (enc->sample_fmt != AV_SAMPLE_FMT_NONE) { if (enc->sample_fmt != AV_SAMPLE_FMT_NONE) {
snprintf(buf + strlen(buf), buf_size - strlen(buf), snprintf(buf + strlen(buf), buf_size - strlen(buf),
......
...@@ -118,11 +118,11 @@ static void print_fps(double d, const char *postfix) ...@@ -118,11 +118,11 @@ static void print_fps(double d, const char *postfix)
{ {
uint64_t v = lrintf(d * 100); uint64_t v = lrintf(d * 100);
if (v % 100) if (v % 100)
av_log(NULL, AV_LOG_INFO, ", %3.2f %s", d, postfix); av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
else if (v % (100 * 1000)) else if (v % (100 * 1000))
av_log(NULL, AV_LOG_INFO, ", %1.0f %s", d, postfix); av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
else else
av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d / 1000, postfix); av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
} }
static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
...@@ -372,15 +372,21 @@ static void dump_stream_format(AVFormatContext *ic, int i, ...@@ -372,15 +372,21 @@ static void dump_stream_format(AVFormatContext *ic, int i,
} }
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (st->avg_frame_rate.den && st->avg_frame_rate.num) int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
print_fps(av_q2d(st->avg_frame_rate), "fps"); int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
#if FF_API_R_FRAME_RATE int tbn = st->time_base.den && st->time_base.num;
if (st->r_frame_rate.den && st->r_frame_rate.num) int tbc = st->codec->time_base.den && st->codec->time_base.num;
print_fps(av_q2d(st->r_frame_rate), "tbr");
#endif if (fps || tbr || tbn || tbc)
if (st->time_base.den && st->time_base.num) av_log(NULL, AV_LOG_INFO, "\n ");
print_fps(1 / av_q2d(st->time_base), "tbn");
if (st->codec->time_base.den && st->codec->time_base.num) if (fps)
print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps");
if (tbr)
print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr");
if (tbn)
print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn");
if (tbc)
print_fps(1 / av_q2d(st->codec->time_base), "tbc"); print_fps(1 / av_q2d(st->codec->time_base), "tbc");
} }
......
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