diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-04 19:41:41 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-04 19:41:41 +0000 |
commit | 380a752a06375686845e51654415dda640eb5434 (patch) | |
tree | 6d9b57898f15204bc05895f01ddd0c4ac7f1766d /libvo | |
parent | 275f89e3cd44ea856908766d38372fc86bf13e5a (diff) | |
download | mpv-380a752a06375686845e51654415dda640eb5434.tar.bz2 mpv-380a752a06375686845e51654415dda640eb5434.tar.xz |
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.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21823 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_yuv4mpeg.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libvo/vo_yuv4mpeg.c b/libvo/vo_yuv4mpeg.c index bf657c3a92..1b5b5696e9 100644 --- a/libvo/vo_yuv4mpeg.c +++ b/libvo/vo_yuv4mpeg.c @@ -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 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, { 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 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, 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); |