Mercurial > libavformat.hg
changeset 3581:3c57739a071d libavformat
Remove common factors from timebase in av_set_pts_info().
Should fix issue313
author | michael |
---|---|
date | Mon, 14 Jul 2008 19:11:09 +0000 |
parents | 29ddd96eeae5 |
children | 813a493658ee |
files | utils.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/utils.c Mon Jul 14 08:55:07 2008 +0000 +++ b/utils.c Mon Jul 14 19:11:09 2008 +0000 @@ -3152,9 +3152,13 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits, int pts_num, int pts_den) { + unsigned int gcd= ff_gcd(pts_num, pts_den); s->pts_wrap_bits = pts_wrap_bits; - s->time_base.num = pts_num; - s->time_base.den = pts_den; + s->time_base.num = pts_num/gcd; + s->time_base.den = pts_den/gcd; + + if(gcd>1) + av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, gcd); } /* fraction handling */