The open source OpenXR runtime
1// Copyright 2019-2022, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Header
6 * @author Pete Black <pblack@collabora.com>
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @ingroup drv_v4l2
9 */
10
11#pragma once
12
13#include "xrt/xrt_frameserver.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/*!
20 * @defgroup drv_v4l2 V4L2 frameserver driver
21 * @ingroup drv
22 *
23 * @brief Frameserver using the Video 4 Linux 2 framework.
24 */
25
26
27/*!
28 * Descriptor of a v4l2 source.
29 *
30 * @ingroup drv_v4l2
31 * @extends xrt_fs_mode
32 */
33struct v4l2_source_descriptor
34{
35 struct xrt_fs_mode base;
36
37 char format_name[32];
38
39 struct
40 {
41 uint32_t width;
42 uint32_t height;
43 uint32_t format;
44 uint8_t extended_format;
45
46 size_t size;
47 size_t stride;
48 } stream;
49
50 /*!
51 * Offset from start off frame to start of pixels.
52 *
53 * Also known as crop_scanline_bytes_start.
54 *
55 * Special case for ps4 camera
56 */
57 size_t offset;
58 uint32_t rate;
59};
60
61
62
63/*!
64 * Create a v4l2 frameserver
65 *
66 * @ingroup drv_v4l2
67 */
68struct xrt_fs *
69v4l2_fs_create(struct xrt_frame_context *xfctx,
70 const char *path,
71 const char *product,
72 const char *manufacturer,
73 const char *serial);
74
75
76#ifdef __cplusplus
77}
78#endif