1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 00:42:57 +00:00

options: remove CONF_OLD option flag

The resulting semantics of this flag are weird enough that they're
unlikely to be what is wanted in any situation. Remove the flag and
convert the two options using it, -screenw and -screenh, to use
CONF_NOSAVE instead. I'm not sure why those specific options had the
flag and if any flag is really needed, but I don't want to check in
detail now and using CONF_NOSAVE should keep about the same behavior
in practice.

A bit more detail about the weird behavior this flag had:

When not using file groups, the flag had the same behavior as
CONF_NOSAVE, namely that when switching files the option would not be
reset to the global value (only possible file-specific settings were
applied). When using file groups, group-specific options would apply
to the _first two_ files in the group, but for the rest after the
first two, settings would not be reset when changing files (wtf?).
This was a result of the following sequence:
1) push higher-level settings, enter group
2) apply group-specific settings
3) push settings before applying ones specific to file 1 in group
4) apply file 1 settings, play file 1
5) pop settings to return to group settings
6) push settings before applying ones specific to file 2
7) apply file 2 settings
8) pop settings

Here the option was set at 2). 3) saved it because it had been set
after last push, so 5) restored the setting and it was used for file 2
too. However 6) no longer saved it because there had been pushes after
the original setting in 2), thus 8) no longer restored the setting and
the option was no longer forced to any particular value when playing
further files after that.
This commit is contained in:
Uoti Urpala 2011-01-31 21:53:05 +02:00
parent 4ea60a3d0e
commit fad3585ef4
3 changed files with 3 additions and 10 deletions

View File

@ -136,8 +136,8 @@ const m_option_t mplayer_opts[]={
OPT_INTRANGE("x", screen_size_x, 0, 0, 4096),
OPT_INTRANGE("y", screen_size_y, 0, 0, 4096),
// set screen dimensions (when not detectable or virtual!=visible)
OPT_INTRANGE("screenw", vo_screenwidth, CONF_OLD, 0, 4096),
OPT_INTRANGE("screenh", vo_screenheight, CONF_OLD, 0, 4096),
OPT_INTRANGE("screenw", vo_screenwidth, CONF_NOSAVE, 0, 4096),
OPT_INTRANGE("screenh", vo_screenheight, CONF_NOSAVE, 0, 4096),
// Geometry string
{"geometry", &vo_geometry, CONF_TYPE_STRING, 0, 0, 0, NULL},
OPT_MAKE_FLAGS("force-window-position", force_window_position, 0),

View File

@ -236,8 +236,6 @@ m_config_push(m_config_t* config) {
continue;
if(co->opt->flags & (M_OPT_GLOBAL|M_OPT_NOSAVE))
continue;
if((co->opt->flags & M_OPT_OLD) && !(co->flags & M_CFG_OPT_SET))
continue;
if(co->flags & M_CFG_OPT_ALIAS)
continue;

View File

@ -347,12 +347,8 @@ struct m_option {
*/
#define M_OPT_NOSAVE (1<<5)
/// \brief The \ref Config will emulate the old behavior by pushing the
/// option only if it was set by the user.
#define M_OPT_OLD (1<<6)
/// The option should be set during command line pre-parsing
#define M_OPT_PRE_PARSE (1<<7)
#define M_OPT_PRE_PARSE (1<<6)
/// \defgroup OldOptionFlags Backward compatibility
///
@ -365,7 +361,6 @@ struct m_option {
#define CONF_NOCMD M_OPT_NOCMD
#define CONF_GLOBAL M_OPT_GLOBAL
#define CONF_NOSAVE M_OPT_NOSAVE
#define CONF_OLD M_OPT_OLD
#define CONF_PRE_PARSE M_OPT_PRE_PARSE
///@}