1 | use std::error; |
2 | use std::ffi::{CStr, CString, NulError}; |
3 | use std::fmt; |
4 | use std::str::{from_utf8_unchecked, FromStr}; |
5 | |
6 | use ffi::AVPixelFormat::*; |
7 | use ffi::*; |
8 | |
9 | #[derive (Eq, PartialEq, Copy, Clone, Debug)] |
10 | pub enum Pixel { |
11 | None, |
12 | |
13 | YUV420P, |
14 | YUYV422, |
15 | RGB24, |
16 | BGR24, |
17 | YUV422P, |
18 | YUV444P, |
19 | YUV410P, |
20 | YUV411P, |
21 | GRAY8, |
22 | MonoWhite, |
23 | MonoBlack, |
24 | PAL8, |
25 | YUVJ420P, |
26 | YUVJ422P, |
27 | YUVJ444P, |
28 | #[cfg (all(feature = "ff_api_xvmc" , not(feature = "ffmpeg_5_0" )))] |
29 | XVMC_MPEG2_MC, |
30 | #[cfg (all(feature = "ff_api_xvmc" , not(feature = "ffmpeg_5_0" )))] |
31 | XVMC_MPEG2_IDCT, |
32 | UYVY422, |
33 | UYYVYY411, |
34 | BGR8, |
35 | BGR4, |
36 | BGR4_BYTE, |
37 | RGB8, |
38 | RGB4, |
39 | RGB4_BYTE, |
40 | NV12, |
41 | NV21, |
42 | |
43 | ARGB, |
44 | RGBA, |
45 | ABGR, |
46 | BGRA, |
47 | |
48 | GRAY16BE, |
49 | GRAY16LE, |
50 | YUV440P, |
51 | YUVJ440P, |
52 | YUVA420P, |
53 | #[cfg (feature = "ff_api_vdpau" )] |
54 | VDPAU_H264, |
55 | #[cfg (feature = "ff_api_vdpau" )] |
56 | VDPAU_MPEG1, |
57 | #[cfg (feature = "ff_api_vdpau" )] |
58 | VDPAU_MPEG2, |
59 | #[cfg (feature = "ff_api_vdpau" )] |
60 | VDPAU_WMV3, |
61 | #[cfg (feature = "ff_api_vdpau" )] |
62 | VDPAU_VC1, |
63 | RGB48BE, |
64 | RGB48LE, |
65 | |
66 | RGB565BE, |
67 | RGB565LE, |
68 | RGB555BE, |
69 | RGB555LE, |
70 | |
71 | BGR565BE, |
72 | BGR565LE, |
73 | BGR555BE, |
74 | BGR555LE, |
75 | |
76 | #[cfg (all(feature = "ff_api_vaapi" , not(feature = "ffmpeg_5_0" )))] |
77 | VAAPI_MOCO, |
78 | #[cfg (all(feature = "ff_api_vaapi" , not(feature = "ffmpeg_5_0" )))] |
79 | VAAPI_IDCT, |
80 | #[cfg (all(feature = "ff_api_vaapi" , not(feature = "ffmpeg_5_0" )))] |
81 | VAAPI_VLD, |
82 | #[cfg (any(not(feature = "ff_api_vaapi" ), feature = "ffmpeg_5_0" ))] |
83 | VAAPI, |
84 | |
85 | YUV420P16LE, |
86 | YUV420P16BE, |
87 | YUV422P16LE, |
88 | YUV422P16BE, |
89 | YUV444P16LE, |
90 | YUV444P16BE, |
91 | #[cfg (feature = "ff_api_vdpau" )] |
92 | VDPAU_MPEG4, |
93 | DXVA2_VLD, |
94 | |
95 | RGB444LE, |
96 | RGB444BE, |
97 | BGR444LE, |
98 | BGR444BE, |
99 | YA8, |
100 | |
101 | BGR48BE, |
102 | BGR48LE, |
103 | |
104 | YUV420P9BE, |
105 | YUV420P9LE, |
106 | YUV420P10BE, |
107 | YUV420P10LE, |
108 | YUV422P10BE, |
109 | YUV422P10LE, |
110 | YUV444P9BE, |
111 | YUV444P9LE, |
112 | YUV444P10BE, |
113 | YUV444P10LE, |
114 | YUV422P9BE, |
115 | YUV422P9LE, |
116 | #[cfg (not(feature = "ffmpeg_4_0" ))] |
117 | VDA_VLD, |
118 | |
119 | GBRP, |
120 | GBRP9BE, |
121 | GBRP9LE, |
122 | GBRP10BE, |
123 | GBRP10LE, |
124 | GBRP16BE, |
125 | GBRP16LE, |
126 | |
127 | YUVA420P9BE, |
128 | YUVA420P9LE, |
129 | YUVA422P9BE, |
130 | YUVA422P9LE, |
131 | YUVA444P9BE, |
132 | YUVA444P9LE, |
133 | YUVA420P10BE, |
134 | YUVA420P10LE, |
135 | YUVA422P10BE, |
136 | YUVA422P10LE, |
137 | YUVA444P10BE, |
138 | YUVA444P10LE, |
139 | YUVA420P16BE, |
140 | YUVA420P16LE, |
141 | YUVA422P16BE, |
142 | YUVA422P16LE, |
143 | YUVA444P16BE, |
144 | YUVA444P16LE, |
145 | |
146 | VDPAU, |
147 | |
148 | XYZ12LE, |
149 | XYZ12BE, |
150 | NV16, |
151 | NV20LE, |
152 | NV20BE, |
153 | |
154 | RGBA64BE, |
155 | RGBA64LE, |
156 | BGRA64BE, |
157 | BGRA64LE, |
158 | |
159 | YVYU422, |
160 | |
161 | #[cfg (not(feature = "ffmpeg_4_0" ))] |
162 | VDA, |
163 | |
164 | YA16BE, |
165 | YA16LE, |
166 | |
167 | QSV, |
168 | MMAL, |
169 | |
170 | D3D11VA_VLD, |
171 | |
172 | CUDA, |
173 | |
174 | ZRGB, |
175 | RGBZ, |
176 | ZBGR, |
177 | BGRZ, |
178 | YUVA444P, |
179 | YUVA422P, |
180 | |
181 | YUV420P12BE, |
182 | YUV420P12LE, |
183 | YUV420P14BE, |
184 | YUV420P14LE, |
185 | YUV422P12BE, |
186 | YUV422P12LE, |
187 | YUV422P14BE, |
188 | YUV422P14LE, |
189 | YUV444P12BE, |
190 | YUV444P12LE, |
191 | YUV444P14BE, |
192 | YUV444P14LE, |
193 | GBRP12BE, |
194 | GBRP12LE, |
195 | GBRP14BE, |
196 | GBRP14LE, |
197 | GBRAP, |
198 | GBRAP16BE, |
199 | GBRAP16LE, |
200 | YUVJ411P, |
201 | |
202 | BAYER_BGGR8, |
203 | BAYER_RGGB8, |
204 | BAYER_GBRG8, |
205 | BAYER_GRBG8, |
206 | BAYER_BGGR16LE, |
207 | BAYER_BGGR16BE, |
208 | BAYER_RGGB16LE, |
209 | BAYER_RGGB16BE, |
210 | BAYER_GBRG16LE, |
211 | BAYER_GBRG16BE, |
212 | BAYER_GRBG16LE, |
213 | BAYER_GRBG16BE, |
214 | |
215 | YUV440P10LE, |
216 | YUV440P10BE, |
217 | YUV440P12LE, |
218 | YUV440P12BE, |
219 | AYUV64LE, |
220 | AYUV64BE, |
221 | |
222 | VIDEOTOOLBOX, |
223 | |
224 | // --- defaults |
225 | #[cfg (feature = "ffmpeg_4_0" )] |
226 | XVMC, |
227 | |
228 | RGB32, |
229 | RGB32_1, |
230 | BGR32, |
231 | BGR32_1, |
232 | ZRGB32, |
233 | ZBGR32, |
234 | |
235 | GRAY16, |
236 | YA16, |
237 | RGB48, |
238 | RGB565, |
239 | RGB555, |
240 | RGB444, |
241 | BGR48, |
242 | BGR565, |
243 | BGR555, |
244 | BGR444, |
245 | |
246 | YUV420P9, |
247 | YUV422P9, |
248 | YUV444P9, |
249 | YUV420P10, |
250 | YUV422P10, |
251 | YUV440P10, |
252 | YUV444P10, |
253 | YUV420P12, |
254 | YUV422P12, |
255 | YUV440P12, |
256 | YUV444P12, |
257 | YUV420P14, |
258 | YUV422P14, |
259 | YUV444P14, |
260 | YUV420P16, |
261 | YUV422P16, |
262 | YUV444P16, |
263 | |
264 | GBRP9, |
265 | GBRP10, |
266 | GBRP12, |
267 | GBRP14, |
268 | GBRP16, |
269 | GBRAP16, |
270 | |
271 | BAYER_BGGR16, |
272 | BAYER_RGGB16, |
273 | BAYER_GBRG16, |
274 | BAYER_GRBG16, |
275 | |
276 | YUVA420P9, |
277 | YUVA422P9, |
278 | YUVA444P9, |
279 | YUVA420P10, |
280 | YUVA422P10, |
281 | YUVA444P10, |
282 | YUVA420P16, |
283 | YUVA422P16, |
284 | YUVA444P16, |
285 | |
286 | XYZ12, |
287 | NV20, |
288 | AYUV64, |
289 | |
290 | P010LE, |
291 | P010BE, |
292 | GBRAP12BE, |
293 | GBRAP12LE, |
294 | GBRAP10LE, |
295 | GBRAP10BE, |
296 | MEDIACODEC, |
297 | GRAY12BE, |
298 | GRAY12LE, |
299 | GRAY10BE, |
300 | GRAY10LE, |
301 | P016LE, |
302 | P016BE, |
303 | |
304 | D3D11, |
305 | GRAY9BE, |
306 | GRAY9LE, |
307 | GBRPF32BE, |
308 | GBRPF32LE, |
309 | GBRAPF32BE, |
310 | GBRAPF32LE, |
311 | DRM_PRIME, |
312 | |
313 | #[cfg (feature = "ffmpeg_4_0" )] |
314 | OPENCL, |
315 | |
316 | #[cfg (feature = "ffmpeg_4_1" )] |
317 | GRAY14BE, |
318 | #[cfg (feature = "ffmpeg_4_1" )] |
319 | GRAY14LE, |
320 | #[cfg (feature = "ffmpeg_4_1" )] |
321 | GRAYF32BE, |
322 | #[cfg (feature = "ffmpeg_4_1" )] |
323 | GRAYF32LE, |
324 | |
325 | #[cfg (feature = "ffmpeg_4_2" )] |
326 | YUVA422P12BE, |
327 | #[cfg (feature = "ffmpeg_4_2" )] |
328 | YUVA422P12LE, |
329 | #[cfg (feature = "ffmpeg_4_2" )] |
330 | YUVA444P12BE, |
331 | #[cfg (feature = "ffmpeg_4_2" )] |
332 | YUVA444P12LE, |
333 | #[cfg (feature = "ffmpeg_4_2" )] |
334 | NV24, |
335 | #[cfg (feature = "ffmpeg_4_2" )] |
336 | NV42, |
337 | |
338 | #[cfg (feature = "ffmpeg_4_3" )] |
339 | VULKAN, |
340 | #[cfg (feature = "ffmpeg_4_3" )] |
341 | Y210BE, |
342 | #[cfg (feature = "ffmpeg_4_3" )] |
343 | Y210LE, |
344 | |
345 | #[cfg (feature = "ffmpeg_4_4" )] |
346 | X2RGB10LE, |
347 | #[cfg (feature = "ffmpeg_4_4" )] |
348 | X2RGB10BE, |
349 | |
350 | #[cfg (feature = "ffmpeg_5_0" )] |
351 | X2BGR10LE, |
352 | #[cfg (feature = "ffmpeg_5_0" )] |
353 | X2BGR10BE, |
354 | #[cfg (feature = "ffmpeg_5_0" )] |
355 | P210BE, |
356 | #[cfg (feature = "ffmpeg_5_0" )] |
357 | P210LE, |
358 | #[cfg (feature = "ffmpeg_5_0" )] |
359 | P410BE, |
360 | #[cfg (feature = "ffmpeg_5_0" )] |
361 | P410LE, |
362 | #[cfg (feature = "ffmpeg_5_0" )] |
363 | P216BE, |
364 | #[cfg (feature = "ffmpeg_5_0" )] |
365 | P216LE, |
366 | #[cfg (feature = "ffmpeg_5_0" )] |
367 | P416BE, |
368 | #[cfg (feature = "ffmpeg_5_0" )] |
369 | P416LE, |
370 | |
371 | #[cfg (feature = "ffmpeg_6_0" )] |
372 | VUYA, |
373 | #[cfg (feature = "ffmpeg_6_0" )] |
374 | RGBAF16BE, |
375 | #[cfg (feature = "ffmpeg_6_0" )] |
376 | RGBAF16LE, |
377 | #[cfg (feature = "ffmpeg_6_0" )] |
378 | VUYX, |
379 | #[cfg (feature = "ffmpeg_6_0" )] |
380 | P012LE, |
381 | #[cfg (feature = "ffmpeg_6_0" )] |
382 | P012BE, |
383 | #[cfg (feature = "ffmpeg_6_0" )] |
384 | Y212BE, |
385 | #[cfg (feature = "ffmpeg_6_0" )] |
386 | Y212LE, |
387 | #[cfg (feature = "ffmpeg_6_0" )] |
388 | XV30BE, |
389 | #[cfg (feature = "ffmpeg_6_0" )] |
390 | XV30LE, |
391 | #[cfg (feature = "ffmpeg_6_0" )] |
392 | XV36BE, |
393 | #[cfg (feature = "ffmpeg_6_0" )] |
394 | XV36LE, |
395 | #[cfg (feature = "ffmpeg_6_0" )] |
396 | RGBF32BE, |
397 | #[cfg (feature = "ffmpeg_6_0" )] |
398 | RGBF32LE, |
399 | #[cfg (feature = "ffmpeg_6_0" )] |
400 | RGBAF32BE, |
401 | #[cfg (feature = "ffmpeg_6_0" )] |
402 | RGBAF32LE, |
403 | |
404 | #[cfg (feature = "ffmpeg_6_1" )] |
405 | P212BE, |
406 | #[cfg (feature = "ffmpeg_6_1" )] |
407 | P212LE, |
408 | #[cfg (feature = "ffmpeg_6_1" )] |
409 | P412BE, |
410 | #[cfg (feature = "ffmpeg_6_1" )] |
411 | P412LE, |
412 | #[cfg (feature = "ffmpeg_6_1" )] |
413 | GBRAP14BE, |
414 | #[cfg (feature = "ffmpeg_6_1" )] |
415 | GBRAP14LE, |
416 | |
417 | #[cfg (feature = "rpi" )] |
418 | SAND128, |
419 | #[cfg (feature = "rpi" )] |
420 | SAND64_10, |
421 | #[cfg (feature = "rpi" )] |
422 | SAND64_16, |
423 | #[cfg (feature = "rpi" )] |
424 | RPI4_8, |
425 | #[cfg (feature = "rpi" )] |
426 | RPI4_10, |
427 | } |
428 | |
429 | #[derive (Clone, Copy, PartialEq, Eq)] |
430 | pub struct Descriptor { |
431 | ptr: *const AVPixFmtDescriptor, |
432 | } |
433 | |
434 | unsafe impl Send for Descriptor {} |
435 | unsafe impl Sync for Descriptor {} |
436 | |
437 | impl Pixel { |
438 | pub const Y400A: Pixel = Pixel::YA8; |
439 | pub const GRAY8A: Pixel = Pixel::YA8; |
440 | pub const GBR24P: Pixel = Pixel::GBRP; |
441 | #[cfg (all(feature = "ff_api_xvmc" , not(feature = "ffmpeg_5_0" )))] |
442 | pub const XVMC: Pixel = Pixel::XVMC_MPEG2_IDCT; |
443 | |
444 | pub fn descriptor(self) -> Option<Descriptor> { |
445 | unsafe { |
446 | let ptr = av_pix_fmt_desc_get(self.into()); |
447 | |
448 | ptr.as_ref().map(|ptr: *const {unknown}| Descriptor { ptr }) |
449 | } |
450 | } |
451 | } |
452 | |
453 | impl Descriptor { |
454 | pub fn as_ptr(self) -> *const AVPixFmtDescriptor { |
455 | self.ptr |
456 | } |
457 | |
458 | pub fn name(self) -> &'static str { |
459 | unsafe { from_utf8_unchecked(CStr::from_ptr((*self.as_ptr()).name).to_bytes()) } |
460 | } |
461 | |
462 | pub fn nb_components(self) -> u8 { |
463 | unsafe { (*self.as_ptr()).nb_components } |
464 | } |
465 | |
466 | pub fn log2_chroma_w(self) -> u8 { |
467 | unsafe { (*self.as_ptr()).log2_chroma_w } |
468 | } |
469 | |
470 | pub fn log2_chroma_h(self) -> u8 { |
471 | unsafe { (*self.as_ptr()).log2_chroma_h } |
472 | } |
473 | } |
474 | |
475 | impl From<AVPixelFormat> for Pixel { |
476 | #[inline ] |
477 | fn from(value: AVPixelFormat) -> Self { |
478 | match value { |
479 | AV_PIX_FMT_NONE => Pixel::None, |
480 | |
481 | AV_PIX_FMT_YUV420P => Pixel::YUV420P, |
482 | AV_PIX_FMT_YUYV422 => Pixel::YUYV422, |
483 | AV_PIX_FMT_RGB24 => Pixel::RGB24, |
484 | AV_PIX_FMT_BGR24 => Pixel::BGR24, |
485 | AV_PIX_FMT_YUV422P => Pixel::YUV422P, |
486 | AV_PIX_FMT_YUV444P => Pixel::YUV444P, |
487 | AV_PIX_FMT_YUV410P => Pixel::YUV410P, |
488 | AV_PIX_FMT_YUV411P => Pixel::YUV411P, |
489 | AV_PIX_FMT_GRAY8 => Pixel::GRAY8, |
490 | AV_PIX_FMT_MONOWHITE => Pixel::MonoWhite, |
491 | AV_PIX_FMT_MONOBLACK => Pixel::MonoBlack, |
492 | AV_PIX_FMT_PAL8 => Pixel::PAL8, |
493 | AV_PIX_FMT_YUVJ420P => Pixel::YUVJ420P, |
494 | AV_PIX_FMT_YUVJ422P => Pixel::YUVJ422P, |
495 | AV_PIX_FMT_YUVJ444P => Pixel::YUVJ444P, |
496 | #[cfg (feature = "ffmpeg_4_0" )] |
497 | AV_PIX_FMT_XVMC => Pixel::XVMC, |
498 | #[cfg (all(feature = "ff_api_xvmc" , not(feature = "ffmpeg_5_0" )))] |
499 | AV_PIX_FMT_XVMC_MPEG2_MC => Pixel::XVMC_MPEG2_MC, |
500 | #[cfg (all(feature = "ff_api_xvmc" , not(feature = "ffmpeg_5_0" )))] |
501 | AV_PIX_FMT_XVMC_MPEG2_IDCT => Pixel::XVMC_MPEG2_IDCT, |
502 | AV_PIX_FMT_UYVY422 => Pixel::UYVY422, |
503 | AV_PIX_FMT_UYYVYY411 => Pixel::UYYVYY411, |
504 | AV_PIX_FMT_BGR8 => Pixel::BGR8, |
505 | AV_PIX_FMT_BGR4 => Pixel::BGR4, |
506 | AV_PIX_FMT_BGR4_BYTE => Pixel::BGR4_BYTE, |
507 | AV_PIX_FMT_RGB8 => Pixel::RGB8, |
508 | AV_PIX_FMT_RGB4 => Pixel::RGB4, |
509 | AV_PIX_FMT_RGB4_BYTE => Pixel::RGB4_BYTE, |
510 | AV_PIX_FMT_NV12 => Pixel::NV12, |
511 | AV_PIX_FMT_NV21 => Pixel::NV21, |
512 | |
513 | AV_PIX_FMT_ARGB => Pixel::ARGB, |
514 | AV_PIX_FMT_RGBA => Pixel::RGBA, |
515 | AV_PIX_FMT_ABGR => Pixel::ABGR, |
516 | AV_PIX_FMT_BGRA => Pixel::BGRA, |
517 | |
518 | AV_PIX_FMT_GRAY16BE => Pixel::GRAY16BE, |
519 | AV_PIX_FMT_GRAY16LE => Pixel::GRAY16LE, |
520 | AV_PIX_FMT_YUV440P => Pixel::YUV440P, |
521 | AV_PIX_FMT_YUVJ440P => Pixel::YUVJ440P, |
522 | AV_PIX_FMT_YUVA420P => Pixel::YUVA420P, |
523 | #[cfg (feature = "ff_api_vdpau" )] |
524 | AV_PIX_FMT_VDPAU_H264 => Pixel::VDPAU_H264, |
525 | #[cfg (feature = "ff_api_vdpau" )] |
526 | AV_PIX_FMT_VDPAU_MPEG1 => Pixel::VDPAU_MPEG1, |
527 | #[cfg (feature = "ff_api_vdpau" )] |
528 | AV_PIX_FMT_VDPAU_MPEG2 => Pixel::VDPAU_MPEG2, |
529 | #[cfg (feature = "ff_api_vdpau" )] |
530 | AV_PIX_FMT_VDPAU_WMV3 => Pixel::VDPAU_WMV3, |
531 | #[cfg (feature = "ff_api_vdpau" )] |
532 | AV_PIX_FMT_VDPAU_VC1 => Pixel::VDPAU_VC1, |
533 | AV_PIX_FMT_RGB48BE => Pixel::RGB48BE, |
534 | AV_PIX_FMT_RGB48LE => Pixel::RGB48LE, |
535 | |
536 | AV_PIX_FMT_RGB565BE => Pixel::RGB565BE, |
537 | AV_PIX_FMT_RGB565LE => Pixel::RGB565LE, |
538 | AV_PIX_FMT_RGB555BE => Pixel::RGB555BE, |
539 | AV_PIX_FMT_RGB555LE => Pixel::RGB555LE, |
540 | |
541 | AV_PIX_FMT_BGR565BE => Pixel::BGR565BE, |
542 | AV_PIX_FMT_BGR565LE => Pixel::BGR565LE, |
543 | AV_PIX_FMT_BGR555BE => Pixel::BGR555BE, |
544 | AV_PIX_FMT_BGR555LE => Pixel::BGR555LE, |
545 | |
546 | #[cfg (all(feature = "ff_api_vaapi" , not(feature = "ffmpeg_5_0" )))] |
547 | AV_PIX_FMT_VAAPI_MOCO => Pixel::VAAPI_MOCO, |
548 | #[cfg (all(feature = "ff_api_vaapi" , not(feature = "ffmpeg_5_0" )))] |
549 | AV_PIX_FMT_VAAPI_IDCT => Pixel::VAAPI_IDCT, |
550 | #[cfg (all(feature = "ff_api_vaapi" , not(feature = "ffmpeg_5_0" )))] |
551 | AV_PIX_FMT_VAAPI_VLD => Pixel::VAAPI_VLD, |
552 | #[cfg (any(not(feature = "ff_api_vaapi" ), feature = "ffmpeg_5_0" ))] |
553 | AV_PIX_FMT_VAAPI => Pixel::VAAPI, |
554 | |
555 | AV_PIX_FMT_YUV420P16LE => Pixel::YUV420P16LE, |
556 | AV_PIX_FMT_YUV420P16BE => Pixel::YUV420P16BE, |
557 | AV_PIX_FMT_YUV422P16LE => Pixel::YUV422P16LE, |
558 | AV_PIX_FMT_YUV422P16BE => Pixel::YUV422P16BE, |
559 | AV_PIX_FMT_YUV444P16LE => Pixel::YUV444P16LE, |
560 | AV_PIX_FMT_YUV444P16BE => Pixel::YUV444P16BE, |
561 | #[cfg (feature = "ff_api_vdpau" )] |
562 | AV_PIX_FMT_VDPAU_MPEG4 => Pixel::VDPAU_MPEG4, |
563 | AV_PIX_FMT_DXVA2_VLD => Pixel::DXVA2_VLD, |
564 | |
565 | AV_PIX_FMT_RGB444LE => Pixel::RGB444LE, |
566 | AV_PIX_FMT_RGB444BE => Pixel::RGB444BE, |
567 | AV_PIX_FMT_BGR444LE => Pixel::BGR444LE, |
568 | AV_PIX_FMT_BGR444BE => Pixel::BGR444BE, |
569 | AV_PIX_FMT_YA8 => Pixel::YA8, |
570 | |
571 | AV_PIX_FMT_BGR48BE => Pixel::BGR48BE, |
572 | AV_PIX_FMT_BGR48LE => Pixel::BGR48LE, |
573 | |
574 | AV_PIX_FMT_YUV420P9BE => Pixel::YUV420P9BE, |
575 | AV_PIX_FMT_YUV420P9LE => Pixel::YUV420P9LE, |
576 | AV_PIX_FMT_YUV420P10BE => Pixel::YUV420P10BE, |
577 | AV_PIX_FMT_YUV420P10LE => Pixel::YUV420P10LE, |
578 | AV_PIX_FMT_YUV422P10BE => Pixel::YUV422P10BE, |
579 | AV_PIX_FMT_YUV422P10LE => Pixel::YUV422P10LE, |
580 | AV_PIX_FMT_YUV444P9BE => Pixel::YUV444P9BE, |
581 | AV_PIX_FMT_YUV444P9LE => Pixel::YUV444P9LE, |
582 | AV_PIX_FMT_YUV444P10BE => Pixel::YUV444P10BE, |
583 | AV_PIX_FMT_YUV444P10LE => Pixel::YUV444P10LE, |
584 | AV_PIX_FMT_YUV422P9BE => Pixel::YUV422P9BE, |
585 | AV_PIX_FMT_YUV422P9LE => Pixel::YUV422P9LE, |
586 | #[cfg (not(feature = "ffmpeg_4_0" ))] |
587 | AV_PIX_FMT_VDA_VLD => Pixel::VDA_VLD, |
588 | |
589 | AV_PIX_FMT_GBRP => Pixel::GBRP, |
590 | AV_PIX_FMT_GBRP9BE => Pixel::GBRP9BE, |
591 | AV_PIX_FMT_GBRP9LE => Pixel::GBRP9LE, |
592 | AV_PIX_FMT_GBRP10BE => Pixel::GBRP10BE, |
593 | AV_PIX_FMT_GBRP10LE => Pixel::GBRP10LE, |
594 | AV_PIX_FMT_GBRP16BE => Pixel::GBRP16BE, |
595 | AV_PIX_FMT_GBRP16LE => Pixel::GBRP16LE, |
596 | |
597 | AV_PIX_FMT_YUVA420P9BE => Pixel::YUVA420P9BE, |
598 | AV_PIX_FMT_YUVA420P9LE => Pixel::YUVA420P9LE, |
599 | AV_PIX_FMT_YUVA422P9BE => Pixel::YUVA422P9BE, |
600 | AV_PIX_FMT_YUVA422P9LE => Pixel::YUVA422P9LE, |
601 | AV_PIX_FMT_YUVA444P9BE => Pixel::YUVA444P9BE, |
602 | AV_PIX_FMT_YUVA444P9LE => Pixel::YUVA444P9LE, |
603 | AV_PIX_FMT_YUVA420P10BE => Pixel::YUVA420P10BE, |
604 | AV_PIX_FMT_YUVA420P10LE => Pixel::YUVA420P10LE, |
605 | AV_PIX_FMT_YUVA422P10BE => Pixel::YUVA422P10BE, |
606 | AV_PIX_FMT_YUVA422P10LE => Pixel::YUVA422P10LE, |
607 | AV_PIX_FMT_YUVA444P10BE => Pixel::YUVA444P10BE, |
608 | AV_PIX_FMT_YUVA444P10LE => Pixel::YUVA444P10LE, |
609 | AV_PIX_FMT_YUVA420P16BE => Pixel::YUVA420P16BE, |
610 | AV_PIX_FMT_YUVA420P16LE => Pixel::YUVA420P16LE, |
611 | AV_PIX_FMT_YUVA422P16BE => Pixel::YUVA422P16BE, |
612 | AV_PIX_FMT_YUVA422P16LE => Pixel::YUVA422P16LE, |
613 | AV_PIX_FMT_YUVA444P16BE => Pixel::YUVA444P16BE, |
614 | AV_PIX_FMT_YUVA444P16LE => Pixel::YUVA444P16LE, |
615 | |
616 | AV_PIX_FMT_VDPAU => Pixel::VDPAU, |
617 | |
618 | AV_PIX_FMT_XYZ12LE => Pixel::XYZ12LE, |
619 | AV_PIX_FMT_XYZ12BE => Pixel::XYZ12BE, |
620 | AV_PIX_FMT_NV16 => Pixel::NV16, |
621 | AV_PIX_FMT_NV20LE => Pixel::NV20LE, |
622 | AV_PIX_FMT_NV20BE => Pixel::NV20BE, |
623 | |
624 | AV_PIX_FMT_RGBA64BE => Pixel::RGBA64BE, |
625 | AV_PIX_FMT_RGBA64LE => Pixel::RGBA64LE, |
626 | AV_PIX_FMT_BGRA64BE => Pixel::BGRA64BE, |
627 | AV_PIX_FMT_BGRA64LE => Pixel::BGRA64LE, |
628 | |
629 | AV_PIX_FMT_YVYU422 => Pixel::YVYU422, |
630 | |
631 | #[cfg (not(feature = "ffmpeg_4_0" ))] |
632 | AV_PIX_FMT_VDA => Pixel::VDA, |
633 | |
634 | AV_PIX_FMT_YA16BE => Pixel::YA16BE, |
635 | AV_PIX_FMT_YA16LE => Pixel::YA16LE, |
636 | |
637 | AV_PIX_FMT_QSV => Pixel::QSV, |
638 | AV_PIX_FMT_MMAL => Pixel::MMAL, |
639 | |
640 | AV_PIX_FMT_D3D11VA_VLD => Pixel::D3D11VA_VLD, |
641 | |
642 | AV_PIX_FMT_CUDA => Pixel::CUDA, |
643 | |
644 | AV_PIX_FMT_0RGB => Pixel::ZRGB, |
645 | AV_PIX_FMT_RGB0 => Pixel::RGBZ, |
646 | AV_PIX_FMT_0BGR => Pixel::ZBGR, |
647 | AV_PIX_FMT_BGR0 => Pixel::BGRZ, |
648 | AV_PIX_FMT_YUVA444P => Pixel::YUVA444P, |
649 | AV_PIX_FMT_YUVA422P => Pixel::YUVA422P, |
650 | |
651 | AV_PIX_FMT_YUV420P12BE => Pixel::YUV420P12BE, |
652 | AV_PIX_FMT_YUV420P12LE => Pixel::YUV420P12LE, |
653 | AV_PIX_FMT_YUV420P14BE => Pixel::YUV420P14BE, |
654 | AV_PIX_FMT_YUV420P14LE => Pixel::YUV420P14LE, |
655 | AV_PIX_FMT_YUV422P12BE => Pixel::YUV422P12BE, |
656 | AV_PIX_FMT_YUV422P12LE => Pixel::YUV422P12LE, |
657 | AV_PIX_FMT_YUV422P14BE => Pixel::YUV422P14BE, |
658 | AV_PIX_FMT_YUV422P14LE => Pixel::YUV422P14LE, |
659 | AV_PIX_FMT_YUV444P12BE => Pixel::YUV444P12BE, |
660 | AV_PIX_FMT_YUV444P12LE => Pixel::YUV444P12LE, |
661 | AV_PIX_FMT_YUV444P14BE => Pixel::YUV444P14BE, |
662 | AV_PIX_FMT_YUV444P14LE => Pixel::YUV444P14LE, |
663 | AV_PIX_FMT_GBRP12BE => Pixel::GBRP12BE, |
664 | AV_PIX_FMT_GBRP12LE => Pixel::GBRP12LE, |
665 | AV_PIX_FMT_GBRP14BE => Pixel::GBRP14BE, |
666 | AV_PIX_FMT_GBRP14LE => Pixel::GBRP14LE, |
667 | AV_PIX_FMT_GBRAP => Pixel::GBRAP, |
668 | AV_PIX_FMT_GBRAP16BE => Pixel::GBRAP16BE, |
669 | AV_PIX_FMT_GBRAP16LE => Pixel::GBRAP16LE, |
670 | AV_PIX_FMT_YUVJ411P => Pixel::YUVJ411P, |
671 | |
672 | AV_PIX_FMT_BAYER_BGGR8 => Pixel::BAYER_BGGR8, |
673 | AV_PIX_FMT_BAYER_RGGB8 => Pixel::BAYER_RGGB8, |
674 | AV_PIX_FMT_BAYER_GBRG8 => Pixel::BAYER_GBRG8, |
675 | AV_PIX_FMT_BAYER_GRBG8 => Pixel::BAYER_GRBG8, |
676 | AV_PIX_FMT_BAYER_BGGR16LE => Pixel::BAYER_BGGR16LE, |
677 | AV_PIX_FMT_BAYER_BGGR16BE => Pixel::BAYER_BGGR16BE, |
678 | AV_PIX_FMT_BAYER_RGGB16LE => Pixel::BAYER_RGGB16LE, |
679 | AV_PIX_FMT_BAYER_RGGB16BE => Pixel::BAYER_RGGB16BE, |
680 | AV_PIX_FMT_BAYER_GBRG16LE => Pixel::BAYER_GBRG16LE, |
681 | AV_PIX_FMT_BAYER_GBRG16BE => Pixel::BAYER_GBRG16BE, |
682 | AV_PIX_FMT_BAYER_GRBG16LE => Pixel::BAYER_GRBG16LE, |
683 | AV_PIX_FMT_BAYER_GRBG16BE => Pixel::BAYER_GRBG16BE, |
684 | |
685 | AV_PIX_FMT_YUV440P10LE => Pixel::YUV440P10LE, |
686 | AV_PIX_FMT_YUV440P10BE => Pixel::YUV440P10BE, |
687 | AV_PIX_FMT_YUV440P12LE => Pixel::YUV440P12LE, |
688 | AV_PIX_FMT_YUV440P12BE => Pixel::YUV440P12BE, |
689 | AV_PIX_FMT_AYUV64LE => Pixel::AYUV64LE, |
690 | AV_PIX_FMT_AYUV64BE => Pixel::AYUV64BE, |
691 | |
692 | AV_PIX_FMT_VIDEOTOOLBOX => Pixel::VIDEOTOOLBOX, |
693 | |
694 | AV_PIX_FMT_P010LE => Pixel::P010LE, |
695 | AV_PIX_FMT_P010BE => Pixel::P010BE, |
696 | AV_PIX_FMT_GBRAP12BE => Pixel::GBRAP12BE, |
697 | AV_PIX_FMT_GBRAP12LE => Pixel::GBRAP12LE, |
698 | AV_PIX_FMT_GBRAP10LE => Pixel::GBRAP10LE, |
699 | AV_PIX_FMT_GBRAP10BE => Pixel::GBRAP10BE, |
700 | AV_PIX_FMT_MEDIACODEC => Pixel::MEDIACODEC, |
701 | AV_PIX_FMT_GRAY12BE => Pixel::GRAY12BE, |
702 | AV_PIX_FMT_GRAY12LE => Pixel::GRAY12LE, |
703 | AV_PIX_FMT_GRAY10BE => Pixel::GRAY10BE, |
704 | AV_PIX_FMT_GRAY10LE => Pixel::GRAY10LE, |
705 | AV_PIX_FMT_P016LE => Pixel::P016LE, |
706 | AV_PIX_FMT_P016BE => Pixel::P016BE, |
707 | |
708 | AV_PIX_FMT_NB => Pixel::None, |
709 | |
710 | AV_PIX_FMT_D3D11 => Pixel::D3D11, |
711 | AV_PIX_FMT_GRAY9BE => Pixel::GRAY9BE, |
712 | AV_PIX_FMT_GRAY9LE => Pixel::GRAY9LE, |
713 | AV_PIX_FMT_GBRPF32BE => Pixel::GBRPF32BE, |
714 | AV_PIX_FMT_GBRPF32LE => Pixel::GBRPF32LE, |
715 | AV_PIX_FMT_GBRAPF32BE => Pixel::GBRAPF32BE, |
716 | AV_PIX_FMT_GBRAPF32LE => Pixel::GBRAPF32LE, |
717 | AV_PIX_FMT_DRM_PRIME => Pixel::DRM_PRIME, |
718 | |
719 | #[cfg (feature = "ffmpeg_4_0" )] |
720 | AV_PIX_FMT_OPENCL => Pixel::OPENCL, |
721 | |
722 | #[cfg (feature = "ffmpeg_4_1" )] |
723 | AV_PIX_FMT_GRAY14BE => Pixel::GRAY14BE, |
724 | #[cfg (feature = "ffmpeg_4_1" )] |
725 | AV_PIX_FMT_GRAY14LE => Pixel::GRAY14LE, |
726 | #[cfg (feature = "ffmpeg_4_1" )] |
727 | AV_PIX_FMT_GRAYF32BE => Pixel::GRAYF32BE, |
728 | #[cfg (feature = "ffmpeg_4_1" )] |
729 | AV_PIX_FMT_GRAYF32LE => Pixel::GRAYF32LE, |
730 | |
731 | #[cfg (feature = "ffmpeg_4_2" )] |
732 | AV_PIX_FMT_YUVA422P12BE => Pixel::YUVA422P12BE, |
733 | #[cfg (feature = "ffmpeg_4_2" )] |
734 | AV_PIX_FMT_YUVA422P12LE => Pixel::YUVA422P12LE, |
735 | #[cfg (feature = "ffmpeg_4_2" )] |
736 | AV_PIX_FMT_YUVA444P12BE => Pixel::YUVA444P12BE, |
737 | #[cfg (feature = "ffmpeg_4_2" )] |
738 | AV_PIX_FMT_YUVA444P12LE => Pixel::YUVA444P12LE, |
739 | #[cfg (feature = "ffmpeg_4_2" )] |
740 | AV_PIX_FMT_NV24 => Pixel::NV24, |
741 | #[cfg (feature = "ffmpeg_4_2" )] |
742 | AV_PIX_FMT_NV42 => Pixel::NV42, |
743 | |
744 | #[cfg (feature = "ffmpeg_4_3" )] |
745 | AV_PIX_FMT_VULKAN => Pixel::VULKAN, |
746 | #[cfg (feature = "ffmpeg_4_3" )] |
747 | AV_PIX_FMT_Y210BE => Pixel::Y210BE, |
748 | #[cfg (feature = "ffmpeg_4_3" )] |
749 | AV_PIX_FMT_Y210LE => Pixel::Y210LE, |
750 | |
751 | #[cfg (feature = "ffmpeg_4_4" )] |
752 | AV_PIX_FMT_X2RGB10LE => Pixel::X2RGB10LE, |
753 | #[cfg (feature = "ffmpeg_4_4" )] |
754 | AV_PIX_FMT_X2RGB10BE => Pixel::X2RGB10BE, |
755 | |
756 | #[cfg (feature = "ffmpeg_5_0" )] |
757 | AV_PIX_FMT_X2BGR10LE => Pixel::X2BGR10LE, |
758 | #[cfg (feature = "ffmpeg_5_0" )] |
759 | AV_PIX_FMT_X2BGR10BE => Pixel::X2BGR10BE, |
760 | #[cfg (feature = "ffmpeg_5_0" )] |
761 | AV_PIX_FMT_P210BE => Pixel::P210BE, |
762 | #[cfg (feature = "ffmpeg_5_0" )] |
763 | AV_PIX_FMT_P210LE => Pixel::P210LE, |
764 | #[cfg (feature = "ffmpeg_5_0" )] |
765 | AV_PIX_FMT_P410BE => Pixel::P410BE, |
766 | #[cfg (feature = "ffmpeg_5_0" )] |
767 | AV_PIX_FMT_P410LE => Pixel::P410LE, |
768 | #[cfg (feature = "ffmpeg_5_0" )] |
769 | AV_PIX_FMT_P216BE => Pixel::P216BE, |
770 | #[cfg (feature = "ffmpeg_5_0" )] |
771 | AV_PIX_FMT_P216LE => Pixel::P216LE, |
772 | #[cfg (feature = "ffmpeg_5_0" )] |
773 | AV_PIX_FMT_P416BE => Pixel::P416BE, |
774 | #[cfg (feature = "ffmpeg_5_0" )] |
775 | AV_PIX_FMT_P416LE => Pixel::P416LE, |
776 | |
777 | #[cfg (feature = "ffmpeg_6_0" )] |
778 | AV_PIX_FMT_VUYA => Pixel::VUYA, |
779 | #[cfg (feature = "ffmpeg_6_0" )] |
780 | AV_PIX_FMT_RGBAF16BE => Pixel::RGBAF16BE, |
781 | #[cfg (feature = "ffmpeg_6_0" )] |
782 | AV_PIX_FMT_RGBAF16LE => Pixel::RGBAF16LE, |
783 | #[cfg (feature = "ffmpeg_6_0" )] |
784 | AV_PIX_FMT_VUYX => Pixel::VUYX, |
785 | #[cfg (feature = "ffmpeg_6_0" )] |
786 | AV_PIX_FMT_P012LE => Pixel::P012LE, |
787 | #[cfg (feature = "ffmpeg_6_0" )] |
788 | AV_PIX_FMT_P012BE => Pixel::P012BE, |
789 | #[cfg (feature = "ffmpeg_6_0" )] |
790 | AV_PIX_FMT_Y212BE => Pixel::Y212BE, |
791 | #[cfg (feature = "ffmpeg_6_0" )] |
792 | AV_PIX_FMT_Y212LE => Pixel::Y212LE, |
793 | #[cfg (feature = "ffmpeg_6_0" )] |
794 | AV_PIX_FMT_XV30BE => Pixel::XV30BE, |
795 | #[cfg (feature = "ffmpeg_6_0" )] |
796 | AV_PIX_FMT_XV30LE => Pixel::XV30LE, |
797 | #[cfg (feature = "ffmpeg_6_0" )] |
798 | AV_PIX_FMT_XV36BE => Pixel::XV36BE, |
799 | #[cfg (feature = "ffmpeg_6_0" )] |
800 | AV_PIX_FMT_XV36LE => Pixel::XV36LE, |
801 | #[cfg (feature = "ffmpeg_6_0" )] |
802 | AV_PIX_FMT_RGBF32BE => Pixel::RGBF32BE, |
803 | #[cfg (feature = "ffmpeg_6_0" )] |
804 | AV_PIX_FMT_RGBF32LE => Pixel::RGBF32LE, |
805 | #[cfg (feature = "ffmpeg_6_0" )] |
806 | AV_PIX_FMT_RGBAF32BE => Pixel::RGBAF32BE, |
807 | #[cfg (feature = "ffmpeg_6_0" )] |
808 | AV_PIX_FMT_RGBAF32LE => Pixel::RGBAF32LE, |
809 | |
810 | #[cfg (feature = "ffmpeg_6_1" )] |
811 | AV_PIX_FMT_P212BE => Pixel::P212BE, |
812 | #[cfg (feature = "ffmpeg_6_1" )] |
813 | AV_PIX_FMT_P212LE => Pixel::P212LE, |
814 | #[cfg (feature = "ffmpeg_6_1" )] |
815 | AV_PIX_FMT_P412BE => Pixel::P412BE, |
816 | #[cfg (feature = "ffmpeg_6_1" )] |
817 | AV_PIX_FMT_P412LE => Pixel::P412LE, |
818 | #[cfg (feature = "ffmpeg_6_1" )] |
819 | AV_PIX_FMT_GBRAP14BE => Pixel::GBRAP14BE, |
820 | #[cfg (feature = "ffmpeg_6_1" )] |
821 | AV_PIX_FMT_GBRAP14LE => Pixel::GBRAP14LE, |
822 | |
823 | #[cfg (feature = "rpi" )] |
824 | AV_PIX_FMT_SAND128 => Pixel::SAND128, |
825 | #[cfg (feature = "rpi" )] |
826 | AV_PIX_FMT_SAND64_10 => Pixel::SAND64_10, |
827 | #[cfg (feature = "rpi" )] |
828 | AV_PIX_FMT_SAND64_16 => Pixel::SAND64_16, |
829 | #[cfg (feature = "rpi" )] |
830 | AV_PIX_FMT_RPI4_8 => Pixel::RPI4_8, |
831 | #[cfg (feature = "rpi" )] |
832 | AV_PIX_FMT_RPI4_10 => Pixel::RPI4_10, |
833 | } |
834 | } |
835 | } |
836 | |
837 | impl From<Pixel> for AVPixelFormat { |
838 | #[inline ] |
839 | fn from(value: Pixel) -> AVPixelFormat { |
840 | match value { |
841 | Pixel::None => AV_PIX_FMT_NONE, |
842 | |
843 | Pixel::YUV420P => AV_PIX_FMT_YUV420P, |
844 | Pixel::YUYV422 => AV_PIX_FMT_YUYV422, |
845 | Pixel::RGB24 => AV_PIX_FMT_RGB24, |
846 | Pixel::BGR24 => AV_PIX_FMT_BGR24, |
847 | Pixel::YUV422P => AV_PIX_FMT_YUV422P, |
848 | Pixel::YUV444P => AV_PIX_FMT_YUV444P, |
849 | Pixel::YUV410P => AV_PIX_FMT_YUV410P, |
850 | Pixel::YUV411P => AV_PIX_FMT_YUV411P, |
851 | Pixel::GRAY8 => AV_PIX_FMT_GRAY8, |
852 | Pixel::MonoWhite => AV_PIX_FMT_MONOWHITE, |
853 | Pixel::MonoBlack => AV_PIX_FMT_MONOBLACK, |
854 | Pixel::PAL8 => AV_PIX_FMT_PAL8, |
855 | Pixel::YUVJ420P => AV_PIX_FMT_YUVJ420P, |
856 | Pixel::YUVJ422P => AV_PIX_FMT_YUVJ422P, |
857 | Pixel::YUVJ444P => AV_PIX_FMT_YUVJ444P, |
858 | #[cfg (all(feature = "ff_api_xvmc" , not(feature = "ffmpeg_5_0" )))] |
859 | Pixel::XVMC_MPEG2_MC => AV_PIX_FMT_XVMC_MPEG2_MC, |
860 | #[cfg (all(feature = "ff_api_xvmc" , not(feature = "ffmpeg_5_0" )))] |
861 | Pixel::XVMC_MPEG2_IDCT => AV_PIX_FMT_XVMC_MPEG2_IDCT, |
862 | Pixel::UYVY422 => AV_PIX_FMT_UYVY422, |
863 | Pixel::UYYVYY411 => AV_PIX_FMT_UYYVYY411, |
864 | Pixel::BGR8 => AV_PIX_FMT_BGR8, |
865 | Pixel::BGR4 => AV_PIX_FMT_BGR4, |
866 | Pixel::BGR4_BYTE => AV_PIX_FMT_BGR4_BYTE, |
867 | Pixel::RGB8 => AV_PIX_FMT_RGB8, |
868 | Pixel::RGB4 => AV_PIX_FMT_RGB4, |
869 | Pixel::RGB4_BYTE => AV_PIX_FMT_RGB4_BYTE, |
870 | Pixel::NV12 => AV_PIX_FMT_NV12, |
871 | Pixel::NV21 => AV_PIX_FMT_NV21, |
872 | |
873 | Pixel::ARGB => AV_PIX_FMT_ARGB, |
874 | Pixel::RGBA => AV_PIX_FMT_RGBA, |
875 | Pixel::ABGR => AV_PIX_FMT_ABGR, |
876 | Pixel::BGRA => AV_PIX_FMT_BGRA, |
877 | |
878 | Pixel::GRAY16BE => AV_PIX_FMT_GRAY16BE, |
879 | Pixel::GRAY16LE => AV_PIX_FMT_GRAY16LE, |
880 | Pixel::YUV440P => AV_PIX_FMT_YUV440P, |
881 | Pixel::YUVJ440P => AV_PIX_FMT_YUVJ440P, |
882 | Pixel::YUVA420P => AV_PIX_FMT_YUVA420P, |
883 | #[cfg (feature = "ff_api_vdpau" )] |
884 | Pixel::VDPAU_H264 => AV_PIX_FMT_VDPAU_H264, |
885 | #[cfg (feature = "ff_api_vdpau" )] |
886 | Pixel::VDPAU_MPEG1 => AV_PIX_FMT_VDPAU_MPEG1, |
887 | #[cfg (feature = "ff_api_vdpau" )] |
888 | Pixel::VDPAU_MPEG2 => AV_PIX_FMT_VDPAU_MPEG2, |
889 | #[cfg (feature = "ff_api_vdpau" )] |
890 | Pixel::VDPAU_WMV3 => AV_PIX_FMT_VDPAU_WMV3, |
891 | #[cfg (feature = "ff_api_vdpau" )] |
892 | Pixel::VDPAU_VC1 => AV_PIX_FMT_VDPAU_VC1, |
893 | Pixel::RGB48BE => AV_PIX_FMT_RGB48BE, |
894 | Pixel::RGB48LE => AV_PIX_FMT_RGB48LE, |
895 | |
896 | Pixel::RGB565BE => AV_PIX_FMT_RGB565BE, |
897 | Pixel::RGB565LE => AV_PIX_FMT_RGB565LE, |
898 | Pixel::RGB555BE => AV_PIX_FMT_RGB555BE, |
899 | Pixel::RGB555LE => AV_PIX_FMT_RGB555LE, |
900 | |
901 | Pixel::BGR565BE => AV_PIX_FMT_BGR565BE, |
902 | Pixel::BGR565LE => AV_PIX_FMT_BGR565LE, |
903 | Pixel::BGR555BE => AV_PIX_FMT_BGR555BE, |
904 | Pixel::BGR555LE => AV_PIX_FMT_BGR555LE, |
905 | |
906 | #[cfg (all(feature = "ff_api_vaapi" , not(feature = "ffmpeg_5_0" )))] |
907 | Pixel::VAAPI_MOCO => AV_PIX_FMT_VAAPI_MOCO, |
908 | #[cfg (all(feature = "ff_api_vaapi" , not(feature = "ffmpeg_5_0" )))] |
909 | Pixel::VAAPI_IDCT => AV_PIX_FMT_VAAPI_IDCT, |
910 | #[cfg (all(feature = "ff_api_vaapi" , not(feature = "ffmpeg_5_0" )))] |
911 | Pixel::VAAPI_VLD => AV_PIX_FMT_VAAPI_VLD, |
912 | #[cfg (not(feature = "ff_api_vaapi" ))] |
913 | Pixel::VAAPI => AV_PIX_FMT_VAAPI, |
914 | |
915 | Pixel::YUV420P16LE => AV_PIX_FMT_YUV420P16LE, |
916 | Pixel::YUV420P16BE => AV_PIX_FMT_YUV420P16BE, |
917 | Pixel::YUV422P16LE => AV_PIX_FMT_YUV422P16LE, |
918 | Pixel::YUV422P16BE => AV_PIX_FMT_YUV422P16BE, |
919 | Pixel::YUV444P16LE => AV_PIX_FMT_YUV444P16LE, |
920 | Pixel::YUV444P16BE => AV_PIX_FMT_YUV444P16BE, |
921 | #[cfg (feature = "ff_api_vdpau" )] |
922 | Pixel::VDPAU_MPEG4 => AV_PIX_FMT_VDPAU_MPEG4, |
923 | Pixel::DXVA2_VLD => AV_PIX_FMT_DXVA2_VLD, |
924 | |
925 | Pixel::RGB444LE => AV_PIX_FMT_RGB444LE, |
926 | Pixel::RGB444BE => AV_PIX_FMT_RGB444BE, |
927 | Pixel::BGR444LE => AV_PIX_FMT_BGR444LE, |
928 | Pixel::BGR444BE => AV_PIX_FMT_BGR444BE, |
929 | Pixel::YA8 => AV_PIX_FMT_YA8, |
930 | |
931 | Pixel::BGR48BE => AV_PIX_FMT_BGR48BE, |
932 | Pixel::BGR48LE => AV_PIX_FMT_BGR48LE, |
933 | |
934 | Pixel::YUV420P9BE => AV_PIX_FMT_YUV420P9BE, |
935 | Pixel::YUV420P9LE => AV_PIX_FMT_YUV420P9LE, |
936 | Pixel::YUV420P10BE => AV_PIX_FMT_YUV420P10BE, |
937 | Pixel::YUV420P10LE => AV_PIX_FMT_YUV420P10LE, |
938 | Pixel::YUV422P10BE => AV_PIX_FMT_YUV422P10BE, |
939 | Pixel::YUV422P10LE => AV_PIX_FMT_YUV422P10LE, |
940 | Pixel::YUV444P9BE => AV_PIX_FMT_YUV444P9BE, |
941 | Pixel::YUV444P9LE => AV_PIX_FMT_YUV444P9LE, |
942 | Pixel::YUV444P10BE => AV_PIX_FMT_YUV444P10BE, |
943 | Pixel::YUV444P10LE => AV_PIX_FMT_YUV444P10LE, |
944 | Pixel::YUV422P9BE => AV_PIX_FMT_YUV422P9BE, |
945 | Pixel::YUV422P9LE => AV_PIX_FMT_YUV422P9LE, |
946 | #[cfg (not(feature = "ffmpeg_4_0" ))] |
947 | Pixel::VDA_VLD => AV_PIX_FMT_VDA_VLD, |
948 | |
949 | Pixel::GBRP => AV_PIX_FMT_GBRP, |
950 | Pixel::GBRP9BE => AV_PIX_FMT_GBRP9BE, |
951 | Pixel::GBRP9LE => AV_PIX_FMT_GBRP9LE, |
952 | Pixel::GBRP10BE => AV_PIX_FMT_GBRP10BE, |
953 | Pixel::GBRP10LE => AV_PIX_FMT_GBRP10LE, |
954 | Pixel::GBRP16BE => AV_PIX_FMT_GBRP16BE, |
955 | Pixel::GBRP16LE => AV_PIX_FMT_GBRP16LE, |
956 | |
957 | Pixel::YUVA420P9BE => AV_PIX_FMT_YUVA420P9BE, |
958 | Pixel::YUVA420P9LE => AV_PIX_FMT_YUVA420P9LE, |
959 | Pixel::YUVA422P9BE => AV_PIX_FMT_YUVA422P9BE, |
960 | Pixel::YUVA422P9LE => AV_PIX_FMT_YUVA422P9LE, |
961 | Pixel::YUVA444P9BE => AV_PIX_FMT_YUVA444P9BE, |
962 | Pixel::YUVA444P9LE => AV_PIX_FMT_YUVA444P9LE, |
963 | Pixel::YUVA420P10BE => AV_PIX_FMT_YUVA420P10BE, |
964 | Pixel::YUVA420P10LE => AV_PIX_FMT_YUVA420P10LE, |
965 | Pixel::YUVA422P10BE => AV_PIX_FMT_YUVA422P10BE, |
966 | Pixel::YUVA422P10LE => AV_PIX_FMT_YUVA422P10LE, |
967 | Pixel::YUVA444P10BE => AV_PIX_FMT_YUVA444P10BE, |
968 | Pixel::YUVA444P10LE => AV_PIX_FMT_YUVA444P10LE, |
969 | Pixel::YUVA420P16BE => AV_PIX_FMT_YUVA420P16BE, |
970 | Pixel::YUVA420P16LE => AV_PIX_FMT_YUVA420P16LE, |
971 | Pixel::YUVA422P16BE => AV_PIX_FMT_YUVA422P16BE, |
972 | Pixel::YUVA422P16LE => AV_PIX_FMT_YUVA422P16LE, |
973 | Pixel::YUVA444P16BE => AV_PIX_FMT_YUVA444P16BE, |
974 | Pixel::YUVA444P16LE => AV_PIX_FMT_YUVA444P16LE, |
975 | |
976 | Pixel::VDPAU => AV_PIX_FMT_VDPAU, |
977 | |
978 | Pixel::XYZ12LE => AV_PIX_FMT_XYZ12LE, |
979 | Pixel::XYZ12BE => AV_PIX_FMT_XYZ12BE, |
980 | Pixel::NV16 => AV_PIX_FMT_NV16, |
981 | Pixel::NV20LE => AV_PIX_FMT_NV20LE, |
982 | Pixel::NV20BE => AV_PIX_FMT_NV20BE, |
983 | |
984 | Pixel::RGBA64BE => AV_PIX_FMT_RGBA64BE, |
985 | Pixel::RGBA64LE => AV_PIX_FMT_RGBA64LE, |
986 | Pixel::BGRA64BE => AV_PIX_FMT_BGRA64BE, |
987 | Pixel::BGRA64LE => AV_PIX_FMT_BGRA64LE, |
988 | |
989 | Pixel::YVYU422 => AV_PIX_FMT_YVYU422, |
990 | |
991 | #[cfg (not(feature = "ffmpeg_4_0" ))] |
992 | Pixel::VDA => AV_PIX_FMT_VDA, |
993 | |
994 | Pixel::YA16BE => AV_PIX_FMT_YA16BE, |
995 | Pixel::YA16LE => AV_PIX_FMT_YA16LE, |
996 | |
997 | Pixel::QSV => AV_PIX_FMT_QSV, |
998 | Pixel::MMAL => AV_PIX_FMT_MMAL, |
999 | |
1000 | Pixel::D3D11VA_VLD => AV_PIX_FMT_D3D11VA_VLD, |
1001 | |
1002 | Pixel::CUDA => AV_PIX_FMT_CUDA, |
1003 | |
1004 | Pixel::ZRGB => AV_PIX_FMT_0RGB, |
1005 | Pixel::RGBZ => AV_PIX_FMT_RGB0, |
1006 | Pixel::ZBGR => AV_PIX_FMT_0BGR, |
1007 | Pixel::BGRZ => AV_PIX_FMT_BGR0, |
1008 | Pixel::YUVA444P => AV_PIX_FMT_YUVA444P, |
1009 | Pixel::YUVA422P => AV_PIX_FMT_YUVA422P, |
1010 | |
1011 | Pixel::YUV420P12BE => AV_PIX_FMT_YUV420P12BE, |
1012 | Pixel::YUV420P12LE => AV_PIX_FMT_YUV420P12LE, |
1013 | Pixel::YUV420P14BE => AV_PIX_FMT_YUV420P14BE, |
1014 | Pixel::YUV420P14LE => AV_PIX_FMT_YUV420P14LE, |
1015 | Pixel::YUV422P12BE => AV_PIX_FMT_YUV422P12BE, |
1016 | Pixel::YUV422P12LE => AV_PIX_FMT_YUV422P12LE, |
1017 | Pixel::YUV422P14BE => AV_PIX_FMT_YUV422P14BE, |
1018 | Pixel::YUV422P14LE => AV_PIX_FMT_YUV422P14LE, |
1019 | Pixel::YUV444P12BE => AV_PIX_FMT_YUV444P12BE, |
1020 | Pixel::YUV444P12LE => AV_PIX_FMT_YUV444P12LE, |
1021 | Pixel::YUV444P14BE => AV_PIX_FMT_YUV444P14BE, |
1022 | Pixel::YUV444P14LE => AV_PIX_FMT_YUV444P14LE, |
1023 | Pixel::GBRP12BE => AV_PIX_FMT_GBRP12BE, |
1024 | Pixel::GBRP12LE => AV_PIX_FMT_GBRP12LE, |
1025 | Pixel::GBRP14BE => AV_PIX_FMT_GBRP14BE, |
1026 | Pixel::GBRP14LE => AV_PIX_FMT_GBRP14LE, |
1027 | Pixel::GBRAP => AV_PIX_FMT_GBRAP, |
1028 | Pixel::GBRAP16BE => AV_PIX_FMT_GBRAP16BE, |
1029 | Pixel::GBRAP16LE => AV_PIX_FMT_GBRAP16LE, |
1030 | Pixel::YUVJ411P => AV_PIX_FMT_YUVJ411P, |
1031 | |
1032 | Pixel::BAYER_BGGR8 => AV_PIX_FMT_BAYER_BGGR8, |
1033 | Pixel::BAYER_RGGB8 => AV_PIX_FMT_BAYER_RGGB8, |
1034 | Pixel::BAYER_GBRG8 => AV_PIX_FMT_BAYER_GBRG8, |
1035 | Pixel::BAYER_GRBG8 => AV_PIX_FMT_BAYER_GRBG8, |
1036 | Pixel::BAYER_BGGR16LE => AV_PIX_FMT_BAYER_BGGR16LE, |
1037 | Pixel::BAYER_BGGR16BE => AV_PIX_FMT_BAYER_BGGR16BE, |
1038 | Pixel::BAYER_RGGB16LE => AV_PIX_FMT_BAYER_RGGB16LE, |
1039 | Pixel::BAYER_RGGB16BE => AV_PIX_FMT_BAYER_RGGB16BE, |
1040 | Pixel::BAYER_GBRG16LE => AV_PIX_FMT_BAYER_GBRG16LE, |
1041 | Pixel::BAYER_GBRG16BE => AV_PIX_FMT_BAYER_GBRG16BE, |
1042 | Pixel::BAYER_GRBG16LE => AV_PIX_FMT_BAYER_GRBG16LE, |
1043 | Pixel::BAYER_GRBG16BE => AV_PIX_FMT_BAYER_GRBG16BE, |
1044 | |
1045 | Pixel::YUV440P10LE => AV_PIX_FMT_YUV440P10LE, |
1046 | Pixel::YUV440P10BE => AV_PIX_FMT_YUV440P10BE, |
1047 | Pixel::YUV440P12LE => AV_PIX_FMT_YUV440P12LE, |
1048 | Pixel::YUV440P12BE => AV_PIX_FMT_YUV440P12BE, |
1049 | Pixel::AYUV64LE => AV_PIX_FMT_AYUV64LE, |
1050 | Pixel::AYUV64BE => AV_PIX_FMT_AYUV64BE, |
1051 | |
1052 | Pixel::VIDEOTOOLBOX => AV_PIX_FMT_VIDEOTOOLBOX, |
1053 | |
1054 | // --- defaults |
1055 | #[cfg (feature = "ffmpeg_4_0" )] |
1056 | Pixel::XVMC => AV_PIX_FMT_XVMC, |
1057 | |
1058 | Pixel::RGB32 => AV_PIX_FMT_RGB32, |
1059 | Pixel::RGB32_1 => AV_PIX_FMT_RGB32_1, |
1060 | Pixel::BGR32 => AV_PIX_FMT_BGR32, |
1061 | Pixel::BGR32_1 => AV_PIX_FMT_BGR32_1, |
1062 | Pixel::ZRGB32 => AV_PIX_FMT_0RGB32, |
1063 | Pixel::ZBGR32 => AV_PIX_FMT_0BGR32, |
1064 | |
1065 | Pixel::GRAY16 => AV_PIX_FMT_GRAY16, |
1066 | Pixel::YA16 => AV_PIX_FMT_YA16, |
1067 | Pixel::RGB48 => AV_PIX_FMT_RGB48, |
1068 | Pixel::RGB565 => AV_PIX_FMT_RGB565, |
1069 | Pixel::RGB555 => AV_PIX_FMT_RGB555, |
1070 | Pixel::RGB444 => AV_PIX_FMT_RGB444, |
1071 | Pixel::BGR48 => AV_PIX_FMT_BGR48, |
1072 | Pixel::BGR565 => AV_PIX_FMT_BGR565, |
1073 | Pixel::BGR555 => AV_PIX_FMT_BGR555, |
1074 | Pixel::BGR444 => AV_PIX_FMT_BGR444, |
1075 | |
1076 | Pixel::YUV420P9 => AV_PIX_FMT_YUV420P9, |
1077 | Pixel::YUV422P9 => AV_PIX_FMT_YUV422P9, |
1078 | Pixel::YUV444P9 => AV_PIX_FMT_YUV444P9, |
1079 | Pixel::YUV420P10 => AV_PIX_FMT_YUV420P10, |
1080 | Pixel::YUV422P10 => AV_PIX_FMT_YUV422P10, |
1081 | Pixel::YUV440P10 => AV_PIX_FMT_YUV440P10, |
1082 | Pixel::YUV444P10 => AV_PIX_FMT_YUV444P10, |
1083 | Pixel::YUV420P12 => AV_PIX_FMT_YUV420P12, |
1084 | Pixel::YUV422P12 => AV_PIX_FMT_YUV422P12, |
1085 | Pixel::YUV440P12 => AV_PIX_FMT_YUV440P12, |
1086 | Pixel::YUV444P12 => AV_PIX_FMT_YUV444P12, |
1087 | Pixel::YUV420P14 => AV_PIX_FMT_YUV420P14, |
1088 | Pixel::YUV422P14 => AV_PIX_FMT_YUV422P14, |
1089 | Pixel::YUV444P14 => AV_PIX_FMT_YUV444P14, |
1090 | Pixel::YUV420P16 => AV_PIX_FMT_YUV420P16, |
1091 | Pixel::YUV422P16 => AV_PIX_FMT_YUV422P16, |
1092 | Pixel::YUV444P16 => AV_PIX_FMT_YUV444P16, |
1093 | |
1094 | Pixel::GBRP9 => AV_PIX_FMT_GBRP9, |
1095 | Pixel::GBRP10 => AV_PIX_FMT_GBRP10, |
1096 | Pixel::GBRP12 => AV_PIX_FMT_GBRP12, |
1097 | Pixel::GBRP14 => AV_PIX_FMT_GBRP14, |
1098 | Pixel::GBRP16 => AV_PIX_FMT_GBRP16, |
1099 | Pixel::GBRAP16 => AV_PIX_FMT_GBRAP16, |
1100 | |
1101 | Pixel::BAYER_BGGR16 => AV_PIX_FMT_BAYER_BGGR16, |
1102 | Pixel::BAYER_RGGB16 => AV_PIX_FMT_BAYER_RGGB16, |
1103 | Pixel::BAYER_GBRG16 => AV_PIX_FMT_BAYER_GBRG16, |
1104 | Pixel::BAYER_GRBG16 => AV_PIX_FMT_BAYER_GRBG16, |
1105 | |
1106 | Pixel::YUVA420P9 => AV_PIX_FMT_YUVA420P9, |
1107 | Pixel::YUVA422P9 => AV_PIX_FMT_YUVA422P9, |
1108 | Pixel::YUVA444P9 => AV_PIX_FMT_YUVA444P9, |
1109 | Pixel::YUVA420P10 => AV_PIX_FMT_YUVA420P10, |
1110 | Pixel::YUVA422P10 => AV_PIX_FMT_YUVA422P10, |
1111 | Pixel::YUVA444P10 => AV_PIX_FMT_YUVA444P10, |
1112 | Pixel::YUVA420P16 => AV_PIX_FMT_YUVA420P16, |
1113 | Pixel::YUVA422P16 => AV_PIX_FMT_YUVA422P16, |
1114 | Pixel::YUVA444P16 => AV_PIX_FMT_YUVA444P16, |
1115 | |
1116 | Pixel::XYZ12 => AV_PIX_FMT_XYZ12, |
1117 | Pixel::NV20 => AV_PIX_FMT_NV20, |
1118 | Pixel::AYUV64 => AV_PIX_FMT_AYUV64, |
1119 | |
1120 | Pixel::P010LE => AV_PIX_FMT_P010LE, |
1121 | Pixel::P010BE => AV_PIX_FMT_P010BE, |
1122 | Pixel::GBRAP12BE => AV_PIX_FMT_GBRAP12BE, |
1123 | Pixel::GBRAP12LE => AV_PIX_FMT_GBRAP12LE, |
1124 | Pixel::GBRAP10LE => AV_PIX_FMT_GBRAP10LE, |
1125 | Pixel::GBRAP10BE => AV_PIX_FMT_GBRAP10BE, |
1126 | Pixel::MEDIACODEC => AV_PIX_FMT_MEDIACODEC, |
1127 | Pixel::GRAY12BE => AV_PIX_FMT_GRAY12BE, |
1128 | Pixel::GRAY12LE => AV_PIX_FMT_GRAY12LE, |
1129 | Pixel::GRAY10BE => AV_PIX_FMT_GRAY10BE, |
1130 | Pixel::GRAY10LE => AV_PIX_FMT_GRAY10LE, |
1131 | Pixel::P016LE => AV_PIX_FMT_P016LE, |
1132 | Pixel::P016BE => AV_PIX_FMT_P016BE, |
1133 | |
1134 | Pixel::D3D11 => AV_PIX_FMT_D3D11, |
1135 | Pixel::GRAY9BE => AV_PIX_FMT_GRAY9BE, |
1136 | Pixel::GRAY9LE => AV_PIX_FMT_GRAY9LE, |
1137 | Pixel::GBRPF32BE => AV_PIX_FMT_GBRPF32BE, |
1138 | Pixel::GBRPF32LE => AV_PIX_FMT_GBRPF32LE, |
1139 | Pixel::GBRAPF32BE => AV_PIX_FMT_GBRAPF32BE, |
1140 | Pixel::GBRAPF32LE => AV_PIX_FMT_GBRAPF32LE, |
1141 | Pixel::DRM_PRIME => AV_PIX_FMT_DRM_PRIME, |
1142 | |
1143 | #[cfg (feature = "ffmpeg_4_0" )] |
1144 | Pixel::OPENCL => AV_PIX_FMT_OPENCL, |
1145 | |
1146 | #[cfg (feature = "ffmpeg_4_1" )] |
1147 | Pixel::GRAY14BE => AV_PIX_FMT_GRAY14BE, |
1148 | #[cfg (feature = "ffmpeg_4_1" )] |
1149 | Pixel::GRAY14LE => AV_PIX_FMT_GRAY14LE, |
1150 | #[cfg (feature = "ffmpeg_4_1" )] |
1151 | Pixel::GRAYF32BE => AV_PIX_FMT_GRAYF32BE, |
1152 | #[cfg (feature = "ffmpeg_4_1" )] |
1153 | Pixel::GRAYF32LE => AV_PIX_FMT_GRAYF32LE, |
1154 | |
1155 | #[cfg (feature = "ffmpeg_4_2" )] |
1156 | Pixel::YUVA422P12BE => AV_PIX_FMT_YUVA422P12BE, |
1157 | #[cfg (feature = "ffmpeg_4_2" )] |
1158 | Pixel::YUVA422P12LE => AV_PIX_FMT_YUVA422P12LE, |
1159 | #[cfg (feature = "ffmpeg_4_2" )] |
1160 | Pixel::YUVA444P12BE => AV_PIX_FMT_YUVA444P12BE, |
1161 | #[cfg (feature = "ffmpeg_4_2" )] |
1162 | Pixel::YUVA444P12LE => AV_PIX_FMT_YUVA444P12LE, |
1163 | #[cfg (feature = "ffmpeg_4_2" )] |
1164 | Pixel::NV24 => AV_PIX_FMT_NV24, |
1165 | #[cfg (feature = "ffmpeg_4_2" )] |
1166 | Pixel::NV42 => AV_PIX_FMT_NV42, |
1167 | |
1168 | #[cfg (feature = "ffmpeg_4_3" )] |
1169 | Pixel::VULKAN => AV_PIX_FMT_VULKAN, |
1170 | #[cfg (feature = "ffmpeg_4_3" )] |
1171 | Pixel::Y210BE => AV_PIX_FMT_Y210BE, |
1172 | #[cfg (feature = "ffmpeg_4_3" )] |
1173 | Pixel::Y210LE => AV_PIX_FMT_Y210LE, |
1174 | |
1175 | #[cfg (feature = "ffmpeg_4_4" )] |
1176 | Pixel::X2RGB10LE => AV_PIX_FMT_X2RGB10LE, |
1177 | #[cfg (feature = "ffmpeg_4_4" )] |
1178 | Pixel::X2RGB10BE => AV_PIX_FMT_X2RGB10BE, |
1179 | |
1180 | #[cfg (feature = "ffmpeg_5_0" )] |
1181 | Pixel::X2BGR10LE => AV_PIX_FMT_X2BGR10LE, |
1182 | #[cfg (feature = "ffmpeg_5_0" )] |
1183 | Pixel::X2BGR10BE => AV_PIX_FMT_X2BGR10BE, |
1184 | #[cfg (feature = "ffmpeg_5_0" )] |
1185 | Pixel::P210BE => AV_PIX_FMT_P210BE, |
1186 | #[cfg (feature = "ffmpeg_5_0" )] |
1187 | Pixel::P210LE => AV_PIX_FMT_P210LE, |
1188 | #[cfg (feature = "ffmpeg_5_0" )] |
1189 | Pixel::P410BE => AV_PIX_FMT_P410BE, |
1190 | #[cfg (feature = "ffmpeg_5_0" )] |
1191 | Pixel::P410LE => AV_PIX_FMT_P410LE, |
1192 | #[cfg (feature = "ffmpeg_5_0" )] |
1193 | Pixel::P216BE => AV_PIX_FMT_P216BE, |
1194 | #[cfg (feature = "ffmpeg_5_0" )] |
1195 | Pixel::P216LE => AV_PIX_FMT_P216LE, |
1196 | #[cfg (feature = "ffmpeg_5_0" )] |
1197 | Pixel::P416BE => AV_PIX_FMT_P416BE, |
1198 | #[cfg (feature = "ffmpeg_5_0" )] |
1199 | Pixel::P416LE => AV_PIX_FMT_P416LE, |
1200 | |
1201 | #[cfg (feature = "ffmpeg_6_0" )] |
1202 | Pixel::VUYA => AV_PIX_FMT_VUYA, |
1203 | #[cfg (feature = "ffmpeg_6_0" )] |
1204 | Pixel::RGBAF16BE => AV_PIX_FMT_RGBAF16BE, |
1205 | #[cfg (feature = "ffmpeg_6_0" )] |
1206 | Pixel::RGBAF16LE => AV_PIX_FMT_RGBAF16LE, |
1207 | #[cfg (feature = "ffmpeg_6_0" )] |
1208 | Pixel::VUYX => AV_PIX_FMT_VUYX, |
1209 | #[cfg (feature = "ffmpeg_6_0" )] |
1210 | Pixel::P012LE => AV_PIX_FMT_P012LE, |
1211 | #[cfg (feature = "ffmpeg_6_0" )] |
1212 | Pixel::P012BE => AV_PIX_FMT_P012BE, |
1213 | #[cfg (feature = "ffmpeg_6_0" )] |
1214 | Pixel::Y212BE => AV_PIX_FMT_Y212BE, |
1215 | #[cfg (feature = "ffmpeg_6_0" )] |
1216 | Pixel::Y212LE => AV_PIX_FMT_Y212LE, |
1217 | #[cfg (feature = "ffmpeg_6_0" )] |
1218 | Pixel::XV30BE => AV_PIX_FMT_XV30BE, |
1219 | #[cfg (feature = "ffmpeg_6_0" )] |
1220 | Pixel::XV30LE => AV_PIX_FMT_XV30LE, |
1221 | #[cfg (feature = "ffmpeg_6_0" )] |
1222 | Pixel::XV36BE => AV_PIX_FMT_XV36BE, |
1223 | #[cfg (feature = "ffmpeg_6_0" )] |
1224 | Pixel::XV36LE => AV_PIX_FMT_XV36LE, |
1225 | #[cfg (feature = "ffmpeg_6_0" )] |
1226 | Pixel::RGBF32BE => AV_PIX_FMT_RGBF32BE, |
1227 | #[cfg (feature = "ffmpeg_6_0" )] |
1228 | Pixel::RGBF32LE => AV_PIX_FMT_RGBF32LE, |
1229 | #[cfg (feature = "ffmpeg_6_0" )] |
1230 | Pixel::RGBAF32BE => AV_PIX_FMT_RGBAF32BE, |
1231 | #[cfg (feature = "ffmpeg_6_0" )] |
1232 | Pixel::RGBAF32LE => AV_PIX_FMT_RGBAF32LE, |
1233 | |
1234 | #[cfg (feature = "ffmpeg_6_1" )] |
1235 | Pixel::P212BE => AV_PIX_FMT_P212BE, |
1236 | #[cfg (feature = "ffmpeg_6_1" )] |
1237 | Pixel::P212LE => AV_PIX_FMT_P212LE, |
1238 | #[cfg (feature = "ffmpeg_6_1" )] |
1239 | Pixel::P412BE => AV_PIX_FMT_P412BE, |
1240 | #[cfg (feature = "ffmpeg_6_1" )] |
1241 | Pixel::P412LE => AV_PIX_FMT_P412LE, |
1242 | #[cfg (feature = "ffmpeg_6_1" )] |
1243 | Pixel::GBRAP14BE => AV_PIX_FMT_GBRAP14BE, |
1244 | #[cfg (feature = "ffmpeg_6_1" )] |
1245 | Pixel::GBRAP14LE => AV_PIX_FMT_GBRAP14LE, |
1246 | |
1247 | #[cfg (feature = "rpi" )] |
1248 | Pixel::SAND128 => AV_PIX_FMT_SAND128, |
1249 | #[cfg (feature = "rpi" )] |
1250 | Pixel::SAND64_10 => AV_PIX_FMT_SAND64_10, |
1251 | #[cfg (feature = "rpi" )] |
1252 | Pixel::SAND64_16 => AV_PIX_FMT_SAND64_16, |
1253 | #[cfg (feature = "rpi" )] |
1254 | Pixel::RPI4_8 => AV_PIX_FMT_RPI4_8, |
1255 | #[cfg (feature = "rpi" )] |
1256 | Pixel::RPI4_10 => AV_PIX_FMT_RPI4_10, |
1257 | } |
1258 | } |
1259 | } |
1260 | |
1261 | #[derive (Debug)] |
1262 | pub enum ParsePixelError { |
1263 | NulError(NulError), |
1264 | UnknownFormat, |
1265 | } |
1266 | |
1267 | impl fmt::Display for ParsePixelError { |
1268 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
1269 | match *self { |
1270 | ParsePixelError::NulError(ref e: &NulError) => e.fmt(f), |
1271 | ParsePixelError::UnknownFormat => write!(f, "unknown pixel format" ), |
1272 | } |
1273 | } |
1274 | } |
1275 | |
1276 | impl error::Error for ParsePixelError { |
1277 | fn cause(&self) -> Option<&dyn error::Error> { |
1278 | match *self { |
1279 | ParsePixelError::NulError(ref e: &NulError) => Some(e), |
1280 | ParsePixelError::UnknownFormat => None, |
1281 | } |
1282 | } |
1283 | } |
1284 | |
1285 | impl From<NulError> for ParsePixelError { |
1286 | fn from(x: NulError) -> ParsePixelError { |
1287 | ParsePixelError::NulError(x) |
1288 | } |
1289 | } |
1290 | |
1291 | impl FromStr for Pixel { |
1292 | type Err = ParsePixelError; |
1293 | |
1294 | #[inline (always)] |
1295 | fn from_str(s: &str) -> Result<Pixel, ParsePixelError> { |
1296 | let cstring: CString = CString::new(s)?; |
1297 | let format: Pixel = unsafe { av_get_pix_fmt(cstring.as_ptr()) }.into(); |
1298 | |
1299 | if format == Pixel::None { |
1300 | Err(ParsePixelError::UnknownFormat) |
1301 | } else { |
1302 | Ok(format) |
1303 | } |
1304 | } |
1305 | } |
1306 | |