[FFmpeg-cvslog] r22880 - trunk/ffprobe.c

stefano subversion
Wed Apr 14 01:41:46 CEST 2010


Author: stefano
Date: Wed Apr 14 01:41:46 2010
New Revision: 22880

Log:
Fix computation of the display aspect ratio.

Previously ffprobe was wrongly outputting the sample aspect ratio as
display aspect ratio.

Patch by Robert Kr?ger $(echo k-r-u-e-g-e-r at s-i-g-n-a-l-7.d-e | sed s/-//g).

Modified:
   trunk/ffprobe.c

Modified: trunk/ffprobe.c
==============================================================================
--- trunk/ffprobe.c	Wed Apr 14 01:24:25 2010	(r22879)
+++ trunk/ffprobe.c	Wed Apr 14 01:41:46 2010	(r22880)
@@ -121,6 +121,7 @@ static void show_stream(AVFormatContext 
     char val_str[128];
     AVMetadataTag *tag = NULL;
     char a, b, c, d;
+    AVRational display_aspect_ratio;
 
     printf("[STREAM]\n");
 
@@ -156,8 +157,12 @@ static void show_stream(AVFormatContext 
             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);
-            printf("display_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;



More information about the ffmpeg-cvslog mailing list