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>
This commit is contained in:
commit
a4e0defa75
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user