1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-31 15:59:34 +00:00

core: make network options available even if old net code is disabled

Preparation for removing the old network code.
This commit is contained in:
wm4 2013-07-07 18:47:39 +02:00
parent 2c732a46ba
commit feaa721916
7 changed files with 21 additions and 25 deletions

View File

@ -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 --------------------

View File

@ -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;

View File

@ -35,6 +35,7 @@
#include "http.h"
#include "url.h"
#include "core/options.h"
#include "core/mp_msg.h"
#include "stream.h"

View File

@ -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;

View File

@ -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;

View File

@ -21,6 +21,7 @@
#include <libavutil/opt.h>
#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);

View File

@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include "core/options.h"
#include "stream.h"
#include "url.h"
#include "udp.h"