VirtualBox

source: vbox/trunk/include/VBox/RemoteDesktop/VRDEVideoIn.h@ 106880

Last change on this file since 106880 was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.0 KB
Line 
1/** @file
2 * VBox Remote Desktop Extension (VRDE) - Video Input interface.
3 */
4
5/*
6 * Copyright (C) 2012-2024 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_RemoteDesktop_VRDEVideoIn_h
37#define VBOX_INCLUDED_RemoteDesktop_VRDEVideoIn_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42
43/* Define VRDE_VIDEOIN_WITH_VRDEINTERFACE to include the server VRDE interface parts. */
44
45#ifdef VRDE_VIDEOIN_WITH_VRDEINTERFACE
46# include <VBox/RemoteDesktop/VRDE.h>
47#endif /* VRDE_VIDEOIN_WITH_VRDEINTERFACE */
48
49#ifdef AssertCompileSize
50# define ASSERTSIZE(type, size) AssertCompileSize(type, size);
51#else
52# define ASSERTSIZE(type, size)
53#endif /* AssertCompileSize */
54
55#include <iprt/types.h>
56
57
58/*
59 * Interface for accessing a video camera device on the client.
60 *
61 * Async callbacks are used for providing feedback, reporting errors, etc.
62 *
63 * Initial version supports: Camera + Processing Unit + Streaming Control.
64 *
65 * There are 2 modes:
66 * 1) The virtual WebCam is already attached to the guest.
67 * 2) The virtual WebCam will be attached when the client has it.
68 *
69 * Initially the mode 1 is supported.
70 *
71 * Mode 1 details:
72 * The WebCam has some fixed functionality, according to the descriptors,
73 * which has been already read by the guest. So some of functions will
74 * not work if the client does not support them.
75 *
76 * Mode 2 details:
77 * Virtual WebCam descriptors are built from the client capabilities.
78 *
79 * Similarly to the smartcard, the server will inform the ConsoleVRDE that there is a WebCam.
80 * ConsoleVRDE creates a VRDEVIDEOIN handle and forwards virtual WebCam requests to it.
81 *
82 * Interface with VBox.
83 *
84 * Virtual WebCam ConsoleVRDE VRDE
85 *
86 * Negotiate <->
87 * <- VideoInDeviceNotify(Attached, DeviceId)
88 * -> GetDeviceDesc
89 * <- DeviceDesc
90 * 2 <- CreateCamera
91 * 2 CameraCreated ->
92 *
93 * CameraRequest -> Request ->
94 * Response <- <- Response <- Response
95 * Frame <- <- Frame <- Frame
96 * <- VideoInDeviceNotify(Detached, DeviceId)
97 *
98 * Unsupported requests fail.
99 * The Device Description received from the client may be used to validate WebCam requests
100 * in the ConsoleVRDE code, for example filter out unsupported requests.
101 *
102 */
103
104/* All structures in this file are packed.
105 * Everything is little-endian.
106 */
107#pragma pack(1)
108
109/*
110 * The interface supports generic video input descriptors, capabilities and controls:
111 * * Descriptors
112 * + Interface
113 * - Input, Camera Terminal
114 * - Processing Unit
115 * + Video Streaming
116 * - Input Header
117 * - Payload Format
118 * - Video Frame
119 * - Still Image Frame
120 * * Video Control requests
121 * + Interface
122 * - Power Mode
123 * + Unit and Terminal
124 * camera
125 * - Scanning Mode (interlaced, progressive)
126 * - Auto-Exposure Mode
127 * - Auto-Exposure Priority
128 * - Exposure Time Absolute, Relative
129 * - Focus Absolute, Relative, Auto
130 * - Iris Absolute, Relative
131 * - Zoom Absolute, Relative
132 * - PanTilt Absolute, Relative
133 * - Roll Absolute, Relative
134 * - Privacy
135 * processing
136 * - Backlight Compensation
137 * - Brightness
138 * - Contrast
139 * - Gain
140 * - Power Line Frequency
141 * - Hue Manual, Auto
142 * - Saturation
143 * - Sharpness
144 * - Gamma
145 * - White Balance Temperature Manual, Auto
146 * - White Balance Component Manual, Auto
147 * - Digital Multiplier
148 * - Digital Multiplier Limit
149 * * Video Streaming requests
150 * + Interface
151 * - Synch Delay
152 * - Still Image Trigger
153 * - Generate Key Frame
154 * - Update Frame Segment
155 * - Stream Error Code
156 *
157 *
158 * Notes:
159 * * still capture uses a method similar to method 2, because the still frame will
160 * be send instead of video over the channel.
161 * Also the method 2 can be in principle emulated by both 1 and 3 on the client.
162 * However the client can initiate a still frame transfer, similar to hardware button trigger.
163 * * all control changes are async.
164 * * probe/commit are not used. The server can select a supported format/frame from the list.
165 * * no color matching. sRGB is the default.
166 * * most of constants are the same as in USB Video Class spec, but they are not the same and
167 * should be always converted.
168 */
169
170/*
171 * The DEVICEDEC describes the device and provides a list of supported formats:
172 * VRDEVIDEOINDEVICEDESC
173 * VRDEVIDEOINFORMATDESC[0];
174 * VRDEVIDEOINFRAMEDESC[0..N-1]
175 * VRDEVIDEOINFORMATDESC[1];
176 * VRDEVIDEOINFRAMEDESC[0..M-1]
177 * ...
178 */
179
180typedef struct VRDEVIDEOINDEVICEDESC
181{
182 uint16_t u16ObjectiveFocalLengthMin;
183 uint16_t u16ObjectiveFocalLengthMax;
184 uint16_t u16OcularFocalLength;
185 uint16_t u16MaxMultiplier;
186 uint32_t fu32CameraControls; /* VRDE_VIDEOIN_F_CT_CTRL_* */
187 uint32_t fu32ProcessingControls; /* VRDE_VIDEOIN_F_PU_CTRL_* */
188 uint8_t fu8DeviceCaps; /* VRDE_VIDEOIN_F_DEV_CAP_* */
189 uint8_t u8NumFormats; /* Number of following VRDEVIDEOINFORMATDESC structures. */
190 uint16_t cbExt; /* Size of the optional extended description. */
191 /* An extended description may follow. */
192 /* An array of VRDEVIDEOINFORMATDESC follows. */
193} VRDEVIDEOINDEVICEDESC;
194
195/* VRDEVIDEOINDEVICEDESC::fu32CameraControls */
196#define VRDE_VIDEOIN_F_CT_CTRL_SCANNING_MODE 0x00000001 /* D0: Scanning Mode */
197#define VRDE_VIDEOIN_F_CT_CTRL_AE_MODE 0x00000002 /* D1: Auto-Exposure Mode */
198#define VRDE_VIDEOIN_F_CT_CTRL_AE_PRIORITY 0x00000004 /* D2: Auto-Exposure Priority */
199#define VRDE_VIDEOIN_F_CT_CTRL_EXPOSURE_TIME_ABSOLUTE 0x00000008 /* D3: Exposure Time (Absolute) */
200#define VRDE_VIDEOIN_F_CT_CTRL_EXPOSURE_TIME_RELATIVE 0x00000010 /* D4: Exposure Time (Relative) */
201#define VRDE_VIDEOIN_F_CT_CTRL_FOCUS_ABSOLUTE 0x00000020 /* D5: Focus (Absolute) */
202#define VRDE_VIDEOIN_F_CT_CTRL_FOCUS_RELATIVE 0x00000040 /* D6: Focus (Relative) */
203#define VRDE_VIDEOIN_F_CT_CTRL_IRIS_ABSOLUTE 0x00000080 /* D7: Iris (Absolute) */
204#define VRDE_VIDEOIN_F_CT_CTRL_IRIS_RELATIVE 0x00000100 /* D8: Iris (Relative) */
205#define VRDE_VIDEOIN_F_CT_CTRL_ZOOM_ABSOLUTE 0x00000200 /* D9: Zoom (Absolute) */
206#define VRDE_VIDEOIN_F_CT_CTRL_ZOOM_RELATIVE 0x00000400 /* D10: Zoom (Relative) */
207#define VRDE_VIDEOIN_F_CT_CTRL_PANTILT_ABSOLUTE 0x00000800 /* D11: PanTilt (Absolute) */
208#define VRDE_VIDEOIN_F_CT_CTRL_PANTILT_RELATIVE 0x00001000 /* D12: PanTilt (Relative) */
209#define VRDE_VIDEOIN_F_CT_CTRL_ROLL_ABSOLUTE 0x00002000 /* D13: Roll (Absolute) */
210#define VRDE_VIDEOIN_F_CT_CTRL_ROLL_RELATIVE 0x00004000 /* D14: Roll (Relative) */
211#define VRDE_VIDEOIN_F_CT_CTRL_RESERVED1 0x00008000 /* D15: Reserved */
212#define VRDE_VIDEOIN_F_CT_CTRL_RESERVED2 0x00010000 /* D16: Reserved */
213#define VRDE_VIDEOIN_F_CT_CTRL_FOCUS_AUTO 0x00020000 /* D17: Focus, Auto */
214#define VRDE_VIDEOIN_F_CT_CTRL_PRIVACY 0x00040000 /* D18: Privacy */
215
216/* VRDEVIDEOINDEVICEDESC::fu32ProcessingControls */
217#define VRDE_VIDEOIN_F_PU_CTRL_BRIGHTNESS 0x00000001 /* D0: Brightness */
218#define VRDE_VIDEOIN_F_PU_CTRL_CONTRAST 0x00000002 /* D1: Contrast */
219#define VRDE_VIDEOIN_F_PU_CTRL_HUE 0x00000004 /* D2: Hue */
220#define VRDE_VIDEOIN_F_PU_CTRL_SATURATION 0x00000008 /* D3: Saturation */
221#define VRDE_VIDEOIN_F_PU_CTRL_SHARPNESS 0x00000010 /* D4: Sharpness */
222#define VRDE_VIDEOIN_F_PU_CTRL_GAMMA 0x00000020 /* D5: Gamma */
223#define VRDE_VIDEOIN_F_PU_CTRL_WHITE_BALANCE_TEMPERATURE 0x00000040 /* D6: White Balance Temperature */
224#define VRDE_VIDEOIN_F_PU_CTRL_WHITE_BALANCE_COMPONENT 0x00000080 /* D7: White Balance Component */
225#define VRDE_VIDEOIN_F_PU_CTRL_BACKLIGHT_COMPENSATION 0x00000100 /* D8: Backlight Compensation */
226#define VRDE_VIDEOIN_F_PU_CTRL_GAIN 0x00000200 /* D9: Gain */
227#define VRDE_VIDEOIN_F_PU_CTRL_POWER_LINE_FREQUENCY 0x00000400 /* D10: Power Line Frequency */
228#define VRDE_VIDEOIN_F_PU_CTRL_HUE_AUTO 0x00000800 /* D11: Hue, Auto */
229#define VRDE_VIDEOIN_F_PU_CTRL_WHITE_BALANCE_TEMPERATURE_AUTO 0x00001000 /* D12: White Balance Temperature, Auto */
230#define VRDE_VIDEOIN_F_PU_CTRL_WHITE_BALANCE_COMPONENT_AUTO 0x00002000 /* D13: White Balance Component, Auto */
231#define VRDE_VIDEOIN_F_PU_CTRL_DIGITAL_MULTIPLIER 0x00004000 /* D14: Digital Multiplier */
232#define VRDE_VIDEOIN_F_PU_CTRL_DIGITAL_MULTIPLIER_LIMIT 0x00008000 /* D15: Digital Multiplier Limit */
233
234/* VRDEVIDEOINDEVICEDESC::fu8DeviceCaps */
235#define VRDE_VIDEOIN_F_DEV_CAP_DYNAMICCHANGE 0x01 /* Whether dynamic format change is supported. */
236#define VRDE_VIDEOIN_F_DEV_CAP_TRIGGER 0x02 /* Whether hardware triggering is supported. */
237#define VRDE_VIDEOIN_F_DEV_CAP_TRIGGER_USAGE 0x04 /* 0 - still image, 1 - generic button event.*/
238
239/* VRDEVIDEOINDEVICEDESC extended description. */
240typedef struct VRDEVIDEOINDEVICEEXT
241{
242 uint32_t fu32Fields;
243 /* One or more VRDEVIDEOINDEVICEFIELD follow. */
244} VRDEVIDEOINDEVICEEXT;
245
246typedef struct VRDEVIDEOINDEVICEFIELDHDR
247{
248 uint16_t cbField; /* Number of bytes reserved for this field. */
249} VRDEVIDEOINDEVICEFIELDHDR;
250
251/* VRDEVIDEOINDEVICEDESC::fu32Fields */
252#define VRDE_VIDEOIN_F_DEV_EXT_NAME 0x00000001 /* Utf8 device name. */
253#define VRDE_VIDEOIN_F_DEV_EXT_SERIAL 0x00000002 /* Utf8 device serial number. */
254
255/* The video format descriptor. */
256typedef struct VRDEVIDEOINFORMATDESC
257{
258 uint16_t cbFormat; /* Size of the structure including cbFormat and format specific data. */
259 uint8_t u8FormatId; /* The unique identifier of the format on the client. */
260 uint8_t u8FormatType; /* MJPEG etc. VRDE_VIDEOIN_FORMAT_* */
261 uint8_t u8FormatFlags; /* VRDE_VIDEOIN_F_FMT_* */
262 uint8_t u8NumFrames; /* Number of following VRDEVIDEOINFRAMEDESC structures. */
263 uint16_t u16Reserved; /* Must be set to 0. */
264 /* Other format specific data may follow. */
265 /* An array of VRDEVIDEOINFRAMEDESC follows. */
266} VRDEVIDEOINFORMATDESC;
267
268/* VRDEVIDEOINFORMATDESC::u8FormatType */
269#define VRDE_VIDEOIN_FORMAT_UNCOMPRESSED 0x04
270#define VRDE_VIDEOIN_FORMAT_MJPEG 0x06
271#define VRDE_VIDEOIN_FORMAT_MPEG2TS 0x0A
272#define VRDE_VIDEOIN_FORMAT_DV 0x0C
273#define VRDE_VIDEOIN_FORMAT_FRAME_BASED 0x10
274#define VRDE_VIDEOIN_FORMAT_STREAM_BASED 0x12
275
276/* VRDEVIDEOINFORMATDESC::u8FormatFlags. */
277#define VRDE_VIDEOIN_F_FMT_GENERATEKEYFRAME 0x01 /* Supports Generate Key Frame */
278#define VRDE_VIDEOIN_F_FMT_UPDATEFRAMESEGMENT 0x02 /* Supports Update Frame Segment */
279#define VRDE_VIDEOIN_F_FMT_COPYPROTECT 0x04 /* If duplication should be restricted. */
280#define VRDE_VIDEOIN_F_FMT_COMPQUALITY 0x08 /* If the format supports an adjustable compression quality. */
281
282typedef struct VRDEVIDEOINFRAMEDESC
283{
284 uint16_t cbFrame; /* Size of the structure including cbFrame and frame specific data. */
285 uint8_t u8FrameId; /* The unique identifier of the frame for the corresponding format on the client. */
286 uint8_t u8FrameFlags;
287 uint16_t u16Width;
288 uint16_t u16Height;
289 uint32_t u32NumFrameIntervals; /* The number of supported frame intervals. */
290 uint32_t u32MinFrameInterval; /* Shortest frame interval supported (at highest frame rate), in 100ns units. */
291 uint32_t u32MaxFrameInterval; /* Longest frame interval supported (at lowest frame rate), in 100ns units. */
292 /* Supported frame intervals (in 100ns units) follow if VRDE_VIDEOIN_F_FRM_DISCRETE_INTERVALS is set.
293 * uint32_t au32FrameIntervals[u32NumFrameIntervals];
294 */
295 /* Supported min and max bitrate in bits per second follow if VRDE_VIDEOIN_F_FRM_BITRATE is set.
296 * uint32_t u32MinBitRate;
297 * uint32_t u32MaxBitRate;
298 */
299 /* Other frame specific data may follow. */
300} VRDEVIDEOINFRAMEDESC;
301
302/* VRDEVIDEOINFRAMEDESC::u8FrameFlags. */
303#define VRDE_VIDEOIN_F_FRM_STILL 0x01 /* If still images are supported for this frame. */
304#define VRDE_VIDEOIN_F_FRM_DISCRETE_INTERVALS 0x02 /* If the discrete intervals list is included. */
305#define VRDE_VIDEOIN_F_FRM_BITRATE 0x04 /* If the bitrate fields are included. */
306#define VRDE_VIDEOIN_F_FRM_SIZE_OF_FIELDS 0x08 /* If the all optional fields start with 16 bit field size. */
307
308/*
309 * Controls.
310 *
311 * The same structures are used for both SET and GET requests.
312 * Requests are async. A callback is invoked, when the client returns a reply.
313 * A control change notification also uses these structures.
314 *
315 * If a control request can not be fulfilled, then VRDE_VIDEOIN_CTRLHDR_F_FAIL
316 * will be set and u8Status contains the error code. This replaces the VC_REQUEST_ERROR_CODE_CONTROL.
317 *
318 * If the client receives an unsupported control, then the client must ignore it.
319 * That is the control request must not affect the client in any way.
320 * The client may send a VRDEVIDEOINCTRLHDR response for the unsupported control with:
321 * u16ControlSelector = the received value;
322 * u16RequestType = the received value;
323 * u16ParmSize = 0;
324 * u8Flags = VRDE_VIDEOIN_CTRLHDR_F_FAIL;
325 * u8Status = VRDE_VIDEOIN_CTRLHDR_STATUS_INVALIDCONTROL;
326 */
327
328typedef struct VRDEVIDEOINCTRLHDR
329{
330 uint16_t u16ControlSelector; /* VRDE_VIDEOIN_CTRLSEL_* */
331 uint16_t u16RequestType; /* VRDE_VIDEOIN_CTRLREQ_* */
332 uint16_t u16ParmSize; /* The size of the control specific parameters. */
333 uint8_t u8Flags; /* VRDE_VIDEOIN_CTRLHDR_F_* */
334 uint8_t u8Status; /* VRDE_VIDEOIN_CTRLHDR_STATUS_* */
335 /* Control specific data follows. */
336} VRDEVIDEOINCTRLHDR;
337
338/* Control request types: VRDEVIDEOINCTRLHDR::u16RequestType. */
339#define VRDE_VIDEOIN_CTRLREQ_UNDEFINED 0x00
340#define VRDE_VIDEOIN_CTRLREQ_SET_CUR 0x01
341#define VRDE_VIDEOIN_CTRLREQ_GET_CUR 0x81
342#define VRDE_VIDEOIN_CTRLREQ_GET_MIN 0x82
343#define VRDE_VIDEOIN_CTRLREQ_GET_MAX 0x83
344#define VRDE_VIDEOIN_CTRLREQ_GET_RES 0x84
345#define VRDE_VIDEOIN_CTRLREQ_GET_LEN 0x85
346#define VRDE_VIDEOIN_CTRLREQ_GET_INFO 0x86
347#define VRDE_VIDEOIN_CTRLREQ_GET_DEF 0x87
348
349/* VRDEVIDEOINCTRLHDR::u8Flags */
350#define VRDE_VIDEOIN_CTRLHDR_F_NOTIFY 0x01 /* Control change notification, the attribute is derived from u16RequestType and F_FAIL. */
351#define VRDE_VIDEOIN_CTRLHDR_F_FAIL 0x02 /* The operation failed. Error code is in u8Status. */
352
353/* VRDEVIDEOINCTRLHDR::u8Status if the VRDE_VIDEOIN_CTRLHDR_F_FAIL is set. */
354#define VRDE_VIDEOIN_CTRLHDR_STATUS_SUCCESS 0x00 /**/
355#define VRDE_VIDEOIN_CTRLHDR_STATUS_NOTREADY 0x01 /* Not ready */
356#define VRDE_VIDEOIN_CTRLHDR_STATUS_WRONGSTATE 0x02 /* Wrong state */
357#define VRDE_VIDEOIN_CTRLHDR_STATUS_POWER 0x03 /* Power */
358#define VRDE_VIDEOIN_CTRLHDR_STATUS_OUTOFRANGE 0x04 /* Out of range */
359#define VRDE_VIDEOIN_CTRLHDR_STATUS_INVALIDUNIT 0x05 /* Invalid unit */
360#define VRDE_VIDEOIN_CTRLHDR_STATUS_INVALIDCONTROL 0x06 /* Invalid control */
361#define VRDE_VIDEOIN_CTRLHDR_STATUS_INVALIDREQUEST 0x07 /* Invalid request */
362#define VRDE_VIDEOIN_CTRLHDR_STATUS_UNKNOWN 0xFF /* Unknown */
363
364/* Control selectors. 16 bit. High byte is the category. Low byte is the identifier.*/
365#ifdef RT_MAKE_U16
366#define VRDE_VIDEOIN_CTRLSEL_MAKE(Lo, Hi) RT_MAKE_U16(Lo, Hi)
367#else
368#define VRDE_VIDEOIN_CTRLSEL_MAKE(Lo, Hi) ((uint16_t)( (uint16_t)((uint8_t)(Hi)) << 8 | (uint8_t)(Lo) ))
369#endif
370
371#define VRDE_VIDEOIN_CTRLSEL_VC(a) VRDE_VIDEOIN_CTRLSEL_MAKE(a, 0x01)
372#define VRDE_VIDEOIN_CTRLSEL_CT(a) VRDE_VIDEOIN_CTRLSEL_MAKE(a, 0x02)
373#define VRDE_VIDEOIN_CTRLSEL_PU(a) VRDE_VIDEOIN_CTRLSEL_MAKE(a, 0x03)
374#define VRDE_VIDEOIN_CTRLSEL_VS(a) VRDE_VIDEOIN_CTRLSEL_MAKE(a, 0x04)
375#define VRDE_VIDEOIN_CTRLSEL_HW(a) VRDE_VIDEOIN_CTRLSEL_MAKE(a, 0x05)
376#define VRDE_VIDEOIN_CTRLSEL_PROT(a) VRDE_VIDEOIN_CTRLSEL_MAKE(a, 0x06)
377
378#define VRDE_VIDEOIN_CTRLSEL_VC_VIDEO_POWER_MODE_CONTROL VRDE_VIDEOIN_CTRLSEL_VC(0x01)
379
380#define VRDE_VIDEOIN_CTRLSEL_CT_UNDEFINED VRDE_VIDEOIN_CTRLSEL_CT(0x00)
381#define VRDE_VIDEOIN_CTRLSEL_CT_SCANNING_MODE VRDE_VIDEOIN_CTRLSEL_CT(0x01)
382#define VRDE_VIDEOIN_CTRLSEL_CT_AE_MODE VRDE_VIDEOIN_CTRLSEL_CT(0x02)
383#define VRDE_VIDEOIN_CTRLSEL_CT_AE_PRIORITY VRDE_VIDEOIN_CTRLSEL_CT(0x03)
384#define VRDE_VIDEOIN_CTRLSEL_CT_EXPOSURE_TIME_ABSOLUTE VRDE_VIDEOIN_CTRLSEL_CT(0x04)
385#define VRDE_VIDEOIN_CTRLSEL_CT_EXPOSURE_TIME_RELATIVE VRDE_VIDEOIN_CTRLSEL_CT(0x05)
386#define VRDE_VIDEOIN_CTRLSEL_CT_FOCUS_ABSOLUTE VRDE_VIDEOIN_CTRLSEL_CT(0x06)
387#define VRDE_VIDEOIN_CTRLSEL_CT_FOCUS_RELATIVE VRDE_VIDEOIN_CTRLSEL_CT(0x07)
388#define VRDE_VIDEOIN_CTRLSEL_CT_FOCUS_AUTO VRDE_VIDEOIN_CTRLSEL_CT(0x08)
389#define VRDE_VIDEOIN_CTRLSEL_CT_IRIS_ABSOLUTE VRDE_VIDEOIN_CTRLSEL_CT(0x09)
390#define VRDE_VIDEOIN_CTRLSEL_CT_IRIS_RELATIVE VRDE_VIDEOIN_CTRLSEL_CT(0x0A)
391#define VRDE_VIDEOIN_CTRLSEL_CT_ZOOM_ABSOLUTE VRDE_VIDEOIN_CTRLSEL_CT(0x0B)
392#define VRDE_VIDEOIN_CTRLSEL_CT_ZOOM_RELATIVE VRDE_VIDEOIN_CTRLSEL_CT(0x0C)
393#define VRDE_VIDEOIN_CTRLSEL_CT_PANTILT_ABSOLUTE VRDE_VIDEOIN_CTRLSEL_CT(0x0D)
394#define VRDE_VIDEOIN_CTRLSEL_CT_PANTILT_RELATIVE VRDE_VIDEOIN_CTRLSEL_CT(0x0E)
395#define VRDE_VIDEOIN_CTRLSEL_CT_ROLL_ABSOLUTE VRDE_VIDEOIN_CTRLSEL_CT(0x0F)
396#define VRDE_VIDEOIN_CTRLSEL_CT_ROLL_RELATIVE VRDE_VIDEOIN_CTRLSEL_CT(0x10)
397#define VRDE_VIDEOIN_CTRLSEL_CT_PRIVACY VRDE_VIDEOIN_CTRLSEL_CT(0x11)
398
399#define VRDE_VIDEOIN_CTRLSEL_PU_UNDEFINED VRDE_VIDEOIN_CTRLSEL_PU(0x00)
400#define VRDE_VIDEOIN_CTRLSEL_PU_BACKLIGHT_COMPENSATION VRDE_VIDEOIN_CTRLSEL_PU(0x01)
401#define VRDE_VIDEOIN_CTRLSEL_PU_BRIGHTNESS VRDE_VIDEOIN_CTRLSEL_PU(0x02)
402#define VRDE_VIDEOIN_CTRLSEL_PU_CONTRAST VRDE_VIDEOIN_CTRLSEL_PU(0x03)
403#define VRDE_VIDEOIN_CTRLSEL_PU_GAIN VRDE_VIDEOIN_CTRLSEL_PU(0x04)
404#define VRDE_VIDEOIN_CTRLSEL_PU_POWER_LINE_FREQUENCY VRDE_VIDEOIN_CTRLSEL_PU(0x05)
405#define VRDE_VIDEOIN_CTRLSEL_PU_HUE VRDE_VIDEOIN_CTRLSEL_PU(0x06)
406#define VRDE_VIDEOIN_CTRLSEL_PU_SATURATION VRDE_VIDEOIN_CTRLSEL_PU(0x07)
407#define VRDE_VIDEOIN_CTRLSEL_PU_SHARPNESS VRDE_VIDEOIN_CTRLSEL_PU(0x08)
408#define VRDE_VIDEOIN_CTRLSEL_PU_GAMMA VRDE_VIDEOIN_CTRLSEL_PU(0x09)
409#define VRDE_VIDEOIN_CTRLSEL_PU_WHITE_BALANCE_TEMPERATURE VRDE_VIDEOIN_CTRLSEL_PU(0x0A)
410#define VRDE_VIDEOIN_CTRLSEL_PU_WHITE_BALANCE_TEMPERATURE_AUTO VRDE_VIDEOIN_CTRLSEL_PU(0x0B)
411#define VRDE_VIDEOIN_CTRLSEL_PU_WHITE_BALANCE_COMPONENT VRDE_VIDEOIN_CTRLSEL_PU(0x0C)
412#define VRDE_VIDEOIN_CTRLSEL_PU_WHITE_BALANCE_COMPONENT_AUTO VRDE_VIDEOIN_CTRLSEL_PU(0x0D)
413#define VRDE_VIDEOIN_CTRLSEL_PU_DIGITAL_MULTIPLIER VRDE_VIDEOIN_CTRLSEL_PU(0x0E)
414#define VRDE_VIDEOIN_CTRLSEL_PU_DIGITAL_MULTIPLIER_LIMIT VRDE_VIDEOIN_CTRLSEL_PU(0x0F)
415#define VRDE_VIDEOIN_CTRLSEL_PU_HUE_AUTO VRDE_VIDEOIN_CTRLSEL_PU(0x10)
416#define VRDE_VIDEOIN_CTRLSEL_PU_ANALOG_VIDEO_STANDARD VRDE_VIDEOIN_CTRLSEL_PU(0x11)
417#define VRDE_VIDEOIN_CTRLSEL_PU_ANALOG_LOCK_STATUS VRDE_VIDEOIN_CTRLSEL_PU(0x12)
418
419#define VRDE_VIDEOIN_CTRLSEL_VS_UNDEFINED VRDE_VIDEOIN_CTRLSEL_VS(0x00)
420#define VRDE_VIDEOIN_CTRLSEL_VS_SETUP VRDE_VIDEOIN_CTRLSEL_VS(0x01)
421#define VRDE_VIDEOIN_CTRLSEL_VS_OFF VRDE_VIDEOIN_CTRLSEL_VS(0x02)
422#define VRDE_VIDEOIN_CTRLSEL_VS_ON VRDE_VIDEOIN_CTRLSEL_VS(0x03)
423#define VRDE_VIDEOIN_CTRLSEL_VS_STILL_IMAGE_TRIGGER VRDE_VIDEOIN_CTRLSEL_VS(0x05)
424#define VRDE_VIDEOIN_CTRLSEL_VS_STREAM_ERROR_CODE VRDE_VIDEOIN_CTRLSEL_VS(0x06)
425#define VRDE_VIDEOIN_CTRLSEL_VS_GENERATE_KEY_FRAME VRDE_VIDEOIN_CTRLSEL_VS(0x07)
426#define VRDE_VIDEOIN_CTRLSEL_VS_UPDATE_FRAME_SEGMENT VRDE_VIDEOIN_CTRLSEL_VS(0x08)
427#define VRDE_VIDEOIN_CTRLSEL_VS_SYNCH_DELAY VRDE_VIDEOIN_CTRLSEL_VS(0x09)
428
429#define VRDE_VIDEOIN_CTRLSEL_HW_BUTTON VRDE_VIDEOIN_CTRLSEL_HW(0x01)
430
431#define VRDE_VIDEOIN_CTRLSEL_PROT_PING VRDE_VIDEOIN_CTRLSEL_PROT(0x01)
432#define VRDE_VIDEOIN_CTRLSEL_PROT_SAMPLING VRDE_VIDEOIN_CTRLSEL_PROT(0x02)
433#define VRDE_VIDEOIN_CTRLSEL_PROT_FRAMES VRDE_VIDEOIN_CTRLSEL_PROT(0x03)
434
435typedef struct VRDEVIDEOINCTRL_VIDEO_POWER_MODE
436{
437 VRDEVIDEOINCTRLHDR hdr;
438 uint8_t u8DevicePowerMode;
439} VRDEVIDEOINCTRL_VIDEO_POWER_MODE;
440
441typedef struct VRDEVIDEOINCTRL_CT_SCANNING_MODE
442{
443 VRDEVIDEOINCTRLHDR hdr;
444 uint8_t u8ScanningMode;
445} VRDEVIDEOINCTRL_CT_SCANNING_MODE;
446
447typedef struct VRDEVIDEOINCTRL_CT_AE_MODE
448{
449 VRDEVIDEOINCTRLHDR hdr;
450 uint8_t u8AutoExposureMode;
451} VRDEVIDEOINCTRL_CT_AE_MODE;
452
453typedef struct VRDEVIDEOINCTRL_CT_AE_PRIORITY
454{
455 VRDEVIDEOINCTRLHDR hdr;
456 uint8_t u8AutoExposurePriority;
457} VRDEVIDEOINCTRL_CT_AE_PRIORITY;
458
459typedef struct VRDEVIDEOINCTRL_CT_EXPOSURE_TIME_ABSOLUTE
460{
461 VRDEVIDEOINCTRLHDR hdr;
462 uint32_t u32ExposureTimeAbsolute;
463} VRDEVIDEOINCTRL_CT_EXPOSURE_TIME_ABSOLUTE;
464
465typedef struct VRDEVIDEOINCTRL_CT_EXPOSURE_TIME_RELATIVE
466{
467 VRDEVIDEOINCTRLHDR hdr;
468 uint8_t u8ExposureTimeRelative;
469} VRDEVIDEOINCTRL_CT_EXPOSURE_TIME_RELATIVE;
470
471typedef struct VRDEVIDEOINCTRL_CT_FOCUS_ABSOLUTE
472{
473 VRDEVIDEOINCTRLHDR hdr;
474 uint16_t u16FocusAbsolute;
475} VRDEVIDEOINCTRL_CT_FOCUS_ABSOLUTE;
476
477typedef struct VRDEVIDEOINCTRL_CT_FOCUS_RELATIVE
478{
479 VRDEVIDEOINCTRLHDR hdr;
480 uint8_t u8FocusRelative;
481 uint8_t u8Speed;
482} VRDEVIDEOINCTRL_CT_FOCUS_RELATIVE;
483
484typedef struct VRDEVIDEOINCTRL_CT_FOCUS_AUTO
485{
486 VRDEVIDEOINCTRLHDR hdr;
487 uint8_t u8FocusAuto;
488} VRDEVIDEOINCTRL_CT_FOCUS_AUTO;
489
490typedef struct VRDEVIDEOINCTRL_CT_IRIS_ABSOLUTE
491{
492 VRDEVIDEOINCTRLHDR hdr;
493 uint16_t u16IrisAbsolute;
494} VRDEVIDEOINCTRL_CT_IRIS_ABSOLUTE;
495
496typedef struct VRDEVIDEOINCTRL_CT_IRIS_RELATIVE
497{
498 VRDEVIDEOINCTRLHDR hdr;
499 uint8_t u8IrisRelative;
500} VRDEVIDEOINCTRL_CT_IRIS_RELATIVE;
501
502typedef struct VRDEVIDEOINCTRL_CT_ZOOM_ABSOLUTE
503{
504 VRDEVIDEOINCTRLHDR hdr;
505 uint16_t u16ZoomAbsolute;
506} VRDEVIDEOINCTRL_CT_ZOOM_ABSOLUTE;
507
508typedef struct VRDEVIDEOINCTRL_CT_ZOOM_RELATIVE
509{
510 VRDEVIDEOINCTRLHDR hdr;
511 uint8_t u8Zoom;
512 uint8_t u8DigitalZoom;
513 uint8_t u8Speed;
514} VRDEVIDEOINCTRL_CT_ZOOM_RELATIVE;
515
516typedef struct VRDEVIDEOINCTRL_CT_PANTILT_ABSOLUTE
517{
518 VRDEVIDEOINCTRLHDR hdr;
519 uint32_t u32PanAbsolute;
520 uint32_t u32TiltAbsolute;
521} VRDEVIDEOINCTRL_CT_PANTILT_ABSOLUTE;
522
523typedef struct VRDEVIDEOINCTRL_CT_PANTILT_RELATIVE
524{
525 VRDEVIDEOINCTRLHDR hdr;
526 uint8_t u8PanRelative;
527 uint8_t u8PanSpeed;
528 uint8_t u8TiltRelative;
529 uint8_t u8TiltSpeed;
530} VRDEVIDEOINCTRL_CT_PANTILT_RELATIVE;
531
532typedef struct VRDEVIDEOINCTRL_CT_ROLL_ABSOLUTE
533{
534 VRDEVIDEOINCTRLHDR hdr;
535 uint16_t u16RollAbsolute;
536} VRDEVIDEOINCTRL_CT_ROLL_ABSOLUTE;
537
538typedef struct VRDEVIDEOINCTRL_CT_ROLL_RELATIVE
539{
540 VRDEVIDEOINCTRLHDR hdr;
541 uint8_t u8RollRelative;
542 uint8_t u8Speed;
543} VRDEVIDEOINCTRL_CT_ROLL_RELATIVE;
544
545typedef struct VRDEVIDEOINCTRL_CT_PRIVACY_MODE
546{
547 VRDEVIDEOINCTRLHDR hdr;
548 uint8_t u8Privacy;
549} VRDEVIDEOINCTRL_CT_PRIVACY_MODE;
550
551typedef struct VRDEVIDEOINCTRL_PU_BACKLIGHT_COMPENSATION
552{
553 VRDEVIDEOINCTRLHDR hdr;
554 uint16_t u16BacklightCompensation;
555} VRDEVIDEOINCTRL_PU_BACKLIGHT_COMPENSATION;
556
557typedef struct VRDEVIDEOINCTRL_PU_BRIGHTNESS
558{
559 VRDEVIDEOINCTRLHDR hdr;
560 uint16_t u16Brightness;
561} VRDEVIDEOINCTRL_PU_BRIGHTNESS;
562
563typedef struct VRDEVIDEOINCTRL_PU_CONTRAST
564{
565 VRDEVIDEOINCTRLHDR hdr;
566 uint16_t u16Contrast;
567} VRDEVIDEOINCTRL_PU_CONTRAST;
568
569typedef struct VRDEVIDEOINCTRL_PU_GAIN
570{
571 VRDEVIDEOINCTRLHDR hdr;
572 uint16_t u16Gain;
573} VRDEVIDEOINCTRL_PU_GAIN;
574
575typedef struct VRDEVIDEOINCTRL_PU_POWER_LINE_FREQUENCY
576{
577 VRDEVIDEOINCTRLHDR hdr;
578 uint16_t u16PowerLineFrequency;
579} VRDEVIDEOINCTRL_PU_POWER_LINE_FREQUENCY;
580
581typedef struct VRDEVIDEOINCTRL_PU_HUE
582{
583 VRDEVIDEOINCTRLHDR hdr;
584 uint16_t u16Hue;
585} VRDEVIDEOINCTRL_PU_HUE;
586
587typedef struct VRDEVIDEOINCTRL_PU_HUE_AUTO
588{
589 VRDEVIDEOINCTRLHDR hdr;
590 uint8_t u8HueAuto;
591} VRDEVIDEOINCTRL_PU_HUE_AUTO;
592
593typedef struct VRDEVIDEOINCTRL_PU_SATURATION
594{
595 VRDEVIDEOINCTRLHDR hdr;
596 uint16_t u16Saturation;
597} VRDEVIDEOINCTRL_PU_SATURATION;
598
599typedef struct VRDEVIDEOINCTRL_PU_SHARPNESS
600{
601 VRDEVIDEOINCTRLHDR hdr;
602 uint16_t u16Sharpness;
603} VRDEVIDEOINCTRL_PU_SHARPNESS;
604
605typedef struct VRDEVIDEOINCTRL_PU_GAMMA
606{
607 VRDEVIDEOINCTRLHDR hdr;
608 uint16_t u16Gamma;
609} VRDEVIDEOINCTRL_PU_GAMMA;
610
611typedef struct VRDEVIDEOINCTRL_PU_WHITE_BALANCE_TEMPERATURE
612{
613 VRDEVIDEOINCTRLHDR hdr;
614 uint16_t u16WhiteBalanceTemperature;
615} VRDEVIDEOINCTRL_PU_WHITE_BALANCE_TEMPERATURE;
616
617typedef struct VRDEVIDEOINCTRL_PU_WHITE_BALANCE_TEMPERATURE_AUTO
618{
619 VRDEVIDEOINCTRLHDR hdr;
620 uint8_t u8WhiteBalanceTemperatureAuto;
621} VRDEVIDEOINCTRL_PU_WHITE_BALANCE_TEMPERATURE_AUTO;
622
623typedef struct VRDEVIDEOINCTRL_PU_WHITE_BALANCE_COMPONENT
624{
625 VRDEVIDEOINCTRLHDR hdr;
626 uint16_t u16WhiteBalanceBlue;
627 uint16_t u16WhiteBalanceRed;
628} VRDEVIDEOINCTRL_PU_WHITE_BALANCE_COMPONENT;
629
630typedef struct VRDEVIDEOINCTRL_PU_WHITE_BALANCE_COMPONENT_AUTO
631{
632 VRDEVIDEOINCTRLHDR hdr;
633 uint8_t u8WhiteBalanceComponentAuto;
634} VRDEVIDEOINCTRL_PU_WHITE_BALANCE_COMPONENT_AUTO;
635
636typedef struct VRDEVIDEOINCTRL_PU_DIGITAL_MULTIPLIER
637{
638 VRDEVIDEOINCTRLHDR hdr;
639 uint16_t u16MultiplierStep;
640} VRDEVIDEOINCTRL_PU_DIGITAL_MULTIPLIER;
641
642typedef struct VRDEVIDEOINCTRL_PU_DIGITAL_MULTIPLIER_LIMIT
643{
644 VRDEVIDEOINCTRLHDR hdr;
645 uint16_t u16MultiplierLimit;
646} VRDEVIDEOINCTRL_PU_DIGITAL_MULTIPLIER_LIMIT;
647
648typedef struct VRDEVIDEOINCTRL_PU_ANALOG_VIDEO_STANDARD
649{
650 VRDEVIDEOINCTRLHDR hdr;
651 uint8_t u8VideoStandard;
652} VRDEVIDEOINCTRL_PU_ANALOG_VIDEO_STANDARD;
653
654typedef struct VRDEVIDEOINCTRL_PU_ANALOG_LOCK_STATUS
655{
656 VRDEVIDEOINCTRLHDR hdr;
657 uint8_t u8Status;
658} VRDEVIDEOINCTRL_PU_ANALOG_LOCK_STATUS;
659
660/* Set streaming parameters. The actual streaming will be enabled by VS_ON. */
661#define VRDEVIDEOINCTRL_F_VS_SETUP_FID 0x01
662#define VRDEVIDEOINCTRL_F_VS_SETUP_EOF 0x02
663
664typedef struct VRDEVIDEOINCTRL_VS_SETUP
665{
666 VRDEVIDEOINCTRLHDR hdr;
667 uint8_t u8FormatId; /* The format id on the client: VRDEVIDEOINFORMATDESC::u8FormatId. */
668 uint8_t u8FramingInfo; /* VRDEVIDEOINCTRL_F_VS_SETUP_*. Set by the client. */
669 uint16_t u16Width;
670 uint16_t u16Height;
671 uint32_t u32FrameInterval; /* Frame interval in 100 ns units, 0 means a still image capture.
672 * The client may choose a different interval if this value is
673 * not supported.
674 */
675 uint16_t u16CompQuality; /* 0 .. 10000 = 0 .. 100%.
676 * Applicable if the format has VRDE_VIDEOIN_F_FMT_COMPQUALITY,
677 * otherwise this field is ignored.
678 */
679 uint16_t u16Delay; /* Latency in ms from video data capture to presentation on the channel.
680 * Set by the client, read by the server.
681 */
682 uint32_t u32ClockFrequency; /* @todo just all clocks in 100ns units? */
683} VRDEVIDEOINCTRL_VS_SETUP;
684
685/* Stop sending video frames. */
686typedef struct VRDEVIDEOINCTRL_VS_OFF
687{
688 VRDEVIDEOINCTRLHDR hdr;
689} VRDEVIDEOINCTRL_VS_OFF;
690
691/* Start sending video frames with parameters set by VS_SETUP. */
692typedef struct VRDEVIDEOINCTRL_VS_ON
693{
694 VRDEVIDEOINCTRLHDR hdr;
695} VRDEVIDEOINCTRL_VS_ON;
696
697typedef struct VRDEVIDEOINCTRL_VS_STILL_IMAGE_TRIGGER
698{
699 VRDEVIDEOINCTRLHDR hdr;
700 uint8_t u8Trigger;
701} VRDEVIDEOINCTRL_VS_STILL_IMAGE_TRIGGER;
702
703typedef struct VRDEVIDEOINCTRL_VS_STREAM_ERROR_CODE
704{
705 VRDEVIDEOINCTRLHDR hdr;
706 uint8_t u8StreamErrorCode;
707} VRDEVIDEOINCTRL_VS_STREAM_ERROR_CODE;
708
709typedef struct VRDEVIDEOINCTRL_VS_GENERATE_KEY_FRAME
710{
711 VRDEVIDEOINCTRLHDR hdr;
712 uint8_t u8GenerateKeyFrame;
713} VRDEVIDEOINCTRL_VS_GENERATE_KEY_FRAME;
714
715typedef struct VRDEVIDEOINCTRL_VS_UPDATE_FRAME_SEGMENT
716{
717 VRDEVIDEOINCTRLHDR hdr;
718 uint8_t u8StartFrameSegment;
719 uint8_t u8EndFrameSegment;
720} VRDEVIDEOINCTRL_VS_UPDATE_FRAME_SEGMENT;
721
722typedef struct VRDEVIDEOINCTRL_VS_SYNCH_DELAY
723{
724 VRDEVIDEOINCTRLHDR hdr;
725 uint16_t u16Delay;
726} VRDEVIDEOINCTRL_VS_SYNCH_DELAY;
727
728/* A hardware button was pressed/released on the device. */
729typedef struct VRDEVIDEOINCTRL_HW_BUTTON
730{
731 VRDEVIDEOINCTRLHDR hdr;
732 uint8_t u8Pressed;
733} VRDEVIDEOINCTRL_HW_BUTTON;
734
735typedef struct VRDEVIDEOINCTRL_PROT_PING
736{
737 VRDEVIDEOINCTRLHDR hdr;
738 uint32_t u32Timestamp; /* Set in the request and the same value must be send back in the response. */
739} VRDEVIDEOINCTRL_PROT_PING;
740
741typedef struct VRDEVIDEOINCTRL_PROT_SAMPLING
742{
743 VRDEVIDEOINCTRLHDR hdr;
744 uint32_t fu32SampleStart; /* Which parameters must be sampled VRDEVIDEOINCTRL_F_PROT_SAMPLING_*. */
745 uint32_t fu32SampleStop; /* Which parameters to disable VRDEVIDEOINCTRL_F_PROT_SAMPLING_*.
746 * If both Start and Stop is set, then restart the sampling.
747 */
748 uint32_t u32PeriodMS; /* Sampling period in milliseconds. Applies to all samples in fu32SampleStart.
749 * Not mandatory, the actual sampling period may be different.
750 */
751} VRDEVIDEOINCTRL_PROT_SAMPLING;
752
753#define VRDEVIDEOINCTRL_F_PROT_SAMPLING_FRAMES_SOURCE 0x00000001 /* Periodic VRDEVIDEOINCTRL_PROT_FRAMES samples */
754#define VRDEVIDEOINCTRL_F_PROT_SAMPLING_FRAMES_CLIENT_OUT 0x00000002 /* Periodic VRDEVIDEOINCTRL_PROT_FRAMES samples */
755
756typedef struct VRDEVIDEOINCTRL_PROT_FRAMES
757{
758 VRDEVIDEOINCTRLHDR hdr; /* Note: the message should be sent as VRDE_VIDEOIN_FN_CONTROL_NOTIFY. */
759 uint32_t u32Sample; /* Which sample is this, one of VRDEVIDEOINCTRL_F_PROT_SAMPLING_*. */
760 uint32_t u32TimestampMS; /* When the period started, milliseconds since the start of sampling. */
761 uint32_t u32PeriodMS; /* Actual period during which the frames were counted in milliseconds.
762 * This may be different from VRDEVIDEOINCTRL_PROT_SAMPLING::u32PeriodMS.
763 */
764 uint32_t u32FramesCount; /* How many frames per u32PeriodMS milliseconds. */
765} VRDEVIDEOINCTRL_PROT_FRAMES;
766
767
768/*
769 * Payload transfers. How frames are sent to the server:
770 * the client send a PAYLOAD packet, which has the already set format.
771 * The server enables the transfers by sending VRDEVIDEOINCTRL_VS_ON.
772 */
773
774/* Payload header */
775typedef struct VRDEVIDEOINPAYLOADHDR
776{
777 uint8_t u8HeaderLength; /* Entire header. */
778 uint8_t u8HeaderInfo; /* VRDE_VIDEOIN_PAYLOAD_F_* */
779 uint32_t u32PresentationTime; /* @todo define this */
780 uint32_t u32SourceTimeClock; /* @todo At the moment when the frame was sent to the channel.
781 * Allows the server to measure clock drift.
782 */
783 uint16_t u16Reserved; /* @todo */
784} VRDEVIDEOINPAYLOADHDR;
785
786/* VRDEVIDEOINPAYLOADHDR::u8HeaderInfo */
787#define VRDE_VIDEOIN_PAYLOAD_F_FID 0x01 /* Frame ID */
788#define VRDE_VIDEOIN_PAYLOAD_F_EOF 0x02 /* End of Frame */
789#define VRDE_VIDEOIN_PAYLOAD_F_PTS 0x04 /* Presentation Time */
790#define VRDE_VIDEOIN_PAYLOAD_F_SCR 0x08 /* Source Clock Reference */
791#define VRDE_VIDEOIN_PAYLOAD_F_RES 0x10 /* Reserved */
792#define VRDE_VIDEOIN_PAYLOAD_F_STI 0x20 /* Still Image */
793#define VRDE_VIDEOIN_PAYLOAD_F_ERR 0x40 /* Error */
794#define VRDE_VIDEOIN_PAYLOAD_F_EOH 0x80 /* End of header */
795
796
797/*
798 * The network channel specification.
799 */
800
801/*
802 * The protocol uses a dynamic RDP channel.
803 * Everything is little-endian.
804 */
805
806/* The dynamic RDP channel name. */
807#define VRDE_VIDEOIN_CHANNEL "RVIDEOIN"
808
809/* Major functions. */
810#define VRDE_VIDEOIN_FN_NEGOTIATE 0x0000 /* Version and capabilities check. */
811#define VRDE_VIDEOIN_FN_NOTIFY 0x0001 /* Device attach/detach from the client. */
812#define VRDE_VIDEOIN_FN_DEVICEDESC 0x0002 /* Query device description. */
813#define VRDE_VIDEOIN_FN_CONTROL 0x0003 /* Control the device and start/stop video input.
814 * This function is used for sending a request and
815 * the corresponding response.
816 */
817#define VRDE_VIDEOIN_FN_CONTROL_NOTIFY 0x0004 /* The client reports a control change, etc.
818 * This function indicated that the message is
819 * not a response to a CONTROL request.
820 */
821#define VRDE_VIDEOIN_FN_FRAME 0x0005 /* Frame from the client. */
822
823/* Status codes. */
824#define VRDE_VIDEOIN_STATUS_SUCCESS 0 /* Function completed successfully. */
825#define VRDE_VIDEOIN_STATUS_FAILED 1 /* Failed for some reason. */
826
827typedef struct VRDEVIDEOINMSGHDR
828{
829 uint32_t u32Length; /* The length of the message in bytes, including the header. */
830 uint32_t u32DeviceId; /* The client's device id. */
831 uint32_t u32MessageId; /* Unique id assigned by the server. The client must send a reply with the same id.
832 * If the client initiates a request, then this must be set to 0, because there is
833 * currently no client requests, which would require a response from the server.
834 */
835 uint16_t u16FunctionId; /* VRDE_VIDEOIN_FN_* */
836 uint16_t u16Status; /* The result of a request. VRDE_VIDEOIN_STATUS_*. */
837} VRDEVIDEOINMSGHDR;
838ASSERTSIZE(VRDEVIDEOINMSGHDR, 16)
839
840/*
841 * VRDE_VIDEOIN_FN_NEGOTIATE
842 *
843 * Sent by the server when the channel is established and the client replies with its capabilities.
844 */
845#define VRDE_VIDEOIN_NEGOTIATE_VERSION 1
846
847/* VRDEVIDEOINMSG_NEGOTIATE::fu32Capabilities */
848#define VRDE_VIDEOIN_NEGOTIATE_CAP_VOID 0x00000000
849#define VRDE_VIDEOIN_NEGOTIATE_CAP_PROT 0x00000001 /* Supports VRDE_VIDEOIN_CTRLSEL_PROT_* controls. */
850
851typedef struct VRDEVIDEOINMSG_NEGOTIATE
852{
853 VRDEVIDEOINMSGHDR hdr;
854 uint32_t u32Version; /* VRDE_VIDEOIN_NEGOTIATE_VERSION */
855 uint32_t fu32Capabilities; /* VRDE_VIDEOIN_NEGOTIATE_CAP_* */
856} VRDEVIDEOINMSG_NEGOTIATE;
857
858/*
859 * VRDE_VIDEOIN_FN_NOTIFY
860 *
861 * Sent by the client when a webcam is attached or detached.
862 * The client must send the ATTACH notification for each webcam, which is
863 * already connected to the client when the VIDEOIN channel is established.
864 */
865#define VRDE_VIDEOIN_NOTIFY_EVENT_ATTACH 0
866#define VRDE_VIDEOIN_NOTIFY_EVENT_DETACH 1
867#define VRDE_VIDEOIN_NOTIFY_EVENT_NEGOTIATE 2 /* Negotiate again with the client. */
868
869typedef struct VRDEVIDEOINMSG_NOTIFY
870{
871 VRDEVIDEOINMSGHDR hdr;
872 uint32_t u32NotifyEvent; /* VRDE_VIDEOIN_NOTIFY_EVENT_* */
873 /* Event specific data may follow. The underlying protocol provides the length of the message. */
874} VRDEVIDEOINMSG_NOTIFY;
875
876/*
877 * VRDE_VIDEOIN_FN_DEVICEDESC
878 *
879 * The server queries the description of a device.
880 */
881typedef struct VRDEVIDEOINMSG_DEVICEDESC_REQ
882{
883 VRDEVIDEOINMSGHDR hdr;
884} VRDEVIDEOINMSG_DEVICEDESC_REQ;
885
886typedef struct VRDEVIDEOINMSG_DEVICEDESC_RSP
887{
888 VRDEVIDEOINMSGHDR hdr;
889 VRDEVIDEOINDEVICEDESC Device;
890 /*
891 * VRDEVIDEOINFORMATDESC[0]
892 * VRDEVIDEOINFRAMEDESC[0]
893 * ...
894 * VRDEVIDEOINFRAMEDESC[n]
895 * VRDEVIDEOINFORMATDESC[1]
896 * VRDEVIDEOINFRAMEDESC[0]
897 * ...
898 * VRDEVIDEOINFRAMEDESC[m]
899 * ...
900 */
901} VRDEVIDEOINMSG_DEVICEDESC_RSP;
902
903/*
904 * VRDE_VIDEOIN_FN_CONTROL
905 * VRDE_VIDEOIN_FN_CONTROL_NOTIFY
906 *
907 * Either sent by the server or by the client as a notification/response.
908 * If sent by the client as a notification, then hdr.u32MessageId must be 0.
909 */
910typedef struct VRDEVIDEOINMSG_CONTROL
911{
912 VRDEVIDEOINMSGHDR hdr;
913 VRDEVIDEOINCTRLHDR Control;
914 /* Control specific data may follow. */
915} VRDEVIDEOINMSG_CONTROL;
916
917/*
918 * VRDE_VIDEOIN_FN_FRAME
919 *
920 * The client sends a video/still frame in the already specified format.
921 * hdr.u32MessageId must be 0.
922 */
923typedef struct VRDEVIDEOINMSG_FRAME
924{
925 VRDEVIDEOINMSGHDR hdr;
926 VRDEVIDEOINPAYLOADHDR Payload;
927 /* The frame data follow. */
928} VRDEVIDEOINMSG_FRAME;
929
930
931#ifdef VRDE_VIDEOIN_WITH_VRDEINTERFACE
932/*
933 * The application interface between VirtualBox and the VRDE server.
934 */
935
936#define VRDE_VIDEOIN_INTERFACE_NAME "VIDEOIN"
937
938typedef struct VRDEVIDEOINDEVICEHANDLE
939{
940 uint32_t u32ClientId;
941 uint32_t u32DeviceId;
942} VRDEVIDEOINDEVICEHANDLE;
943
944/* The VRDE server video input interface entry points. Interface version 1. */
945typedef struct VRDEVIDEOININTERFACE
946{
947 /* The header. */
948 VRDEINTERFACEHDR header;
949
950 /* Tell the server that this device will be used and associate a context with the device.
951 *
952 * @param hServer The VRDE server instance.
953 * @param pDeviceHandle The device reported by ATTACH notification.
954 * @param pvDeviceCtx The caller context associated with the pDeviceHandle.
955 *
956 * @return IPRT status code.
957 */
958 DECLR3CALLBACKMEMBER(int, VRDEVideoInDeviceAttach, (HVRDESERVER hServer,
959 const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle,
960 void *pvDeviceCtx));
961
962 /* This device will be not be used anymore. The device context must not be used by the server too.
963 *
964 * @param hServer The VRDE server instance.
965 * @param pDeviceHandle The device reported by ATTACH notification.
966 *
967 * @return IPRT status code.
968 */
969 DECLR3CALLBACKMEMBER(int, VRDEVideoInDeviceDetach, (HVRDESERVER hServer,
970 const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle));
971
972 /* Get a device description.
973 *
974 * @param hServer The VRDE server instance.
975 * @param pvUser The callers context of this request.
976 * @param pDeviceHandle The device reported by ATTACH notification.
977 *
978 * @return IPRT status code.
979 */
980 DECLR3CALLBACKMEMBER(int, VRDEVideoInGetDeviceDesc, (HVRDESERVER hServer,
981 void *pvUser,
982 const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle));
983
984 /* Submit a set/get control request.
985 *
986 * @param hServer The VRDE server instance.
987 * @param pvUser The callers context of this request.
988 * @param pDeviceHandle The device reported by ATTACH notification.
989 * @param pReq The request.
990 * @param cbReq Size of the request.
991 *
992 * @return IPRT status code.
993 */
994 DECLR3CALLBACKMEMBER(int, VRDEVideoInControl, (HVRDESERVER hServer,
995 void *pvUser,
996 const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle,
997 const VRDEVIDEOINCTRLHDR *pReq,
998 uint32_t cbReq));
999
1000} VRDEVIDEOININTERFACE;
1001
1002
1003/*
1004 * Notifications.
1005 * Data structures: pvData of VRDEVIDEOINCALLBACKS::VRDECallbackVideoInNotify.
1006 */
1007typedef struct VRDEVIDEOINNOTIFYATTACH
1008{
1009 VRDEVIDEOINDEVICEHANDLE deviceHandle;
1010 uint32_t u32Version; /* VRDE_VIDEOIN_NEGOTIATE_VERSION */
1011 uint32_t fu32Capabilities; /* VRDE_VIDEOIN_NEGOTIATE_CAP_* */
1012} VRDEVIDEOINNOTIFYATTACH;
1013
1014typedef struct VRDEVIDEOINNOTIFYDETACH
1015{
1016 VRDEVIDEOINDEVICEHANDLE deviceHandle;
1017} VRDEVIDEOINNOTIFYDETACH;
1018
1019/* Notification codes, */
1020#define VRDE_VIDEOIN_NOTIFY_ID_ATTACH 0
1021#define VRDE_VIDEOIN_NOTIFY_ID_DETACH 1
1022
1023
1024/* Video input interface callbacks. */
1025typedef struct VRDEVIDEOINCALLBACKS
1026{
1027 /* The header. */
1028 VRDEINTERFACEHDR header;
1029
1030 /* Notifications.
1031 *
1032 * @param pvCallback The callbacks context specified in VRDEGetInterface.
1033 * @param u32EventId The notification identifier: VRDE_VIDEOIN_NOTIFY_*.
1034 * @param pvData The notification specific data.
1035 * @param cbData The size of buffer pointed by pvData.
1036 */
1037 DECLR3CALLBACKMEMBER(void, VRDECallbackVideoInNotify,(void *pvCallback,
1038 uint32_t u32Id,
1039 const void *pvData,
1040 uint32_t cbData));
1041
1042 /* Device description received from the client.
1043 *
1044 * @param pvCallback The callbacks context specified in VRDEGetInterface.
1045 * @param rcRequest The result code of the request.
1046 * @param pDeviceCtx The device context associated with the device in VRDEVideoInGetDeviceDesc.
1047 * @param pvUser The pvUser parameter of VRDEVideoInGetDeviceDesc.
1048 * @param pDeviceDesc The device description.
1049 * @param cbDeviceDesc The size of buffer pointed by pDevice.
1050 */
1051 DECLR3CALLBACKMEMBER(void, VRDECallbackVideoInDeviceDesc,(void *pvCallback,
1052 int rcRequest,
1053 void *pDeviceCtx,
1054 void *pvUser,
1055 const VRDEVIDEOINDEVICEDESC *pDeviceDesc,
1056 uint32_t cbDeviceDesc));
1057
1058 /* Control response or notification.
1059 *
1060 * @param pvCallback The callbacks context specified in VRDEGetInterface.
1061 * @param rcRequest The result code of the request.
1062 * @param pDeviceCtx The device context associated with the device in VRDEVideoInGetDeviceDesc.
1063 * @param pvUser The pvUser parameter of VRDEVideoInControl. NULL if this is a notification.
1064 * @param pControl The control information.
1065 * @param cbControl The size of buffer pointed by pControl.
1066 */
1067 DECLR3CALLBACKMEMBER(void, VRDECallbackVideoInControl,(void *pvCallback,
1068 int rcRequest,
1069 void *pDeviceCtx,
1070 void *pvUser,
1071 const VRDEVIDEOINCTRLHDR *pControl,
1072 uint32_t cbControl));
1073
1074 /* Frame which was received from the client.
1075 *
1076 * @param pvCallback The callbacks context specified in VRDEGetInterface.
1077 * @param rcRequest The result code of the request.
1078 * @param pDeviceCtx The device context associated with the device in VRDEVideoInGetDeviceDesc.
1079 * @param pFrame The frame data.
1080 * @param cbFrame The size of buffer pointed by pFrame.
1081 */
1082 DECLR3CALLBACKMEMBER(void, VRDECallbackVideoInFrame,(void *pvCallback,
1083 int rcRequest,
1084 void *pDeviceCtx,
1085 const VRDEVIDEOINPAYLOADHDR *pFrame,
1086 uint32_t cbFrame));
1087
1088} VRDEVIDEOINCALLBACKS;
1089#endif /* VRDE_VIDEOIN_WITH_VRDEINTERFACE */
1090
1091#pragma pack()
1092
1093#endif /* !VBOX_INCLUDED_RemoteDesktop_VRDEVideoIn_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette