1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 00:02:13 +00:00
mpv/filters
Philip Langdale 3f006eced4 options: Make validation and help possible for all option types
Today, validation is only possible for string type options. But there's
no particular reason why it needs to be restricted in this way, and
there are potential uses, to allow other options to be validated
without forcing the option to have to reimplement parsing from
scratch.

The first part, simply making the validation function an explicit
field instead of overloading priv is simple enough. But if we only do
that, then the validation function still needs to deal with the raw
pre-parsed string. Instead, we want to allow the value to be parsed
before it is validated. That in turn leads to us having validator
functions that should be type aware. Unfortunately, that means we need
to keep the explicit macro like OPT_STRING_VALIDATE() as a way to
enforce the correct typing of the function. Otherwise, we'd have to
have the validator take a void * and hope the implementation can cast
it correctly.

For help, we don't have this problem, as help doesn't look at the
value.

Then, we turn validators that are really help generators into explicit
help functions and where a validator is help + validation, we split
them into two parts.

I have, however, left functions that need to query information for both
help and validation as single functions to avoid code duplication.

In this change, I have not added an other OPT_FOO_VALIDATE() macros as
they are not needed, but I will add some in a separate change to
illustrate the pattern.
2021-03-28 19:46:27 +03:00
..
f_async_queue.c f_async_queue: add various helper functions 2020-08-28 20:08:32 +02:00
f_async_queue.h f_async_queue: add various helper functions 2020-08-28 20:08:32 +02:00
f_auto_filters.c filters/auto_filters: switch from scaletempo to scaletempo2 2021-02-15 00:13:03 +02:00
f_auto_filters.h filters/auto_filters: switch from scaletempo to scaletempo2 2021-02-15 00:13:03 +02:00
f_autoconvert.c vf_format: add gross mechanism for forcing scaler for testing 2020-04-13 15:56:27 +02:00
f_autoconvert.h vf_format: add gross mechanism for forcing scaler for testing 2020-04-13 15:56:27 +02:00
f_decoder_wrapper.c options: Make validation and help possible for all option types 2021-03-28 19:46:27 +03:00
f_decoder_wrapper.h player: let frontend decide whether to use cover-art mode 2020-09-28 00:04:21 +02:00
f_demux_in.c f_demux_in: log EOF "recovery" 2020-08-27 18:40:57 +02:00
f_demux_in.h
f_hwtransfer.c f_hwtransfer: extend vaapi whitelist with some working formats 2020-01-17 15:13:23 +01:00
f_hwtransfer.h f_hwtransfer: move format fields to private struct 2020-01-12 01:47:42 +01:00
f_lavfi.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
f_lavfi.h options: pre-check filter names when using vf/af libavfilter bridge 2019-11-25 20:29:42 +01:00
f_output_chain.c audio: redo video-sync=display-adrop 2020-05-23 04:04:46 +02:00
f_output_chain.h audio: redo video-sync=display-adrop 2020-05-23 04:04:46 +02:00
f_swresample.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
f_swresample.h
f_swscale.c f_swscale: let common code guess color levels when RGB->YUV 2020-04-23 13:26:04 +02:00
f_swscale.h vf_format: add gross mechanism for forcing scaler for testing 2020-04-13 15:56:27 +02:00
f_utils.c filters: add another dumb helper 2019-10-02 21:09:30 +02:00
f_utils.h filters: add another dumb helper 2019-10-02 21:09:30 +02:00
filter_internal.h filter: add a helper 2020-08-27 11:55:20 +02:00
filter.c filter: add filter priority thing 2020-08-28 19:57:23 +02:00
filter.h filter: add filter priority thing 2020-08-28 19:57:23 +02:00
frame.c Implement backwards playback 2019-09-19 20:37:04 +02:00
frame.h Implement backwards playback 2019-09-19 20:37:04 +02:00
user_filters.c audio: add scaletempo2 filter based on chromium 2020-07-27 00:57:22 +02:00
user_filters.h audio: add scaletempo2 filter based on chromium 2020-07-27 00:57:22 +02:00