1 | /** @file
|
---|
2 | * VBox Remote Desktop Extension (VRDE) - Image updates interface.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2020 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_INCLUDED_RemoteDesktop_VRDEImage_h
|
---|
27 | #define VBOX_INCLUDED_RemoteDesktop_VRDEImage_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <VBox/RemoteDesktop/VRDE.h>
|
---|
33 |
|
---|
34 | /*
|
---|
35 | * Generic interface for external image updates with a clipping region to be sent
|
---|
36 | * to the client.
|
---|
37 | *
|
---|
38 | * Async callbacks are used for reporting errors, providing feedback, etc.
|
---|
39 | */
|
---|
40 |
|
---|
41 | #define VRDE_IMAGE_INTERFACE_NAME "IMAGE"
|
---|
42 |
|
---|
43 | #ifdef __cplusplus
|
---|
44 | class VRDEImage;
|
---|
45 | typedef class VRDEImage *HVRDEIMAGE;
|
---|
46 | #else
|
---|
47 | struct VRDEImage;
|
---|
48 | typedef struct VRDEImage *HVRDEIMAGE;
|
---|
49 | #endif /* __cplusplus */
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * Format description structures for VRDEImageHandleCreate.
|
---|
53 | */
|
---|
54 | typedef struct VRDEIMAGEFORMATBITMAP
|
---|
55 | {
|
---|
56 | uint32_t u32BytesPerPixel; /** @todo impl */
|
---|
57 | } VRDEIMAGEFORMATBITMAP;
|
---|
58 |
|
---|
59 | typedef struct VRDEIMAGEBITMAP
|
---|
60 | {
|
---|
61 | uint32_t cWidth; /* The width of the bitmap in pixels. */
|
---|
62 | uint32_t cHeight; /* The height of the bitmap in pixels. */
|
---|
63 | const void *pvData; /* Address of pixel buffer. */
|
---|
64 | uint32_t cbData; /* Size of pixel buffer. */
|
---|
65 | const void *pvScanLine0; /* Address of first scanline. */
|
---|
66 | int32_t iScanDelta; /* Difference between two scanlines. */
|
---|
67 | } VRDEIMAGEBITMAP;
|
---|
68 |
|
---|
69 | /*
|
---|
70 | * Image update handle creation flags.
|
---|
71 | */
|
---|
72 | #define VRDE_IMAGE_F_CREATE_DEFAULT 0x00000000
|
---|
73 | #define VRDE_IMAGE_F_CREATE_CONTENT_3D 0x00000001 /* Input image data is a rendered 3d scene. */
|
---|
74 | #define VRDE_IMAGE_F_CREATE_CONTENT_VIDEO 0x00000002 /* Input image data is a sequence of video frames. */
|
---|
75 | #define VRDE_IMAGE_F_CREATE_WINDOW 0x00000004 /* pRect parameter is the image update area. */
|
---|
76 |
|
---|
77 | /*
|
---|
78 | * Completion flags for image update handle creation.
|
---|
79 | */
|
---|
80 | #define VRDE_IMAGE_F_COMPLETE_DEFAULT 0x00000000 /* The handle has been created. */
|
---|
81 | #define VRDE_IMAGE_F_COMPLETE_ASYNC 0x00000001 /* The server will call VRDEImageCbNotify when the handle is ready. */
|
---|
82 |
|
---|
83 | /*
|
---|
84 | * Supported input image formats.
|
---|
85 | *
|
---|
86 | * The identifiers are arbitrary and new formats can be introduced later.
|
---|
87 | *
|
---|
88 | */
|
---|
89 | #define VRDE_IMAGE_FMT_ID_BITMAP_BGRA8 "BITMAP_BGRA8.07e46a64-e93e-41d4-a845-204094f5ccf1"
|
---|
90 |
|
---|
91 | /** The VRDE server external image updates interface entry points. Interface version 1. */
|
---|
92 | typedef struct VRDEIMAGEINTERFACE
|
---|
93 | {
|
---|
94 | /** The header. */
|
---|
95 | VRDEINTERFACEHDR header;
|
---|
96 |
|
---|
97 | /** Create image updates handle.
|
---|
98 | *
|
---|
99 | * The server can setup a context which will speed up further updates.
|
---|
100 | *
|
---|
101 | * A failure is returned if the server either does not support requested updates
|
---|
102 | * or it failed to create a handle.
|
---|
103 | *
|
---|
104 | * A success means that the server was able to create an internal context for
|
---|
105 | * the updates.
|
---|
106 | *
|
---|
107 | * @param hServer The server instance handle.
|
---|
108 | * @param phImage The returned image updates handle.
|
---|
109 | * @param pvUser The caller context of the call.
|
---|
110 | * @param u32ScreenId Updates are for this screen in a multimonitor config.
|
---|
111 | * @param fu32Flags VRDE_IMAGE_F_CREATE_* flags, which describe input data.
|
---|
112 | * @param pRect If VRDE_IMAGE_F_CREATE_WINDOW is set, this is the area of expected updates.
|
---|
113 | * Otherwise the entire screen will be used for updates.
|
---|
114 | * @param pvFormat Format specific data.
|
---|
115 | * @param cbFormat Size of format specific data.
|
---|
116 | * @param *pfu32CompletionFlags VRDE_IMAGE_F_COMPLETE_* flags. Async handle creation, etc.
|
---|
117 | *
|
---|
118 | * @return IPRT status code.
|
---|
119 | */
|
---|
120 | DECLR3CALLBACKMEMBER(int, VRDEImageHandleCreate, (HVRDESERVER hServer,
|
---|
121 | HVRDEIMAGE *phImage,
|
---|
122 | void *pvUser,
|
---|
123 | uint32_t u32ScreenId,
|
---|
124 | uint32_t fu32Flags,
|
---|
125 | const RTRECT *pRect,
|
---|
126 | const char *pszFormatId,
|
---|
127 | const void *pvFormat,
|
---|
128 | uint32_t cbFormat,
|
---|
129 | uint32_t *pfu32CompletionFlags));
|
---|
130 |
|
---|
131 | /** Create image updates handle.
|
---|
132 | *
|
---|
133 | * @param hImage The image updates handle, which the caller will not use anymore.
|
---|
134 | *
|
---|
135 | * @return IPRT status code.
|
---|
136 | */
|
---|
137 | DECLR3CALLBACKMEMBER(void, VRDEImageHandleClose, (HVRDEIMAGE hImage));
|
---|
138 |
|
---|
139 | /** Set a clipping region for a particular screen.
|
---|
140 | *
|
---|
141 | * @param hImage The image updates handle.
|
---|
142 | * @param cRects How many rectangles. 0 clears region for this screen.
|
---|
143 | * @param paRects Rectangles in the screen coordinates.
|
---|
144 | *
|
---|
145 | * @return IPRT status code.
|
---|
146 | */
|
---|
147 | DECLR3CALLBACKMEMBER(int, VRDEImageRegionSet, (HVRDEIMAGE hImage,
|
---|
148 | uint32_t cRects,
|
---|
149 | const RTRECT *paRects));
|
---|
150 |
|
---|
151 | /** Set the new position of the update area. Only works if the image handle
|
---|
152 | * has been created with VRDE_IMAGE_F_CREATE_WINDOW.
|
---|
153 | *
|
---|
154 | * @param hImage The image updates handle.
|
---|
155 | * @param pRect New area rectangle in the screen coordinates.
|
---|
156 | *
|
---|
157 | * @return IPRT status code.
|
---|
158 | */
|
---|
159 | DECLR3CALLBACKMEMBER(int, VRDEImageGeometrySet, (HVRDEIMAGE hImage,
|
---|
160 | const RTRECT *pRect));
|
---|
161 |
|
---|
162 | /** Set a configuration parameter.
|
---|
163 | *
|
---|
164 | * @param hImage The image updates handle.
|
---|
165 | * @param pszName The parameter name.
|
---|
166 | * @param pszValue The parameter value.
|
---|
167 | *
|
---|
168 | * @return IPRT status code.
|
---|
169 | */
|
---|
170 | DECLR3CALLBACKMEMBER(int, VRDEImagePropertySet, (HVRDEIMAGE hImage,
|
---|
171 | const char *pszName,
|
---|
172 | const char *pszValue));
|
---|
173 |
|
---|
174 | /** Query a configuration parameter.
|
---|
175 | *
|
---|
176 | * @param hImage The image updates handle.
|
---|
177 | * @param pszName The parameter name.
|
---|
178 | * @param pszValue The parameter value.
|
---|
179 | * @param cbValueIn The size of pszValue buffer.
|
---|
180 | * @param pcbValueOut The length of data returned in pszValue buffer.
|
---|
181 | *
|
---|
182 | * Properties names:
|
---|
183 | * "ID" - an unique string for this hImage.
|
---|
184 | *
|
---|
185 | * @return IPRT status code.
|
---|
186 | */
|
---|
187 | DECLR3CALLBACKMEMBER(int, VRDEImagePropertyQuery, (HVRDEIMAGE hImage,
|
---|
188 | const char *pszName,
|
---|
189 | char *pszValue,
|
---|
190 | uint32_t cbValueIn,
|
---|
191 | uint32_t *pcbValueOut));
|
---|
192 |
|
---|
193 | /** Data for an image update.
|
---|
194 | *
|
---|
195 | * @param hImage The image updates handle.
|
---|
196 | * @param i32TargetX Target x.
|
---|
197 | * @param i32TargetY Target y.
|
---|
198 | * @param i32TargetW Target width.
|
---|
199 | * @param i32TargetH Target height.
|
---|
200 | * @param pvImageData Format specific image data (for example VRDEIMAGEBITMAP).
|
---|
201 | * @param cbImageData Size of format specific image data.
|
---|
202 | */
|
---|
203 | DECLR3CALLBACKMEMBER(void, VRDEImageUpdate, (HVRDEIMAGE hImage,
|
---|
204 | int32_t i32TargetX,
|
---|
205 | int32_t i32TargetY,
|
---|
206 | uint32_t u32TargetW,
|
---|
207 | uint32_t u32TargetH,
|
---|
208 | const void *pvImageData,
|
---|
209 | uint32_t cbImageData));
|
---|
210 | } VRDEIMAGEINTERFACE;
|
---|
211 |
|
---|
212 | /*
|
---|
213 | * Notifications.
|
---|
214 | * u32Id parameter of VRDEIMAGECALLBACKS::VRDEImageCbNotify.
|
---|
215 | */
|
---|
216 | #define VRDE_IMAGE_NOTIFY_HANDLE_CREATE 1 /* Async result of VRDEImageHandleCreate.
|
---|
217 | * pvData: uint32_t = 0 if stream was not created,
|
---|
218 | * a non zero value otherwise.
|
---|
219 | */
|
---|
220 |
|
---|
221 | typedef struct VRDEIMAGECALLBACKS
|
---|
222 | {
|
---|
223 | /** The header. */
|
---|
224 | VRDEINTERFACEHDR header;
|
---|
225 |
|
---|
226 | /** Generic notification callback.
|
---|
227 | *
|
---|
228 | * @param hServer The server instance handle.
|
---|
229 | * @param pvContext The callbacks context specified in VRDEGetInterface.
|
---|
230 | * @param pvUser The pvUser parameter of VRDEImageHandleCreate.
|
---|
231 | * @param hImage The handle, same as returned by VRDEImageHandleCreate.
|
---|
232 | * @param u32Id The notification identifier: VRDE_IMAGE_NOTIFY_*.
|
---|
233 | * @param pvData The callback specific data.
|
---|
234 | * @param cbData The size of buffer pointed by pvData.
|
---|
235 | *
|
---|
236 | * @return IPRT status code.
|
---|
237 | */
|
---|
238 | DECLR3CALLBACKMEMBER(int, VRDEImageCbNotify,(void *pvContext,
|
---|
239 | void *pvUser,
|
---|
240 | HVRDEIMAGE hVideo,
|
---|
241 | uint32_t u32Id,
|
---|
242 | void *pvData,
|
---|
243 | uint32_t cbData));
|
---|
244 | } VRDEIMAGECALLBACKS;
|
---|
245 |
|
---|
246 | #endif /* !VBOX_INCLUDED_RemoteDesktop_VRDEImage_h */
|
---|