[MPlayer-dev-eng] Saving position and Bookmark functionality.

Alexander Roalter alex at roalter.it
Wed Aug 22 14:21:31 CEST 2007


Michal Majchrowicz wrote:
> Hi
> I would like to help in implementing two things in mplayer:
> 1) Saving the position of current file when quting the mplayer and
> loading this position when the file is opened the next time.
> 2) Add possibility to manually save/load file position at any moment
> for instance using key combinations.
> Here is an example of implementation that explains the details:
> When mplayer plays some file it creates ".mplayer" directory in
> current dir. So for instance we are playing file /opt/my_movie.avi so
> we create the directory /opt/.mplayer/ In that directory we create a
> file for every file we play. In our exmple we create file
> /opt/.mplayer/my_movie.avi.pos These file contains something like
> this:
> 0  - 0
> 1 - 1:30:00
> 2 - 0:20:00
> 3 - 0
> ....
> q - 1:34:12
> Lines with numbers (from 0 to 9) refer to bookmarks(The format is
> "bookmark number - position in file"). When user hits Ctrl+1 The
> position of current playback is saved in second line (1 - 1:30:00).
> When user hits Alt+1 the bookmark from second line is loaded (which
> means settings the playback position to 1:30:00). It is very usefull
> when every member of family wants to watch the same movie in different
> moments. They only have to save/load their bookmarks and don't have to
> wonder "when did I finish last night :)". The line with may be called
> the "default bookmark" Everytime you quit mplayer it should save the
> current position there and load it when opening the file again.
> Similar functionality ("default bookmark") is added by this script:
> http://www.spaceparanoids.org/trac/bend/wiki/mplayer-resume
> I hope we can find some mplayer-friendly way of implementing it in mplayer :)
> I count on your suggestions and advice.
> Regards Michal.

Seeking to a specified time can be very tricky, as video streams can 
reset themselves from time to time, I'd rather suggest a filepos in 
bytes or whatever serves this best.

And as for a .mplayer-directory in every directory I play a file in: I 
don't think it's such a good idea (at least I'd not like the idea of 
having these directories all around). Here I'd stick to a central 
sub-tree in ~/.mplayer, just as some image viewing programs do with 
their thumbnails.

mplayer already searches for a file when playing, but I don't know what 
mplayer expects in this file, but there might go also the handling for 
the bookmarks.

And lastly, resuming should of course only work then specified with a 
-resume parameter or something else in this way. One could also 
implement a A-B-Repeat function using this (there's none such to my 
knowledge a.t.m.)

-- 
cheers,
Alex



More information about the MPlayer-dev-eng mailing list