[FFmpeg-cvslog] r11248 - in trunk/libavformat: asf.c utils.c

benoit subversion
Mon Dec 17 10:28:46 CET 2007


Author: benoit
Date: Mon Dec 17 10:28:46 2007
New Revision: 11248

Log:
Enable av_read_pause(), av_read_play() and the ASF demuxer's av_read_seek()
to use the protocol-native functionality if available.
Patch by Bj?rn Axelsson: bjorn point axelsson at intinor dot se
Original thread: [FFmpeg-devel] [PATCH][4/4] Enable use of the extended API
Date: Thu Nov 22 16:01:06 CET 2007


Modified:
   trunk/libavformat/asf.c
   trunk/libavformat/utils.c

Modified: trunk/libavformat/asf.c
==============================================================================
--- trunk/libavformat/asf.c	(original)
+++ trunk/libavformat/asf.c	Mon Dec 17 10:28:46 2007
@@ -1049,6 +1049,14 @@ static int asf_read_seek(AVFormatContext
     if (asf->packet_size <= 0)
         return -1;
 
+    /* Try using the protocol's read_seek if available */
+    if(s->pb && s->pb->read_seek) {
+        int ret = av_url_read_fseek(s->pb, stream_index, pts, flags);
+        if(ret >= 0)
+            asf_reset_header(s);
+        return ret;
+    }
+
     if (!asf->index_read)
         asf_build_simple_index(s, stream_index);
 

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Mon Dec 17 10:28:46 2007
@@ -2030,16 +2030,20 @@ int av_find_stream_info(AVFormatContext 
 
 int av_read_play(AVFormatContext *s)
 {
-    if (!s->iformat->read_play)
-        return AVERROR(ENOSYS);
-    return s->iformat->read_play(s);
+    if (s->iformat->read_play)
+        return s->iformat->read_play(s);
+    if (s->pb && s->pb->read_play)
+        return av_url_read_fplay(s->pb);
+    return AVERROR(ENOSYS);
 }
 
 int av_read_pause(AVFormatContext *s)
 {
-    if (!s->iformat->read_pause)
-        return AVERROR(ENOSYS);
-    return s->iformat->read_pause(s);
+    if (s->iformat->read_pause)
+        return s->iformat->read_pause(s);
+    if (s->pb && s->pb->read_pause)
+        return av_url_read_fpause(s->pb);
+    return AVERROR(ENOSYS);
 }
 
 void av_close_input_file(AVFormatContext *s)




More information about the ffmpeg-cvslog mailing list