mpv/player
wm4 c784820454 options: introduce bool option type, use it for --fullscreen
The option code is very old and was added to MPlayer in the early 2000s,
when C99 was still new. MPlayer did not use the "bool" type anywhere,l
and the logical option equivalent to bool, the "flag" option type, used
int, with the convention that only the values 0 and 1 are allowed.

mpv may have hammered many, many additional tentacles to the option
code, but some of the basics never changed, and m_option_type_flag still
uses int. This seems a bit weird, since mpv uses bool for booleans. So
finally introduce an m_option_type_bool. To avoid duplicating too much
code, change the flag code to bool, and "reimplement" m_option_type_flag
on top of m_option_type_bool.

As a "demonstration", change the --fullscreen option to this new type.
Ideally, all options would be changed too bool, and m_option_type_flag
would be removed. But that is a lot of monotonous thankless work, so I'm
not doing it, and making it a painful years long transition.

At the same time, I'm introducing a new concept for option declarations.
Instead of OPT_BOOL(), which define the full m_option struct contents,
there's OPTF_BOOL(), which only takes the option field name itself. The
name is provided via a normal struct field initializer. Other fields
(such as flags) can be provided via designated initializers.

The advantage of this is that we don't need tons of nested vararg
macros. We also don't need to deal with 0-sized varargs being a pain
(and in fact they are not a thing in standard C99 and probably C11).
There is no need to provide a mandatory flags argument either, which is
the reason why so many OPT_ macros are used with a "0" argument. (The
flag argument seems to confuse other developers; they either don't
immediately recognize what it is, and sometimes it's supposed to be the
option's default value.)

Not having to mess with the flag argument in such option macros is also
a reason for the removal of M_OPT_RANGE etc., for the better or worse.

The only place that special-cased the _flag option type was in
command.c; change it to use something effectively very similar that
automatically includes the new _bool option type. Everything else should
be transparent to the change. The fullscreen option change should be
transparent too, as C99 bool is basically an integer type that is
clamped to 0/1 (except in Swift, Swift sucks).
2020-03-14 02:23:38 +01:00
..
javascript js: osd-overlay update: return the command result (match 7a76b577) 2020-03-07 12:37:35 +02:00
lua command: extend osd-overlay command with bounds reporting 2020-03-06 18:20:11 +01:00
audio.c f_decoder_wrapper: replace most public fields with setters/getters 2020-02-29 01:23:20 +01:00
client.c client API: always reset new_property_events fields 2020-03-07 12:47:46 +01:00
client.h scripting: load scripts from directories 2020-02-01 18:09:40 +01:00
command.c options: introduce bool option type, use it for --fullscreen 2020-03-14 02:23:38 +01:00
command.h command: remove legacy hook API 2020-03-06 19:23:14 +01:00
configfiles.c player: fix minor coding style issue 2020-01-26 14:29:48 +01:00
core.h player: force update of cache properties even on inactive demuxer cache 2020-03-05 22:23:43 +01:00
external_files.c external_files: add .lrc subtitle extension 2019-09-02 01:25:43 +03:00
external_files.h player: get rid of mpv_global.opts 2018-05-24 19:56:35 +02:00
javascript.c js: require: directory-scripts: first look at <dir>/modules/ 2020-02-07 18:22:12 +02:00
loadfile.c filter: minor cosmetic naming issue 2020-03-08 19:38:10 +01:00
lua.c lua: fix typo in comment 2020-02-06 23:02:23 +01:00
main.c player: rearrange libav* library check 2020-03-08 19:38:10 +01:00
misc.c player: dumb seeking related stuff, make audio hr-seek default 2020-02-28 17:15:07 +01:00
osd.c f_decoder_wrapper: replace most public fields with setters/getters 2020-02-29 01:23:20 +01:00
playloop.c options: split m_config.c/h 2020-03-13 16:50:27 +01:00
screenshot.c screenshot: fix typo in comment 2020-02-07 13:42:42 +01:00
screenshot.h player: make screenshot each-frame mode more accurate 2020-02-07 13:32:21 +01:00
scripting.c scripting: fix racy crash if loading .run files fails 2020-02-25 22:41:09 +01:00
sub.c player: partially fix backward playback display of cached text subtitles 2020-02-04 20:26:35 +01:00
video.c f_decoder_wrapper: replace most public fields with setters/getters 2020-02-29 01:23:20 +01:00