The macro can be used to define consistently the internal class of a filter, save some typing and factorize.tags/n1.0
| @@ -46,20 +46,14 @@ typedef struct AFormatContext { | |||||
| #define OFFSET(x) offsetof(AFormatContext, x) | #define OFFSET(x) offsetof(AFormatContext, x) | ||||
| #define A AV_OPT_FLAG_AUDIO_PARAM | #define A AV_OPT_FLAG_AUDIO_PARAM | ||||
| static const AVOption options[] = { | |||||
| static const AVOption aformat_options[] = { | |||||
| { "sample_fmts", "A comma-separated list of sample formats.", OFFSET(formats_str), AV_OPT_TYPE_STRING, .flags = A }, | { "sample_fmts", "A comma-separated list of sample formats.", OFFSET(formats_str), AV_OPT_TYPE_STRING, .flags = A }, | ||||
| { "sample_rates", "A comma-separated list of sample rates.", OFFSET(sample_rates_str), AV_OPT_TYPE_STRING, .flags = A }, | { "sample_rates", "A comma-separated list of sample rates.", OFFSET(sample_rates_str), AV_OPT_TYPE_STRING, .flags = A }, | ||||
| { "channel_layouts", "A comma-separated list of channel layouts.", OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = A }, | { "channel_layouts", "A comma-separated list of channel layouts.", OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = A }, | ||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass aformat_class = { | |||||
| .class_name = "aformat", | |||||
| .item_name = av_default_item_name, | |||||
| .option = options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(aformat); | |||||
| #define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc) \ | #define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc) \ | ||||
| do { \ | do { \ | ||||
| @@ -52,13 +52,7 @@ static const AVOption amerge_options[] = { | |||||
| {0} | {0} | ||||
| }; | }; | ||||
| static const AVClass amerge_class = { | |||||
| .class_name = "amerge", | |||||
| .item_name = av_default_item_name, | |||||
| .option = amerge_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(amerge); | |||||
| static av_cold void uninit(AVFilterContext *ctx) | static av_cold void uninit(AVFilterContext *ctx) | ||||
| { | { | ||||
| @@ -173,7 +173,7 @@ typedef struct MixContext { | |||||
| #define OFFSET(x) offsetof(MixContext, x) | #define OFFSET(x) offsetof(MixContext, x) | ||||
| #define A AV_OPT_FLAG_AUDIO_PARAM | #define A AV_OPT_FLAG_AUDIO_PARAM | ||||
| static const AVOption options[] = { | |||||
| static const AVOption amix_options[] = { | |||||
| { "inputs", "Number of inputs.", | { "inputs", "Number of inputs.", | ||||
| OFFSET(nb_inputs), AV_OPT_TYPE_INT, { 2 }, 1, 32, A }, | OFFSET(nb_inputs), AV_OPT_TYPE_INT, { 2 }, 1, 32, A }, | ||||
| { "duration", "How to determine the end-of-stream.", | { "duration", "How to determine the end-of-stream.", | ||||
| @@ -187,14 +187,7 @@ static const AVOption options[] = { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass amix_class = { | |||||
| .class_name = "amix", | |||||
| .item_name = av_default_item_name, | |||||
| .option = options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(amix); | |||||
| /** | /** | ||||
| * Update the scaling factors to apply to each input during mixing. | * Update the scaling factors to apply to each input during mixing. | ||||
| @@ -29,6 +29,7 @@ | |||||
| #include "libavutil/opt.h" | #include "libavutil/opt.h" | ||||
| #include "avfilter.h" | #include "avfilter.h" | ||||
| #include "audio.h" | #include "audio.h" | ||||
| #include "internal.h" | |||||
| #include "formats.h" | #include "formats.h" | ||||
| typedef struct { | typedef struct { | ||||
| @@ -42,7 +43,7 @@ typedef struct { | |||||
| #define OFFSET(x) offsetof(ASNSContext, x) | #define OFFSET(x) offsetof(ASNSContext, x) | ||||
| static const AVOption asns_options[] = { | |||||
| static const AVOption asetnsamples_options[] = { | |||||
| { "pad", "pad last frame with zeros", OFFSET(pad), AV_OPT_TYPE_INT, {.dbl=1}, 0, 1 }, | { "pad", "pad last frame with zeros", OFFSET(pad), AV_OPT_TYPE_INT, {.dbl=1}, 0, 1 }, | ||||
| { "p", "pad last frame with zeros", OFFSET(pad), AV_OPT_TYPE_INT, {.dbl=1}, 0, 1 }, | { "p", "pad last frame with zeros", OFFSET(pad), AV_OPT_TYPE_INT, {.dbl=1}, 0, 1 }, | ||||
| { "nb_out_samples", "set the number of per-frame output samples", OFFSET(nb_out_samples), AV_OPT_TYPE_INT, {.dbl=1024}, 1, INT_MAX }, | { "nb_out_samples", "set the number of per-frame output samples", OFFSET(nb_out_samples), AV_OPT_TYPE_INT, {.dbl=1024}, 1, INT_MAX }, | ||||
| @@ -50,20 +51,14 @@ static const AVOption asns_options[] = { | |||||
| { NULL } | { NULL } | ||||
| }; | }; | ||||
| static const AVClass asns_class = { | |||||
| .class_name = "asetnsamples", | |||||
| .item_name = av_default_item_name, | |||||
| .option = asns_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(asetnsamples); | |||||
| static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| ASNSContext *asns = ctx->priv; | ASNSContext *asns = ctx->priv; | ||||
| int err; | int err; | ||||
| asns->class = &asns_class; | |||||
| asns->class = &asetnsamples_class; | |||||
| av_opt_set_defaults(asns); | av_opt_set_defaults(asns); | ||||
| if ((err = av_set_options_string(asns, args, "=", ":")) < 0) { | if ((err = av_set_options_string(asns, args, "=", ":")) < 0) { | ||||
| @@ -41,7 +41,7 @@ typedef struct ASyncContext { | |||||
| #define OFFSET(x) offsetof(ASyncContext, x) | #define OFFSET(x) offsetof(ASyncContext, x) | ||||
| #define A AV_OPT_FLAG_AUDIO_PARAM | #define A AV_OPT_FLAG_AUDIO_PARAM | ||||
| static const AVOption options[] = { | |||||
| static const AVOption asyncts_options[] = { | |||||
| { "compensate", "Stretch/squeeze the data to make it match the timestamps", OFFSET(resample), AV_OPT_TYPE_INT, { 0 }, 0, 1, A }, | { "compensate", "Stretch/squeeze the data to make it match the timestamps", OFFSET(resample), AV_OPT_TYPE_INT, { 0 }, 0, 1, A }, | ||||
| { "min_delta", "Minimum difference between timestamps and audio data " | { "min_delta", "Minimum difference between timestamps and audio data " | ||||
| "(in seconds) to trigger padding/trimmin the data.", OFFSET(min_delta_sec), AV_OPT_TYPE_FLOAT, { 0.1 }, 0, INT_MAX, A }, | "(in seconds) to trigger padding/trimmin the data.", OFFSET(min_delta_sec), AV_OPT_TYPE_FLOAT, { 0.1 }, 0, INT_MAX, A }, | ||||
| @@ -49,20 +49,14 @@ static const AVOption options[] = { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass async_class = { | |||||
| .class_name = "asyncts", | |||||
| .item_name = av_default_item_name, | |||||
| .option = options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(asyncts); | |||||
| static int init(AVFilterContext *ctx, const char *args, void *opaque) | static int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| ASyncContext *s = ctx->priv; | ASyncContext *s = ctx->priv; | ||||
| int ret; | int ret; | ||||
| s->class = &async_class; | |||||
| s->class = &asyncts_class; | |||||
| av_opt_set_defaults(s); | av_opt_set_defaults(s); | ||||
| if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | ||||
| @@ -40,18 +40,12 @@ typedef struct ChannelSplitContext { | |||||
| #define OFFSET(x) offsetof(ChannelSplitContext, x) | #define OFFSET(x) offsetof(ChannelSplitContext, x) | ||||
| #define A AV_OPT_FLAG_AUDIO_PARAM | #define A AV_OPT_FLAG_AUDIO_PARAM | ||||
| static const AVOption options[] = { | |||||
| static const AVOption channelsplit_options[] = { | |||||
| { "channel_layout", "Input channel layout.", OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, { .str = "stereo" }, .flags = A }, | { "channel_layout", "Input channel layout.", OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, { .str = "stereo" }, .flags = A }, | ||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass channelsplit_class = { | |||||
| .class_name = "channelsplit", | |||||
| .item_name = av_default_item_name, | |||||
| .option = options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(channelsplit); | |||||
| static int init(AVFilterContext *ctx, const char *arg, void *opaque) | static int init(AVFilterContext *ctx, const char *arg, void *opaque) | ||||
| { | { | ||||
| @@ -28,6 +28,7 @@ | |||||
| #include "audio.h" | #include "audio.h" | ||||
| #include "formats.h" | #include "formats.h" | ||||
| #include "avfilter.h" | #include "avfilter.h" | ||||
| #include "internal.h" | |||||
| typedef struct { | typedef struct { | ||||
| const AVClass *class; | const AVClass *class; | ||||
| @@ -48,13 +49,7 @@ static const AVOption silencedetect_options[] = { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass silencedetect_class = { | |||||
| .class_name = "silencedetect", | |||||
| .item_name = av_default_item_name, | |||||
| .option = silencedetect_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(silencedetect); | |||||
| static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -66,7 +66,7 @@ typedef struct { | |||||
| #define OFFSET(x) offsetof(EvalContext, x) | #define OFFSET(x) offsetof(EvalContext, x) | ||||
| static const AVOption eval_options[]= { | |||||
| static const AVOption aevalsrc_options[]= { | |||||
| { "nb_samples", "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.dbl = 1024}, 0, INT_MAX }, | { "nb_samples", "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.dbl = 1024}, 0, INT_MAX }, | ||||
| { "n", "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.dbl = 1024}, 0, INT_MAX }, | { "n", "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.dbl = 1024}, 0, INT_MAX }, | ||||
| { "sample_rate", "set the sample rate", OFFSET(sample_rate_str), AV_OPT_TYPE_STRING, {.str = "44100"}, CHAR_MIN, CHAR_MAX }, | { "sample_rate", "set the sample rate", OFFSET(sample_rate_str), AV_OPT_TYPE_STRING, {.str = "44100"}, CHAR_MIN, CHAR_MAX }, | ||||
| @@ -78,13 +78,7 @@ static const AVOption eval_options[]= { | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| static const AVClass eval_class = { | |||||
| .class_name = "aevalsrc", | |||||
| .item_name = av_default_item_name, | |||||
| .option = eval_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(aevalsrc); | |||||
| static int init(AVFilterContext *ctx, const char *args, void *opaque) | static int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -93,7 +87,7 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque) | |||||
| char *expr, *buf, *bufptr; | char *expr, *buf, *bufptr; | ||||
| int ret, i; | int ret, i; | ||||
| eval->class = &eval_class; | |||||
| eval->class = &aevalsrc_class; | |||||
| av_opt_set_defaults(eval); | av_opt_set_defaults(eval); | ||||
| /* parse expressions */ | /* parse expressions */ | ||||
| @@ -54,13 +54,7 @@ static const AVOption anullsrc_options[]= { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass anullsrc_class = { | |||||
| .class_name = "anullsrc", | |||||
| .item_name = av_default_item_name, | |||||
| .option = anullsrc_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(anullsrc); | |||||
| static int init(AVFilterContext *ctx, const char *args, void *opaque) | static int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -30,6 +30,7 @@ | |||||
| #include "formats.h" | #include "formats.h" | ||||
| #include "audio.h" | #include "audio.h" | ||||
| #include "video.h" | #include "video.h" | ||||
| #include "internal.h" | |||||
| typedef struct { | typedef struct { | ||||
| const AVClass *class; | const AVClass *class; | ||||
| @@ -54,13 +55,7 @@ static const AVOption showwaves_options[] = { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass showwaves_class = { | |||||
| .class_name = "showwaves", | |||||
| .item_name = av_default_item_name, | |||||
| .option = showwaves_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(showwaves); | |||||
| static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -219,7 +219,7 @@ unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src) | |||||
| #define OFFSET(x) offsetof(BufferSourceContext, x) | #define OFFSET(x) offsetof(BufferSourceContext, x) | ||||
| #define V AV_OPT_FLAG_VIDEO_PARAM | #define V AV_OPT_FLAG_VIDEO_PARAM | ||||
| static const AVOption video_options[] = { | |||||
| static const AVOption buffer_options[] = { | |||||
| { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { 0 }, 0, INT_MAX, V }, | { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { 0 }, 0, INT_MAX, V }, | ||||
| { "frame_rate", NULL, OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, { 0 }, 0, INT_MAX, V }, | { "frame_rate", NULL, OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, { 0 }, 0, INT_MAX, V }, | ||||
| { "video_size", NULL, OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, .flags = V }, | { "video_size", NULL, OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, .flags = V }, | ||||
| @@ -230,13 +230,7 @@ static const AVOption video_options[] = { | |||||
| }; | }; | ||||
| #undef V | #undef V | ||||
| static const AVClass vbuffer_class = { | |||||
| .class_name = "vbuffer source", | |||||
| .item_name = av_default_item_name, | |||||
| .option = video_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(buffer); | |||||
| static av_cold int init_video(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int init_video(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -244,7 +238,7 @@ static av_cold int init_video(AVFilterContext *ctx, const char *args, void *opaq | |||||
| char pix_fmt_str[128], sws_param[256] = "", *colon, *equal; | char pix_fmt_str[128], sws_param[256] = "", *colon, *equal; | ||||
| int ret, n = 0; | int ret, n = 0; | ||||
| c->class = &vbuffer_class; | |||||
| c->class = &buffer_class; | |||||
| if (!args) { | if (!args) { | ||||
| av_log(ctx, AV_LOG_ERROR, "Arguments required\n"); | av_log(ctx, AV_LOG_ERROR, "Arguments required\n"); | ||||
| @@ -295,7 +289,7 @@ fail: | |||||
| } | } | ||||
| #define A AV_OPT_FLAG_AUDIO_PARAM | #define A AV_OPT_FLAG_AUDIO_PARAM | ||||
| static const AVOption audio_options[] = { | |||||
| static const AVOption abuffer_options[] = { | |||||
| { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { 0 }, 0, INT_MAX, A }, | { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { 0 }, 0, INT_MAX, A }, | ||||
| { "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { 0 }, 0, INT_MAX, A }, | { "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { 0 }, 0, INT_MAX, A }, | ||||
| { "sample_fmt", NULL, OFFSET(sample_fmt_str), AV_OPT_TYPE_STRING, .flags = A }, | { "sample_fmt", NULL, OFFSET(sample_fmt_str), AV_OPT_TYPE_STRING, .flags = A }, | ||||
| @@ -303,13 +297,7 @@ static const AVOption audio_options[] = { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass abuffer_class = { | |||||
| .class_name = "abuffer source", | |||||
| .item_name = av_default_item_name, | |||||
| .option = audio_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(abuffer); | |||||
| static av_cold int init_audio(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int init_audio(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -326,4 +326,13 @@ int ff_poll_frame(AVFilterLink *link); | |||||
| */ | */ | ||||
| int ff_request_frame(AVFilterLink *link); | int ff_request_frame(AVFilterLink *link); | ||||
| #define AVFILTER_DEFINE_CLASS(fname) \ | |||||
| static const AVClass fname##_class = { \ | |||||
| .class_name = #fname, \ | |||||
| .item_name = av_default_item_name, \ | |||||
| .option = fname##_options, \ | |||||
| .version = LIBAVUTIL_VERSION_INT, \ | |||||
| .category = AV_CLASS_CATEGORY_FILTER, \ | |||||
| } | |||||
| #endif /* AVFILTER_INTERNAL_H */ | #endif /* AVFILTER_INTERNAL_H */ | ||||
| @@ -80,13 +80,7 @@ static const AVOption movie_options[]= { | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| static const AVClass movie_class = { | |||||
| .class_name = "movie", | |||||
| .item_name = av_default_item_name, | |||||
| .option = movie_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(movie); | |||||
| static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, void *opaque, | static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, void *opaque, | ||||
| enum AVMediaType type) | enum AVMediaType type) | ||||
| @@ -34,6 +34,7 @@ | |||||
| #include "libavutil/parseutils.h" | #include "libavutil/parseutils.h" | ||||
| #include "drawutils.h" | #include "drawutils.h" | ||||
| #include "avfilter.h" | #include "avfilter.h" | ||||
| #include "internal.h" | |||||
| #include "formats.h" | #include "formats.h" | ||||
| #include "video.h" | #include "video.h" | ||||
| @@ -56,13 +57,7 @@ static const AVOption ass_options[] = { | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| static const AVClass ass_class = { | |||||
| .class_name = "ass", | |||||
| .item_name = av_default_item_name, | |||||
| .option = ass_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(ass); | |||||
| /* libass supports a log level ranging from 0 to 7 */ | /* libass supports a log level ranging from 0 to 7 */ | ||||
| int ass_libav_log_level_map[] = { | int ass_libav_log_level_map[] = { | ||||
| @@ -58,13 +58,7 @@ static const AVOption blackdetect_options[] = { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass blackdetect_class = { | |||||
| .class_name = "blackdetect", | |||||
| .item_name = av_default_item_name, | |||||
| .option = blackdetect_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(blackdetect); | |||||
| #define YUVJ_FORMATS \ | #define YUVJ_FORMATS \ | ||||
| PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUVJ440P | PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUVJ440P | ||||
| @@ -151,13 +151,7 @@ static const AVOption delogo_options[]= { | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| static const AVClass delogo_class = { | |||||
| .class_name = "delogo", | |||||
| .item_name = av_default_item_name, | |||||
| .option = delogo_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(delogo); | |||||
| static int query_formats(AVFilterContext *ctx) | static int query_formats(AVFilterContext *ctx) | ||||
| { | { | ||||
| @@ -207,13 +207,7 @@ static const AVOption drawtext_options[]= { | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| static const AVClass drawtext_class = { | |||||
| .class_name = "drawtext", | |||||
| .item_name = av_default_item_name, | |||||
| .option = drawtext_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(drawtext); | |||||
| #undef __FTERRORS_H__ | #undef __FTERRORS_H__ | ||||
| #define FT_ERROR_START_LIST { | #define FT_ERROR_START_LIST { | ||||
| @@ -71,13 +71,7 @@ static const AVOption fade_options[] = { | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| static const AVClass fade_class = { | |||||
| .class_name = "fade", | |||||
| .item_name = av_default_item_name, | |||||
| .option = fade_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(fade); | |||||
| static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -55,25 +55,19 @@ typedef struct FPSContext { | |||||
| #define OFFSET(x) offsetof(FPSContext, x) | #define OFFSET(x) offsetof(FPSContext, x) | ||||
| #define V AV_OPT_FLAG_VIDEO_PARAM | #define V AV_OPT_FLAG_VIDEO_PARAM | ||||
| static const AVOption options[] = { | |||||
| static const AVOption fps_options[] = { | |||||
| { "fps", "A string describing desired output framerate", OFFSET(fps), AV_OPT_TYPE_STRING, { .str = "25" }, .flags = V }, | { "fps", "A string describing desired output framerate", OFFSET(fps), AV_OPT_TYPE_STRING, { .str = "25" }, .flags = V }, | ||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass class = { | |||||
| .class_name = "fps", | |||||
| .item_name = av_default_item_name, | |||||
| .option = options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(fps); | |||||
| static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| FPSContext *s = ctx->priv; | FPSContext *s = ctx->priv; | ||||
| int ret; | int ret; | ||||
| s->class = &class; | |||||
| s->class = &fps_class; | |||||
| av_opt_set_defaults(s); | av_opt_set_defaults(s); | ||||
| if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | if ((ret = av_set_options_string(s, args, "=", ":")) < 0) { | ||||
| @@ -91,13 +91,7 @@ static const AVOption lut_options[] = { | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| static const AVClass lut_class = { | |||||
| .class_name = "lut", | |||||
| .item_name = av_default_item_name, | |||||
| .option = lut_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(lut); | |||||
| static int init(AVFilterContext *ctx, const char *args, void *opaque) | static int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -103,13 +103,7 @@ static const AVOption overlay_options[] = { | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| static const AVClass overlay_class = { | |||||
| .class_name = "overlay", | |||||
| .item_name = av_default_item_name, | |||||
| .option = overlay_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(overlay); | |||||
| static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -31,6 +31,7 @@ | |||||
| #include "libavutil/parseutils.h" | #include "libavutil/parseutils.h" | ||||
| #include "libavutil/random_seed.h" | #include "libavutil/random_seed.h" | ||||
| #include "avfilter.h" | #include "avfilter.h" | ||||
| #include "internal.h" | |||||
| #include "formats.h" | #include "formats.h" | ||||
| #include "video.h" | #include "video.h" | ||||
| @@ -78,13 +79,7 @@ static const AVOption cellauto_options[] = { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass cellauto_class = { | |||||
| .class_name = "cellauto", | |||||
| .item_name = av_default_item_name, | |||||
| .option = cellauto_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(cellauto); | |||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| static void show_cellauto_row(AVFilterContext *ctx) | static void show_cellauto_row(AVFilterContext *ctx) | ||||
| @@ -59,13 +59,7 @@ static const AVOption color_options[]= { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass color_class = { | |||||
| .class_name = "color", | |||||
| .item_name = av_default_item_name, | |||||
| .option = color_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(color); | |||||
| static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -32,6 +32,7 @@ | |||||
| #include "libavutil/parseutils.h" | #include "libavutil/parseutils.h" | ||||
| #include "libavutil/random_seed.h" | #include "libavutil/random_seed.h" | ||||
| #include "avfilter.h" | #include "avfilter.h" | ||||
| #include "internal.h" | |||||
| #include "formats.h" | #include "formats.h" | ||||
| #include "video.h" | #include "video.h" | ||||
| @@ -97,13 +98,7 @@ static const AVOption life_options[] = { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass life_class = { | |||||
| .class_name = "life", | |||||
| .item_name = av_default_item_name, | |||||
| .option = life_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(life); | |||||
| static int parse_rule(uint16_t *born_rule, uint16_t *stay_rule, | static int parse_rule(uint16_t *born_rule, uint16_t *stay_rule, | ||||
| const char *rule_str, void *log_ctx) | const char *rule_str, void *log_ctx) | ||||
| @@ -29,6 +29,7 @@ | |||||
| #include "avfilter.h" | #include "avfilter.h" | ||||
| #include "formats.h" | #include "formats.h" | ||||
| #include "video.h" | #include "video.h" | ||||
| #include "internal.h" | |||||
| #include "libavutil/imgutils.h" | #include "libavutil/imgutils.h" | ||||
| #include "libavutil/opt.h" | #include "libavutil/opt.h" | ||||
| #include "libavutil/parseutils.h" | #include "libavutil/parseutils.h" | ||||
| @@ -105,13 +106,7 @@ static const AVOption mandelbrot_options[] = { | |||||
| {NULL}, | {NULL}, | ||||
| }; | }; | ||||
| static const AVClass mandelbrot_class = { | |||||
| .class_name = "mandelbrot", | |||||
| .item_name = av_default_item_name, | |||||
| .option = mandelbrot_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(mandelbrot); | |||||
| static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| { | { | ||||
| @@ -28,6 +28,7 @@ | |||||
| #include "libavutil/parseutils.h" | #include "libavutil/parseutils.h" | ||||
| #include "libavutil/pixdesc.h" | #include "libavutil/pixdesc.h" | ||||
| #include "avfilter.h" | #include "avfilter.h" | ||||
| #include "internal.h" | |||||
| #include "formats.h" | #include "formats.h" | ||||
| #include "video.h" | #include "video.h" | ||||
| @@ -84,13 +85,7 @@ static const AVOption mptestsrc_options[]= { | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||
| static const AVClass mptestsrc_class = { | |||||
| .class_name = "mptestsrc", | |||||
| .item_name = av_default_item_name, | |||||
| .option = mptestsrc_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(mptestsrc); | |||||
| static double c[64]; | static double c[64]; | ||||
| @@ -194,13 +194,7 @@ AVFilter avfilter_vsrc_nullsrc = { | |||||
| #if CONFIG_TESTSRC_FILTER | #if CONFIG_TESTSRC_FILTER | ||||
| static const AVClass testsrc_class = { | |||||
| .class_name = "testsrc", | |||||
| .item_name = av_default_item_name, | |||||
| .option = testsrc_options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| .category = AV_CLASS_CATEGORY_FILTER, | |||||
| }; | |||||
| AVFILTER_DEFINE_CLASS(testsrc); | |||||
| /** | /** | ||||
| * Fill a rectangle with value val. | * Fill a rectangle with value val. | ||||