]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/http.c
replaygain: fix gain sign decoding
[ffmpeg] / libavformat / http.c
index f7d5c8925b06bba6a2097ba26bbf6bacabf54d7c..948930a053d765cf462a39d265ff7df06d93f8ae 100644 (file)
@@ -353,7 +353,7 @@ static int parse_location(HTTPContext *s, const char *p)
 }
 
 /* "bytes $from-$to/$document_size" */
-static void parse_content_range(URLContext *h, char *p)
+static void parse_content_range(URLContext *h, const char *p)
 {
     HTTPContext *s = h->priv_data;
     const char *slash;
@@ -367,7 +367,7 @@ static void parse_content_range(URLContext *h, char *p)
     h->is_streamed = 0; /* we _can_ in fact seek */
 }
 
-static int parse_content_encoding(URLContext *h, char *p)
+static int parse_content_encoding(URLContext *h, const char *p)
 {
     HTTPContext *s = h->priv_data;
 
@@ -405,6 +405,7 @@ static int parse_content_encoding(URLContext *h, char *p)
 static int parse_icy(HTTPContext *s, const char *tag, const char *p)
 {
     int len = 4 + strlen(p) + strlen(tag);
+    int is_first = !s->icy_metadata_headers;
     int ret;
 
     if (s->icy_metadata_headers)
@@ -413,6 +414,9 @@ static int parse_icy(HTTPContext *s, const char *tag, const char *p)
     if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
         return ret;
 
+    if (is_first)
+        *s->icy_metadata_headers = '\0';
+
     av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
 
     return 0;