OSDN Git Service

Merge commit '8c929098141ebc94ad3f303521c520bb3dc6d8f6'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 22 Nov 2013 17:07:23 +0000 (18:07 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 22 Nov 2013 17:08:53 +0000 (18:08 +0100)
* commit '8c929098141ebc94ad3f303521c520bb3dc6d8f6':
  hls: Check whether the AVIOContext contains a new redirected URL

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/hls.c

@@@ -213,25 -208,15 +213,26 @@@ static int parse_playlist(HLSContext *c
      uint8_t iv[16] = "";
      int has_iv = 0;
      char key[MAX_URL_SIZE] = "";
 -    char line[1024];
 +    char line[MAX_URL_SIZE];
      const char *ptr;
      int close_in = 0;
+     uint8_t *new_url = NULL;
  
      if (!in) {
 +        AVDictionary *opts = NULL;
          close_in = 1;
 -        if ((ret = avio_open2(&in, url, AVIO_FLAG_READ,
 -                              c->interrupt_callback, NULL)) < 0)
 +        /* Some HLS servers don't like being sent the range header */
 +        av_dict_set(&opts, "seekable", "0", 0);
 +
 +        // broker prior HTTP options that should be consistent across requests
 +        av_dict_set(&opts, "user-agent", c->user_agent, 0);
 +        av_dict_set(&opts, "cookies", c->cookies, 0);
 +        av_dict_set(&opts, "headers", c->headers, 0);
 +
 +        ret = avio_open2(&in, url, AVIO_FLAG_READ,
 +                         c->interrupt_callback, &opts);
 +        av_dict_free(&opts);
 +        if (ret < 0)
              return ret;
      }