[MPlayer-cvslog] r21823 - trunk/libvo/vo_yuv4mpeg.c

reimar subversion at mplayerhq.hu
Thu Jan 4 20:41:42 CET 2007


Author: reimar
Date: Thu Jan  4 20:41:41 2007
New Revision: 21823

Modified:
   trunk/libvo/vo_yuv4mpeg.c

Log:
Use av_d2q to produce the fps fraction, this usually produces more sane fractions
and works right also for extreme values that otherwise would over- or underflow.


Modified: trunk/libvo/vo_yuv4mpeg.c
==============================================================================
--- trunk/libvo/vo_yuv4mpeg.c	(original)
+++ trunk/libvo/vo_yuv4mpeg.c	Thu Jan  4 20:41:41 2007
@@ -27,6 +27,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <limits.h>
 
 #include "config.h"
 #include "subopt-helper.h"
@@ -86,6 +87,7 @@
 {
 	AVRational pixelaspect = av_div_q((AVRational){d_width, d_height},
 	                                  (AVRational){width, height});
+	AVRational fps_frac = av_d2q(vo_fps, INT_MAX);
 	if (image_width == width && image_height == height &&
 	     image_fps == vo_fps && vo_config_count)
 	  return 0;
@@ -157,9 +159,9 @@
 	image_u = image_y + image_width * image_height;
 	image_v = image_u + image_width * image_height / 4;
 	
-	fprintf(yuv_out, "YUV4MPEG2 W%d H%d F%ld:%ld I%c A%d:%d\n", 
-			image_width, image_height, (long)(image_fps * 1000000.0), 
-			(long)1000000, config_interlace,
+	fprintf(yuv_out, "YUV4MPEG2 W%d H%d F%d:%d I%c A%d:%d\n", 
+			image_width, image_height, fps_frac.num, fps_frac.den,
+			config_interlace,
 			pixelaspect.num, pixelaspect.den);
 
 	fflush(yuv_out);



More information about the MPlayer-cvslog mailing list