[FFmpeg-soc] [soc]: r4600 - concat/libavformat/playlist.c

gkovacs subversion at mplayerhq.hu
Sat Jul 4 22:49:33 CEST 2009


Author: gkovacs
Date: Sat Jul  4 22:49:33 2009
New Revision: 4600

Log:
switched to av_rescale_q for converting stream time formats

Modified:
   concat/libavformat/playlist.c

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Sat Jul  4 22:30:09 2009	(r4599)
+++ concat/libavformat/playlist.c	Sat Jul  4 22:49:33 2009	(r4600)
@@ -239,12 +239,10 @@ int ff_playlist_populate_context(Playlis
 int64_t ff_conv_stream_time(AVFormatContext *ic, int stream_index, int64_t avt_duration)
 {
     int64_t durn;
-    durn = (int64_t)(
-           (avt_duration *
-           ic->streams[stream_index]->time_base.den) /
-           (AV_TIME_BASE * // 10^6
-           ic->streams[stream_index]->time_base.num)
-           );
+    AVRational avtimebase;
+    avtimebase.num = 1;
+    avtimebase.den = AV_TIME_BASE;
+    durn = av_rescale_q(avt_duration, avtimebase, ic->streams[stream_index]->time_base);
     printf("%s conv stream time from %ld to %ld/%ld is %ld\n", ic->iformat->name, avt_duration, ic->streams[stream_index]->time_base.num, ic->streams[stream_index]->time_base.den, durn);
     return durn;
 }
@@ -253,12 +251,10 @@ int64_t ff_conv_stream_time(AVFormatCont
 int64_t ff_conv_base_time(AVFormatContext *ic, int stream_index, int64_t stream_duration)
 {
     int64_t durn;
-    durn = (int64_t)(
-           (stream_duration *
-           ic->streams[stream_index]->time_base.num) *
-           (AV_TIME_BASE / // 10^6
-           ic->streams[stream_index]->time_base.den)
-           );
+    AVRational avtimebase;
+    avtimebase.num = 1;
+    avtimebase.den = AV_TIME_BASE;
+    durn = av_rescale_q(stream_duration, ic->streams[stream_index]->time_base, avtimebase);
     return durn;
 }
 


More information about the FFmpeg-soc mailing list