diff options
author | wm4 <wm4@nowhere> | 2013-09-15 05:03:37 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-15 05:03:55 +0200 |
commit | 884c179177063ad81cf7a7242c01767f46cd1cf8 (patch) | |
tree | b7f1c8b896541594eff6f59c36a97a65decdca3f /mpvcore/mp_core.h | |
parent | aa43405020e2e710b8b431633b6750e92897c6b9 (diff) | |
download | mpv-884c179177063ad81cf7a7242c01767f46cd1cf8.tar.bz2 mpv-884c179177063ad81cf7a7242c01767f46cd1cf8.tar.xz |
mplayer: attempt to skip playlist entries which can't be played
This is for situations when repeated attempts at playing a playlist
entry failed, and playlist navigation becomes impossible due to that.
For example, it wasn't possible to skip backwards past an unplayable
playlist entry:
mpv file1.mkv doesntexist.mkv file3.mkv
You couldn't skip back to file1.mkv from file3.mkv. When running a
single "playlist_prev" command, doesntexist.mkv would be played, which
would fail to load. As reaction to the failure to load it, the next file
would be played, which is file3.mkv.
To make this even worse, the file could successfully load, but run only
for a split second. So just loading successfully isn't good enough.
Attempt to solve this by marking problematic playlist entries as failed,
and by having playlist_prev skip past such playlist entries. We define
failure as not being able to play more than 3 seconds (or failing to
initialize to begin with). (The 3 seconds are in real time, not file
duration.)
"playlist_prev force" still exhibits the old behavior.
Additionally, use the same mechanism to prevent pointless infinite
reloading if none of the files on the playlist exist. (See github issue
All in all, this is a heuristic, and later adjustments might be
necessary.
Note: forward skips (playlist_next) are not affected at all. (Except for
the interaction with --loop.)
Diffstat (limited to 'mpvcore/mp_core.h')
-rw-r--r-- | mpvcore/mp_core.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mpvcore/mp_core.h b/mpvcore/mp_core.h index d997aa4d58..9f3e095110 100644 --- a/mpvcore/mp_core.h +++ b/mpvcore/mp_core.h @@ -42,7 +42,8 @@ enum stop_play_reason { KEEP_PLAYING = 0, // must be 0, numeric values of others do not matter - AT_END_OF_FILE, // file has ended normally, prepare to play next + 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 @@ -332,7 +333,8 @@ void mp_switch_track(struct MPContext *mpctx, enum stream_type type, struct track *mp_track_by_tid(struct MPContext *mpctx, enum stream_type type, int tid); bool mp_remove_track(struct MPContext *mpctx, struct track *track); -struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction); +struct playlist_entry *mp_next_file(struct MPContext *mpctx, int direction, + bool force); int mp_get_cache_percent(struct MPContext *mpctx); void mp_write_watch_later_conf(struct MPContext *mpctx); void mp_set_playlist_entry(struct MPContext *mpctx, struct playlist_entry *e); |