diff options
author | wm4 <wm4@nowhere> | 2014-10-06 21:20:38 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-10-06 21:49:26 +0200 |
commit | 5fb05940f1b4d0dad208d94ddd73d78520d8ce03 (patch) | |
tree | 9be531822bb1cd7e2fc1daab2aa96eaf00043945 /player/core.h | |
parent | d26104351b65a212c03ec08679cb45a3aa2f0a32 (diff) | |
download | mpv-5fb05940f1b4d0dad208d94ddd73d78520d8ce03.tar.bz2 mpv-5fb05940f1b4d0dad208d94ddd73d78520d8ce03.tar.xz |
player: open stream and demuxer asynchronously
Run opening the stream and opening the demuxer in a separate thread.
This should remove the last code paths in which the player can normally
get blocked on network.
When the stream is opened, the player will still react to input and so
on. Commands to abort opening can also be handled properly, instead of
using some of the old hacks in input.c. The only thing the user can
really do is aborting loading by navigating the playlist or quitting.
Whether playback abort works depends on the stream implementation; with
normal network, this will depend on what libavformat (via "interrupt"
callback) does.
Some pain is caused by DVD/BD/DVB. These want to reload the demuxer
sometimes. DVB wants it in order to discard old, inactive streams.
DVD/BD for the same reason, and also for reloading stream languages
and similar metadata. This means the stream and the demuxer have to
be loaded separately.
One minor detail is that we now need to copy all global options. This
wasn't really needed before, because the options were accessed on
opening only, but since opening is now on a separate thread, this
obviously becomes a necessity.
Diffstat (limited to 'player/core.h')
-rw-r--r-- | player/core.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/player/core.h b/player/core.h index cf35df64b2..a0c9db2cc5 100644 --- a/player/core.h +++ b/player/core.h @@ -178,7 +178,7 @@ typedef struct MPContext { struct playlist *playlist; struct playlist_entry *playing; // currently playing file - char *filename; // always the same as playing->filename (or NULL) + char *filename; // immutable copy of playing->filename (or NULL) struct mp_resolve_result *resolve_result; enum stop_play_reason stop_play; bool playback_initialized; // playloop can be run/is running @@ -417,6 +417,9 @@ float mp_get_cache_percent(struct MPContext *mpctx); bool mp_get_cache_idle(struct MPContext *mpctx); void update_window_title(struct MPContext *mpctx, bool force); void stream_dump(struct MPContext *mpctx); +int mpctx_run_non_blocking(struct MPContext *mpctx, void (*thread_fn)(void *arg), + void *thread_arg); +struct mpv_global *create_sub_global(struct MPContext *mpctx); // osd.c void set_osd_bar(struct MPContext *mpctx, int type, @@ -449,6 +452,7 @@ double chapter_start_time(struct MPContext *mpctx, int chapter); int get_chapter_count(struct MPContext *mpctx); void execute_queued_seek(struct MPContext *mpctx); void run_playloop(struct MPContext *mpctx); +void mp_idle(struct MPContext *mpctx); void idle_loop(struct MPContext *mpctx); void handle_force_window(struct MPContext *mpctx, bool reconfig); void add_frame_pts(struct MPContext *mpctx, double pts); |