$subj, this may not be needed for RTSP over HTTP (depending on how I
do it), but I think this patch cleans up the code a bit regardless.
Messy diff though; all I did was factor out a hunk of code to a
separate function, but old and new lines are interleaved here. My
git-fu is weak; if there's a command to make a cleaner diff (I used
git diff -b), please let me know.
Tested with feng and the cathedral mp4, works OK.
Josh
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 6dbd796..2138a13 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1001,34 +1001,45 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
return 0;
}
-void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
+static void write_rtsp_headers(RTSPState *rt, char *buf, int buf_length,
const char *method, const char *url,
const char *headers,
const unsigned char *send_content,
int send_content_length)
{
- RTSPState *rt = s->priv_data;
- char buf[4096];
-
- rt->seq++;
- snprintf(buf, sizeof(buf), "%s %s RTSP/1.0\r\n", method, url);
+ snprintf(buf, buf_length, "%s %s RTSP/1.0\r\n", method, url);
if (headers)
- av_strlcat(buf, headers, sizeof(buf));
- av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", rt->seq);
+ av_strlcat(buf, headers, buf_length);
+ av_strlcatf(buf, buf_length, "CSeq: %d\r\n", rt->seq);
if (rt->session_id[0] != '\0' && (!headers ||
!strstr(headers, "\nIf-Match:"))) {
- av_strlcatf(buf, sizeof(buf), "Session: %s\r\n", rt->session_id);
+ av_strlcatf(buf, buf_length, "Session: %s\r\n", rt->session_id);
}
if (rt->auth[0]) {
char *str = ff_http_auth_create_response(&rt->auth_state,
rt->auth, url, method);
if (str)
- av_strlcat(buf, str, sizeof(buf));
+ av_strlcat(buf, str, buf_length);
av_free(str);
}
if (send_content_length > 0 && send_content)
- av_strlcatf(buf, sizeof(buf), "Content-Length: %d\r\n", send_content_length);
- av_strlcat(buf, "\r\n", sizeof(buf));
+ av_strlcatf(buf, buf_length, "Content-Length: %d\r\n", send_content_length);
+ av_strlcat(buf, "\r\n", buf_length);
+
+}
+
+void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
+ const char *method, const char *url,
+ const char *headers,
+ const unsigned char *send_content,
+ int send_content_length)
+{
+ RTSPState *rt = s->priv_data;
+ char buf[4096];
+
+ rt->seq++;
+ write_rtsp_headers(rt, buf, sizeof(buf), method, url,
+ headers, send_content, send_content_length);
dprintf(s, "Sending:\n%s--\n", buf);
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc