diff options
author | wm4 <wm4@nowhere> | 2013-12-22 13:28:55 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-22 13:29:16 +0100 |
commit | 8b7048b7d54d7e1a163d6efc994dbd3792812334 (patch) | |
tree | e9bc3ad625d5a4b1c7e58bc307624719c758c0fd /stream/stream_lavf.c | |
parent | 3a637d411f603fd82ee0bf8a181ea20d60e7c88f (diff) | |
download | mpv-8b7048b7d54d7e1a163d6efc994dbd3792812334.tar.bz2 mpv-8b7048b7d54d7e1a163d6efc994dbd3792812334.tar.xz |
stream: minor cookie cleanup
Avoid global state (reload cookie file every time), actually free
loaded cookies, use mp_get_user_path() for cookie file.
Diffstat (limited to 'stream/stream_lavf.c')
-rw-r--r-- | stream/stream_lavf.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c index 645fcb5c6c..da57b10e82 100644 --- a/stream/stream_lavf.c +++ b/stream/stream_lavf.c @@ -22,6 +22,7 @@ #include "config.h" #include "options/options.h" +#include "options/path.h" #include "common/msg.h" #include "stream.h" #include "options/m_option.h" @@ -184,7 +185,11 @@ static int open_f(stream_t *stream, int mode) av_dict_set(&dict, "user-agent", opts->network_useragent, 0); if (opts->network_cookies_enabled) { char *file = opts->network_cookies_file; - av_dict_set(&dict, "cookies", cookies_lavf(temp, stream->log, file), 0); + if (file && file[0]) + file = mp_get_user_path(temp, stream->global, file); + char *cookies = cookies_lavf(temp, stream->log, file); + if (cookies && cookies[0]) + av_dict_set(&dict, "cookies", cookies, 0); } av_dict_set(&dict, "tls_verify", opts->network_tls_verify ? "1" : "0", 0); if (opts->network_tls_ca_file) |