[FFmpeg-soc] [soc]: r4603 - in concat/libavformat: concatgen.c playlist.c playlist.h

gkovacs subversion at mplayerhq.hu
Sat Jul 4 23:38:07 CEST 2009


Author: gkovacs
Date: Sat Jul  4 23:38:07 2009
New Revision: 4603

Log:
removed stream time conversion convenience functions

Modified:
   concat/libavformat/concatgen.c
   concat/libavformat/playlist.c
   concat/libavformat/playlist.h

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Sat Jul  4 23:24:40 2009	(r4602)
+++ concat/libavformat/concatgen.c	Sat Jul  4 23:38:07 2009	(r4603)
@@ -40,7 +40,11 @@ int concatgen_read_packet(AVFormatContex
     }
     if (ret >= 0) {
         if (pkt) {
-            int64_t time_offset = ff_conv_stream_time(ic, pkt->stream_index, ctx->time_offsets[pkt->stream_index]);
+            int64_t time_offset;
+            AVRational avbasetime = {1, AV_TIME_BASE};
+            time_offset = av_rescale_q(ctx->time_offsets[pkt->stream_index], avbasetime, ic->streams[stream_index]->time_base);
+            printf("%s conv stream time from %ld to %ld/%ld is %ld\n", ic->iformat->name, ctx->time_offsets[pkt->stream_index], ic->streams[stream_index]->time_base.num, ic->streams[stream_index]->time_base.den, time_offset);
+            // TODO changing either dts or pts leads to timing issues on h264
             pkt->dts += time_offset;
             if (!ic->streams[pkt->stream_index]->codec->has_b_frames)
                 pkt->pts = pkt->dts + 1;

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Sat Jul  4 23:24:40 2009	(r4602)
+++ concat/libavformat/playlist.c	Sat Jul  4 23:38:07 2009	(r4603)
@@ -235,29 +235,6 @@ int ff_playlist_populate_context(Playlis
     return 0;
 }
 
-// converts duration to stream base
-int64_t ff_conv_stream_time(AVFormatContext *ic, int stream_index, int64_t avt_duration)
-{
-    int64_t durn;
-    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;
-}
-
-// converts duration to AV_TIME_BASE
-int64_t ff_conv_base_time(AVFormatContext *ic, int stream_index, int64_t stream_duration)
-{
-    int64_t durn;
-    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;
-}
-
 // returns duration in seconds * AV_TIME_BASE
 int64_t ff_playlist_get_duration(AVFormatContext *ic, int stream_index)
 {
@@ -274,7 +251,8 @@ int64_t ff_playlist_get_duration(AVForma
     int64_t durn;
 
 //    durn = ic->duration;
-    durn = ff_conv_base_time(ic, stream_index, ic->streams[stream_index]->duration);
+    AVRational avbasetime = {1, AV_TIME_BASE};
+    durn = av_rescale_q(ic->streams[stream_index]->duration, ic->streams[stream_index]->time_base, avbasetime);
 
 //    durn = ic->streams[stream_index]->duration; // ogg gives wrong value
     printf("duration is %ld\n", durn);

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Sat Jul  4 23:24:40 2009	(r4602)
+++ concat/libavformat/playlist.h	Sat Jul  4 23:38:07 2009	(r4603)
@@ -64,10 +64,6 @@ char* ff_buf_getline(ByteIOContext *s);
 
 void ff_split_wd_fn(char *filepath, char **workingdir, char **filename);
 
-int64_t ff_conv_stream_time(AVFormatContext *ic, int stream_index, int64_t avt_duration);
-
-int64_t ff_conv_base_time(AVFormatContext *ic, int stream_index, int64_t stream_duration);
-
 int64_t ff_playlist_get_duration(AVFormatContext *ic, int stream_index);
 
 #endif /* _PLAYLIST_H */


More information about the FFmpeg-soc mailing list