[FFmpeg-cvslog] mmsh: mmsh_read_seek()

Michael Niedermayer git at videolan.org
Mon Oct 31 20:57:28 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Oct 31 20:50:04 2011 +0100| [8475ec190c688e39cc8d2b4aa9048196ca7e775e] | committer: Michael Niedermayer

mmsh: mmsh_read_seek()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8475ec190c688e39cc8d2b4aa9048196ca7e775e
---

 libavformat/mmsh.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c
index 94dc167..beef0a8 100644
--- a/libavformat/mmsh.c
+++ b/libavformat/mmsh.c
@@ -366,6 +366,25 @@ static int mmsh_read(URLContext *h, uint8_t *buf, int size)
     return res;
 }
 
+static int64_t mmsh_read_seek(URLContext *h, int stream_index,
+                        int64_t timestamp, int flags)
+{
+    MMSHContext *mmsh = h->priv_data;
+    MMSContext *mms   = &mmsh->mms;
+    int ret;
+
+    ret= mmsh_open_internal(h, mmsh->location, 0, timestamp, 0);
+    if(ret>=0){
+        if (mms->mms_hd)
+            ffurl_close(mms->mms_hd);
+        av_freep(&mms->streams);
+        av_freep(&mms->asf_header);
+        av_free(mmsh);
+    }else
+        h->priv_data= mmsh;
+    return ret;
+}
+
 URLProtocol ff_mmsh_protocol = {
     .name      = "mmsh",
     .url_open  = mmsh_open,
@@ -373,4 +392,5 @@ URLProtocol ff_mmsh_protocol = {
     .url_write = NULL,
     .url_seek  = NULL,
     .url_close = mmsh_close,
+    .url_read_seek  = mmsh_read_seek,
 };



More information about the ffmpeg-cvslog mailing list