mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
avprobe: also output dar/par if only defined in stream
Based on a patch by Jan Gerber <j@v2v.cc>
This commit is contained in:
parent
be6cde3ce8
commit
dda20a6e2c
15
avprobe.c
15
avprobe.c
@ -583,7 +583,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
|
|||||||
const AVCodec *dec;
|
const AVCodec *dec;
|
||||||
const char *profile;
|
const char *profile;
|
||||||
char val_str[128];
|
char val_str[128];
|
||||||
AVRational display_aspect_ratio;
|
AVRational display_aspect_ratio, *sar = NULL;
|
||||||
const AVPixFmtDescriptor *desc;
|
const AVPixFmtDescriptor *desc;
|
||||||
|
|
||||||
probe_object_header("stream");
|
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("width", dec_ctx->width);
|
||||||
probe_int("height", dec_ctx->height);
|
probe_int("height", dec_ctx->height);
|
||||||
probe_int("has_b_frames", dec_ctx->has_b_frames);
|
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",
|
probe_str("sample_aspect_ratio",
|
||||||
rational_string(val_str, sizeof(val_str), ":",
|
rational_string(val_str, sizeof(val_str), ":", sar));
|
||||||
&dec_ctx->sample_aspect_ratio));
|
|
||||||
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
|
av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
|
||||||
dec_ctx->width * dec_ctx->sample_aspect_ratio.num,
|
dec_ctx->width * sar->num, dec_ctx->height * sar->den,
|
||||||
dec_ctx->height * dec_ctx->sample_aspect_ratio.den,
|
|
||||||
1024*1024);
|
1024*1024);
|
||||||
probe_str("display_aspect_ratio",
|
probe_str("display_aspect_ratio",
|
||||||
rational_string(val_str, sizeof(val_str), ":",
|
rational_string(val_str, sizeof(val_str), ":",
|
||||||
|
Loading…
Reference in New Issue
Block a user