all: use designated initializers for AVOption.unit

Makes it robust against adding fields before it, which will be useful in
following commits.

Majority of the patch generated by the following Coccinelle script:

@@
typedef AVOption;
identifier arr_name;
initializer list il;
initializer list[8] il1;
expression tail;
@@
AVOption arr_name[] = { il, { il1,
- tail
+ .unit = tail
}, ...  };

with some manual changes, as the script:
* has trouble with options defined inside macros
* sometimes does not handle options under an #else branch
* sometimes swallows whitespace
This commit is contained in:
Anton Khirnov 2024-02-11 15:41:05 +01:00
parent 8a2c8687bd
commit 1e7d2007c3
338 changed files with 4656 additions and 4656 deletions

View file

@ -866,27 +866,27 @@ static const AVOption vaapi_encode_av1_options[] = {
VAAPI_ENCODE_RC_OPTIONS,
{ "profile", "Set profile (seq_profile)",
OFFSET(profile), AV_OPT_TYPE_INT,
{ .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xff, FLAGS, "profile" },
{ .i64 = AV_PROFILE_UNKNOWN }, AV_PROFILE_UNKNOWN, 0xff, FLAGS, .unit = "profile" },
#define PROFILE(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
{ .i64 = value }, 0, 0, FLAGS, "profile"
{ .i64 = value }, 0, 0, FLAGS, .unit = "profile"
{ PROFILE("main", AV_PROFILE_AV1_MAIN) },
{ PROFILE("high", AV_PROFILE_AV1_HIGH) },
{ PROFILE("professional", AV_PROFILE_AV1_PROFESSIONAL) },
#undef PROFILE
{ "tier", "Set tier (seq_tier)",
OFFSET(tier), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "tier" },
OFFSET(tier), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, .unit = "tier" },
{ "main", NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = 0 }, 0, 0, FLAGS, "tier" },
{ .i64 = 0 }, 0, 0, FLAGS, .unit = "tier" },
{ "high", NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = 1 }, 0, 0, FLAGS, "tier" },
{ .i64 = 1 }, 0, 0, FLAGS, .unit = "tier" },
{ "level", "Set level (seq_level_idx)",
OFFSET(level), AV_OPT_TYPE_INT,
{ .i64 = AV_LEVEL_UNKNOWN }, AV_LEVEL_UNKNOWN, 0x1f, FLAGS, "level" },
{ .i64 = AV_LEVEL_UNKNOWN }, AV_LEVEL_UNKNOWN, 0x1f, FLAGS, .unit = "level" },
#define LEVEL(name, value) name, NULL, 0, AV_OPT_TYPE_CONST, \
{ .i64 = value }, 0, 0, FLAGS, "level"
{ .i64 = value }, 0, 0, FLAGS, .unit = "level"
{ LEVEL("2.0", 0) },
{ LEVEL("2.1", 1) },
{ LEVEL("3.0", 4) },