Merge commit 'a39c154049a2d0c4fb02a5c74f58d6986ec21cec'

* commit 'a39c154049a2d0c4fb02a5c74f58d6986ec21cec':
  vf_fieldorder: switch to an AVOptions-based system.

Conflicts:
	doc/filters.texi
	libavfilter/vf_fieldorder.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/21/head
Michael Niedermayer 12 years ago
commit b8a1f8b4e2
  1. 15
      doc/filters.texi
  2. 1
      libavfilter/avfilter.c
  3. 50
      libavfilter/vf_fieldorder.c

@ -3128,16 +3128,13 @@ field=type=bottom
Transform the field order of the input video.
This filter accepts the named option @option{order} which
specifies the required field order that the input interlaced video
will be transformed to. The option name can be omitted.
This filter accepts the following options:
The option @option{order} can assume one of the following values:
@table @samp
@item bff
output bottom field first
@item tff
output top field first
@table @option
@item order
Output field order. Valid values are @var{tff} for top field first or @var{bff}
for bottom field first.
@end table
Default value is @samp{tff}.

@ -665,6 +665,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
!strcmp(filter->filter->name, "drawbox" ) ||
!strcmp(filter->filter->name, "drawtext" ) ||
!strcmp(filter->filter->name, "fade" ) ||
!strcmp(filter->filter->name, "fieldorder") ||
!strcmp(filter->filter->name, "format") ||
!strcmp(filter->filter->name, "noformat") ||
!strcmp(filter->filter->name, "resample")

@ -26,47 +26,19 @@
#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
enum FieldOrder {
ORDER_TFF,
ORDER_BFF,
ORDER_NB,
};
typedef struct {
const AVClass *class;
enum FieldOrder order;
unsigned int dst_tff; ///< output bff/tff
int dst_tff; ///< output bff/tff
int line_size[4]; ///< bytes of pixel data per line for each plane
} FieldOrderContext;
#define OFFSET(x) offsetof(FieldOrderContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static const AVOption fieldorder_options[] = {
{ "order", "set output field order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=ORDER_TFF}, 0, ORDER_NB-1, FLAGS, "order" },
{ "tff", "set top field first", 0, AV_OPT_TYPE_CONST, {.i64=ORDER_TFF}, .flags=FLAGS, .unit="order" },
{ "bff", "set bottom field first", 0, AV_OPT_TYPE_CONST, {.i64=ORDER_BFF}, .flags=FLAGS, .unit="order" },
{ NULL }
};
AVFILTER_DEFINE_CLASS(fieldorder);
static av_cold int init(AVFilterContext *ctx, const char *args)
{
FieldOrderContext *fieldorder = ctx->priv;
fieldorder->dst_tff = fieldorder->order == ORDER_TFF;
av_log(ctx, AV_LOG_VERBOSE, "tff:%d\n", fieldorder->dst_tff);
return 0;
}
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
@ -176,6 +148,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
return ff_filter_frame(outlink, frame);
}
#define OFFSET(x) offsetof(FieldOrderContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static const AVOption fieldorder_options[] = {
{ "order", "output field order", OFFSET(dst_tff), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "order" },
{ "bff", "bottom field first", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, .flags=FLAGS, .unit = "order" },
{ "tff", "top field first", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .flags=FLAGS, .unit = "order" },
{ NULL },
};
AVFILTER_DEFINE_CLASS(fieldorder);
static const AVFilterPad avfilter_vf_fieldorder_inputs[] = {
{
.name = "default",
@ -196,16 +180,12 @@ static const AVFilterPad avfilter_vf_fieldorder_outputs[] = {
{ NULL }
};
static const char *const shorthand[] = { "order", NULL };
AVFilter avfilter_vf_fieldorder = {
.name = "fieldorder",
.description = NULL_IF_CONFIG_SMALL("Set the field order."),
.init = init,
.priv_size = sizeof(FieldOrderContext),
.priv_class = &fieldorder_class,
.query_formats = query_formats,
.inputs = avfilter_vf_fieldorder_inputs,
.outputs = avfilter_vf_fieldorder_outputs,
.priv_class = &fieldorder_class,
.shorthand = shorthand,
};

Loading…
Cancel
Save