summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-19 19:57:31 +0200
committerwm4 <wm4@nowhere>2016-09-19 19:57:31 +0200
commit44a7cb7f0ed9c46bb83ce4aa23de257c4ba1b862 (patch)
tree9b77b4b23e3bf93415e44c9d36186da3e156a3b2 /player
parentce65ea3345b657b624f28587bd7f31466ac145a2 (diff)
downloadmpv-44a7cb7f0ed9c46bb83ce4aa23de257c4ba1b862.tar.bz2
mpv-44a7cb7f0ed9c46bb83ce4aa23de257c4ba1b862.tar.xz
player: minor changes in init code
Move the MPV_LEAK_REPORT env query to mp_create(), where it will also be used by the client API (it might be helpful, so why not). The same applies to MPV_VERBOSE. The prepare_playlist() call doesn't need to be in mp_initialize() and can just be in mp_play_files() to reduce the size of mp_initialize(). Also, remove wakeup_playloop(), which is 100% redundant with mp_wakeup_core_cb().
Diffstat (limited to 'player')
-rw-r--r--player/core.h1
-rw-r--r--player/loadfile.c2
-rw-r--r--player/main.c25
-rw-r--r--player/video.c2
4 files changed, 11 insertions, 19 deletions
diff --git a/player/core.h b/player/core.h
index c36972e807..df2df834fa 100644
--- a/player/core.h
+++ b/player/core.h
@@ -486,7 +486,6 @@ int mp_initialize(struct MPContext *mpctx, char **argv);
struct MPContext *mp_create(void);
void mp_destroy(struct MPContext *mpctx);
void mp_print_version(struct mp_log *log, int always);
-void wakeup_playloop(void *ctx);
void mp_update_logging(struct MPContext *mpctx);
// misc.c
diff --git a/player/loadfile.c b/player/loadfile.c
index abce5b3168..9fdd38127f 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1296,6 +1296,8 @@ struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction,
// Return if all done.
void mp_play_files(struct MPContext *mpctx)
{
+ prepare_playlist(mpctx, mpctx->playlist);
+
for (;;) {
idle_loop(mpctx);
if (mpctx->stop_play == PT_QUIT)
diff --git a/player/main.c b/player/main.c
index c1ee73b5cf..b4371ed1fa 100644
--- a/player/main.c
+++ b/player/main.c
@@ -314,14 +314,12 @@ static int cfg_include(void *ctx, char *filename, int flags)
return r;
}
-void wakeup_playloop(void *ctx)
-{
- struct MPContext *mpctx = ctx;
- mp_wakeup_core(mpctx);
-}
-
struct MPContext *mp_create(void)
{
+ char *enable_talloc = getenv("MPV_LEAK_REPORT");
+ if (enable_talloc && strcmp(enable_talloc, "1") == 0)
+ talloc_enable_leak_report();
+
mp_time_init();
struct MPContext *mpctx = talloc(NULL, MPContext);
@@ -368,6 +366,10 @@ struct MPContext *mp_create(void)
mp_input_set_cancel(mpctx->input, mpctx->playback_abort);
+ char *verbose_env = getenv("MPV_VERBOSE");
+ if (verbose_env)
+ mpctx->opts->verbose = atoi(verbose_env);
+
return mpctx;
}
@@ -473,8 +475,6 @@ int mp_initialize(struct MPContext *mpctx, char **options)
SetPriorityClass(GetCurrentProcess(), opts->w32_priority);
#endif
- prepare_playlist(mpctx, mpctx->playlist);
-
MP_STATS(mpctx, "end init");
return 0;
@@ -482,16 +482,7 @@ int mp_initialize(struct MPContext *mpctx, char **options)
int mpv_main(int argc, char *argv[])
{
- char *enable_talloc = getenv("MPV_LEAK_REPORT");
- if (enable_talloc && strcmp(enable_talloc, "1") == 0)
- talloc_enable_leak_report();
-
struct MPContext *mpctx = mp_create();
- struct MPOpts *opts = mpctx->opts;
-
- char *verbose_env = getenv("MPV_VERBOSE");
- if (verbose_env)
- opts->verbose = atoi(verbose_env);
char **options = argv && argv[0] ? argv + 1 : NULL; // skips program name
int r = mp_initialize(mpctx, options);
diff --git a/player/video.c b/player/video.c
index 3835ef5f95..ca207fb6aa 100644
--- a/player/video.c
+++ b/player/video.c
@@ -285,7 +285,7 @@ static void recreate_video_filters(struct MPContext *mpctx)
vf_destroy(vo_c->vf);
vo_c->vf = vf_new(mpctx->global);
vo_c->vf->hwdec_devs = vo_c->hwdec_devs;
- vo_c->vf->wakeup_callback = wakeup_playloop;
+ vo_c->vf->wakeup_callback = mp_wakeup_core_cb;
vo_c->vf->wakeup_callback_ctx = mpctx;
vo_c->vf->container_fps = vo_c->container_fps;
vo_control(vo_c->vo, VOCTRL_GET_DISPLAY_FPS, &vo_c->vf->display_fps);