diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-10 13:52:53 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-10 13:59:45 +0200 |
commit | 2a2a643c90ff091f1fa4a0634bcc4e18639bcee0 (patch) | |
tree | 2f093ba8b00873b35ed154df0da9251bb6dbacc6 /libavfilter/vf_format.c | |
parent | 451315830a3b8ff4014cd0dda8583f5845e5a8d0 (diff) | |
parent | e67a87eac814c7805d18c983c43033a8a1bd62af (diff) | |
download | ffmpeg-streaming-2a2a643c90ff091f1fa4a0634bcc4e18639bcee0.zip ffmpeg-streaming-2a2a643c90ff091f1fa4a0634bcc4e18639bcee0.tar.gz |
Merge commit 'e67a87eac814c7805d18c983c43033a8a1bd62af'
* commit 'e67a87eac814c7805d18c983c43033a8a1bd62af':
vf_(no)format: switch to an AVOptions-based system.
af_aformat: switch to an AVOptions-based system.
Conflicts:
doc/filters.texi
libavfilter/af_aformat.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_format.c')
-rw-r--r-- | libavfilter/vf_format.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index df3c77a..5a95b5f 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -28,6 +28,8 @@ #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" @@ -35,6 +37,8 @@ #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. @@ -53,8 +57,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args) 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; @@ -90,6 +94,12 @@ static AVFilterFormats *make_format_list(FormatContext *format, int flag) 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) { @@ -97,6 +107,13 @@ 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", @@ -123,6 +140,7 @@ AVFilter avfilter_vf_format = { .query_formats = query_formats_format, .priv_size = sizeof(FormatContext), + .priv_class = &format_class, .inputs = avfilter_vf_format_inputs, .outputs = avfilter_vf_format_outputs, @@ -136,6 +154,13 @@ static int query_formats_noformat(AVFilterContext *ctx) 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", @@ -162,6 +187,7 @@ AVFilter avfilter_vf_noformat = { .query_formats = query_formats_noformat, .priv_size = sizeof(FormatContext), + .priv_class = &noformat_class, .inputs = avfilter_vf_noformat_inputs, .outputs = avfilter_vf_noformat_outputs, |