summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-10 21:25:22 +0100
committerwm4 <wm4@nowhere>2014-02-10 21:25:22 +0100
commit3dd12104d9c021a10ba92680896edb777ae852d3 (patch)
tree8cbd1a665bcd56971728811e5ef0882d76b1b4a4 /player
parent238c9b1d8dd648462d66167e2a373b1f3e74d3a9 (diff)
downloadmpv-3dd12104d9c021a10ba92680896edb777ae852d3.tar.bz2
mpv-3dd12104d9c021a10ba92680896edb777ae852d3.tar.xz
build: add option to build a library
This library will export the client API functions. Note that this doesn't allow compiling the command line player to link against this library yet. The reason is that there's lots of weird stuff required to setup the execution environment (mostly Windows and OSX specifics), as well as things which are out of scope of the client API and every application has to do on its own. However, since the mpv command line player basically reuses functions from the mpv core to implement these things, it's not very easy to separate the command line player form the mpv core.
Diffstat (limited to 'player')
-rw-r--r--player/core.h1
-rw-r--r--player/main.c11
-rw-r--r--player/main_fn.c15
3 files changed, 17 insertions, 10 deletions
diff --git a/player/core.h b/player/core.h
index 10c2f1886d..b772f862f7 100644
--- a/player/core.h
+++ b/player/core.h
@@ -388,6 +388,7 @@ void mp_set_playlist_entry(struct MPContext *mpctx, struct playlist_entry *e);
void mp_play_files(struct MPContext *mpctx);
// main.c
+int mpv_main(int argc, char *argv[]);
int mp_initialize(struct MPContext *mpctx);
struct MPContext *mp_create(void);
void mp_destroy(struct MPContext *mpctx);
diff --git a/player/main.c b/player/main.c
index 4493d8aeb5..99ba0becd2 100644
--- a/player/main.c
+++ b/player/main.c
@@ -444,7 +444,7 @@ int mp_initialize(struct MPContext *mpctx)
return 0;
}
-static int mpv_main(int argc, char *argv[])
+int mpv_main(int argc, char *argv[])
{
osdep_preinit(&argc, &argv);
@@ -519,12 +519,3 @@ static int mpv_main(int argc, char *argv[])
return 1;
}
-
-int main(int argc, char *argv[])
-{
-#if HAVE_COCOA
- return cocoa_main(mpv_main, argc, argv);
-#else
- return mpv_main(argc, argv);
-#endif
-}
diff --git a/player/main_fn.c b/player/main_fn.c
new file mode 100644
index 0000000000..87e1681987
--- /dev/null
+++ b/player/main_fn.c
@@ -0,0 +1,15 @@
+#include "config.h"
+#include "core.h"
+
+#if HAVE_COCOA
+#include "osdep/macosx_application.h"
+#endif
+
+int main(int argc, char *argv[])
+{
+#if HAVE_COCOA
+ return cocoa_main(mpv_main, argc, argv);
+#else
+ return mpv_main(argc, argv);
+#endif
+}