Reputation: 1853
There is an option for declaring video size:
av_dict_set(&options, "video_size", "1920x1080", 0);
Are there any equivalent options for the size components? Like:
av_dict_set_int(&options, VIDEO_WIDTH_OPT_STR , 1920, 0);
av_dict_set_int(&options, VIDEO_HEIGHT_OPT_STR, 1080, 0);
What would be the values for those macros (if any)?
#define VIDEO_WIDTH_OPT_STR "?"
#define VIDEO_HEIGHT_OPT_STR "?"
Please note I'm aware of man snprintf
, that's not my concern, thank you.
Upvotes: 0
Views: 164
Reputation: 31209
You can add whatever you want in the dictionary, it's just a container. video_size
is parsed to two integers for the formats who use it for example. See AV_OPT_TYPE_IMAGE_SIZE
in libavutil/opt.c
.
You can define your own options (AVOption
) for a class. So there's nothing stopping you from adding two options like video_width
and video_height
and initialize them via a dictionary.
static const AVOption options[] = {
{ "video_width", "frame width", OFFSET(width), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, DEC },
{ "video_height", "frame height", OFFSET(height), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, DEC },
{ NULL }
};
static const AVClass some_class = {
[...]
.option = options,
[...]
}
where width
and height
are members of the struct used by your format.
Upvotes: 2