From feaa721916303c36dcd676c11ac74ecdec2db006 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 7 Jul 2013 18:47:39 +0200 Subject: core: make network options available even if old net code is disabled Preparation for removing the old network code. --- core/options.c | 10 ++++++++-- core/options.h | 10 ++++++++++ stream/http.c | 1 + stream/network.c | 11 ----------- stream/network.h | 10 ---------- stream/stream_lavf.c | 3 +-- stream/stream_udp.c | 1 + 7 files changed, 21 insertions(+), 25 deletions(-) diff --git a/core/options.c b/core/options.c index 5e1104d3e6..3a60e3c810 100644 --- a/core/options.c +++ b/core/options.c @@ -40,6 +40,14 @@ #include "mp_core.h" #include "osdep/priority.h" +char *network_username=NULL; +char *network_password=NULL; +int network_bandwidth=0; +int network_cookies_enabled = 0; +char *network_useragent="MPlayer 1.1-4.7"; +char *network_referrer=NULL; +char **network_http_header_fields=NULL; + extern char *lirc_configfile; extern int mp_msg_color; @@ -343,7 +351,6 @@ const m_option_t mp_opts[] = { {"bluray-angle", &bluray_angle, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL}, #endif /* CONFIG_LIBBLURAY */ -#ifdef CONFIG_NETWORKING {"user", &network_username, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"passwd", &network_password, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"bandwidth", &network_bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, @@ -358,7 +365,6 @@ const m_option_t mp_opts[] = { #ifdef HAVE_AF_INET6 {"prefer-ipv6", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, NULL}, #endif /* HAVE_AF_INET6 */ -#endif /* CONFIG_NETWORKING */ // ------------------------- demuxer options -------------------- diff --git a/core/options.h b/core/options.h index 80398bae95..54048d9966 100644 --- a/core/options.h +++ b/core/options.h @@ -266,6 +266,16 @@ typedef struct MPOpts { } encode_output; } MPOpts; +// Should be moved into MPOpts +extern char **network_http_header_fields; +extern char *network_username; +extern char *network_password; +extern int network_bandwidth; +extern char *network_useragent; +extern char *network_referrer; +extern int network_cookies_enabled; +extern char *cookies_file; + extern const m_option_t mp_opts[]; extern const struct MPOpts mp_default_opts; diff --git a/stream/http.c b/stream/http.c index 2ec7c9d58c..d17261910f 100644 --- a/stream/http.c +++ b/stream/http.c @@ -35,6 +35,7 @@ #include "http.h" #include "url.h" +#include "core/options.h" #include "core/mp_msg.h" #include "stream.h" diff --git a/stream/network.c b/stream/network.c index 371b7f52cd..101e4507ab 100644 --- a/stream/network.c +++ b/stream/network.c @@ -47,17 +47,6 @@ #include "cookies.h" #include "url.h" -/* Variables for the command line option -user, -passwd, -bandwidth, - -user-agent and -nocookies */ - -char *network_username=NULL; -char *network_password=NULL; -int network_bandwidth=0; -int network_cookies_enabled = 0; -char *network_useragent="MPlayer 1.1-4.7"; -char *network_referrer=NULL; -char **network_http_header_fields=NULL; - /* IPv6 options */ int network_ipv4_only_proxy = 0; diff --git a/stream/network.h b/stream/network.h index a2d1d3d173..65ec3d41d9 100644 --- a/stream/network.h +++ b/stream/network.h @@ -61,16 +61,6 @@ typedef struct { extern const mime_struct_t mime_type_table[]; -extern char **network_http_header_fields; - -extern char *network_username; -extern char *network_password; -extern int network_bandwidth; -extern char *network_useragent; -extern char *network_referrer; -extern int network_cookies_enabled; -extern char *cookies_file; - extern int network_prefer_ipv4; extern int network_ipv4_only_proxy; extern int reuse_socket; diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c index a21b46c46d..640c719109 100644 --- a/stream/stream_lavf.c +++ b/stream/stream_lavf.c @@ -21,6 +21,7 @@ #include #include "config.h" +#include "core/options.h" #include "core/mp_msg.h" #include "stream.h" #include "core/m_option.h" @@ -178,7 +179,6 @@ static int open_f(stream_t *stream, int mode, void *opts, int *file_format) filename = talloc_asprintf(temp, "mmsh://%.*s", BSTR_P(b_filename)); } -#ifdef CONFIG_NETWORKING // HTTP specific options (other protocols ignore them) if (network_useragent) av_dict_set(&dict, "user-agent", network_useragent, 0); @@ -197,7 +197,6 @@ static int open_f(stream_t *stream, int mode, void *opts, int *file_format) } if (strlen(cust_headers)) av_dict_set(&dict, "headers", cust_headers, 0); -#endif av_dict_set(&dict, "icy", "1", 0); int err = avio_open2(&avio, filename, flags, NULL, &dict); diff --git a/stream/stream_udp.c b/stream/stream_udp.c index d447a9238c..f3a3918e63 100644 --- a/stream/stream_udp.c +++ b/stream/stream_udp.c @@ -25,6 +25,7 @@ #include #include +#include "core/options.h" #include "stream.h" #include "url.h" #include "udp.h" -- cgit v1.2.3