我有一个结构 AVFilter,
typedef struct AVFilter
{
const char *name;
const char *description;
const AVClass *priv_class;
int priv_size;
int (*init)(AVFilterContext *ctx);
void (*uninit)(AVFilterContext *ctx);
int (*query_formats)(AVFilterContext *);
const AVFilterPad *inputs;
const AVFilterPad *outputs;
int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
} AVFilter;
我正在访问结构变量,例如,
AVFilter avfilter_vsrc_color = {
avfilter_vsrc_color.name = "color",
avfilter_vsrc_color.description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input."),
avfilter_vsrc_color.priv_class = &color_class, // error here
avfilter_vsrc_color.priv_size = sizeof(TestSourceContext),// error here
avfilter_vsrc_color.init = color_init,// error here
avfilter_vsrc_color.uninit = uninit,// error here
avfilter_vsrc_color.query_formats = color_query_formats,// error here
avfilter_vsrc_color.inputs = NULL,// error here
avfilter_vsrc_color.outputs = color_outputs,// error here
avfilter_vsrc_color.process_command = color_process_command // error here
};
我不知道如何访问 priv_class。请帮我解决这个问题
如果我真的喜欢这样,
AVFilter avfilter_vsrc_color=
{
.name = "color", //error
.description = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input."),
.priv_class = &color_class,
.priv_size = sizeof(TestSourceContext),
.init = color_init,
.uninit = uninit,
.query_formats = color_query_formats,
.inputs = NULL,
.outputs = color_outputs,
.process_command = color_process_command
};
我收到错误,例如,
2>c:\users\awki6\desktop\ffmpeg\libavfilter\vsrc_testsrc.cpp(271): error C2143: syntax error : missing '}' before '.'
2>c:\users\awki6\desktop\ffmpeg\libavfilter\vsrc_testsrc.cpp(271): error C2143: syntax error : missing ';' before '.'