summaryrefslogtreecommitdiffstats
path: root/player/core.h
diff options
context:
space:
mode:
Diffstat (limited to 'player/core.h')
-rw-r--r--player/core.h45
1 files changed, 36 insertions, 9 deletions
diff --git a/player/core.h b/player/core.h
index c740b76f22..f0a66ffdff 100644
--- a/player/core.h
+++ b/player/core.h
@@ -37,12 +37,13 @@
// definitions used internally by the core player code
enum stop_play_reason {
- KEEP_PLAYING = 0, // must be 0, numeric values of others do not matter
+ KEEP_PLAYING = 0, // playback of a file is actually going on
+ // must be 0, numeric values of others do not matter
AT_END_OF_FILE, // file has ended, prepare to play next
// also returned on unrecoverable playback errors
PT_NEXT_ENTRY, // prepare to play next entry in playlist
PT_CURRENT_ENTRY, // prepare to play mpctx->playlist->current
- PT_STOP, // stop playback, clear playlist
+ PT_STOP, // stop playback, or transient state when going to next
PT_QUIT, // stop playback, quit player
PT_ERROR, // play next playlist entry (due to an error)
};
@@ -243,6 +244,8 @@ typedef struct MPContext {
// mp_dispatch_lock must be called to change it.
int64_t outstanding_async;
+ struct mp_thread_pool *thread_pool; // for coarse I/O, often during loading
+
struct mp_log *statusline;
struct osd_state *osd;
char *term_osd_text;
@@ -294,6 +297,8 @@ typedef struct MPContext {
struct track **tracks;
int num_tracks;
+ int64_t death_hack; // don't fucking ask, just don't
+
char *track_layout_hash;
// Selected tracks. NULL if no track selected.
@@ -434,10 +439,12 @@ typedef struct MPContext {
struct mp_ipc_ctx *ipc_ctx;
- pthread_mutex_t lock;
+ pthread_mutex_t abort_lock;
- // --- The following fields are protected by lock
- struct mp_cancel *demuxer_cancel; // cancel handle for MPContext.demuxer
+ // --- The following fields are protected by abort_lock
+ struct mp_abort_entry **abort_list;
+ int num_abort_list;
+ bool abort_all; // during final termination
// --- Owned by MPContext
pthread_t open_thread;
@@ -455,6 +462,20 @@ typedef struct MPContext {
int open_res_error;
} MPContext;
+// Contains information about an asynchronous work item, how it can be aborted,
+// and when. All fields are protected by MPContext.abort_lock.
+struct mp_abort_entry {
+ // General conditions.
+ bool coupled_to_playback; // trigger when playback is terminated
+ // Actual trigger to abort the work.
+ struct mp_cancel *cancel;
+ // For client API.
+ struct mpv_handle *client; // non-NULL if done by a client API user
+ int client_work_type; // client API type, e.h. MPV_EVENT_COMMAND_REPLY
+ uint64_t client_work_id; // client API user reply_userdata value
+ // (only valid if client_work_type set)
+};
+
// audio.c
void reset_audio_state(struct MPContext *mpctx);
void reinit_audio_chain(struct MPContext *mpctx);
@@ -484,9 +505,15 @@ struct playlist_entry *mp_check_playlist_resume(struct MPContext *mpctx,
// loadfile.c
void mp_abort_playback_async(struct MPContext *mpctx);
+void mp_abort_add(struct MPContext *mpctx, struct mp_abort_entry *abort);
+void mp_abort_remove(struct MPContext *mpctx, struct mp_abort_entry *abort);
+void mp_abort_recheck_locked(struct MPContext *mpctx,
+ struct mp_abort_entry *abort);
+void mp_abort_trigger_locked(struct MPContext *mpctx,
+ struct mp_abort_entry *abort);
void uninit_player(struct MPContext *mpctx, unsigned int mask);
int mp_add_external_file(struct MPContext *mpctx, char *filename,
- enum stream_type filter);
+ enum stream_type filter, struct mp_cancel *cancel);
#define FLAG_MARK_SELECTION 1
void mp_switch_track(struct MPContext *mpctx, enum stream_type type,
struct track *track, int flags);
@@ -505,7 +532,7 @@ void update_demuxer_properties(struct MPContext *mpctx);
void print_track_list(struct MPContext *mpctx, const char *msg);
void reselect_demux_stream(struct MPContext *mpctx, struct track *track);
void prepare_playlist(struct MPContext *mpctx, struct playlist *pl);
-void autoload_external_files(struct MPContext *mpctx);
+void autoload_external_files(struct MPContext *mpctx, struct mp_cancel *cancel);
struct track *select_default_track(struct MPContext *mpctx, int order,
enum stream_type type);
void prefetch_next(struct MPContext *mpctx);
@@ -528,8 +555,6 @@ double get_play_end_pts(struct MPContext *mpctx);
double get_play_start_pts(struct MPContext *mpctx);
double get_ab_loop_start_time(struct MPContext *mpctx);
void merge_playlist_files(struct playlist *pl);
-float mp_get_cache_percent(struct MPContext *mpctx);
-bool mp_get_cache_idle(struct MPContext *mpctx);
void update_vo_playback_state(struct MPContext *mpctx);
void update_window_title(struct MPContext *mpctx, bool force);
void error_on_track(struct MPContext *mpctx, struct track *track);
@@ -551,6 +576,8 @@ void mp_wait_events(struct MPContext *mpctx);
void mp_set_timeout(struct MPContext *mpctx, double sleeptime);
void mp_wakeup_core(struct MPContext *mpctx);
void mp_wakeup_core_cb(void *ctx);
+void mp_core_lock(struct MPContext *mpctx);
+void mp_core_unlock(struct MPContext *mpctx);
void mp_process_input(struct MPContext *mpctx);
double get_relative_time(struct MPContext *mpctx);
void reset_playback_state(struct MPContext *mpctx);