[FFmpeg-cvslog] r17956 - trunk/libavformat/utils.c

michael subversion
Sat Mar 14 16:51:47 CET 2009


Author: michael
Date: Sat Mar 14 16:51:46 2009
New Revision: 17956

Log:
add avformat_seek_file()

Modified:
   trunk/libavformat/utils.c

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Sat Mar 14 11:18:18 2009	(r17955)
+++ trunk/libavformat/utils.c	Sat Mar 14 16:51:46 2009	(r17956)
@@ -1584,6 +1584,28 @@ int av_seek_frame(AVFormatContext *s, in
         return av_seek_frame_generic(s, stream_index, timestamp, flags);
 }
 
+int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
+{
+    if(min_ts > ts || max_ts < ts)
+        return -1;
+
+    av_read_frame_flush(s);
+
+    if (s->iformat->read_seek2)
+        return s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags);
+
+    if(s->iformat->read_timestamp){
+        //try to seek via read_timestamp()
+    }
+
+    //Fallback to old API if new is not implemented but old is
+    //Note the old has somewat different sematics
+    if(s->iformat->read_seek || 1)
+        return av_seek_frame(s, stream_index, ts, ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0);
+
+    // try some generic seek like av_seek_frame_generic() but with new ts semantics
+}
+
 /*******************************************************/
 
 /**




More information about the ffmpeg-cvslog mailing list