X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/blobdiff_plain/0a6a282a512ca44658db121b7597ae0e70d8a273..7e566bbe6ce367e880bf09e293a9e72e52c0988e:/ffprobe.c diff --git a/ffprobe.c b/ffprobe.c index b3d4517..4be5d0f 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -120,7 +120,6 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) AVCodec *dec; char val_str[128]; AVMetadataTag *tag = NULL; - char a, b, c, d; AVRational display_aspect_ratio; printf("[STREAM]\n"); @@ -139,30 +138,25 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) printf("codec_time_base=%d/%d\n", dec_ctx->time_base.num, dec_ctx->time_base.den); /* print AVI/FourCC tag */ - a = dec_ctx->codec_tag & 0xff; - b = dec_ctx->codec_tag>>8 & 0xff; - c = dec_ctx->codec_tag>>16 & 0xff; - d = dec_ctx->codec_tag>>24 & 0xff; - printf("codec_tag_string="); - if (isprint(a)) printf("%c", a); else printf("[%d]", a); - if (isprint(b)) printf("%c", b); else printf("[%d]", b); - if (isprint(c)) printf("%c", c); else printf("[%d]", c); - if (isprint(d)) printf("%c", d); else printf("[%d]", d); - printf("\ncodec_tag=0x%04x\n", dec_ctx->codec_tag); + av_get_codec_tag_string(val_str, sizeof(val_str), dec_ctx->codec_tag); + printf("codec_tag_string=%s\n", val_str); + printf("codec_tag=0x%04x\n", dec_ctx->codec_tag); switch (dec_ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: printf("width=%d\n", dec_ctx->width); printf("height=%d\n", dec_ctx->height); printf("has_b_frames=%d\n", dec_ctx->has_b_frames); - printf("sample_aspect_ratio=%d:%d\n", dec_ctx->sample_aspect_ratio.num, - dec_ctx->sample_aspect_ratio.den); - av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, - dec_ctx->width*dec_ctx->sample_aspect_ratio.num, - dec_ctx->height*dec_ctx->sample_aspect_ratio.den, - 1024*1024); - printf("display_aspect_ratio=%d:%d\n", display_aspect_ratio.num, - display_aspect_ratio.den); + if (dec_ctx->sample_aspect_ratio.num) { + printf("sample_aspect_ratio=%d:%d\n", dec_ctx->sample_aspect_ratio.num, + dec_ctx->sample_aspect_ratio.den); + av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, + dec_ctx->width * dec_ctx->sample_aspect_ratio.num, + dec_ctx->height * dec_ctx->sample_aspect_ratio.den, + 1024*1024); + printf("display_aspect_ratio=%d:%d\n", display_aspect_ratio.num, + display_aspect_ratio.den); + } printf("pix_fmt=%s\n", dec_ctx->pix_fmt != PIX_FMT_NONE ? av_pix_fmt_descriptors[dec_ctx->pix_fmt].name : "unknown"); break;