diff options
-rw-r--r-- | DOCS/man/mpv.rst | 18 | ||||
-rw-r--r-- | DOCS/man/options.rst | 6 | ||||
-rw-r--r-- | TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf | 2 | ||||
-rw-r--r-- | etc/mpv.desktop | 2 | ||||
-rw-r--r-- | libmpv/client.h | 1 | ||||
-rw-r--r-- | options/m_config.c | 7 | ||||
-rw-r--r-- | options/m_config.h | 2 | ||||
-rw-r--r-- | options/options.c | 4 | ||||
-rw-r--r-- | options/options.h | 2 | ||||
-rw-r--r-- | osdep/main-fn-win.c | 6 | ||||
-rw-r--r-- | player/main.c | 3 |
11 files changed, 42 insertions, 11 deletions
diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst index dbd6f16b7c..8ede4075f1 100644 --- a/DOCS/man/mpv.rst +++ b/DOCS/man/mpv.rst @@ -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 diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 0e2dbf78f0..126641f1eb 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -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 ----- diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf b/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf index d23926be9b..bdffa7a951 100644 --- a/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf +++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/mpv.conf @@ -1 +1 @@ -profile=pseudo-gui +player-operation-mode=pseudo-gui diff --git a/etc/mpv.desktop b/etc/mpv.desktop index d79d846d8c..3ff63888ad 100644 --- a/etc/mpv.desktop +++ b/etc/mpv.desktop @@ -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; diff --git a/libmpv/client.h b/libmpv/client.h index c5847bc3db..ca7ed9f552 100644 --- a/libmpv/client.h +++ b/libmpv/client.h @@ -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 diff --git a/options/m_config.c b/options/m_config.c index 5c8a99b372..576527c0c5 100644 --- a/options/m_config.c +++ b/options/m_config.c @@ -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 diff --git a/options/m_config.h b/options/m_config.h index 4571488051..94a6c9e6ee 100644 --- a/options/m_config.h +++ b/options/m_config.h @@ -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. diff --git a/options/options.c b/options/options.c index f401b00803..bbe74ff8a2 100644 --- a/options/options.c +++ b/options/options.c @@ -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 -------------------- diff --git a/options/options.h b/options/options.h index 3e4978f0cb..7885b9090e 100644 --- a/options/options.h +++ b/options/options.h @@ -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; diff --git a/osdep/main-fn-win.c b/osdep/main-fn-win.c index 84a77a3903..f003a5502b 100644 --- a/osdep/main-fn-win.c +++ b/osdep/main-fn-win.c @@ -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); diff --git a/player/main.c b/player/main.c index 676f82946c..cecdc15392 100644 --- a/player/main.c +++ b/player/main.c @@ -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) { |