Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (c) 2012 Stefano Sabatini | ||
3 | * | ||
4 | * This file is part of FFmpeg. | ||
5 | * | ||
6 | * FFmpeg is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * FFmpeg is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with FFmpeg; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include "config_components.h" | ||
22 | |||
23 | #include "libavutil/pixfmt.h" | ||
24 | #include "libavutil/opt.h" | ||
25 | #include "avfilter.h" | ||
26 | #include "formats.h" | ||
27 | #include "internal.h" | ||
28 | #include "video.h" | ||
29 | |||
30 | enum SetFieldMode { | ||
31 | MODE_AUTO = -1, | ||
32 | MODE_BFF, | ||
33 | MODE_TFF, | ||
34 | MODE_PROG, | ||
35 | }; | ||
36 | |||
37 | typedef struct SetParamsContext { | ||
38 | const AVClass *class; | ||
39 | int field_mode; | ||
40 | int color_range; | ||
41 | int color_primaries; | ||
42 | int color_trc; | ||
43 | int colorspace; | ||
44 | } SetParamsContext; | ||
45 | |||
46 | #define OFFSET(x) offsetof(SetParamsContext, x) | ||
47 | #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM | ||
48 | |||
49 | static const AVOption setparams_options[] = { | ||
50 | {"field_mode", "select interlace mode", OFFSET(field_mode), AV_OPT_TYPE_INT, {.i64=MODE_AUTO}, -1, MODE_PROG, FLAGS, .unit = "mode"}, | ||
51 | {"auto", "keep the same input field", 0, AV_OPT_TYPE_CONST, {.i64=MODE_AUTO}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"}, | ||
52 | {"bff", "mark as bottom-field-first", 0, AV_OPT_TYPE_CONST, {.i64=MODE_BFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"}, | ||
53 | {"tff", "mark as top-field-first", 0, AV_OPT_TYPE_CONST, {.i64=MODE_TFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"}, | ||
54 | {"prog", "mark as progressive", 0, AV_OPT_TYPE_CONST, {.i64=MODE_PROG}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"}, | ||
55 | |||
56 | {"range", "select color range", OFFSET(color_range), AV_OPT_TYPE_INT, {.i64=-1},-1, AVCOL_RANGE_NB-1, FLAGS, .unit = "range"}, | ||
57 | {"auto", "keep the same color range", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, FLAGS, .unit = "range"}, | ||
58 | {"unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, FLAGS, .unit = "range"}, | ||
59 | {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, FLAGS, .unit = "range"}, | ||
60 | {"limited", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
61 | {"tv", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
62 | {"mpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
63 | {"full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
64 | {"pc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
65 | {"jpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
66 | |||
67 | {"color_primaries", "select color primaries", OFFSET(color_primaries), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_PRI_NB-1, FLAGS, .unit = "color_primaries"}, | ||
68 | {"auto", "keep the same color primaries", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
69 | {"bt709", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT709}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
70 | {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_UNSPECIFIED}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
71 | {"bt470m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT470M}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
72 | {"bt470bg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT470BG}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
73 | {"smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE170M}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
74 | {"smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE240M}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
75 | {"film", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_FILM}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
76 | {"bt2020", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_BT2020}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
77 | {"smpte428", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE428}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
78 | {"smpte431", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE431}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
79 | {"smpte432", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_SMPTE432}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
80 | {"jedec-p22", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_JEDEC_P22}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
81 | {"ebu3213", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_PRI_EBU3213}, INT_MIN, INT_MAX, FLAGS, .unit = "color_primaries"}, | ||
82 | |||
83 | {"color_trc", "select color transfer", OFFSET(color_trc), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_TRC_NB-1, FLAGS, .unit = "color_trc"}, | ||
84 | {"auto", "keep the same color transfer", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
85 | {"bt709", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_BT709}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
86 | {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_UNSPECIFIED}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
87 | {"bt470m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_GAMMA22}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
88 | {"bt470bg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_GAMMA28}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
89 | {"smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE170M}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
90 | {"smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE240M}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
91 | {"linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_LINEAR}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
92 | {"log100", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_LOG}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
93 | {"log316", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_LOG_SQRT}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
94 | {"iec61966-2-4", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_IEC61966_2_4}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
95 | {"bt1361e", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_BT1361_ECG}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
96 | {"iec61966-2-1", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_IEC61966_2_1}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
97 | {"bt2020-10", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_BT2020_10}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
98 | {"bt2020-12", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_BT2020_12}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
99 | {"smpte2084", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE2084}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
100 | {"smpte428", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE428}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
101 | {"arib-std-b67", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_ARIB_STD_B67}, INT_MIN, INT_MAX, FLAGS, .unit = "color_trc"}, | ||
102 | |||
103 | {"colorspace", "select colorspace", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_SPC_NB-1, FLAGS, .unit = "colorspace"}, | ||
104 | {"auto", "keep the same colorspace", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
105 | {"gbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_RGB}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
106 | {"bt709", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT709}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
107 | {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_UNSPECIFIED}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
108 | {"fcc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_FCC}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
109 | {"bt470bg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT470BG}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
110 | {"smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE170M}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
111 | {"smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE240M}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
112 | {"ycgco", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
113 | {"ycgco-re", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO_RE}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
114 | {"ycgco-ro", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO_RO}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
115 | {"bt2020nc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_NCL}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
116 | {"bt2020c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_CL}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
117 | {"smpte2085", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE2085}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
118 | {"chroma-derived-nc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_NCL},INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
119 | {"chroma-derived-c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_CL}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
120 | {"ictcp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_ICTCP}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
121 | {"ipt-c2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_IPT_C2}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | ||
122 | {NULL} | ||
123 | }; | ||
124 | |||
125 | AVFILTER_DEFINE_CLASS(setparams); | ||
126 | |||
127 | ✗ | static int query_formats(AVFilterContext *ctx) | |
128 | { | ||
129 | ✗ | SetParamsContext *s = ctx->priv; | |
130 | ✗ | AVFilterLink *outlink = ctx->outputs[0]; | |
131 | int ret; | ||
132 | |||
133 | ✗ | if (s->colorspace >= 0) { | |
134 | ✗ | ret = ff_formats_ref(ff_make_formats_list_singleton(s->colorspace), | |
135 | &outlink->incfg.color_spaces); | ||
136 | ✗ | if (ret < 0) | |
137 | ✗ | return ret; | |
138 | } | ||
139 | |||
140 | ✗ | if (s->color_range >= 0) { | |
141 | ✗ | ret = ff_formats_ref(ff_make_formats_list_singleton(s->color_range), | |
142 | &outlink->incfg.color_ranges); | ||
143 | ✗ | if (ret < 0) | |
144 | ✗ | return ret; | |
145 | } | ||
146 | |||
147 | ✗ | return 0; | |
148 | } | ||
149 | |||
150 | 251 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) | |
151 | { | ||
152 | 251 | AVFilterContext *ctx = inlink->dst; | |
153 | 251 | SetParamsContext *s = ctx->priv; | |
154 | |||
155 | /* set field */ | ||
156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 251 times.
|
251 | if (s->field_mode == MODE_PROG) { |
157 | #if FF_API_INTERLACED_FRAME | ||
158 | FF_DISABLE_DEPRECATION_WARNINGS | ||
159 | ✗ | frame->interlaced_frame = 0; | |
160 | FF_ENABLE_DEPRECATION_WARNINGS | ||
161 | #endif | ||
162 | ✗ | frame->flags &= ~AV_FRAME_FLAG_INTERLACED; | |
163 |
1/2✓ Branch 0 taken 251 times.
✗ Branch 1 not taken.
|
251 | } else if (s->field_mode != MODE_AUTO) { |
164 | #if FF_API_INTERLACED_FRAME | ||
165 | FF_DISABLE_DEPRECATION_WARNINGS | ||
166 | 251 | frame->interlaced_frame = 1; | |
167 | 251 | frame->top_field_first = s->field_mode; | |
168 | FF_ENABLE_DEPRECATION_WARNINGS | ||
169 | #endif | ||
170 | 251 | frame->flags |= AV_FRAME_FLAG_INTERLACED; | |
171 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 225 times.
|
251 | if (s->field_mode) |
172 | 26 | frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; | |
173 | else | ||
174 | 225 | frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; | |
175 | } | ||
176 | |||
177 | /* set range */ | ||
178 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 251 times.
|
251 | if (s->color_range >= 0) |
179 | ✗ | frame->color_range = s->color_range; | |
180 | |||
181 | /* set color prim, trc, space */ | ||
182 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 251 times.
|
251 | if (s->color_primaries >= 0) |
183 | ✗ | frame->color_primaries = s->color_primaries; | |
184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 251 times.
|
251 | if (s->color_trc >= 0) |
185 | ✗ | frame->color_trc = s->color_trc; | |
186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 251 times.
|
251 | if (s->colorspace >= 0) |
187 | ✗ | frame->colorspace = s->colorspace; | |
188 | 251 | return ff_filter_frame(ctx->outputs[0], frame); | |
189 | } | ||
190 | |||
191 | static const AVFilterPad inputs[] = { | ||
192 | { | ||
193 | .name = "default", | ||
194 | .type = AVMEDIA_TYPE_VIDEO, | ||
195 | .filter_frame = filter_frame, | ||
196 | }, | ||
197 | }; | ||
198 | |||
199 | const AVFilter ff_vf_setparams = { | ||
200 | .name = "setparams", | ||
201 | .description = NULL_IF_CONFIG_SMALL("Force field, or color property for the output video frame."), | ||
202 | .priv_size = sizeof(SetParamsContext), | ||
203 | .priv_class = &setparams_class, | ||
204 | .flags = AVFILTER_FLAG_METADATA_ONLY, | ||
205 | FILTER_INPUTS(inputs), | ||
206 | FILTER_OUTPUTS(ff_video_default_filterpad), | ||
207 | FILTER_QUERY_FUNC(query_formats), | ||
208 | }; | ||
209 | |||
210 | #if CONFIG_SETRANGE_FILTER | ||
211 | |||
212 | static const AVOption setrange_options[] = { | ||
213 | {"range", "select color range", OFFSET(color_range), AV_OPT_TYPE_INT, {.i64=-1},-1, AVCOL_RANGE_NB-1, FLAGS, .unit = "range"}, | ||
214 | {"auto", "keep the same color range", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, FLAGS, .unit = "range"}, | ||
215 | {"unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, FLAGS, .unit = "range"}, | ||
216 | {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, FLAGS, .unit = "range"}, | ||
217 | {"limited", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
218 | {"tv", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
219 | {"mpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_MPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
220 | {"full", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
221 | {"pc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
222 | {"jpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_JPEG}, 0, 0, FLAGS, .unit = "range"}, | ||
223 | {NULL} | ||
224 | }; | ||
225 | |||
226 | AVFILTER_DEFINE_CLASS(setrange); | ||
227 | |||
228 | ✗ | static av_cold int init_setrange(AVFilterContext *ctx) | |
229 | { | ||
230 | ✗ | SetParamsContext *s = ctx->priv; | |
231 | |||
232 | ✗ | s->field_mode = MODE_AUTO;/* set field mode to auto */ | |
233 | ✗ | s->color_primaries = -1; | |
234 | ✗ | s->color_trc = -1; | |
235 | ✗ | s->colorspace = -1; | |
236 | ✗ | return 0; | |
237 | } | ||
238 | |||
239 | const AVFilter ff_vf_setrange = { | ||
240 | .name = "setrange", | ||
241 | .description = NULL_IF_CONFIG_SMALL("Force color range for the output video frame."), | ||
242 | .priv_size = sizeof(SetParamsContext), | ||
243 | .init = init_setrange, | ||
244 | .priv_class = &setrange_class, | ||
245 | .flags = AVFILTER_FLAG_METADATA_ONLY, | ||
246 | FILTER_INPUTS(inputs), | ||
247 | FILTER_OUTPUTS(ff_video_default_filterpad), | ||
248 | FILTER_QUERY_FUNC(query_formats), | ||
249 | }; | ||
250 | #endif /* CONFIG_SETRANGE_FILTER */ | ||
251 | |||
252 | #if CONFIG_SETFIELD_FILTER | ||
253 | static const AVOption setfield_options[] = { | ||
254 | {"mode", "select interlace mode", OFFSET(field_mode), AV_OPT_TYPE_INT, {.i64=MODE_AUTO}, -1, MODE_PROG, FLAGS, .unit = "mode"}, | ||
255 | {"auto", "keep the same input field", 0, AV_OPT_TYPE_CONST, {.i64=MODE_AUTO}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"}, | ||
256 | {"bff", "mark as bottom-field-first", 0, AV_OPT_TYPE_CONST, {.i64=MODE_BFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"}, | ||
257 | {"tff", "mark as top-field-first", 0, AV_OPT_TYPE_CONST, {.i64=MODE_TFF}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"}, | ||
258 | {"prog", "mark as progressive", 0, AV_OPT_TYPE_CONST, {.i64=MODE_PROG}, INT_MIN, INT_MAX, FLAGS, .unit = "mode"}, | ||
259 | {NULL} | ||
260 | }; | ||
261 | |||
262 | AVFILTER_DEFINE_CLASS(setfield); | ||
263 | |||
264 | 302 | static av_cold int init_setfield(AVFilterContext *ctx) | |
265 | { | ||
266 | 302 | SetParamsContext *s = ctx->priv; | |
267 | |||
268 | 302 | s->color_range = -1;/* set range mode to auto */ | |
269 | 302 | s->color_primaries = -1; | |
270 | 302 | s->color_trc = -1; | |
271 | 302 | s->colorspace = -1; | |
272 | 302 | return 0; | |
273 | } | ||
274 | |||
275 | const AVFilter ff_vf_setfield = { | ||
276 | .name = "setfield", | ||
277 | .description = NULL_IF_CONFIG_SMALL("Force field for the output video frame."), | ||
278 | .priv_size = sizeof(SetParamsContext), | ||
279 | .init = init_setfield, | ||
280 | .priv_class = &setfield_class, | ||
281 | .flags = AVFILTER_FLAG_METADATA_ONLY, | ||
282 | FILTER_INPUTS(inputs), | ||
283 | FILTER_OUTPUTS(ff_video_default_filterpad), | ||
284 | }; | ||
285 | #endif /* CONFIG_SETFIELD_FILTER */ | ||
286 |