[Ffmpeg-devel] [PATCH] use av_q2d() instead

Limin Wang lance.lmwang
Thu Mar 8 06:26:25 CET 2007


Hi,

please review the patch.


Thanks,
Limin
-------------- next part --------------
Index: ffmpeg.c
===================================================================
--- ffmpeg.c	(revision 8289)
+++ ffmpeg.c	(working copy)
@@ -963,7 +963,7 @@
             vid = 1;
         }
         /* compute min output value */
-        pts = (double)ost->st->pts.val * ost->st->time_base.num / ost->st->time_base.den;
+        pts = (double)ost->st->pts.val * av_q2d(ost->st->time_base);
         if ((pts < ti1) && (pts > 0))
             ti1 = pts;
     }
@@ -1079,9 +1079,7 @@
                         goto discard_packet;
                     }
                     if (ist->st->codec->time_base.num != 0) {
-                        ist->next_pts += ((int64_t)AV_TIME_BASE *
-                                          ist->st->codec->time_base.num) /
-                            ist->st->codec->time_base.den;
+                        ist->next_pts += ((int64_t)AV_TIME_BASE * av_q2d(ist->st->codec->time_base));
                     }
                     len = 0;
                     break;
@@ -1107,9 +1105,7 @@
                     break;
                 case CODEC_TYPE_VIDEO:
                     if (ist->st->codec->time_base.num != 0) {
-                        ist->next_pts += ((int64_t)AV_TIME_BASE *
-                                          ist->st->codec->time_base.num) /
-                            ist->st->codec->time_base.den;
+                        ist->next_pts += ((int64_t)AV_TIME_BASE * av_q2d(ist->st->codec->time_base));
                     }
                     break;
                 }
@@ -3337,7 +3333,7 @@
                         AVCodecContext *c = input_files[j]->streams[i]->codec;
                         if(c->codec_type != CODEC_TYPE_VIDEO)
                             continue;
-                        fr = c->time_base.den * 1000 / c->time_base.num;
+                        fr = 1000 * av_q2d(c->time_base);
                         if(fr == 25000) {
                             norm = 0;
                             break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070308/486ed1d5/attachment.pgp>



More information about the ffmpeg-devel mailing list