summaryrefslogtreecommitdiffstats
path: root/player/main-fn-win.c
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2015-03-29 22:36:46 +1100
committerJames Ross-Gowan <rossymiles@gmail.com>2015-04-11 14:27:25 +1000
commitac7ecbe30cdec598955471d2ed012f36296b78de (patch)
treecd62299e8df947fa73787a857e5019277ed5d952 /player/main-fn-win.c
parent6f46bafbd06e6a107e55f35860744ed66c1b8426 (diff)
downloadmpv-ac7ecbe30cdec598955471d2ed012f36296b78de.tar.bz2
mpv-ac7ecbe30cdec598955471d2ed012f36296b78de.tar.xz
win32: use a platform-specific unicode entry-point
Add a platform-specific entry-point for Windows. This will allow some platform-specific initialization to be added without the need for ugly ifdeffery in main.c. As an immediate advantage, mpv can now use a unicode entry-point and convert the command line arguments to UTF-8 before passing them to mpv_main, so osdep_preinit can be simplified a little bit.
Diffstat (limited to 'player/main-fn-win.c')
-rw-r--r--player/main-fn-win.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/player/main-fn-win.c b/player/main-fn-win.c
new file mode 100644
index 0000000000..125b4116f8
--- /dev/null
+++ b/player/main-fn-win.c
@@ -0,0 +1,20 @@
+#include "config.h"
+#include "core.h"
+#include "osdep/io.h"
+
+int wmain(int argc, wchar_t *argv[]);
+
+// mpv does its own wildcard expansion in the option parser
+int _dowildcard = 0;
+
+int wmain(int argc, wchar_t *argv[])
+{
+ char **argv_u8 = talloc_zero_array(NULL, char*, argc + 1);
+ for (int i = 0; i < argc; i++)
+ argv_u8[i] = mp_to_utf8(argv_u8, argv[i]);
+
+ int ret = mpv_main(argc, argv_u8);
+
+ talloc_free(argv_u8);
+ return ret;
+}