summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-07 19:40:14 +0200
committerwm4 <wm4@nowhere>2013-07-07 19:42:38 +0200
commit854303ad49d188d96af8151b290162916c81c993 (patch)
treed47fc0ccd34adf47df7612c8b213d09b3816eae5 /core
parentfeaa721916303c36dcd676c11ac74ecdec2db006 (diff)
downloadmpv-854303ad49d188d96af8151b290162916c81c993.tar.bz2
mpv-854303ad49d188d96af8151b290162916c81c993.tar.xz
Remove internal network support
This commit removes the "old" networking code in favor of libavformat's code. The code was still used for mp_http, udp, ftp, cddb. http has been mapped to libavformat's http support since approximately 6 months ago. udp and ftp have support in ffmpeg (though ftp was added only last month). cddb support is removed with this commit - it's probably not important and rarely used if at all, so we don't care about it.
Diffstat (limited to 'core')
-rw-r--r--core/m_option.c34
-rw-r--r--core/options.c11
-rw-r--r--core/options.h3
3 files changed, 33 insertions, 15 deletions
diff --git a/core/m_option.c b/core/m_option.c
index 9ef968194f..9b8256abe4 100644
--- a/core/m_option.c
+++ b/core/m_option.c
@@ -29,6 +29,7 @@
#include <limits.h>
#include <inttypes.h>
#include <unistd.h>
+#include <ctype.h>
#include <assert.h>
#include <libavutil/common.h>
@@ -38,7 +39,6 @@
#include "core/mp_common.h"
#include "core/m_option.h"
#include "core/mp_msg.h"
-#include "stream/url.h"
char *m_option_strerror(int code)
{
@@ -2367,6 +2367,38 @@ const m_option_type_t m_option_type_obj_settings_list = {
};
+/* Replace escape sequences in an URL (or a part of an URL) */
+/* works like strcpy(), but without return argument,
+ except that outbuf == inbuf is allowed */
+static void url_unescape_string(char *outbuf, const char *inbuf)
+{
+ unsigned char c,c1,c2;
+ int i,len=strlen(inbuf);
+ for (i=0;i<len;i++) {
+ c = inbuf[i];
+ if (c == '%' && i<len-2) { //must have 2 more chars
+ c1 = toupper(inbuf[i+1]); // we need uppercase characters
+ c2 = toupper(inbuf[i+2]);
+ if (((c1>='0' && c1<='9') || (c1>='A' && c1<='F')) &&
+ ((c2>='0' && c2<='9') || (c2>='A' && c2<='F')) )
+ {
+ if (c1>='0' && c1<='9')
+ c1-='0';
+ else
+ c1-='A'-10;
+ if (c2>='0' && c2<='9')
+ c2-='0';
+ else
+ c2-='A'-10;
+ c = (c1<<4) + c2;
+ i=i+2; //only skip next 2 chars if valid esc
+ }
+ }
+ *outbuf++ = c;
+ }
+ *outbuf++='\0'; //add nullterm to string
+}
+
static int parse_custom_url(const m_option_t *opt, struct bstr name,
struct bstr url, void *dst)
{
diff --git a/core/options.c b/core/options.c
index 3a60e3c810..b00f79c003 100644
--- a/core/options.c
+++ b/core/options.c
@@ -40,8 +40,6 @@
#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";
@@ -351,20 +349,11 @@ const m_option_t mp_opts[] = {
{"bluray-angle", &bluray_angle, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL},
#endif /* CONFIG_LIBBLURAY */
- {"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},
{"http-header-fields", &network_http_header_fields, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
{"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"referrer", &network_referrer, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"cookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"cookies-file", &cookies_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"prefer-ipv4", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"ipv4-only-proxy", &network_ipv4_only_proxy, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"reuse-socket", &reuse_socket, CONF_TYPE_FLAG, 0, 0, 1, NULL},
-#ifdef HAVE_AF_INET6
- {"prefer-ipv6", &network_prefer_ipv4, CONF_TYPE_FLAG, 0, 1, 0, NULL},
-#endif /* HAVE_AF_INET6 */
// ------------------------- demuxer options --------------------
diff --git a/core/options.h b/core/options.h
index 54048d9966..1eb111e33e 100644
--- a/core/options.h
+++ b/core/options.h
@@ -268,9 +268,6 @@ typedef struct 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;