VirtualBox

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

Last change on this file since 44654 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

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

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