Monado OpenXR Runtime
Loading...
Searching...
No Matches
uvc_internal.h
Go to the documentation of this file.
1// Copyright 2017, Philipp Zabel
2// Copyright 2019-2021, Jan Schmidt
3// Copyright 2025-2026, Beyley Cardellio
4// SPDX-License-Identifier: BSL-1.0
5/*!
6 * @file
7 * @brief Userspace UVC frameserver implementation
8 * @author Philipp Zabel <philipp.zabel@gmail.com>
9 * @author Jan Schmidt <jan@centricular.com>
10 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
11 * @ingroup drv_uvc
12 */
13
14#pragma once
15
16#include "os/os_threading.h"
17
18#include "util/u_sink.h"
19#include "util/u_logging.h"
20#include "util/u_var.h"
21
22#include "uvc_interface.h"
23
24
25struct uvc_fs
26{
27 struct xrt_fs base;
28
29 struct xrt_frame_node node;
30
31 struct u_sink_debug usd;
32
33 enum u_logging_level log_level;
34
35 struct xrt_fs_mode mode;
36
37 //! Target sink
39
40 struct uvc_stream_parameters parameters;
41
42 struct os_mutex frames_lock;
43 size_t num_free_frames;
44 struct xrt_frame **free_frames;
45
46 //! Frame data destination
48
49 //! Total size of a full frame in bytes
50 size_t frame_size;
51 //! Current frame ID
53 //! Current PTS being accumulated
54 uint32_t cur_pts;
55 //! Number of bytes collected from the current frame
57 //! true if we're skipping the current frame
59
60 //! Time at which we started skipping frames
62
63 //! USB streaming alt_setting
65
66 size_t num_transfers;
67 struct libusb_transfer **transfer;
68 size_t active_transfers;
69
70 libusb_context *usb_ctx;
71 libusb_device_handle *devh;
72
73 bool is_running;
74 struct xrt_frame *alloced_frames;
75 size_t num_alloced_frames;
76
77 void *get_frame_timestamp_user_data;
78 get_frame_timestamp_t get_frame_timestamp;
79};
u_logging_level
Logging level enum.
Definition u_logging.h:45
int64_t timepoint_ns
Integer timestamp type.
Definition u_time.h:77
Wrapper around OS threading native functions.
A wrapper around a native mutex.
Definition os_threading.h:69
Allows more safely to debug sink inputs and outputs.
Definition u_sink.h:211
Definition uvc_internal.h:26
int frame_id
Current frame ID.
Definition uvc_internal.h:52
bool skip_frame
true if we're skipping the current frame
Definition uvc_internal.h:58
size_t frame_collected
Number of bytes collected from the current frame.
Definition uvc_internal.h:56
struct xrt_frame * cur_frame
Frame data destination.
Definition uvc_internal.h:47
size_t frame_size
Total size of a full frame in bytes.
Definition uvc_internal.h:50
int alt_setting
USB streaming alt_setting.
Definition uvc_internal.h:64
struct xrt_frame_sink * sink
Target sink.
Definition uvc_internal.h:38
uint32_t cur_pts
Current PTS being accumulated.
Definition uvc_internal.h:54
timepoint_ns skip_frame_start
Time at which we started skipping frames.
Definition uvc_internal.h:61
Definition uvc_interface.h:66
A interface object used for destroying a frame graph.
Definition xrt_frame.h:87
A object that is sent frames.
Definition xrt_frame.h:58
Basic frame data structure - holds a pointer to buffer.
Definition xrt_frame.h:25
Definition xrt_frameserver.h:44
Frameserver that generates frames.
Definition xrt_frameserver.h:70
Basic logging functionality.
xrt_frame_sink converters and other helpers.
Variable tracking code.
Public interface for userspace UVC frameserver implementation.
bool(* get_frame_timestamp_t)(void *user_data, timepoint_ns *timestamp, uint32_t pts)
Called to get the timestamp of a specific frame, if a callee has a more precise way of timestamping f...
Definition uvc_interface.h:60