1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
21
27
30
33
37
40
43
46
47
50 {
54
55 if (
ctx->color_primaries >= 0 ||
56 ctx->transfer_characteristics >= 0 ||
57 ctx->matrix_coefficients >= 0) {
59
60 if (
ctx->color_primaries >= 0)
62 if (
ctx->transfer_characteristics >= 0)
64 if (
ctx->matrix_coefficients >= 0)
66 }
67
68 if (
ctx->color_range >= 0) {
73 "on RGB streams encoded in BT.709 sRGB.\n");
74 } else {
76 }
77 }
78
79 if (
ctx->chroma_sample_position >= 0) {
82 "can only be set for 4:2:0 streams.\n");
83 } else {
85 }
86 }
87
88 if (
ctx->tick_rate.num &&
ctx->tick_rate.den) {
89 int num, den;
90
92 UINT32_MAX > INT_MAX ? UINT32_MAX : INT_MAX);
93
97
98 if (
ctx->num_ticks_per_picture > 0) {
101 ctx->num_ticks_per_picture - 1;
102 }
103 }
104
105 return 0;
106 }
107
110 {
113
118 if (err < 0)
119 return err;
120 }
121 }
122
123 // If a Temporal Delimiter is present, it must be the first OBU.
130 if (err < 0) {
132 return err;
133 }
134 }
135
136 if (
ctx->delete_padding) {
140 }
141 }
142
143 return 0;
144 }
145
148 .fragment_name = "temporal unit",
149 .unit_name = "OBU",
151 };
152
154 {
156
159 };
160
162 }
163
164 #define OFFSET(x) offsetof(AV1MetadataContext, x)
165 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
169
170 { "color_primaries", "Set color primaries (section 6.4.2)",
172 { .i64 = -1 }, -1, 255,
FLAGS },
173 { "transfer_characteristics", "Set transfer characteristics (section 6.4.2)",
175 { .i64 = -1 }, -1, 255,
FLAGS },
176 { "matrix_coefficients", "Set matrix coefficients (section 6.4.2)",
178 { .i64 = -1 }, -1, 255,
FLAGS },
179
180 { "color_range", "Set color range flag (section 6.4.2)",
182 { .i64 = -1 }, -1, 1,
FLAGS, .unit =
"cr" },
184 { .i64 = 0 }, .flags =
FLAGS, .unit =
"cr" },
186 { .i64 = 1 }, .flags =
FLAGS, .unit =
"cr" },
187
188 { "chroma_sample_position", "Set chroma sample position (section 6.4.2)",
190 { .i64 = -1 }, -1, 3,
FLAGS, .unit =
"csp" },
197
198 { "tick_rate", "Set display tick rate (time_scale / num_units_in_display_tick)",
200 { .dbl = 0.0 }, 0, UINT_MAX,
FLAGS },
201 { "num_ticks_per_picture", "Set display ticks per picture for CFR streams",
203 { .i64 = -1 }, -1, INT_MAX,
FLAGS },
204
205 { "delete_padding", "Delete all Padding OBUs",
207 { .i64 = 0 }, 0, 1,
FLAGS},
208
210 };
211
217 };
218
221 };
222
224 .
p.
name =
"av1_metadata",
231 };