Zephyr API Documentation 4.4.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
video.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Linaro Limited.
3 * Copyright 2025 NXP
4 * Copyright (c) 2025 STMicroelectronics
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
14
15#ifndef ZEPHYR_INCLUDE_VIDEO_H_
16#define ZEPHYR_INCLUDE_VIDEO_H_
17
26
27#include <zephyr/device.h>
28#include <stddef.h>
29#include <zephyr/kernel.h>
30
31#include <zephyr/types.h>
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37struct video_control;
38
53
65
100
122
140
148 /* It must be kept as first field of the struct if used for @ref k_fifo APIs. */
173};
174
184
196
210
229
240
258
274
288
293
298typedef int (*video_api_format_t)(const struct device *dev, struct video_format *fmt);
299
304typedef int (*video_api_frmival_t)(const struct device *dev, struct video_frmival *frmival);
305
310typedef int (*video_api_enum_frmival_t)(const struct device *dev, struct video_frmival_enum *fie);
311
316typedef int (*video_api_enqueue_t)(const struct device *dev, struct video_buffer *buf);
317
322typedef int (*video_api_dequeue_t)(const struct device *dev, struct video_buffer **buf,
323 k_timeout_t timeout);
324
329typedef int (*video_api_flush_t)(const struct device *dev, bool cancel);
330
342typedef int (*video_api_set_stream_t)(const struct device *dev, bool enable,
343 enum video_buf_type type);
344
351typedef int (*video_api_ctrl_t)(const struct device *dev, uint32_t cid);
352
357typedef int (*video_api_get_caps_t)(const struct device *dev, struct video_caps *caps);
358
363typedef int (*video_api_transform_cap_t)(const struct device *const dev,
364 const struct video_format_cap *const cap,
365 struct video_format_cap *const res_cap,
366 enum video_buf_type type, uint16_t ind);
367
372typedef int (*video_api_set_signal_t)(const struct device *dev, struct k_poll_signal *sig);
373
377typedef int (*video_api_selection_t)(const struct device *dev, struct video_selection *sel);
378
448
452
466static inline int video_set_format(const struct device *dev, struct video_format *fmt)
467{
468 const struct video_driver_api *api;
469
470 if (dev == NULL || fmt == NULL) {
471 return -EINVAL;
472 }
473
474 api = (const struct video_driver_api *)dev->api;
475 if (api->set_format == NULL) {
476 return -ENOSYS;
477 }
478
479 return api->set_format(dev, fmt);
480}
481
492static inline int video_get_format(const struct device *dev, struct video_format *fmt)
493{
494 const struct video_driver_api *api;
495
496 if (dev == NULL || fmt == NULL) {
497 return -EINVAL;
498 }
499
500 api = (const struct video_driver_api *)dev->api;
501 if (api->get_format == NULL) {
502 return -ENOSYS;
503 }
504
505 return api->get_format(dev, fmt);
506}
507
524static inline int video_set_frmival(const struct device *dev, struct video_frmival *frmival)
525{
526 const struct video_driver_api *api;
527
528 if (dev == NULL || frmival == NULL) {
529 return -EINVAL;
530 }
531
532 if (frmival->numerator == 0 || frmival->denominator == 0) {
533 return -EINVAL;
534 }
535
536 api = (const struct video_driver_api *)dev->api;
537 if (api->set_frmival == NULL) {
538 return -ENOSYS;
539 }
540
541 return api->set_frmival(dev, frmival);
542}
543
557static inline int video_get_frmival(const struct device *dev, struct video_frmival *frmival)
558{
559 const struct video_driver_api *api;
560
561 if (dev == NULL || frmival == NULL) {
562 return -EINVAL;
563 }
564
565 api = (const struct video_driver_api *)dev->api;
566 if (api->get_frmival == NULL) {
567 return -ENOSYS;
568 }
569
570 return api->get_frmival(dev, frmival);
571}
572
590static inline int video_enum_frmival(const struct device *dev, struct video_frmival_enum *fie)
591{
592 const struct video_driver_api *api;
593
594 if (dev == NULL || fie == NULL || fie->format == NULL) {
595 return -EINVAL;
596 }
597
598 api = (const struct video_driver_api *)dev->api;
599 if (api->enum_frmival == NULL) {
600 return -ENOSYS;
601 }
602
603 return api->enum_frmival(dev, fie);
604}
605
619int video_enqueue(const struct device *dev, struct video_buffer *buf);
620
635static inline int video_dequeue(const struct device *dev, struct video_buffer **buf,
636 k_timeout_t timeout)
637{
638 const struct video_driver_api *api;
639
640 if (dev == NULL || buf == NULL) {
641 return -EINVAL;
642 }
643
644 api = (const struct video_driver_api *)dev->api;
645 if (api->dequeue == NULL) {
646 return -ENOSYS;
647 }
648
649 return api->dequeue(dev, buf, timeout);
650}
651
665static inline int video_flush(const struct device *dev, bool cancel)
666{
667 const struct video_driver_api *api;
668
669 if (dev == NULL) {
670 return -EINVAL;
671 }
672
673 api = (const struct video_driver_api *)dev->api;
674 if (api->flush == NULL) {
675 return -ENOSYS;
676 }
677
678 return api->flush(dev, cancel);
679}
680
697static inline int video_stream_start(const struct device *dev, enum video_buf_type type)
698{
699 const struct video_driver_api *api;
700
701 if (dev == NULL) {
702 return -EINVAL;
703 }
704
705 api = (const struct video_driver_api *)dev->api;
706 if (api->set_stream == NULL) {
707 return -ENOSYS;
708 }
709
710 return api->set_stream(dev, true, type);
711}
712
726static inline int video_stream_stop(const struct device *dev, enum video_buf_type type)
727{
728 const struct video_driver_api *api;
729 int ret;
730
731 if (dev == NULL) {
732 return -EINVAL;
733 }
734
735 api = (const struct video_driver_api *)dev->api;
736 if (api->set_stream == NULL) {
737 return -ENOSYS;
738 }
739
740 ret = api->set_stream(dev, false, type);
741 video_flush(dev, true);
742
743 return ret;
744}
745
754static inline int video_get_caps(const struct device *dev, struct video_caps *caps)
755{
756 const struct video_driver_api *api;
757
758 if (dev == NULL || caps == NULL ||
759 (caps->type != VIDEO_BUF_TYPE_INPUT && caps->type != VIDEO_BUF_TYPE_OUTPUT)) {
760 return -EINVAL;
761 }
762
763 api = (const struct video_driver_api *)dev->api;
764 if (api->get_caps == NULL) {
765 return -ENOSYS;
766 }
767
768 return api->get_caps(dev, caps);
769}
770
805static inline int video_transform_cap(const struct device *const dev,
806 const struct video_format_cap *const cap,
807 struct video_format_cap *const res_cap,
808 enum video_buf_type type, uint16_t ind)
809{
810 const struct video_driver_api *api;
811
812 if (dev == NULL || cap == NULL || res_cap == NULL ||
813 (type != VIDEO_BUF_TYPE_INPUT && type != VIDEO_BUF_TYPE_OUTPUT)) {
814 return -EINVAL;
815 }
816
817 api = (const struct video_driver_api *)dev->api;
818 if (api->transform_cap == NULL) {
819 return -ENOSYS;
820 }
821
822 return api->transform_cap(dev, cap, res_cap, type, ind);
823}
824
839int video_set_ctrl(const struct device *dev, struct video_control *control);
840
855int video_get_ctrl(const struct device *dev, struct video_control *control);
856
857struct video_ctrl_query;
858
878
888void video_print_ctrl(const struct video_ctrl_query *const cq);
889
902static inline int video_set_signal(const struct device *dev, struct k_poll_signal *sig)
903{
904 const struct video_driver_api *api;
905
906 if (dev == NULL || sig == NULL) {
907 return -EINVAL;
908 }
909
910 api = (const struct video_driver_api *)dev->api;
911 if (api->set_signal == NULL) {
912 return -ENOSYS;
913 }
914
915 return api->set_signal(dev, sig);
916}
917
937static inline int video_set_selection(const struct device *dev, struct video_selection *sel)
938{
939 const struct video_driver_api *api;
940
941 if (dev == NULL || sel == NULL) {
942 return -EINVAL;
943 }
944
945 api = (const struct video_driver_api *)dev->api;
946 if (api->set_selection == NULL) {
947 return -ENOSYS;
948 }
949
950 return api->set_selection(dev, sel);
951}
952
970static inline int video_get_selection(const struct device *dev, struct video_selection *sel)
971{
972 const struct video_driver_api *api;
973
974 if (dev == NULL || sel == NULL) {
975 return -EINVAL;
976 }
977
978 api = (const struct video_driver_api *)dev->api;
979 if (api->get_selection == NULL) {
980 return -ENOSYS;
981 }
982
983 return api->get_selection(dev, sel);
984}
985
995struct video_buffer *video_buffer_aligned_alloc(size_t size, size_t align, k_timeout_t timeout);
996
1006
1015
1026int video_format_caps_index(const struct video_format_cap *fmts, const struct video_format *fmt,
1027 size_t *idx);
1028
1036static inline uint64_t video_frmival_nsec(const struct video_frmival *frmival)
1037{
1038 if (frmival == NULL || frmival->denominator == 0) {
1039 return -EINVAL;
1040 }
1041
1042 return (uint64_t)NSEC_PER_SEC * frmival->numerator / frmival->denominator;
1043}
1044
1053 const struct video_frmival *desired,
1054 struct video_frmival *match);
1055
1073int video_closest_frmival(const struct device *dev, struct video_frmival_enum *match);
1074
1090int64_t video_get_csi_link_freq(const struct device *dev, uint8_t bpp, uint8_t lane_nb);
1091
1107
1127int video_set_compose_format(const struct device *dev, struct video_format *fmt);
1128
1143int video_transfer_buffer(const struct device *src, const struct device *sink,
1144 enum video_buf_type src_type, enum video_buf_type sink_type,
1145 k_timeout_t timeout);
1146
1154
1158#define VIDEO_FOURCC(a, b, c, d) \
1159 ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
1160
1170#define VIDEO_FOURCC_FROM_STR(str) VIDEO_FOURCC((str)[0], (str)[1], (str)[2], (str)[3])
1171
1181#define VIDEO_FOURCC_TO_STR(fourcc) \
1182 ((char[]){ \
1183 (char)((fourcc) & 0xFF), \
1184 (char)(((fourcc) >> 8) & 0xFF), \
1185 (char)(((fourcc) >> 16) & 0xFF), \
1186 (char)(((fourcc) >> 24) & 0xFF), \
1187 '\0' \
1188 })
1189
1203
1210#define VIDEO_FOREACH_BAYER(X, ...) \
1211 VIDEO_FOREACH_BAYER_PADDED(X, __VA_ARGS__) \
1212 VIDEO_FOREACH_BAYER_MIPI_PACKED(X, __VA_ARGS__) \
1213 VIDEO_FOREACH_BAYER_NON_PACKED(X, __VA_ARGS__)
1214
1221#define VIDEO_FOREACH_BAYER_PADDED(X, ...) \
1222 X(VIDEO_PIX_FMT_SBGGR8P16, __VA_ARGS__) \
1223 X(VIDEO_PIX_FMT_SGBRG8P16, __VA_ARGS__) \
1224 X(VIDEO_PIX_FMT_SGRBG8P16, __VA_ARGS__) \
1225 X(VIDEO_PIX_FMT_SRGGB8P16, __VA_ARGS__)
1226
1235#define VIDEO_PIX_FMT_SBGGR8P16 VIDEO_FOURCC('p', 'B', '8', '2')
1236
1245#define VIDEO_PIX_FMT_SGBRG8P16 VIDEO_FOURCC('p', 'G', '8', '2')
1246
1255#define VIDEO_PIX_FMT_SGRBG8P16 VIDEO_FOURCC('p', 'g', '8', '2')
1256
1265#define VIDEO_PIX_FMT_SRGGB8P16 VIDEO_FOURCC('p', 'R', '8', '2')
1266
1275#define VIDEO_FOREACH_BAYER_MIPI_PACKED(X, ...) \
1276 X(VIDEO_PIX_FMT_SBGGR10P, __VA_ARGS__) \
1277 X(VIDEO_PIX_FMT_SGBRG10P, __VA_ARGS__) \
1278 X(VIDEO_PIX_FMT_SGRBG10P, __VA_ARGS__) \
1279 X(VIDEO_PIX_FMT_SRGGB10P, __VA_ARGS__) \
1280 X(VIDEO_PIX_FMT_SBGGR12P, __VA_ARGS__) \
1281 X(VIDEO_PIX_FMT_SGBRG12P, __VA_ARGS__) \
1282 X(VIDEO_PIX_FMT_SGRBG12P, __VA_ARGS__) \
1283 X(VIDEO_PIX_FMT_SRGGB12P, __VA_ARGS__) \
1284 X(VIDEO_PIX_FMT_SBGGR14P, __VA_ARGS__) \
1285 X(VIDEO_PIX_FMT_SGBRG14P, __VA_ARGS__) \
1286 X(VIDEO_PIX_FMT_SGRBG14P, __VA_ARGS__) \
1287 X(VIDEO_PIX_FMT_SRGGB14P, __VA_ARGS__)
1288
1296#define VIDEO_PIX_FMT_SBGGR10P VIDEO_FOURCC('p', 'B', 'A', 'A')
1297
1305#define VIDEO_PIX_FMT_SGBRG10P VIDEO_FOURCC('p', 'G', 'A', 'A')
1306
1314#define VIDEO_PIX_FMT_SGRBG10P VIDEO_FOURCC('p', 'g', 'A', 'A')
1315
1323#define VIDEO_PIX_FMT_SRGGB10P VIDEO_FOURCC('p', 'R', 'A', 'A')
1324
1332#define VIDEO_PIX_FMT_SBGGR12P VIDEO_FOURCC('p', 'B', 'C', 'C')
1333
1341#define VIDEO_PIX_FMT_SGBRG12P VIDEO_FOURCC('p', 'G', 'C', 'C')
1342
1350#define VIDEO_PIX_FMT_SGRBG12P VIDEO_FOURCC('p', 'g', 'C', 'C')
1351
1359#define VIDEO_PIX_FMT_SRGGB12P VIDEO_FOURCC('p', 'R', 'C', 'C')
1360
1368#define VIDEO_PIX_FMT_SBGGR14P VIDEO_FOURCC('p', 'B', 'E', 'E')
1369
1377#define VIDEO_PIX_FMT_SGBRG14P VIDEO_FOURCC('p', 'G', 'E', 'E')
1378
1386#define VIDEO_PIX_FMT_SGRBG14P VIDEO_FOURCC('p', 'g', 'E', 'E')
1387
1395#define VIDEO_PIX_FMT_SRGGB14P VIDEO_FOURCC('p', 'R', 'E', 'E')
1396
1405#define VIDEO_FOREACH_BAYER_NON_PACKED(X, ...) \
1406 X(VIDEO_PIX_FMT_SBGGR8, __VA_ARGS__) \
1407 X(VIDEO_PIX_FMT_SGBRG8, __VA_ARGS__) \
1408 X(VIDEO_PIX_FMT_SGRBG8, __VA_ARGS__) \
1409 X(VIDEO_PIX_FMT_SRGGB8, __VA_ARGS__) \
1410 X(VIDEO_PIX_FMT_SGBRG10, __VA_ARGS__) \
1411 X(VIDEO_PIX_FMT_SGRBG10, __VA_ARGS__) \
1412 X(VIDEO_PIX_FMT_SRGGB10, __VA_ARGS__) \
1413 X(VIDEO_PIX_FMT_SBGGR12, __VA_ARGS__) \
1414 X(VIDEO_PIX_FMT_SGBRG12, __VA_ARGS__) \
1415 X(VIDEO_PIX_FMT_SGRBG12, __VA_ARGS__) \
1416 X(VIDEO_PIX_FMT_SRGGB12, __VA_ARGS__) \
1417 X(VIDEO_PIX_FMT_SBGGR14, __VA_ARGS__) \
1418 X(VIDEO_PIX_FMT_SGBRG14, __VA_ARGS__) \
1419 X(VIDEO_PIX_FMT_SGRBG14, __VA_ARGS__) \
1420 X(VIDEO_PIX_FMT_SRGGB14, __VA_ARGS__) \
1421 X(VIDEO_PIX_FMT_SBGGR16, __VA_ARGS__) \
1422 X(VIDEO_PIX_FMT_SGBRG16, __VA_ARGS__) \
1423 X(VIDEO_PIX_FMT_SGRBG16, __VA_ARGS__) \
1424 X(VIDEO_PIX_FMT_SRGGB16, __VA_ARGS__)
1425
1433#define VIDEO_PIX_FMT_SBGGR8 VIDEO_FOURCC('B', 'A', '8', '1')
1434
1442#define VIDEO_PIX_FMT_SGBRG8 VIDEO_FOURCC('G', 'B', 'R', 'G')
1443
1451#define VIDEO_PIX_FMT_SGRBG8 VIDEO_FOURCC('G', 'R', 'B', 'G')
1452
1460#define VIDEO_PIX_FMT_SRGGB8 VIDEO_FOURCC('R', 'G', 'G', 'B')
1461
1468#define VIDEO_PIX_FMT_SBGGR10 VIDEO_FOURCC('B', 'G', '1', '0')
1469
1476#define VIDEO_PIX_FMT_SGBRG10 VIDEO_FOURCC('G', 'B', '1', '0')
1477
1484#define VIDEO_PIX_FMT_SGRBG10 VIDEO_FOURCC('B', 'A', '1', '0')
1485
1492#define VIDEO_PIX_FMT_SRGGB10 VIDEO_FOURCC('R', 'G', '1', '0')
1493
1500#define VIDEO_PIX_FMT_SBGGR12 VIDEO_FOURCC('B', 'G', '1', '2')
1501
1508#define VIDEO_PIX_FMT_SGBRG12 VIDEO_FOURCC('G', 'B', '1', '2')
1509
1516#define VIDEO_PIX_FMT_SGRBG12 VIDEO_FOURCC('B', 'A', '1', '2')
1517
1524#define VIDEO_PIX_FMT_SRGGB12 VIDEO_FOURCC('R', 'G', '1', '2')
1525
1532#define VIDEO_PIX_FMT_SBGGR14 VIDEO_FOURCC('B', 'G', '1', '4')
1533
1540#define VIDEO_PIX_FMT_SGBRG14 VIDEO_FOURCC('G', 'B', '1', '4')
1541
1548#define VIDEO_PIX_FMT_SGRBG14 VIDEO_FOURCC('G', 'R', '1', '4')
1549
1556#define VIDEO_PIX_FMT_SRGGB14 VIDEO_FOURCC('R', 'G', '1', '4')
1557
1564#define VIDEO_PIX_FMT_SBGGR16 VIDEO_FOURCC('B', 'Y', 'R', '2')
1565
1572#define VIDEO_PIX_FMT_SGBRG16 VIDEO_FOURCC('G', 'B', '1', '6')
1573
1580#define VIDEO_PIX_FMT_SGRBG16 VIDEO_FOURCC('G', 'R', '1', '6')
1581
1588#define VIDEO_PIX_FMT_SRGGB16 VIDEO_FOURCC('R', 'G', '1', '6')
1589
1593
1605
1612#define VIDEO_FOREACH_GRAYSCALE(X, ...) \
1613 VIDEO_FOREACH_GRAYSCALE_NON_PACKED(X, __VA_ARGS__) \
1614 VIDEO_FOREACH_GRAYSCALE_PADDED(X, __VA_ARGS__) \
1615 VIDEO_FOREACH_GRAYSCALE_MIPI_PACKED(X, __VA_ARGS__)
1616
1625#define VIDEO_FOREACH_GRAYSCALE_NON_PACKED(X, ...) \
1626 X(VIDEO_PIX_FMT_GREY, __VA_ARGS__) \
1627 X(VIDEO_PIX_FMT_Y10, __VA_ARGS__) \
1628 X(VIDEO_PIX_FMT_Y12, __VA_ARGS__) \
1629 X(VIDEO_PIX_FMT_Y14, __VA_ARGS__) \
1630 X(VIDEO_PIX_FMT_Y16, __VA_ARGS__)
1631
1641#define VIDEO_PIX_FMT_GREY VIDEO_FOURCC('G', 'R', 'E', 'Y')
1642
1651#define VIDEO_PIX_FMT_Y10 VIDEO_FOURCC('Y', '1', '0', ' ')
1652
1661#define VIDEO_PIX_FMT_Y12 VIDEO_FOURCC('Y', '1', '2', ' ')
1662
1671#define VIDEO_PIX_FMT_Y14 VIDEO_FOURCC('Y', '1', '4', ' ')
1672
1681#define VIDEO_PIX_FMT_Y16 VIDEO_FOURCC('Y', '1', '6', ' ')
1682
1689#define VIDEO_FOREACH_GRAYSCALE_PADDED(X, ...) \
1690 X(VIDEO_PIX_FMT_Y8P16, __VA_ARGS__)
1691
1700#define VIDEO_PIX_FMT_Y8P16 VIDEO_FOURCC('Y', '8', 'P', '2')
1701
1708#define VIDEO_FOREACH_GRAYSCALE_MIPI_PACKED(X, ...) \
1709 X(VIDEO_PIX_FMT_Y10P, __VA_ARGS__) \
1710 X(VIDEO_PIX_FMT_Y12P, __VA_ARGS__) \
1711 X(VIDEO_PIX_FMT_Y14P, __VA_ARGS__)
1712
1719#define VIDEO_PIX_FMT_Y10P VIDEO_FOURCC('Y', '1', '0', 'P')
1720
1728#define VIDEO_PIX_FMT_Y12P VIDEO_FOURCC('Y', '1', '2', 'P')
1729
1737#define VIDEO_PIX_FMT_Y14P VIDEO_FOURCC('Y', '1', '4', 'P')
1738
1742
1748
1755#define VIDEO_FOREACH_RGB(X, ...) \
1756 VIDEO_FOREACH_RGB_PACKED(X, __VA_ARGS__) \
1757 VIDEO_FOREACH_RGB_NON_PACKED(X, __VA_ARGS__) \
1758 VIDEO_FOREACH_RGB_ALPHA(X, __VA_ARGS__) \
1759 VIDEO_FOREACH_RGB_PADDED(X, __VA_ARGS__)
1760
1769#define VIDEO_FOREACH_RGB_PACKED(X, ...) \
1770 X(VIDEO_PIX_FMT_RGB565X, __VA_ARGS__) \
1771 X(VIDEO_PIX_FMT_RGB565, __VA_ARGS__)
1772
1782#define VIDEO_PIX_FMT_RGB565X VIDEO_FOURCC('R', 'G', 'B', 'R')
1783
1793#define VIDEO_PIX_FMT_RGB565 VIDEO_FOURCC('R', 'G', 'B', 'P')
1794
1803#define VIDEO_FOREACH_RGB_NON_PACKED(X, ...) \
1804 X(VIDEO_PIX_FMT_BGR24, __VA_ARGS__) \
1805 X(VIDEO_PIX_FMT_RGB24, __VA_ARGS__)
1806
1814#define VIDEO_PIX_FMT_BGR24 VIDEO_FOURCC('B', 'G', 'R', '3')
1815
1823#define VIDEO_PIX_FMT_RGB24 VIDEO_FOURCC('R', 'G', 'B', '3')
1824
1833#define VIDEO_FOREACH_RGB_ALPHA(X, ...) \
1834 X(VIDEO_PIX_FMT_ARGB32, __VA_ARGS__) \
1835 X(VIDEO_PIX_FMT_ABGR32, __VA_ARGS__) \
1836 X(VIDEO_PIX_FMT_RGBA32, __VA_ARGS__) \
1837 X(VIDEO_PIX_FMT_BGRA32, __VA_ARGS__)
1838
1846#define VIDEO_PIX_FMT_ARGB32 VIDEO_FOURCC('B', 'A', '2', '4')
1847
1857#define VIDEO_PIX_FMT_BGRA32 VIDEO_FOURCC('A', 'R', '2', '4')
1858
1866#define VIDEO_PIX_FMT_RGBA32 VIDEO_FOURCC('A', 'B', '2', '4')
1867
1877#define VIDEO_PIX_FMT_ABGR32 VIDEO_FOURCC('R', 'A', '2', '4')
1878
1887#define VIDEO_FOREACH_RGB_PADDED(X, ...) \
1888 X(VIDEO_PIX_FMT_XRGB32, __VA_ARGS__)
1889
1897#define VIDEO_PIX_FMT_XRGB32 VIDEO_FOURCC('B', 'X', '2', '4')
1898
1908#define VIDEO_PIX_FMT_XBGR32 VIDEO_FOURCC('R', 'X', '2', '4')
1909
1919#define VIDEO_PIX_FMT_BGRX32 VIDEO_FOURCC('X', 'R', '2', '4')
1920
1928#define VIDEO_PIX_FMT_RGBX32 VIDEO_FOURCC('X', 'B', '2', '4')
1929
1933
1939
1946#define VIDEO_FOREACH_YUV(X, ...) \
1947 VIDEO_FOREACH_YUV_FULL_PLANAR(X, __VA_ARGS__) \
1948 VIDEO_FOREACH_YUV_NON_PLANAR(X, __VA_ARGS__) \
1949 VIDEO_FOREACH_YUV_SEMI_PLANAR(X, __VA_ARGS__)
1950
1957#define VIDEO_FOREACH_YUV_NON_PLANAR(X, ...) \
1958 X(VIDEO_PIX_FMT_YUYV, __VA_ARGS__) \
1959 X(VIDEO_PIX_FMT_YVYU, __VA_ARGS__) \
1960 X(VIDEO_PIX_FMT_VYUY, __VA_ARGS__) \
1961 X(VIDEO_PIX_FMT_UYVY, __VA_ARGS__) \
1962 X(VIDEO_PIX_FMT_YUV24, __VA_ARGS__) \
1963 X(VIDEO_PIX_FMT_XYUV32, __VA_ARGS__)
1964
1973#define VIDEO_PIX_FMT_YUYV VIDEO_FOURCC('Y', 'U', 'Y', 'V')
1974
1980#define VIDEO_PIX_FMT_YVYU VIDEO_FOURCC('Y', 'V', 'Y', 'U')
1981
1987#define VIDEO_PIX_FMT_VYUY VIDEO_FOURCC('V', 'Y', 'U', 'Y')
1988
1994#define VIDEO_PIX_FMT_UYVY VIDEO_FOURCC('U', 'Y', 'V', 'Y')
1995
2003#define VIDEO_PIX_FMT_XYUV32 VIDEO_FOURCC('X', 'Y', 'U', 'V')
2004
2012#define VIDEO_PIX_FMT_YUV24 VIDEO_FOURCC('Y', 'U', 'V', '3')
2013
2020#define VIDEO_FOREACH_YUV_SEMI_PLANAR(X, ...) \
2021 X(VIDEO_PIX_FMT_NV12, __VA_ARGS__) \
2022 X(VIDEO_PIX_FMT_NV21, __VA_ARGS__) \
2023 X(VIDEO_PIX_FMT_NV16, __VA_ARGS__) \
2024 X(VIDEO_PIX_FMT_NV61, __VA_ARGS__) \
2025 X(VIDEO_PIX_FMT_NV24, __VA_ARGS__) \
2026 X(VIDEO_PIX_FMT_NV42, __VA_ARGS__)
2027
2050#define VIDEO_PIX_FMT_NV12 VIDEO_FOURCC('N', 'V', '1', '2')
2051
2074#define VIDEO_PIX_FMT_NV21 VIDEO_FOURCC('N', 'V', '2', '1')
2075
2100#define VIDEO_PIX_FMT_NV16 VIDEO_FOURCC('N', 'V', '1', '6')
2101
2126
2127#define VIDEO_PIX_FMT_NV61 VIDEO_FOURCC('N', 'V', '6', '1')
2128
2153#define VIDEO_PIX_FMT_NV24 VIDEO_FOURCC('N', 'V', '2', '4')
2154
2179#define VIDEO_PIX_FMT_NV42 VIDEO_FOURCC('N', 'V', '4', '2')
2180
2187#define VIDEO_FOREACH_YUV_FULL_PLANAR(X, ...) \
2188 X(VIDEO_PIX_FMT_YUV420, __VA_ARGS__) \
2189 X(VIDEO_PIX_FMT_YVU420, __VA_ARGS__)
2190
2218#define VIDEO_PIX_FMT_YUV420 VIDEO_FOURCC('Y', 'U', '1', '2')
2219
2247#define VIDEO_PIX_FMT_YVU420 VIDEO_FOURCC('Y', 'V', '1', '2')
2248
2252
2257
2264#define VIDEO_FOREACH_COMPRESSED(X, ...) \
2265 X(VIDEO_PIX_FMT_JPEG, __VA_ARGS__) \
2266 X(VIDEO_PIX_FMT_H264, __VA_ARGS__) \
2267 X(VIDEO_PIX_FMT_H264_NO_SC, __VA_ARGS__) \
2268 X(VIDEO_PIX_FMT_PNG, __VA_ARGS__)
2269
2273#define VIDEO_PIX_FMT_JPEG VIDEO_FOURCC('J', 'P', 'E', 'G')
2274
2278#define VIDEO_PIX_FMT_H264 VIDEO_FOURCC('H', '2', '6', '4')
2279
2283#define VIDEO_PIX_FMT_H264_NO_SC VIDEO_FOURCC('A', 'V', 'C', '1')
2284
2288#define VIDEO_PIX_FMT_PNG VIDEO_FOURCC('P', 'N', 'G', ' ')
2289
2293
2295#define _VIDEO_FMT_OR_EQ(pixfmt_a, pixfmt_b) || ((pixfmt_a) == (pixfmt_b))
2297
2304#define VIDEO_FMT_IS_GRAYSCALE(pixfmt) \
2305 (0 VIDEO_FOREACH_GRAYSCALE(_VIDEO_FMT_OR_EQ, pixfmt))
2306
2313#define VIDEO_FMT_IS_BAYER(pixfmt) \
2314 (0 VIDEO_FOREACH_BAYER(_VIDEO_FMT_OR_EQ, pixfmt))
2315
2322#define VIDEO_FMT_IS_RGB(pixfmt) \
2323 (0 VIDEO_FOREACH_RGB(_VIDEO_FMT_OR_EQ, pixfmt))
2324
2331#define VIDEO_FMT_IS_YUV(pixfmt) \
2332 (0 VIDEO_FOREACH_YUV(_VIDEO_FMT_OR_EQ, pixfmt))
2333
2340#define VIDEO_FMT_IS_MIPI_PACKED(pixfmt) \
2341 (0 VIDEO_FOREACH_BAYER_MIPI_PACKED(_VIDEO_FMT_OR_EQ, pixfmt) \
2342 VIDEO_FOREACH_GRAYSCALE_MIPI_PACKED(_VIDEO_FMT_OR_EQ, pixfmt))
2343
2350#define VIDEO_FMT_IS_PADDED(pixfmt) \
2351 (0 VIDEO_FOREACH_BAYER_PADDED(_VIDEO_FMT_OR_EQ, pixfmt) \
2352 VIDEO_FOREACH_GRAYSCALE_PADDED(_VIDEO_FMT_OR_EQ, pixfmt))
2353
2360#define VIDEO_FMT_IS_SEMI_PLANAR(pixfmt) \
2361 (0 VIDEO_FOREACH_YUV_SEMI_PLANAR(_VIDEO_FMT_OR_EQ, pixfmt))
2362
2369#define VIDEO_FMT_IS_FULL_PLANAR(pixfmt) \
2370 (0 VIDEO_FOREACH_YUV_FULL_PLANAR(_VIDEO_FMT_OR_EQ, pixfmt))
2371
2380static inline unsigned int video_bits_per_pixel(uint32_t pixfmt)
2381{
2382 switch (pixfmt) {
2387 case VIDEO_PIX_FMT_GREY:
2388 return 8;
2393 case VIDEO_PIX_FMT_Y10P:
2394 return 10;
2399 case VIDEO_PIX_FMT_Y12P:
2400 case VIDEO_PIX_FMT_NV12:
2401 case VIDEO_PIX_FMT_NV21:
2404 return 12;
2409 case VIDEO_PIX_FMT_Y14P:
2410 return 14;
2412 case VIDEO_PIX_FMT_YUYV:
2413 case VIDEO_PIX_FMT_YVYU:
2414 case VIDEO_PIX_FMT_UYVY:
2415 case VIDEO_PIX_FMT_VYUY:
2437 case VIDEO_PIX_FMT_Y10:
2438 case VIDEO_PIX_FMT_Y12:
2439 case VIDEO_PIX_FMT_Y14:
2440 case VIDEO_PIX_FMT_Y16:
2441 case VIDEO_PIX_FMT_NV16:
2442 case VIDEO_PIX_FMT_NV61:
2443 return 16;
2446 case VIDEO_PIX_FMT_NV24:
2447 case VIDEO_PIX_FMT_NV42:
2449 return 24;
2459 return 32;
2460 default:
2461 /* Variable number of bits per pixel or unknown format */
2462 return 0;
2463 }
2464}
2465
2469
2480
2482#define VIDEO_MIPI_CSI2_DT_NULL 0x10
2484#define VIDEO_MIPI_CSI2_DT_BLANKING 0x11
2486#define VIDEO_MIPI_CSI2_DT_EMBEDDED_8 0x12
2488#define VIDEO_MIPI_CSI2_DT_YUV420_8 0x18
2490#define VIDEO_MIPI_CSI2_DT_YUV420_10 0x19
2492#define VIDEO_MIPI_CSI2_DT_YUV420_CSPS_8 0x1c
2494#define VIDEO_MIPI_CSI2_DT_YUV420_CSPS_10 0x1d
2496#define VIDEO_MIPI_CSI2_DT_YUV422_8 0x1e
2498#define VIDEO_MIPI_CSI2_DT_YUV422_10 0x1f
2500#define VIDEO_MIPI_CSI2_DT_RGB444 0x20
2502#define VIDEO_MIPI_CSI2_DT_RGB555 0x21
2504#define VIDEO_MIPI_CSI2_DT_RGB565 0x22
2506#define VIDEO_MIPI_CSI2_DT_RGB666 0x23
2508#define VIDEO_MIPI_CSI2_DT_RGB888 0x24
2510#define VIDEO_MIPI_CSI2_DT_RAW6 0x28
2512#define VIDEO_MIPI_CSI2_DT_RAW7 0x29
2514#define VIDEO_MIPI_CSI2_DT_RAW8 0x2a
2516#define VIDEO_MIPI_CSI2_DT_RAW10 0x2b
2518#define VIDEO_MIPI_CSI2_DT_RAW12 0x2c
2520#define VIDEO_MIPI_CSI2_DT_RAW14 0x2d
2521
2533#define VIDEO_MIPI_CSI2_DT_USER(n) (0x30 + (n))
2534
2538
2539#ifdef __cplusplus
2540}
2541#endif
2542
2546
2547#endif /* ZEPHYR_INCLUDE_VIDEO_H_ */
#define NSEC_PER_SEC
number of nanoseconds per second
Definition clock.h:113
#define EINVAL
Invalid argument.
Definition errno.h:60
#define ENOSYS
Function not implemented.
Definition errno.h:82
int(* video_api_enum_frmival_t)(const struct device *dev, struct video_frmival_enum *fie)
Callback API to enumerate supported frame intervals for a format.
Definition video.h:310
int(* video_api_get_caps_t)(const struct device *dev, struct video_caps *caps)
Callback API to get capabilities of a video endpoint.
Definition video.h:357
int(* video_api_transform_cap_t)(const struct device *const dev, const struct video_format_cap *const cap, struct video_format_cap *const res_cap, enum video_buf_type type, uint16_t ind)
Callback API to transform a format capability across m2m device endpoints.
Definition video.h:363
int(* video_api_dequeue_t)(const struct device *dev, struct video_buffer **buf, k_timeout_t timeout)
Callback API to dequeue a buffer from the driver outgoing queue.
Definition video.h:322
int(* video_api_ctrl_t)(const struct device *dev, uint32_t cid)
Callback API to set or get a video control value.
Definition video.h:351
int(* video_api_format_t)(const struct device *dev, struct video_format *fmt)
Callback API to set or get video format.
Definition video.h:298
int(* video_api_flush_t)(const struct device *dev, bool cancel)
Callback API to flush endpoint buffers.
Definition video.h:329
int(* video_api_selection_t)(const struct device *dev, struct video_selection *sel)
Callback API to set or get video selection (crop/compose).
Definition video.h:377
int(* video_api_set_stream_t)(const struct device *dev, bool enable, enum video_buf_type type)
Callback API to start or stop streaming on the video device.
Definition video.h:342
int(* video_api_set_signal_t)(const struct device *dev, struct k_poll_signal *sig)
Callback API to register or unregister poll signal for buffer events.
Definition video.h:372
int(* video_api_enqueue_t)(const struct device *dev, struct video_buffer *buf)
Callback API to enqueue a buffer in the driver incoming queue.
Definition video.h:316
int(* video_api_frmival_t)(const struct device *dev, struct video_frmival *frmival)
Callback API to set or get video frame interval.
Definition video.h:304
int video_enqueue(const struct device *dev, struct video_buffer *buf)
Enqueue a video buffer.
video_signal_result
Video signal result.
Definition video.h:235
static int video_transform_cap(const struct device *const dev, const struct video_format_cap *const cap, struct video_format_cap *const res_cap, enum video_buf_type type, uint16_t ind)
Transform a video format capability from one end to the other end of a m2m video device.
Definition video.h:805
struct video_buffer * video_buffer_aligned_alloc(size_t size, size_t align, k_timeout_t timeout)
Allocate aligned video buffer.
int video_set_ctrl(const struct device *dev, struct video_control *control)
Set the value of a control.
static int video_set_selection(const struct device *dev, struct video_selection *sel)
Set video selection (crop/compose).
Definition video.h:937
void video_print_ctrl(const struct video_ctrl_query *const cq)
Print all the information of a control.
int64_t video_get_csi_link_freq(const struct device *dev, uint8_t bpp, uint8_t lane_nb)
Return the link-frequency advertised by a device.
video_buf_memory
video_buf_memory enum
Definition video.h:59
static int video_dequeue(const struct device *dev, struct video_buffer **buf, k_timeout_t timeout)
Dequeue a video buffer.
Definition video.h:635
int video_transfer_buffer(const struct device *src, const struct device *sink, enum video_buf_type src_type, enum video_buf_type sink_type, k_timeout_t timeout)
Transfer a buffer between 2 video device.
video_frmival_type
Supported frame interval type of a video device.
Definition video.h:178
static uint64_t video_frmival_nsec(const struct video_frmival *frmival)
Compute the difference between two frame intervals.
Definition video.h:1036
int video_get_ctrl(const struct device *dev, struct video_control *control)
Get the current value of a control.
int video_estimate_fmt_size(struct video_format *fmt)
Estimate the size and pitch in bytes of a video_format.
static int video_enum_frmival(const struct device *dev, struct video_frmival_enum *fie)
List video frame intervals.
Definition video.h:590
static int video_stream_start(const struct device *dev, enum video_buf_type type)
Start the video device function.
Definition video.h:697
int video_query_ctrl(struct video_ctrl_query *cq)
Query information about a control.
static int video_get_caps(const struct device *dev, struct video_caps *caps)
Get the capabilities of a video endpoint.
Definition video.h:754
static int video_get_selection(const struct device *dev, struct video_selection *sel)
Get video selection (crop/compose).
Definition video.h:970
int video_closest_frmival(const struct device *dev, struct video_frmival_enum *match)
Find the closest match to a frame interval value within a video device.
int video_set_compose_format(const struct device *dev, struct video_format *fmt)
Set compose rectangle (if applicable) prior to setting format.
static int video_flush(const struct device *dev, bool cancel)
Flush endpoint buffers.
Definition video.h:665
static int video_stream_stop(const struct device *dev, enum video_buf_type type)
Stop the video device function.
Definition video.h:726
int video_buffer_release(struct video_buffer *buf)
Release a video buffer.
static int video_set_format(const struct device *dev, struct video_format *fmt)
Set video format.
Definition video.h:466
static int video_set_signal(const struct device *dev, struct k_poll_signal *sig)
Register/Unregister k_poll signal for a video endpoint.
Definition video.h:902
static int video_set_frmival(const struct device *dev, struct video_frmival *frmival)
Set video frame interval.
Definition video.h:524
video_buf_type
video_buf_type enum
Definition video.h:47
static int video_get_format(const struct device *dev, struct video_format *fmt)
Get video format.
Definition video.h:492
int video_format_caps_index(const struct video_format_cap *fmts, const struct video_format *fmt, size_t *idx)
Search for a format that matches in a list of capabilities.
video_selection_target
Video selection target.
Definition video.h:246
struct video_buffer * video_buffer_alloc(size_t size, k_timeout_t timeout)
Allocate video buffer.
static int video_get_frmival(const struct device *dev, struct video_frmival *frmival)
Get video frame interval.
Definition video.h:557
int video_closest_frmival_stepwise(const struct video_frmival_stepwise *stepwise, const struct video_frmival *desired, struct video_frmival *match)
Find the closest match to a frame interval value within a stepwise frame interval.
@ VIDEO_BUF_ABORTED
Buffer is aborted.
Definition video.h:237
@ VIDEO_BUF_DONE
Buffer is done.
Definition video.h:236
@ VIDEO_BUF_ERROR
Buffer is in error.
Definition video.h:238
@ VIDEO_MEMORY_INTERNAL
buffer is allocated from the internal video heap
Definition video.h:61
@ VIDEO_MEMORY_EXTERNAL
buffer is allocated from outside
Definition video.h:63
@ VIDEO_FRMIVAL_TYPE_DISCRETE
discrete frame interval type
Definition video.h:180
@ VIDEO_FRMIVAL_TYPE_STEPWISE
stepwise frame interval type
Definition video.h:182
@ VIDEO_BUF_TYPE_INPUT
input buffer type
Definition video.h:49
@ VIDEO_BUF_TYPE_OUTPUT
output buffer type
Definition video.h:51
@ VIDEO_SEL_TGT_COMPOSE_BOUND
Compose bound (aka the maximum compose achievable).
Definition video.h:256
@ VIDEO_SEL_TGT_COMPOSE
Current compose setting.
Definition video.h:254
@ VIDEO_SEL_TGT_NATIVE_SIZE
Native size of the input frame.
Definition video.h:252
@ VIDEO_SEL_TGT_CROP
Current crop setting.
Definition video.h:248
@ VIDEO_SEL_TGT_CROP_BOUND
Crop bound (aka the maximum crop achievable).
Definition video.h:250
#define VIDEO_PIX_FMT_SGRBG10
Definition video.h:1484
#define VIDEO_PIX_FMT_XYUV32
The first byte is empty (X) for each pixel.
Definition video.h:2003
#define VIDEO_PIX_FMT_SGRBG12P
Definition video.h:1350
#define VIDEO_PIX_FMT_RGB24
24 bit RGB format with 8 bit per component
Definition video.h:1823
#define VIDEO_PIX_FMT_Y10
Little endian, with the 6 most significant bits set to Zero.
Definition video.h:1651
#define VIDEO_PIX_FMT_NV24
Chroma (U/V) are not subsampled.
Definition video.h:2153
#define VIDEO_PIX_FMT_SGBRG8P16
8-bit bayer format, split in two 4-bit blocks each zero-padded, little endian.
Definition video.h:1245
#define VIDEO_PIX_FMT_SBGGR10
Definition video.h:1468
#define VIDEO_PIX_FMT_Y12
Little endian, with the 4 most significant bits set to Zero.
Definition video.h:1661
#define VIDEO_PIX_FMT_NV21
Chroma (U/V) are subsampled horizontaly and vertically.
Definition video.h:2074
#define VIDEO_PIX_FMT_SGRBG8
Definition video.h:1451
#define VIDEO_PIX_FMT_SRGGB10
Definition video.h:1492
#define VIDEO_PIX_FMT_Y12P
Definition video.h:1728
#define VIDEO_PIX_FMT_YVYU
Definition video.h:1980
#define VIDEO_PIX_FMT_NV61
Chroma (U/V) are subsampled horizontaly.
Definition video.h:2127
#define VIDEO_PIX_FMT_SRGGB12P
Definition video.h:1359
#define VIDEO_PIX_FMT_SBGGR10P
Definition video.h:1296
#define VIDEO_PIX_FMT_SBGGR14
Definition video.h:1532
#define VIDEO_PIX_FMT_SGRBG16
Definition video.h:1580
#define VIDEO_PIX_FMT_XBGR32
The first byte is empty (X) for each pixel.
Definition video.h:1908
#define VIDEO_PIX_FMT_SGRBG8P16
8-bit bayer format, split in two 4-bit blocks each zero-padded, little endian.
Definition video.h:1255
#define VIDEO_PIX_FMT_SRGGB16
Definition video.h:1588
#define VIDEO_PIX_FMT_Y10P
Definition video.h:1719
#define VIDEO_PIX_FMT_BGRA32
The last byte is alpha (A) for each pixel.
Definition video.h:1857
#define VIDEO_PIX_FMT_ARGB32
The first byte is alpha (A) for each pixel.
Definition video.h:1846
#define VIDEO_PIX_FMT_SRGGB10P
Definition video.h:1323
#define VIDEO_PIX_FMT_VYUY
Definition video.h:1987
#define VIDEO_PIX_FMT_SRGGB14P
Definition video.h:1395
#define VIDEO_PIX_FMT_SGBRG14
Definition video.h:1540
#define VIDEO_PIX_FMT_NV12
Chroma (U/V) are subsampled horizontaly and vertically.
Definition video.h:2050
#define VIDEO_PIX_FMT_SRGGB12
Definition video.h:1524
#define VIDEO_PIX_FMT_Y14
Little endian, with the 2 most significant bits set to Zero.
Definition video.h:1671
#define VIDEO_PIX_FMT_SGBRG16
Definition video.h:1572
#define VIDEO_PIX_FMT_SGBRG14P
Definition video.h:1377
#define VIDEO_PIX_FMT_XRGB32
The first byte is empty (X) for each pixel.
Definition video.h:1897
#define VIDEO_PIX_FMT_SGBRG10
Definition video.h:1476
#define VIDEO_PIX_FMT_RGBA32
The last byte is alpha (A) for each pixel.
Definition video.h:1866
#define VIDEO_PIX_FMT_YUV420
Chroma (U/V) are subsampled horizontaly and vertically.
Definition video.h:2218
#define VIDEO_PIX_FMT_YVU420
Chroma (U/V) are subsampled horizontaly and vertically.
Definition video.h:2247
#define VIDEO_PIX_FMT_SGRBG10P
Definition video.h:1314
#define VIDEO_PIX_FMT_SBGGR12
Definition video.h:1500
#define VIDEO_PIX_FMT_GREY
Same as Y8 (8-bit luma-only) following the standard FOURCC naming, or L8 in some graphics libraries.
Definition video.h:1641
#define VIDEO_PIX_FMT_SGBRG12
Definition video.h:1508
#define VIDEO_PIX_FMT_Y16
Little endian.
Definition video.h:1681
#define VIDEO_PIX_FMT_SRGGB14
Definition video.h:1556
#define VIDEO_PIX_FMT_SGBRG8
Definition video.h:1442
#define VIDEO_PIX_FMT_SRGGB8P16
8-bit bayer format, split in two 4-bit blocks each zero-padded, little endian.
Definition video.h:1265
#define VIDEO_PIX_FMT_SBGGR12P
Definition video.h:1332
#define VIDEO_PIX_FMT_SBGGR8P16
8-bit bayer format, split in two 4-bit blocks each zero-padded, little endian.
Definition video.h:1235
#define VIDEO_PIX_FMT_NV16
Chroma (U/V) are subsampled horizontaly.
Definition video.h:2100
#define VIDEO_PIX_FMT_SBGGR8
Definition video.h:1433
#define VIDEO_PIX_FMT_YUV24
24 bit YUV format with 8 bit per component
Definition video.h:2012
static unsigned int video_bits_per_pixel(uint32_t pixfmt)
Get number of bits per pixel of a pixel format.
Definition video.h:2380
#define VIDEO_PIX_FMT_SRGGB8
Definition video.h:1460
#define VIDEO_PIX_FMT_SBGGR14P
Definition video.h:1368
#define VIDEO_PIX_FMT_NV42
Chroma (U/V) are not subsampled.
Definition video.h:2179
#define VIDEO_PIX_FMT_YUYV
There is either a missing channel per pixel, U or V.
Definition video.h:1973
#define VIDEO_PIX_FMT_Y8P16
8-bit luma-only split in two 4-bit blocks each zero-padded, little endian.
Definition video.h:1700
#define VIDEO_PIX_FMT_SGBRG10P
Definition video.h:1305
#define VIDEO_PIX_FMT_Y14P
Definition video.h:1737
#define VIDEO_PIX_FMT_UYVY
Definition video.h:1994
#define VIDEO_PIX_FMT_BGRX32
The last byte is empty (X) for each pixel.
Definition video.h:1919
#define VIDEO_PIX_FMT_RGBX32
The last byte is empty (X) for each pixel.
Definition video.h:1928
#define VIDEO_PIX_FMT_SGRBG14P
Definition video.h:1386
#define VIDEO_PIX_FMT_SBGGR16
Definition video.h:1564
#define VIDEO_PIX_FMT_SGBRG12P
Definition video.h:1341
#define VIDEO_PIX_FMT_RGB565
5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0].
Definition video.h:1793
#define VIDEO_PIX_FMT_SGRBG12
Definition video.h:1516
#define VIDEO_PIX_FMT_BGR24
24 bit RGB format with 8 bit per component
Definition video.h:1814
#define VIDEO_PIX_FMT_SGRBG14
Definition video.h:1548
#define VIDEO_PIX_FMT_ABGR32
The first byte is alpha (A) for each pixel.
Definition video.h:1877
#define NULL
Definition iar_missing_defs.h:20
Public kernel APIs.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT64_TYPE__ int64_t
Definition stdint.h:75
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:519
Definition kernel.h:6566
Kernel timeout type.
Definition clock.h:65
Video buffer structure.
Definition video.h:146
uint32_t bytesused
number of bytes occupied by the valid data in the buffer.
Definition video.h:161
uint32_t size
size of the buffer in bytes.
Definition video.h:159
enum video_buf_type type
type of the buffer
Definition video.h:151
uint8_t memory
type of the buffer memory, see video_buf_memory
Definition video.h:153
uint8_t * buffer
pointer to the start of the buffer.
Definition video.h:155
uint16_t index
index of the buffer in the video buffer pool
Definition video.h:157
void * driver_data
Pointer to driver specific data.
Definition video.h:149
uint16_t line_offset
Line offset within frame this buffer represents, from the beginning of the frame.
Definition video.h:172
uint32_t timestamp
time reference in milliseconds at which the last data byte was actually received for input endpoints ...
Definition video.h:166
Video format capabilities.
Definition video.h:128
uint8_t min_vbuf_count
minimal count of video buffers to enqueue before being able to start the stream.
Definition video.h:136
enum video_buf_type type
type of the buffer
Definition video.h:130
size_t buf_align
requirement on the buffer alignment, in bytes
Definition video.h:138
const struct video_format_cap * format_caps
list of video format capabilities (zero terminated).
Definition video.h:132
Video control structure.
Definition video-controls.h:467
Definition video-controls.h:514
const struct device * dev
device being queried, application needs to set this field
Definition video-controls.h:516
<span class="mlabel">Driver Operations</span> Video driver operations
Definition video.h:382
video_api_transform_cap_t transform_cap
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:446
video_api_format_t set_format
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition video.h:386
video_api_ctrl_t set_ctrl
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:414
video_api_enqueue_t enqueue
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:402
video_api_set_signal_t set_signal
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:422
video_api_enum_frmival_t enum_frmival
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:434
video_api_get_caps_t get_caps
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition video.h:398
video_api_selection_t get_selection
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:442
video_api_selection_t set_selection
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:438
video_api_format_t get_format
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition video.h:390
video_api_flush_t flush
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:410
video_api_dequeue_t dequeue
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:406
video_api_frmival_t get_frmival
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:430
video_api_frmival_t set_frmival
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:426
video_api_set_stream_t set_stream
<span class="op-badge op-req" title="This operation MUST be implemented by the driver....
Definition video.h:394
video_api_ctrl_t get_volatile_ctrl
<span class="op-badge op-opt" title="This operation MAY optionally be implemented by the driver....
Definition video.h:418
Video format capability.
Definition video.h:106
uint16_t height_step
height step size in pixels.
Definition video.h:120
uint32_t width_min
minimum supported frame width in pixels.
Definition video.h:110
uint32_t width_max
maximum supported frame width in pixels.
Definition video.h:112
uint16_t width_step
width step size in pixels.
Definition video.h:118
uint32_t height_max
maximum supported frame height in pixels.
Definition video.h:116
uint32_t height_min
minimum supported frame height in pixels.
Definition video.h:114
uint32_t pixelformat
FourCC pixel format value (Video pixel formats).
Definition video.h:108
Video format structure.
Definition video.h:71
uint32_t height
frame height in pixels.
Definition video.h:79
enum video_buf_type type
type of the buffer
Definition video.h:73
uint32_t size
size of the buffer in bytes, need to be set by the drivers
Definition video.h:98
uint32_t width
frame width in pixels.
Definition video.h:77
uint32_t pitch
line stride.
Definition video.h:87
uint32_t pixelformat
FourCC pixel format value (Video pixel formats).
Definition video.h:75
Video frame interval enumeration structure.
Definition video.h:216
uint32_t index
frame interval index during enumeration
Definition video.h:218
const struct video_format * format
video format for which the query is made
Definition video.h:220
struct video_frmival_stepwise stepwise
Definition video.h:226
enum video_frmival_type type
frame interval type the device supports
Definition video.h:222
struct video_frmival discrete
Definition video.h:225
Video frame interval stepwise structure.
Definition video.h:202
struct video_frmival min
minimum frame interval in seconds
Definition video.h:204
struct video_frmival max
maximum frame interval in seconds
Definition video.h:206
struct video_frmival step
frame interval step size in seconds
Definition video.h:208
Video frame interval structure.
Definition video.h:190
uint32_t numerator
numerator of the frame interval
Definition video.h:192
uint32_t denominator
denominator of the frame interval
Definition video.h:194
Description of a rectangle area.
Definition video.h:264
uint32_t width
width of selection rectangle
Definition video.h:270
uint32_t height
height of selection rectangle
Definition video.h:272
uint32_t top
top offset of selection rectangle
Definition video.h:268
uint32_t left
left offset of selection rectangle
Definition video.h:266
Video selection (crop / compose) structure.
Definition video.h:280
struct video_rect rect
selection target rectangle
Definition video.h:286
enum video_buf_type type
buffer type, allow to select for device having both input and output
Definition video.h:282
enum video_selection_target target
selection target enum
Definition video.h:284