summaryrefslogtreecommitdiffstats
path: root/audio/decode
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-14 21:28:01 +0100
committerwm4 <wm4@nowhere>2020-03-18 19:52:01 +0100
commit26f4f18c0629998a9b91e94722d166866d8b80a3 (patch)
tree16d4891d241d528f63ee99f0017530bba7b3dc8b /audio/decode
parentcdd6eb0994bc6aeb8aeb0326e5d8c61c06eb38eb (diff)
downloadmpv-26f4f18c0629998a9b91e94722d166866d8b80a3.tar.bz2
mpv-26f4f18c0629998a9b91e94722d166866d8b80a3.tar.xz
options: change option macros and all option declarations
Change all OPT_* macros such that they don't define the entire m_option initializer, and instead expand only to a part of it, which sets certain fields. This requires changing almost every option declaration, because they all use these macros. A declaration now always starts with {"name", ... followed by designated initializers only (possibly wrapped in macros). The OPT_* macros now initialize the .offset and .type fields only, sometimes also .priv and others. I think this change makes the option macros less tricky. The old code had to stuff everything into macro arguments (and attempted to allow setting arbitrary fields by letting the user pass designated initializers in the vararg parts). Some of this was made messy due to C99 and C11 not allowing 0-sized varargs with ',' removal. It's also possible that this change is pointless, other than cosmetic preferences. Not too happy about some things. For example, the OPT_CHOICE() indentation I applied looks a bit ugly. Much of this change was done with regex search&replace, but some places required manual editing. In particular, code in "obscure" areas (which I didn't include in compilation) might be broken now. In wayland_common.c the author of some option declarations confused the flags parameter with the default value (though the default value was also properly set below). I fixed this with this change.
Diffstat (limited to 'audio/decode')
-rw-r--r--audio/decode/ad_lavc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index a4e06822b7..eaaf0729e9 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -63,10 +63,10 @@ struct ad_lavc_params {
const struct m_sub_options ad_lavc_conf = {
.opts = (const m_option_t[]) {
- OPT_FLOATRANGE("ac3drc", ac3drc, 0, 0, 6),
- OPT_FLAG("downmix", downmix, 0),
- OPT_INTRANGE("threads", threads, 0, 0, 16),
- OPT_KEYVALUELIST("o", avopts, 0),
+ {"ac3drc", OPT_FLOAT(ac3drc), M_RANGE(0, 6)},
+ {"downmix", OPT_FLAG(downmix)},
+ {"threads", OPT_INT(threads), M_RANGE(0, 16)},
+ {"o", OPT_KEYVALUELIST(avopts)},
{0}
},
.size = sizeof(struct ad_lavc_params),