#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/opt.h"
+
#include "avfilter.h"
#include "internal.h"
#include "formats.h"
#include "video.h"
typedef struct {
+ const AVClass *class;
+ char *pix_fmts;
/**
* List of flags telling if a given image format has been listed
* as argument to the filter.
enum AVPixelFormat pix_fmt;
/* parse the list of formats */
- for (cur = args; cur; cur = sep ? sep+1 : NULL) {
- if (!(sep = strchr(cur, ':')))
+ for (cur = format->pix_fmts; cur; cur = sep ? sep + 1 : NULL) {
+ if (!(sep = strchr(cur, '|')))
pix_fmt_name_len = strlen(cur);
else
pix_fmt_name_len = sep - cur;
return formats;
}
+#define OFFSET(x) offsetof(FormatContext, x)
+static const AVOption options[] = {
+ { "pix_fmts", "A '|'-separated list of pixel formats", OFFSET(pix_fmts), AV_OPT_TYPE_STRING, .flags = AV_OPT_FLAG_VIDEO_PARAM },
+ { NULL },
+};
+
#if CONFIG_FORMAT_FILTER
static int query_formats_format(AVFilterContext *ctx)
{
return 0;
}
+static const AVClass format_class = {
+ .class_name = "format",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
static const AVFilterPad avfilter_vf_format_inputs[] = {
{
.name = "default",
.query_formats = query_formats_format,
.priv_size = sizeof(FormatContext),
+ .priv_class = &format_class,
.inputs = avfilter_vf_format_inputs,
.outputs = avfilter_vf_format_outputs,
return 0;
}
+static const AVClass noformat_class = {
+ .class_name = "noformat",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
static const AVFilterPad avfilter_vf_noformat_inputs[] = {
{
.name = "default",
.query_formats = query_formats_noformat,
.priv_size = sizeof(FormatContext),
+ .priv_class = &noformat_class,
.inputs = avfilter_vf_noformat_inputs,
.outputs = avfilter_vf_noformat_outputs,