Commit 2fe5e3e9 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '1dd1b233'

* commit '1dd1b233':
  rtsp: Include an User-Agent header field in all requests
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 4aa2874a 1dd1b233
...@@ -62,8 +62,6 @@ ...@@ -62,8 +62,6 @@
#define DEC AV_OPT_FLAG_DECODING_PARAM #define DEC AV_OPT_FLAG_DECODING_PARAM
#define ENC AV_OPT_FLAG_ENCODING_PARAM #define ENC AV_OPT_FLAG_ENCODING_PARAM
#define DEFAULT_USER_AGENT "Lavf/" AV_STRINGIFY(LIBAVFORMAT_VERSION)
#define RTSP_FLAG_OPTS(name, longname) \ #define RTSP_FLAG_OPTS(name, longname) \
{ name, longname, OFFSET(rtsp_flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, DEC, "rtsp_flags" }, \ { name, longname, OFFSET(rtsp_flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, DEC, "rtsp_flags" }, \
{ "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" }, \ { "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" }, \
...@@ -93,7 +91,7 @@ const AVOption ff_rtsp_options[] = { ...@@ -93,7 +91,7 @@ const AVOption ff_rtsp_options[] = {
{ "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 }, { "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 },
{ "stimeout", "timeout (in micro seconds) of socket i/o operations.", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC }, { "stimeout", "timeout (in micro seconds) of socket i/o operations.", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC },
RTSP_REORDERING_OPTS(), RTSP_REORDERING_OPTS(),
{ "user-agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = DEFAULT_USER_AGENT}, 0, 0, DEC }, { "user-agent", "override User-Agent header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC },
{ NULL }, { NULL },
}; };
...@@ -1138,6 +1136,7 @@ static int rtsp_send_cmd_with_content_async(AVFormatContext *s, ...@@ -1138,6 +1136,7 @@ static int rtsp_send_cmd_with_content_async(AVFormatContext *s,
if (headers) if (headers)
av_strlcat(buf, headers, sizeof(buf)); av_strlcat(buf, headers, sizeof(buf));
av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", rt->seq); av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", rt->seq);
av_strlcatf(buf, sizeof(buf), "User-Agent: %s\r\n", rt->user_agent);
if (rt->session_id[0] != '\0' && (!headers || if (rt->session_id[0] != '\0' && (!headers ||
!strstr(headers, "\nIf-Match:"))) { !strstr(headers, "\nIf-Match:"))) {
av_strlcatf(buf, sizeof(buf), "Session: %s\r\n", rt->session_id); av_strlcatf(buf, sizeof(buf), "Session: %s\r\n", rt->session_id);
......
...@@ -574,8 +574,6 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply) ...@@ -574,8 +574,6 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
/* describe the stream */ /* describe the stream */
snprintf(cmd, sizeof(cmd), snprintf(cmd, sizeof(cmd),
"Accept: application/sdp\r\n"); "Accept: application/sdp\r\n");
av_strlcatf(cmd, sizeof(cmd),
"User-Agent: %s\r\n", rt->user_agent);
if (rt->server_type == RTSP_SERVER_REAL) { if (rt->server_type == RTSP_SERVER_REAL) {
/** /**
* The Require: attribute is needed for proper streaming from * The Require: attribute is needed for proper streaming from
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment