[FFmpeg-devel] [PATCH 2/2] avcodec/utils: Pretty print analog overscan style display aspect ratios
Michael Niedermayer
michaelni at gmx.at
Sun Jan 18 14:57:41 CET 2015
I hope this should reduce the confusion about display aspect ratios in the overscan case
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavcodec/utils.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7b6677f..b8b7ced 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2992,9 +2992,36 @@ void avpriv_aspect_string(char *buf, int buf_size, AVRational sar,
height * sar.den,
1024 * 1024);
+ if (overscan) {
+ AVRational dar1 = dar;
+
+ if (width == 720) {
+ av_reduce(&dar1.num, &dar1.den,
+ 704L * sar.num,
+ height * sar.den,
+ 1024 * 1024);
+ } else if (width == 480) {
+ av_reduce(&dar1.num, &dar1.den,
+ 1407L * sar.num,
+ height * 3L * sar.den,
+ 1024 * 1024);
+ } else if (overscan < 0)
+ overscan = 0;
+
+
+ if (overscan == 1 ||
+ !av_cmp_q(dar1, (AVRational){4, 3}) ||
+ !av_cmp_q(dar1, (AVRational){16, 9})
+ ) {
+ dar = dar1;
+ } else
+ overscan = 0;
+ }
+
snprintf(buf, buf_size,
- "SAR %d:%d DAR %d:%d",
+ "SAR %d:%d DAR%s %d:%d",
sar.num, sar.den,
+ overscan ? "(overscan)" : "",
dar.num, dar.den);
}
--
1.7.9.5
More information about the ffmpeg-devel
mailing list