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
31283128
31293129 Transform the field order of the input video.
31303130
3131−This filter accepts the named option @option{order} which
3132−specifies the required field order that the input interlaced video
3133−will be transformed to. The option name can be omitted.
3131+This filter accepts the following options:
31343132
3135−The option @option{order} can assume one of the following values:
3136−@table @samp
3137−@item bff
3138−output bottom field first
3139−@item tff
3140−output top field first
3133+@table @option
3134+
3135+@item order
3136+Output field order. Valid values are @var{tff} for top field first or @var{bff}
3137+for bottom field first.
31413138 @end table
31423139
31433140 Default 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
665665 !strcmp(filter->filter->name, "drawbox" ) ||
666666 !strcmp(filter->filter->name, "drawtext" ) ||
667667 !strcmp(filter->filter->name, "fade" ) ||
668+ !strcmp(filter->filter->name, "fieldorder") ||
668669 !strcmp(filter->filter->name, "format") ||
669670 !strcmp(filter->filter->name, "noformat") ||
670671 !strcmp(filter->filter->name, "resample")
libavfilter/vf_fieldorder.c+15−35
@@ -26,47 +26,19 @@ · 25 unmodified lines
2626 #include "libavutil/opt.h"
2727 #include "libavutil/imgutils.h"
2828 #include "libavutil/internal.h"
29+#include "libavutil/opt.h"
2930 #include "libavutil/pixdesc.h"
3031 #include "avfilter.h"
3132 #include "formats.h"
3233 #include "internal.h"
3334 #include "video.h"
3435
35−enum FieldOrder {
36− ORDER_TFF,
37− ORDER_BFF,
38− ORDER_NB,
39−};
40−
4136 typedef struct {
4237 const AVClass *class;
43− enum FieldOrder order;
44− unsigned int dst_tff; ///< output bff/tff
38+ int dst_tff; ///< output bff/tff
4539 int line_size[4]; ///< bytes of pixel data per line for each plane
4640 } FieldOrderContext;
4741
48−#define OFFSET(x) offsetof(FieldOrderContext, x)
49−#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
50−
51−static 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−
58−AVFILTER_DEFINE_CLASS(fieldorder);
59−
60−static 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−
7042 static int query_formats(AVFilterContext *ctx)
7143 {
7244 AVFilterFormats *formats;
@@ -176,6 +148,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 103 unmodified lines
176148 return ff_filter_frame(outlink, frame);
177149 }
178150
151+#define OFFSET(x) offsetof(FieldOrderContext, x)
152+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
153+
154+static 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+
161+AVFILTER_DEFINE_CLASS(fieldorder);
162+
179163 static const AVFilterPad avfilter_vf_fieldorder_inputs[] = {
180164 {
181165 .name = "default",
@@ -196,16 +180,12 @@ static const AVFilterPad avfilter_vf_fieldorder_outputs[] = { · 14 unmodified lines
196180 { NULL }
197181 };
198182
199−static const char *const shorthand[] = { "order", NULL };
200−
201183 AVFilter avfilter_vf_fieldorder = {
202184 .name = "fieldorder",
203185 .description = NULL_IF_CONFIG_SMALL("Set the field order."),
204− .init = init,
205186 .priv_size = sizeof(FieldOrderContext),
187+ .priv_class = &fieldorder_class,
206188 .query_formats = query_formats,
207189 .inputs = avfilter_vf_fieldorder_inputs,
208190 .outputs = avfilter_vf_fieldorder_outputs,
209− .priv_class = &fieldorder_class,
210− .shorthand = shorthand,
211191 };

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