Ticket #2710: follow-http-redirect.patch

File follow-http-redirect.patch, 2.8 KB (added by Sidney N'Guessan, 13 years ago)

Patch to follow HTTP redirect 307 on a specified URL

  • libavformat/http.c

     
    202202        location_changed = 0;
    203203        goto redo;
    204204    }
     205    av_strlcpy(h->fileloc, s->location, sizeof(h->fileloc));
    205206    return 0;
    206207 fail:
    207208    if (s->hd)
  • libavformat/aviobuf.c

     
    788788        ffurl_close(h);
    789789        return err;
    790790    }
     791
     792    av_log(*s, AV_LOG_DEBUG, "Ressource opened: %s\n",  h->fileloc);
     793    memcpy((*s)->res_opened, h->fileloc, sizeof((*s)->res_opened));
    791794    return 0;
    792795}
    793796
  • libavformat/utils.c

     
    505505        return ret;
    506506    if (s->iformat)
    507507        return 0;
    508     return av_probe_input_buffer(s->pb, &s->iformat, filename, s, 0, s->probesize);
     508
     509    return av_probe_input_buffer(s->pb, &s->iformat, s->pb->res_opened, s, 0, s->probesize);
    509510}
    510511
    511512static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt,
     
    572573    }
    573574
    574575    s->duration = s->start_time = AV_NOPTS_VALUE;
    575     av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename));
     576    av_strlcpy(s->filename, s->pb->res_opened ? s->pb->res_opened : "", sizeof(s->filename));
    576577
    577578    /* allocate private data */
    578579    if (s->iformat->priv_data_size > 0) {
  • libavformat/avio.h

     
    7979     * to any av_opt_* functions in that case.
    8080     */
    8181    const AVClass *av_class;
     82    char res_opened[4096];  /**< Ressource opened during probing */
    8283    unsigned char *buffer;  /**< Start of the buffer. */
    8384    int buffer_size;        /**< Maximum buffer size */
    8485    unsigned char *buf_ptr; /**< Current position in the buffer */
     
    140141     * This field is internal to libavformat and access from outside is not allowed.
    141142     */
    142143     int seek_count;
     144
    143145} AVIOContext;
    144146
    145147/* unbuffered I/O */
  • libavformat/url.h

     
    4343    struct URLProtocol *prot;
    4444    void *priv_data;
    4545    char *filename;             /**< specified URL */
     46    char fileloc[4096];         /**< file location of a specified URL */
    4647    int flags;
    4748    int max_packet_size;        /**< if non zero, the stream is packetized with this max packet size */
    4849    int is_streamed;            /**< true if streamed (no seek possible), default = false */