1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-25 04:38:01 +00:00

player: do not let pseudo-gui override user config settings

Seems like this confused users quite often.

Instead of --profile=pseudo-gui, --player-operation-mode=pseudo-gui now
has to be used to invoke pseudo GUI mode. The old way still works, and
still behaves in the old way.
This commit is contained in:
wm4 2016-09-23 21:24:50 +02:00
parent f0fd663320
commit 9eef41dec1
11 changed files with 42 additions and 11 deletions

View File

@ -736,10 +736,13 @@ Currently this happens only in the following cases:
or file associations provided by desktop environments)
- if started from explorer.exe on Windows (technically, if it was started on
Windows, and all of the stdout/stderr/stdin handles are unset)
- manually adding ``--profile=pseudo-gui`` to the command line
- started out of the bundle on OSX
- you can add ``--profile=pseudo-gui`` to the command line, but it will behave
subtly differently (since mpv 0.22.0)
This mode implicitly adds ``--profile=pseudo-gui`` to the command line, with
the ``pseudo-gui`` profile being predefined with the following contents:
This mode implicitly performs the same action as ``--profile=pseudo-gui``, but
roughly before config files are loaded and the command line is applied. The
``pseudo-gui`` profile is predefined with the following contents:
::
@ -749,11 +752,12 @@ the ``pseudo-gui`` profile being predefined with the following contents:
idle=once
screenshot-directory=~~desktop/
This follows the mpv config file format. To customize pseudo-GUI mode, you can
put your own ``pseudo-gui`` profile into your ``mpv.conf``. This profile will
enhance the default profile, rather than overwrite it.
.. warning::
The profile always overrides other settings in ``mpv.conf``.
Currently, you can extend the ``pseudo-gui`` profile in the config file the
normal way. This is deprecated. In future mpv releases, the behavior might
change, and not apply your additional settings, and/or use a different
profile name.
.. include:: options.rst

View File

@ -521,6 +521,12 @@ Program Behavior
``--ytdl-raw-options=username=user,password=pass``
``--ytdl-raw-options=force-ipv6=``
``--player-operation-mode=<cplayer|pseudo-gui>``
For enabling "pseudo GUI mode", which means that the defaults for some
options are changed. This option should not normally be used directly, but
only by mpv internally, or mpv-provided scripts, config files, or .desktop
files.
Video
-----

View File

@ -1 +1 @@
profile=pseudo-gui
player-operation-mode=pseudo-gui

View File

@ -24,7 +24,7 @@ Comment[zh-CN]=播放电影和歌曲
Comment[zh-TW]=
Icon=mpv
TryExec=mpv
Exec=mpv --profile=pseudo-gui -- %U
Exec=mpv --player-operation-mode=pseudo-gui -- %U
Terminal=false
Categories=AudioVideo;Audio;Video;Player;TV;
MimeType=application/ogg;application/x-ogg;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/m4a;audio/x-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/ogg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg;video/x-mpeg2;video/mp4;video/msvideo;video/x-msvideo;video/ogg;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/x-fli;video/x-flv;video/x-theora;video/x-matroska;video/webm;audio/x-flac;audio/x-vorbis+ogg;video/x-ogm+ogg;audio/x-shorten;audio/x-ape;audio/x-wavpack;audio/x-tta;audio/AMR;audio/ac3;video/mp2t;audio/flac;audio/mp4;

View File

@ -426,6 +426,7 @@ mpv_handle *mpv_create(void);
* - input-conf
* - load-scripts
* - script
* - player-operation-mode
* - priority (win32)
* - input-app-events (OSX)
* - all encoding mode options

View File

@ -658,6 +658,10 @@ static int handle_set_opt_flags(struct m_config *config,
if ((flags & M_SETOPT_PRESERVE_CMDLINE) && co->is_set_from_cmdline)
set = false;
if ((flags & M_SETOPT_NO_OVERWRITE) &&
(co->is_set_from_cmdline || co->is_set_from_config))
set = false;
if ((flags & M_SETOPT_NO_FIXED) && (optflags & M_OPT_FIXED))
return M_OPT_INVALID;
@ -680,6 +684,9 @@ void m_config_mark_co_flags(struct m_config_option *co, int flags)
{
if (flags & M_SETOPT_FROM_CMDLINE)
co->is_set_from_cmdline = true;
if (flags & M_SETOPT_FROM_CONFIG_FILE)
co->is_set_from_config = true;
}
// Unlike m_config_set_option_raw() this does not go through the property layer

View File

@ -40,6 +40,7 @@ struct mp_log;
struct m_config_option {
bool is_hidden : 1; // Does not show up in help
bool is_set_from_cmdline : 1; // Set by user from command line
bool is_set_from_config : 1; // Set by a config file
bool is_set_locally : 1; // Has a backup entry
bool warning_was_printed : 1;
int16_t shadow_offset; // Offset into m_config_shadow.data
@ -155,6 +156,7 @@ enum {
M_SETOPT_PRESERVE_CMDLINE = 32, // Don't set if already marked as FROM_CMDLINE
M_SETOPT_NO_FIXED = 64, // Reject M_OPT_FIXED options
M_SETOPT_NO_PRE_PARSE = 128, // Reject M_OPT_PREPARSE options
M_SETOPT_NO_OVERWRITE = 256, // Skip options marked with FROM_*
};
// Flags for safe option setting during runtime.

View File

@ -250,6 +250,10 @@ const m_option_t mp_opts[] = {
OPT_FLAG("list-properties", property_print_help,
CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP),
OPT_CHOICE("player-operation-mode", operation_mode,
M_OPT_FIXED | M_OPT_PRE_PARSE | M_OPT_NOPROP,
({"cplayer", 0}, {"pseudo-gui", 1})),
OPT_FLAG("shuffle", shuffle, 0),
// ------------------------- common options --------------------

View File

@ -74,6 +74,8 @@ typedef struct MPOpts {
int msg_time;
char *log_file;
int operation_mode;
char **reset_options;
char **script_files;
char **script_opts;

View File

@ -67,8 +67,10 @@ int wmain(int argc, wchar_t *argv[])
// Build mpv's UTF-8 argv, and add the pseudo-GUI profile if necessary
if (argv[0])
MP_TARRAY_APPEND(NULL, argv_u8, argv_len, mp_to_utf8(argv_u8, argv[0]));
if (gui)
MP_TARRAY_APPEND(NULL, argv_u8, argv_len, "--profile=pseudo-gui");
if (gui) {
MP_TARRAY_APPEND(NULL, argv_u8, argv_len,
"--player-operation-mode=pseudo-gui");
}
for (int i = 1; i < argc; i++)
MP_TARRAY_APPEND(NULL, argv_u8, argv_len, mp_to_utf8(argv_u8, argv[i]));
MP_TARRAY_APPEND(NULL, argv_u8, argv_len, NULL);

View File

@ -399,6 +399,9 @@ int mp_initialize(struct MPContext *mpctx, char **options)
mp_print_version(mpctx->log, false);
if (opts->operation_mode == 1)
m_config_set_profile(mpctx->mconfig, "pseudo-gui", M_SETOPT_NO_OVERWRITE);
mp_parse_cfgfiles(mpctx);
if (options) {