History

Merge commit 'a39c154049a2d0c4fb02a5c74f58d6986ec21cec'

* commit 'a39c154049a2d0c4fb02a5c74f58d6986ec21cec': vf_fieldorder: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/vf_fieldorder.c

Michael Niedermayer committed 13 years ago

Commit b8a1f8b2 parents 0c3d706 a39c1543 files · +22 −44Browse files

Unified · Split

3 files
  1. doc/filters.texi +6 −9
  2. libavfilter/avfilter.c +1 −0
  3. libavfilter/vf_fieldorder.c +15 −35
doc/filters.texi+6−9
@@ -3128,16 +3128,13 @@ field=type=bottom · 3127 unmodified lines
3128 3128
3129Transform the field order of the input video.3129Transform the field order of the input video.
3130 3130
3131This filter accepts the named option @option{order} which3131This filter accepts the following options:
3132specifies the required field order that the input interlaced video
3133will be transformed to. The option name can be omitted.
3134 3132
3135The option @option{order} can assume one of the following values:3133@table @option
3136@table @samp3134
3137@item bff3135@item order
3138output bottom field first3136Output field order. Valid values are @var{tff} for top field first or @var{bff}
3139@item tff3137for bottom field first.
3140output top field first
3141@end table3138@end table
3142 3139
3143Default value is @samp{tff}.3140Default value is @samp{tff}.
libavfilter/avfilter.c+1−0
@@ -665,6 +665,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque · 664 unmodified lines
665 !strcmp(filter->filter->name, "drawbox" ) ||665 !strcmp(filter->filter->name, "drawbox" ) ||
666 !strcmp(filter->filter->name, "drawtext" ) ||666 !strcmp(filter->filter->name, "drawtext" ) ||
667 !strcmp(filter->filter->name, "fade" ) ||667 !strcmp(filter->filter->name, "fade" ) ||
668 !strcmp(filter->filter->name, "fieldorder") ||
668 !strcmp(filter->filter->name, "format") ||669 !strcmp(filter->filter->name, "format") ||
669 !strcmp(filter->filter->name, "noformat") ||670 !strcmp(filter->filter->name, "noformat") ||
670 !strcmp(filter->filter->name, "resample")671 !strcmp(filter->filter->name, "resample")
libavfilter/vf_fieldorder.c+15−35
@@ -26,47 +26,19 @@ · 25 unmodified lines
26#include "libavutil/opt.h"26#include "libavutil/opt.h"
27#include "libavutil/imgutils.h"27#include "libavutil/imgutils.h"
28#include "libavutil/internal.h"28#include "libavutil/internal.h"
29#include "libavutil/opt.h"
29#include "libavutil/pixdesc.h"30#include "libavutil/pixdesc.h"
30#include "avfilter.h"31#include "avfilter.h"
31#include "formats.h"32#include "formats.h"
32#include "internal.h"33#include "internal.h"
33#include "video.h"34#include "video.h"
34 35
35enum FieldOrder {
36 ORDER_TFF,
37 ORDER_BFF,
38 ORDER_NB,
39};
40
41typedef struct {36typedef struct {
42 const AVClass *class;37 const AVClass *class;
43 enum FieldOrder order;38 int dst_tff; ///< output bff/tff
44 unsigned int dst_tff; ///< output bff/tff
45 int line_size[4]; ///< bytes of pixel data per line for each plane39 int line_size[4]; ///< bytes of pixel data per line for each plane
46} FieldOrderContext;40} FieldOrderContext;
47 41
48#define OFFSET(x) offsetof(FieldOrderContext, x)
49#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
50
51static const AVOption fieldorder_options[] = {
52 { "order", "set output field order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=ORDER_TFF}, 0, ORDER_NB-1, FLAGS, "order" },
53 { "tff", "set top field first", 0, AV_OPT_TYPE_CONST, {.i64=ORDER_TFF}, .flags=FLAGS, .unit="order" },
54 { "bff", "set bottom field first", 0, AV_OPT_TYPE_CONST, {.i64=ORDER_BFF}, .flags=FLAGS, .unit="order" },
55 { NULL }
56};
57
58AVFILTER_DEFINE_CLASS(fieldorder);
59
60static av_cold int init(AVFilterContext *ctx, const char *args)
61{
62 FieldOrderContext *fieldorder = ctx->priv;
63
64 fieldorder->dst_tff = fieldorder->order == ORDER_TFF;
65 av_log(ctx, AV_LOG_VERBOSE, "tff:%d\n", fieldorder->dst_tff);
66
67 return 0;
68}
69
70static int query_formats(AVFilterContext *ctx)42static int query_formats(AVFilterContext *ctx)
71{43{
72 AVFilterFormats *formats;44 AVFilterFormats *formats;
@@ -176,6 +148,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 103 unmodified lines
176 return ff_filter_frame(outlink, frame);148 return ff_filter_frame(outlink, frame);
177}149}
178 150
151#define OFFSET(x) offsetof(FieldOrderContext, x)
152#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
153
154static const AVOption fieldorder_options[] = {
155 { "order", "output field order", OFFSET(dst_tff), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, FLAGS, "order" },
156 { "bff", "bottom field first", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, .flags=FLAGS, .unit = "order" },
157 { "tff", "top field first", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .flags=FLAGS, .unit = "order" },
158 { NULL },
159};
160
161AVFILTER_DEFINE_CLASS(fieldorder);
162
179static const AVFilterPad avfilter_vf_fieldorder_inputs[] = {163static const AVFilterPad avfilter_vf_fieldorder_inputs[] = {
180 {164 {
181 .name = "default",165 .name = "default",
@@ -196,16 +180,12 @@ static const AVFilterPad avfilter_vf_fieldorder_outputs[] = { · 14 unmodified lines
196 { NULL }180 { NULL }
197};181};
198 182
199static const char *const shorthand[] = { "order", NULL };
200
201AVFilter avfilter_vf_fieldorder = {183AVFilter avfilter_vf_fieldorder = {
202 .name = "fieldorder",184 .name = "fieldorder",
203 .description = NULL_IF_CONFIG_SMALL("Set the field order."),185 .description = NULL_IF_CONFIG_SMALL("Set the field order."),
204 .init = init,
205 .priv_size = sizeof(FieldOrderContext),186 .priv_size = sizeof(FieldOrderContext),
187 .priv_class = &fieldorder_class,
206 .query_formats = query_formats,188 .query_formats = query_formats,
207 .inputs = avfilter_vf_fieldorder_inputs,189 .inputs = avfilter_vf_fieldorder_inputs,
208 .outputs = avfilter_vf_fieldorder_outputs,190 .outputs = avfilter_vf_fieldorder_outputs,
209 .priv_class = &fieldorder_class,
210 .shorthand = shorthand,
211};191};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t