Ticket #2761: patchrtspuseragent2.diff

File patchrtspuseragent2.diff, 2.2 KB (added by Carl Eugen Hoyos, 13 years ago)
  • libavformat/rtsp.c

    diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
    index 6310d79..5421bb2 100644
    a b  
    6262#define DEC AV_OPT_FLAG_DECODING_PARAM
    6363#define ENC AV_OPT_FLAG_ENCODING_PARAM
    6464
     65#define DEFAULT_USER_AGENT "Lavf/" AV_STRINGIFY(LIBAVFORMAT_VERSION)
     66
    6567#define RTSP_FLAG_OPTS(name, longname) \
    6668    { name, longname, OFFSET(rtsp_flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, DEC, "rtsp_flags" }, \
    6769    { "filter_src", "Only receive packets from the negotiated peer IP", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_FILTER_SRC}, 0, 0, DEC, "rtsp_flags" }, \
    const AVOption ff_rtsp_options[] = {  
    9193    { "timeout", "Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies flag listen", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC },
    9294    { "stimeout", "timeout (in micro seconds) of socket i/o operations.", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC },
    9395    RTSP_REORDERING_OPTS(),
     96    { "user-agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = DEFAULT_USER_AGENT}, 0, 0, DEC },
    9497    { NULL },
    9598};
    9699
  • libavformat/rtsp.h

    diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
    index 4af3507..9e6e237 100644
    a b typedef struct RTSPState {  
    399399     * Size of RTP packet reordering queue.
    400400     */
    401401    int reordering_queue_size;
     402
     403    /**
     404     * User-Agent string
     405     */
     406    char *user_agent;
    402407} RTSPState;
    403408
    404409#define RTSP_FLAG_FILTER_SRC  0x1    /**< Filter incoming UDP packets -
  • libavformat/rtspdec.c

    diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
    index da571a8..99a21cd 100644
    a b int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)  
    574574    /* describe the stream */
    575575    snprintf(cmd, sizeof(cmd),
    576576             "Accept: application/sdp\r\n");
     577    av_strlcatf(cmd, sizeof(cmd),
     578                "User-Agent: %s\r\n", rt->user_agent);
    577579    if (rt->server_type == RTSP_SERVER_REAL) {
    578580        /**
    579581         * The Require: attribute is needed for proper streaming from