2007-08-28 11:20:24 +00:00
|
|
|
/*
|
|
|
|
* Get path to config dir/file.
|
|
|
|
*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2008-05-14 18:02:27 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2007-08-28 11:20:24 +00:00
|
|
|
*/
|
|
|
|
|
2010-03-20 23:38:27 +00:00
|
|
|
#ifndef MPLAYER_PATH_H
|
|
|
|
#define MPLAYER_PATH_H
|
2007-08-28 11:20:24 +00:00
|
|
|
|
2012-02-03 07:05:11 +00:00
|
|
|
#include <stdbool.h>
|
2013-08-06 20:41:30 +00:00
|
|
|
#include "mpvcore/bstr.h"
|
2011-02-23 14:18:09 +00:00
|
|
|
|
2012-12-09 14:05:21 +00:00
|
|
|
|
|
|
|
// Search for the input filename in several paths. These include user and global
|
|
|
|
// config locations by default. Some platforms may implement additional platform
|
|
|
|
// related lookups (i.e.: OSX inside an application bundle).
|
|
|
|
char *mp_find_config_file(const char *filename);
|
|
|
|
|
|
|
|
// Search for the input filename in the global configuration location.
|
|
|
|
char *mp_find_global_config_file(const char *filename);
|
|
|
|
|
|
|
|
// Search for the input filename in the user configuration location.
|
|
|
|
char *mp_find_user_config_file(const char *filename);
|
2011-02-23 14:18:09 +00:00
|
|
|
|
2013-12-14 18:50:00 +00:00
|
|
|
// Normally returns a talloc_strdup'ed copy of the path, except for special
|
|
|
|
// paths starting with '~'. Used to allow the user explicitly reference a
|
|
|
|
// file from the user's home or mpv config directory.
|
|
|
|
char *mp_get_user_path(void *talloc_ctx, const char *path);
|
|
|
|
|
2011-02-23 14:18:09 +00:00
|
|
|
// Return pointer to filename part of path
|
|
|
|
|
|
|
|
char *mp_basename(const char *path);
|
|
|
|
|
2013-07-08 18:34:26 +00:00
|
|
|
/* Return file extension, including the '.'. If root is not NULL, set it to the
|
|
|
|
* part of the path without extension. So: path == root + returnvalue
|
|
|
|
* Don't consider it a file extension if the only '.' is the first character.
|
|
|
|
* Return "" if no extension.
|
|
|
|
*/
|
|
|
|
char *mp_splitext(const char *path, bstr *root);
|
|
|
|
|
2011-02-23 14:18:09 +00:00
|
|
|
/* Return struct bstr referencing directory part of path, or if that
|
|
|
|
* would be empty, ".".
|
|
|
|
*/
|
|
|
|
struct bstr mp_dirname(const char *path);
|
|
|
|
|
|
|
|
/* Join two path components and return a newly allocated string
|
|
|
|
* for the result. '/' is inserted between the components if needed.
|
|
|
|
* If p2 is an absolute path then the value of p1 is ignored.
|
|
|
|
*/
|
|
|
|
char *mp_path_join(void *talloc_ctx, struct bstr p1, struct bstr p2);
|
2007-08-28 11:20:24 +00:00
|
|
|
|
core: add playback resume feature (manual/opt-in)
A "watch later" command is now mapped to Shift+Q. This quits the player
and stores the playback state in a config file in ~/.mpv/watch_later/.
When calling the player with the same file again, playback is resumed
at that time position.
It's also possible to make mpv save playback state always on quit with
the --save-position-on-quit option. Likewise, resuming can be disabled
with the --no-resume-playback option.
This also attempts to save some playback parameters, like fullscreen
state or track selection. This will unconditionally override config
settings and command line options (which is probably not what you would
expect, but in general nobody will really care about this). Some things
are not backed up, because that would cause various problems. Additional
subtitle files, video filters, etc. are not stored because that would be
too hard and fragile. Volume/mute state are not stored because it would
mess up if the system mixer is used, or if the system mixer was
readjusted in the meantime.
Basically, the tradeoff between perfect state restoration and
complexity/fragility makes it not worth to attempt to implement
it perfectly, even if the result is a little bit inconsistent.
2013-05-05 17:37:29 +00:00
|
|
|
char *mp_getcwd(void *talloc_ctx);
|
|
|
|
|
2012-02-03 07:05:11 +00:00
|
|
|
bool mp_path_exists(const char *path);
|
|
|
|
bool mp_path_isdir(const char *path);
|
|
|
|
|
2013-09-04 12:04:35 +00:00
|
|
|
bool mp_is_url(bstr path);
|
|
|
|
|
2013-10-29 21:38:29 +00:00
|
|
|
void mp_mk_config_dir(char *subdir);
|
|
|
|
|
2010-03-20 23:38:27 +00:00
|
|
|
#endif /* MPLAYER_PATH_H */
|