[FFmpeg-cvslog] http: add hack to make streams served by MediaGateway not seekable

wm4 git at videolan.org
Sun Nov 3 23:11:51 CET 2013


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Sun Nov  3 18:17:45 2013 +0100| [3220a894f794607efab96ec3837e4c64f19f75ea] | committer: Michael Niedermayer

http: add hack to make streams served by MediaGateway not seekable

These streams are reported as seekable, but all tests show they are not,
and the server merely pretends the streams are seekable. The server
responds with:

    content-range: bytes 0-1999999999/2000000000

Range requests seem to be correctly answered, but the actual data
returned at the same offset is different. Assume this is a bug in the
server software. The server identifies itself as:

    Server: MediaGateway 3.5.2-001

Add a hack that checks the server name, and disables seeking in this
case.

Test URL: http://8283.live.streamtheworld.com:80/CBC_R1_VCR_H_SC

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

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

 libavformat/http.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 9be1181..7283477 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -68,6 +68,7 @@ typedef struct {
     uint8_t *post_data;
     int post_datalen;
     int is_akamai;
+    int is_mediagateway;
     char *mime_type;
     char *cookies;          ///< holds newline (\n) delimited Set-Cookie header field values (without the "Set-Cookie: " field name)
     int icy;
@@ -386,8 +387,12 @@ static int process_line(URLContext *h, char *line, int line_count,
         } else if (!av_strcasecmp (tag, "Connection")) {
             if (!strcmp(p, "close"))
                 s->willclose = 1;
-        } else if (!av_strcasecmp (tag, "Server") && !av_strcasecmp (p, "AkamaiGHost")) {
-            s->is_akamai = 1;
+        } else if (!av_strcasecmp (tag, "Server")) {
+            if (!av_strcasecmp (p, "AkamaiGHost")) {
+                s->is_akamai = 1;
+            } else if (!av_strncasecmp (p, "MediaGateway", 12)) {
+                s->is_mediagateway = 1;
+            }
         } else if (!av_strcasecmp (tag, "Content-Type")) {
             av_free(s->mime_type); s->mime_type = av_strdup(p);
         } else if (!av_strcasecmp (tag, "Set-Cookie")) {
@@ -570,6 +575,9 @@ static int http_read_header(URLContext *h, int *new_location)
         s->line_count++;
     }
 
+    if (s->seekable == -1 && s->is_mediagateway && s->filesize == 2000000000)
+        h->is_streamed = 1; /* we can in fact _not_ seek */
+
     return err;
 }
 



More information about the ffmpeg-cvslog mailing list