summaryrefslogtreecommitdiffstats
path: root/demux/demux_lavf.c
diff options
context:
space:
mode:
authorVladimir Panteleev <git@thecybershadow.net>2020-10-22 16:25:20 +0000
committerDudemanguy <random342@airmail.cc>2020-10-22 19:53:35 +0000
commita92466c28959536cd3b1e7fa5ce31232a2b9a5fd (patch)
treefe6c9add6b8974ee0e8e775730a2535358ba8070 /demux/demux_lavf.c
parentdc0e9644cd4e056a30e773851d20b8725d943035 (diff)
downloadmpv-a92466c28959536cd3b1e7fa5ce31232a2b9a5fd.tar.bz2
mpv-a92466c28959536cd3b1e7fa5ce31232a2b9a5fd.tar.xz
command: add delete-watch-later-config
This introduces the delete-watch-later-config command, to complement write-watch-later-config. This is an alternative to #8141. The general problem that this change is attempting to help solve has been described in #336, #3169 and #6574. Though persistent playback position of a single file is generally a solved problem, this is not the case for playlists, as described in #8138. The motivation is facilitating intermittent playback of very large playlists, consisting of hundreds of entries each many hours long. Though the current "watch later" mechanism works well - provided that the files each occur only once in that playlist, and are played only via that playlist - the biggest issue is that the position is lost completely should mpv exit uncleanly (e.g. due to a power failure). Existing workarounds (in the form of Lua scripts which call write-watch-later-config periodically) fail in the playlist case, due to the mechanism used by mpv to determine where within a playlist to resume playback from. The missing puzzle piece needed to allow scripts to implement a complete solution to this problem is simply a way to clean up the watch-later configuration that the script asked mpv to write using write-watch-later-config. With that in place, scripts can then register an end-file event listener, check the stop playback reason, and in the "eof" and "stop" case, invoke delete-watch-later-config to delete any saved positions written by write-watch-later-config. The script can then proceed to immediately write a new one when the next file is loaded, which altogether allows mpv to resume from the correct playlist and file position upon next startup. Because events are delivered and executed asynchronously, delete-watch-later-config takes an optional filename argument, to allow scripts to clear watch-later configuration for files after mpv had already moved on from playing them and proceeded to another file. A Lua script which makes use of this change can be found here: https://gist.github.com/CyberShadow/2f71a97fb85ed42146f6d9f522bc34ef (A modification of the one written by @Hakkin, in that this one takes advantage of the new command, and also saves the state immediately when a new file is loaded.)
Diffstat (limited to 'demux/demux_lavf.c')
0 files changed, 0 insertions, 0 deletions