aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-01-03 12:01:15 +0100
committerAnton Khirnov <anton@khirnov.net>2013-01-04 12:55:58 +0100
commitdda20a6e2c0c3d7985a93c60f5897975549d53b0 (patch)
tree4a8fede3995ef28154dcbc7b1b080f368ce4ceb5
parentbe6cde3ce86e9ecf9b52309d7ca68c410ced525d (diff)
downloadffmpeg-dda20a6e2c0c3d7985a93c60f5897975549d53b0.tar.gz
avprobe: also output dar/par if only defined in stream
Based on a patch by Jan Gerber <j@v2v.cc>
-rw-r--r--avprobe.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/avprobe.c b/avprobe.c
index 4da9621b85..38b74a3bae 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -583,7 +583,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
const AVCodec *dec;
const char *profile;
char val_str[128];
- AVRational display_aspect_ratio;
+ AVRational display_aspect_ratio, *sar = NULL;
const AVPixFmtDescriptor *desc;
probe_object_header("stream");
@@ -618,13 +618,16 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
probe_int("width", dec_ctx->width);
probe_int("height", dec_ctx->height);
probe_int("has_b_frames", dec_ctx->has_b_frames);
- if (dec_ctx->sample_aspect_ratio.num) {
+ if (dec_ctx->sample_aspect_ratio.num)
+ sar = &dec_ctx->sample_aspect_ratio;
+ else if (stream->sample_aspect_ratio.num)
+ sar = &stream->sample_aspect_ratio;
+
+ if (sar) {
probe_str("sample_aspect_ratio",
- rational_string(val_str, sizeof(val_str), ":",
- &dec_ctx->sample_aspect_ratio));
+ rational_string(val_str, sizeof(val_str), ":", sar));
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,
+ dec_ctx->width * sar->num, dec_ctx->height * sar->den,
1024*1024);
probe_str("display_aspect_ratio",
rational_string(val_str, sizeof(val_str), ":",