summaryrefslogtreecommitdiffstats
path: root/mp_core.h
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-08-13 08:06:26 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-08-13 08:06:26 +0300
commit8ea7eb77fc7ba8bd0b596ea32ee60909a012828f (patch)
tree6d997337d31fe3577a66df3bb5a4c87b3b26fccc /mp_core.h
parente107cf785132418cc658e1cee4ad814e17eac886 (diff)
downloadmpv-8ea7eb77fc7ba8bd0b596ea32ee60909a012828f.tar.bz2
mpv-8ea7eb77fc7ba8bd0b596ea32ee60909a012828f.tar.xz
core: Clean up move-to-next-file logic
The mpctx->eof field was used to also store other reasons to stop playing the current file besides EOF, and the code didn't properly distinguish those from EOF. Rename the field to "stop_play" and clean up some of the code accessing it. Properly separating EOF from other reasons allows handling file switching better. Before this commit buffered audio was always drained before moving to the next file (the only exception when it was NOT drained when stopping a file was when quitting the player completely). This added an extra delay when manually moving to the next file as you had to wait for the currently buffered audio to finish playing before the next file would start. After this commit audio is only drained if the file reaches EOF normally; otherwise audio is cut and the next file starts immediately.
Diffstat (limited to 'mp_core.h')
-rw-r--r--mp_core.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/mp_core.h b/mp_core.h
index 61250a8289..a396c53ad9 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -26,13 +26,17 @@
#define SUB_SOURCES 3
-#define PT_NEXT_ENTRY 1
-#define PT_PREV_ENTRY -1
-#define PT_NEXT_SRC 2
-#define PT_PREV_SRC -2
-#define PT_UP_NEXT 3
-#define PT_UP_PREV -3
-#define PT_STOP 4
+enum stop_play_reason {
+ KEEP_PLAYING = 0, // must be 0, numeric values of others do not matter
+ AT_END_OF_FILE,
+ PT_NEXT_ENTRY,
+ PT_PREV_ENTRY,
+ PT_NEXT_SRC,
+ PT_PREV_SRC,
+ PT_UP_NEXT,
+ PT_UP_PREV,
+ PT_STOP,
+};
typedef struct MPContext {
@@ -48,7 +52,7 @@ typedef struct MPContext {
struct play_tree *playtree;
struct play_tree_iter *playtree_iter;
char *filename; // currently playing file
- int eof;
+ enum stop_play_reason stop_play;
int play_tree_step;
unsigned int initialized_flags; // which subsystems have been initialized