diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-11 00:32:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-11 00:33:31 +0200 |
commit | a4e0defa75b6f766aa31d80c55688d036b5fd87b (patch) | |
tree | aad13d8b9f98ec3111ff405795a492fc31e2e881 | |
parent | cff8f91ddfbdef72be7ec3adec6adf3e92ae4a27 (diff) | |
parent | 0c2466dec719b933d161f5d680a57fde38aa5daa (diff) | |
download | ffmpeg-a4e0defa75b6f766aa31d80c55688d036b5fd87b.tar.gz |
Merge commit '0c2466dec719b933d161f5d680a57fde38aa5daa'
* commit '0c2466dec719b933d161f5d680a57fde38aa5daa':
vf_transpose: switch to an AVOptions-based system.
Conflicts:
doc/filters.texi
libavfilter/vf_transpose.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | doc/filters.texi | 16 | ||||
-rw-r--r-- | libavfilter/avfilter.c | 1 | ||||
-rw-r--r-- | libavfilter/vf_transpose.c | 58 |
3 files changed, 40 insertions, 35 deletions
diff --git a/doc/filters.texi b/doc/filters.texi index 01381e208f..96f15c5cc6 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -5540,17 +5540,15 @@ Vertical low-pass filtering can only be enabled for @option{mode} Transpose rows with columns in the input video and optionally flip it. -The filter accepts parameters as a list of @var{key}=@var{value} -pairs, separated by ':'. If the key of the first options is omitted, -the arguments are interpreted according to the syntax -@var{dir}:@var{passthrough}. +This filter accepts the following options: @table @option + @item dir -Specify the transposition direction. Can assume the following values: +The direction of the transpose. @table @samp -@item 0, 4 +@item 0, 4, cclock_flip Rotate by 90 degrees counterclockwise and vertically flip (default), that is: @example L.R L.l @@ -5558,7 +5556,7 @@ L.R L.l l.r R.r @end example -@item 1, 5 +@item 1, 5, clock Rotate by 90 degrees clockwise, that is: @example L.R l.L @@ -5566,7 +5564,7 @@ L.R l.L l.r r.R @end example -@item 2, 6 +@item 2, 6, cclock Rotate by 90 degrees counterclockwise, that is: @example L.R R.r @@ -5574,7 +5572,7 @@ L.R R.r l.r L.l @end example -@item 3, 7 +@item 3, 7, clock_flip Rotate by 90 degrees clockwise and vertically flip, that is: @example L.R r.R diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 3adee34785..226008ee61 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -699,6 +699,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque !strcmp(filter->filter->name, "smartblur") || !strcmp(filter->filter->name, "subtitles") || !strcmp(filter->filter->name, "thumbnail") || + !strcmp(filter->filter->name, "transpose") || // !strcmp(filter->filter->name, "scale" ) || !strcmp(filter->filter->name, "select") || 0 diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index ed870178e5..2b1fa1f0fa 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -32,6 +32,7 @@ #include "libavutil/pixdesc.h" #include "libavutil/imgutils.h" #include "libavutil/internal.h" +#include "libavutil/opt.h" #include "avfilter.h" #include "formats.h" #include "internal.h" @@ -43,36 +44,22 @@ typedef enum { TRANSPOSE_PT_TYPE_PORTRAIT, } PassthroughType; +enum TransposeDir { + TRANSPOSE_CCLOCK_FLIP, + TRANSPOSE_CLOCK, + TRANSPOSE_CCLOCK, + TRANSPOSE_CLOCK_FLIP, +}; + typedef struct { const AVClass *class; int hsub, vsub; int pixsteps[4]; - /* 0 Rotate by 90 degrees counterclockwise and vflip. */ - /* 1 Rotate by 90 degrees clockwise. */ - /* 2 Rotate by 90 degrees counterclockwise. */ - /* 3 Rotate by 90 degrees clockwise and vflip. */ - int dir; PassthroughType passthrough; ///< landscape passthrough mode enabled + enum TransposeDir dir; } TransContext; -#define OFFSET(x) offsetof(TransContext, x) -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM - -static const AVOption transpose_options[] = { - { "dir", "set transpose direction", OFFSET(dir), AV_OPT_TYPE_INT, {.i64=0}, 0, 7, FLAGS }, - - { "passthrough", "do not apply transposition if the input matches the specified geometry", - OFFSET(passthrough), AV_OPT_TYPE_INT, {.i64=TRANSPOSE_PT_TYPE_NONE}, 0, INT_MAX, FLAGS, "passthrough" }, - { "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_NONE}, INT_MIN, INT_MAX, FLAGS, "passthrough" }, - { "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_PORTRAIT}, INT_MIN, INT_MAX, FLAGS, "passthrough" }, - { "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_LANDSCAPE}, INT_MIN, INT_MAX, FLAGS, "passthrough" }, - - { NULL }, -}; - -AVFILTER_DEFINE_CLASS(transpose); - static int query_formats(AVFilterContext *ctx) { AVFilterFormats *pix_fmts = NULL; @@ -236,6 +223,28 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return ff_filter_frame(outlink, out); } +#define OFFSET(x) offsetof(TransContext, x) +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM + +static const AVOption transpose_options[] = { + { "dir", "Transpose direction", OFFSET(dir), AV_OPT_TYPE_INT, { .i64 = TRANSPOSE_CCLOCK_FLIP }, + TRANSPOSE_CCLOCK_FLIP, TRANSPOSE_CLOCK_FLIP, FLAGS, "dir" }, + { "cclock_flip", "counter-clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK_FLIP }, .unit = "dir" }, + { "clock", "clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .unit = "dir" }, + { "cclock", "counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .unit = "dir" }, + { "clock_flip", "clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .unit = "dir" }, + + { "passthrough", "do not apply transposition if the input matches the specified geometry", + OFFSET(passthrough), AV_OPT_TYPE_INT, {.i64=TRANSPOSE_PT_TYPE_NONE}, 0, INT_MAX, FLAGS, "passthrough" }, + { "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_NONE}, INT_MIN, INT_MAX, FLAGS, "passthrough" }, + { "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_PORTRAIT}, INT_MIN, INT_MAX, FLAGS, "passthrough" }, + { "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_LANDSCAPE}, INT_MIN, INT_MAX, FLAGS, "passthrough" }, + + { NULL }, +}; + +AVFILTER_DEFINE_CLASS(transpose); + static const AVFilterPad avfilter_vf_transpose_inputs[] = { { .name = "default", @@ -255,18 +264,15 @@ static const AVFilterPad avfilter_vf_transpose_outputs[] = { { NULL } }; -static const char *const shorthand[] = { "dir", "passthrough", NULL }; - AVFilter avfilter_vf_transpose = { .name = "transpose", .description = NULL_IF_CONFIG_SMALL("Transpose input video."), .priv_size = sizeof(TransContext), + .priv_class = &transpose_class, .query_formats = query_formats, .inputs = avfilter_vf_transpose_inputs, .outputs = avfilter_vf_transpose_outputs, - .priv_class = &transpose_class, - .shorthand = shorthand, }; |