path: root/stream/cookies.c
diff options
authorwm4 <wm4@nowhere>2013-01-24 16:05:52 +0100
committerwm4 <wm4@nowhere>2013-01-24 17:45:13 +0100
commitdd96c11d5e0166ce6c597d178ee4827193cff16d (patch)
treed6ff3e8af74aebefe3866e8654683e8356ac5214 /stream/cookies.c
parent570271c7767e924be3d9d347b04508579dfa4d80 (diff)
stream: implement some HTTP specific options for stream_lavf
The "http:" protocol has been switched to use ffmpeg's HTTP implementation some time ago. One problem with this was that many HTTP specific options stopped working, because they were obviously implemented for the internal HTTP implementation only. Add the missing things. Note that many options will work for ffmpeg only, as Libav's HTTP implementation is missing these. They will silently be ignored on Libav. Some options we can't fix: --ipv4-only-proxy, --prefer-ipv4, --prefer-ipv6 As far as I can see, not even libavformat internals distinguish between ipv4 and ipv6. --user, --passwd ffmpeg probably supports specifying these in the URL directly.
Diffstat (limited to 'stream/cookies.c')
1 files changed, 21 insertions, 0 deletions
diff --git a/stream/cookies.c b/stream/cookies.c
index d8f8b051f9..5d772b8a6a 100644
--- a/stream/cookies.c
+++ b/stream/cookies.c
@@ -261,3 +261,24 @@ cookies_set(HTTP_header_t * http_hdr, const char *domain, const char *url)
http_set_field(http_hdr, buf);
+// Return a cookies string as expected by lavf (libavformat/http.c). The format
+// is like a Set-Cookie header (,
+// separated by newlines.
+char *cookies_lavf(void)
+ if (!cookie_list)
+ cookie_list = load_cookies();
+ struct cookie_list_type *list = cookie_list;
+ char *res = talloc_strdup(NULL, "");
+ while (list) {
+ res = talloc_asprintf_append_buffer(res,
+ "%s=%s; path=%s; domain=%s; %s\n", list->name, list->value,
+ list->path, list->domain, list->secure ? "secure" : "");
+ list = list->next;
+ }
+ return res;