VirtualBox

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

Last change on this file since 72490 was 69107, checked in by vboxsync, 7 years ago

include/VBox/: (C) year

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