Mercurial > libavcodec.hg
comparison utils.c @ 5837:4400d47f7c91 libavcodec
Print pixel and display aspect ratios
author | mbardiaux |
---|---|
date | Thu, 18 Oct 2007 14:01:20 +0000 |
parents | 2ec1ec2d1eae |
children | d63186919b60 |
comparison
equal
deleted
inserted
replaced
5836:0859108b4ae3 | 5837:4400d47f7c91 |
---|---|
1073 const char *codec_name; | 1073 const char *codec_name; |
1074 AVCodec *p; | 1074 AVCodec *p; |
1075 char buf1[32]; | 1075 char buf1[32]; |
1076 char channels_str[100]; | 1076 char channels_str[100]; |
1077 int bitrate; | 1077 int bitrate; |
1078 AVRational display_aspect_ratio; | |
1078 | 1079 |
1079 if (encode) | 1080 if (encode) |
1080 p = avcodec_find_encoder(enc->codec_id); | 1081 p = avcodec_find_encoder(enc->codec_id); |
1081 else | 1082 else |
1082 p = avcodec_find_decoder(enc->codec_id); | 1083 p = avcodec_find_decoder(enc->codec_id); |
1123 } | 1124 } |
1124 if (enc->width) { | 1125 if (enc->width) { |
1125 snprintf(buf + strlen(buf), buf_size - strlen(buf), | 1126 snprintf(buf + strlen(buf), buf_size - strlen(buf), |
1126 ", %dx%d", | 1127 ", %dx%d", |
1127 enc->width, enc->height); | 1128 enc->width, enc->height); |
1129 av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, | |
1130 enc->width*enc->sample_aspect_ratio.num, | |
1131 enc->height*enc->sample_aspect_ratio.den, | |
1132 1024*1024); | |
1133 snprintf(buf + strlen(buf), buf_size - strlen(buf), | |
1134 " [PAR %d:%d DAR %d:%d]", | |
1135 enc->sample_aspect_ratio.num, enc->sample_aspect_ratio.den, | |
1136 display_aspect_ratio.num, display_aspect_ratio.den); | |
1128 if(av_log_level >= AV_LOG_DEBUG){ | 1137 if(av_log_level >= AV_LOG_DEBUG){ |
1129 int g= ff_gcd(enc->time_base.num, enc->time_base.den); | 1138 int g= ff_gcd(enc->time_base.num, enc->time_base.den); |
1130 snprintf(buf + strlen(buf), buf_size - strlen(buf), | 1139 snprintf(buf + strlen(buf), buf_size - strlen(buf), |
1131 ", %d/%d", | 1140 ", %d/%d", |
1132 enc->time_base.num/g, enc->time_base.den/g); | 1141 enc->time_base.num/g, enc->time_base.den/g); |