sl@0
|
1 |
// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
//
|
sl@0
|
3 |
// Permission is hereby granted, free of charge, to any person obtaining a
|
sl@0
|
4 |
// copy of this software and/or associated documentation files (the
|
sl@0
|
5 |
// "Materials"), to deal in the Materials without restriction, including
|
sl@0
|
6 |
// without limitation the rights to use, copy, modify, merge, publish,
|
sl@0
|
7 |
// distribute, sublicense, and/or sell copies of the Materials, and to
|
sl@0
|
8 |
// permit persons to whom the Materials are furnished to do so, subject to
|
sl@0
|
9 |
// the following conditions:
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// The above copyright notice and this permission notice shall be included
|
sl@0
|
12 |
// in all copies or substantial portions of the Materials.
|
sl@0
|
13 |
//
|
sl@0
|
14 |
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
sl@0
|
15 |
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
sl@0
|
16 |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
sl@0
|
17 |
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
sl@0
|
18 |
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
sl@0
|
19 |
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
sl@0
|
20 |
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
sl@0
|
21 |
//
|
sl@0
|
22 |
// Description:
|
sl@0
|
23 |
// Native Stream Stubs
|
sl@0
|
24 |
//
|
sl@0
|
25 |
//
|
sl@0
|
26 |
|
sl@0
|
27 |
#include <WF/wfc.h>
|
sl@0
|
28 |
#include <graphics/symbianstream.h>
|
sl@0
|
29 |
#include <graphics/surfacemanager.h>
|
sl@0
|
30 |
#include <graphics/streammap.h>
|
sl@0
|
31 |
#include "owfnativestream.h"
|
sl@0
|
32 |
|
sl@0
|
33 |
#ifdef __cplusplus
|
sl@0
|
34 |
extern "C" {
|
sl@0
|
35 |
#endif
|
sl@0
|
36 |
|
sl@0
|
37 |
|
sl@0
|
38 |
static khronos_int32_t max(khronos_int32_t aLhs, khronos_int32_t aRhs)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
if (aLhs > aRhs) {
|
sl@0
|
41 |
return aLhs;
|
sl@0
|
42 |
}
|
sl@0
|
43 |
return aRhs;
|
sl@0
|
44 |
}
|
sl@0
|
45 |
|
sl@0
|
46 |
static TSurfaceId createSurface(RSurfaceManager& surface_manager, khronos_int32_t width,
|
sl@0
|
47 |
khronos_int32_t height,
|
sl@0
|
48 |
const OWF_IMAGE_FORMAT* format,
|
sl@0
|
49 |
khronos_int32_t nbufs)
|
sl@0
|
50 |
{
|
sl@0
|
51 |
TSurfaceId surface = TSurfaceId::CreateNullId();
|
sl@0
|
52 |
RSurfaceManager::TSurfaceCreationAttributesBuf bf;
|
sl@0
|
53 |
RSurfaceManager::TSurfaceCreationAttributes& b = bf();
|
sl@0
|
54 |
|
sl@0
|
55 |
TBool premultiplied = format->premultiplied;
|
sl@0
|
56 |
OWF_PIXEL_FORMAT pixelFormat = format->pixelFormat;
|
sl@0
|
57 |
khronos_int32_t bytesPerPixel = 0;
|
sl@0
|
58 |
// we don't support linear mode
|
sl@0
|
59 |
if (format->linear)
|
sl@0
|
60 |
{
|
sl@0
|
61 |
return surface;
|
sl@0
|
62 |
}
|
sl@0
|
63 |
switch(pixelFormat)
|
sl@0
|
64 |
{
|
sl@0
|
65 |
case OWF_IMAGE_RGB565:
|
sl@0
|
66 |
b.iPixelFormat = EUidPixelFormatRGB_565;
|
sl@0
|
67 |
bytesPerPixel = 2;
|
sl@0
|
68 |
b.iAlignment = max(format->rowPadding, 4);
|
sl@0
|
69 |
break;
|
sl@0
|
70 |
case OWF_IMAGE_ARGB8888:
|
sl@0
|
71 |
{
|
sl@0
|
72 |
if (premultiplied)
|
sl@0
|
73 |
{
|
sl@0
|
74 |
b.iPixelFormat = EUidPixelFormatARGB_8888_PRE;
|
sl@0
|
75 |
}
|
sl@0
|
76 |
else
|
sl@0
|
77 |
{
|
sl@0
|
78 |
b.iPixelFormat = EUidPixelFormatARGB_8888;
|
sl@0
|
79 |
}
|
sl@0
|
80 |
bytesPerPixel = 4;
|
sl@0
|
81 |
b.iAlignment = format->rowPadding;
|
sl@0
|
82 |
break;
|
sl@0
|
83 |
}
|
sl@0
|
84 |
case OWF_IMAGE_XRGB8888 :
|
sl@0
|
85 |
b.iPixelFormat = EUidPixelFormatXRGB_8888;
|
sl@0
|
86 |
bytesPerPixel = 4;
|
sl@0
|
87 |
b.iAlignment = max(format->rowPadding,4);
|
sl@0
|
88 |
break;
|
sl@0
|
89 |
default:
|
sl@0
|
90 |
return surface;
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
b.iSize.iWidth = width;
|
sl@0
|
94 |
b.iSize.iHeight = height;
|
sl@0
|
95 |
b.iBuffers = nbufs; // number of buffers in the surface
|
sl@0
|
96 |
b.iOffsetToFirstBuffer = 0; // way of reserving space before the surface pixel data
|
sl@0
|
97 |
if (bytesPerPixel >= 0)
|
sl@0
|
98 |
{
|
sl@0
|
99 |
b.iStride = bytesPerPixel * width; // number of bytes between start of one line and start of next
|
sl@0
|
100 |
}
|
sl@0
|
101 |
else
|
sl@0
|
102 |
{
|
sl@0
|
103 |
b.iStride = (width-(bytesPerPixel+1)) / (-bytesPerPixel);
|
sl@0
|
104 |
}
|
sl@0
|
105 |
b.iContiguous = OWF_TRUE;
|
sl@0
|
106 |
b.iMappable = OWF_TRUE;
|
sl@0
|
107 |
|
sl@0
|
108 |
TInt err=surface_manager.CreateSurface(bf, surface);
|
sl@0
|
109 |
if (err<0)
|
sl@0
|
110 |
{
|
sl@0
|
111 |
surface=TSurfaceId::CreateNullId();
|
sl@0
|
112 |
}
|
sl@0
|
113 |
return surface;
|
sl@0
|
114 |
}
|
sl@0
|
115 |
|
sl@0
|
116 |
static void WipeWriteBuffer(SymbianStreamType ns)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
khronos_int32_t height,stride;
|
sl@0
|
119 |
SymbianStreamGetHeader(ns,NULL,&height,&stride,NULL,NULL);
|
sl@0
|
120 |
SymbianStreamBuffer buffer;
|
sl@0
|
121 |
if( KErrNone != SymbianStreamAcquireWriteBuffer(ns, &buffer))
|
sl@0
|
122 |
{
|
sl@0
|
123 |
return;
|
sl@0
|
124 |
}
|
sl@0
|
125 |
void* pixels = NULL;
|
sl@0
|
126 |
// If we fail to get buffer pointer, we proceed without initial wipe
|
sl@0
|
127 |
if( KErrNone != SymbianStreamGetBufferPointer(ns,buffer,&pixels))
|
sl@0
|
128 |
{
|
sl@0
|
129 |
return;
|
sl@0
|
130 |
}
|
sl@0
|
131 |
memset(pixels,0,height*stride);
|
sl@0
|
132 |
SymbianStreamReleaseWriteBuffer(ns,buffer);
|
sl@0
|
133 |
}
|
sl@0
|
134 |
|
sl@0
|
135 |
/*!---------------------------------------------------------------------------
|
sl@0
|
136 |
* Create new off-screen image stream.
|
sl@0
|
137 |
*
|
sl@0
|
138 |
* \param width Stream image buffer width
|
sl@0
|
139 |
* \param height Stream image buffer height
|
sl@0
|
140 |
* \param imageFormat Stream image buffer format
|
sl@0
|
141 |
* \param nbufs Number of image buffers to allocate
|
sl@0
|
142 |
*
|
sl@0
|
143 |
* \param Handle to newly created stream or OWF_INVALID_HANDLe if no
|
sl@0
|
144 |
* stream could be created.
|
sl@0
|
145 |
*----------------------------------------------------------------------------*/
|
sl@0
|
146 |
OWF_API_CALL OWFNativeStreamType
|
sl@0
|
147 |
owfNativeStreamCreateImageStream(OWFint width,
|
sl@0
|
148 |
OWFint height,
|
sl@0
|
149 |
const OWF_IMAGE_FORMAT* format,
|
sl@0
|
150 |
OWFint nbufs)
|
sl@0
|
151 |
{
|
sl@0
|
152 |
RSurfaceManager surface_manager;
|
sl@0
|
153 |
TInt err=surface_manager.Open();
|
sl@0
|
154 |
if (err<KErrNone)
|
sl@0
|
155 |
{
|
sl@0
|
156 |
return WFC_INVALID_HANDLE;
|
sl@0
|
157 |
}
|
sl@0
|
158 |
TSurfaceId surface;
|
sl@0
|
159 |
|
sl@0
|
160 |
surface = createSurface(surface_manager, width, height, format, nbufs);
|
sl@0
|
161 |
if (surface.IsNull())
|
sl@0
|
162 |
{
|
sl@0
|
163 |
return WFC_INVALID_HANDLE;
|
sl@0
|
164 |
}
|
sl@0
|
165 |
SymbianStreamType ns=WFC_INVALID_HANDLE; //No more error checking required...
|
sl@0
|
166 |
SymbianStreamAcquire(&surface,&ns);
|
sl@0
|
167 |
|
sl@0
|
168 |
surface_manager.CloseSurface(surface);
|
sl@0
|
169 |
if (ns)
|
sl@0
|
170 |
{
|
sl@0
|
171 |
WipeWriteBuffer(ns);
|
sl@0
|
172 |
}
|
sl@0
|
173 |
surface_manager.Close();
|
sl@0
|
174 |
return (OWFNativeStreamType)ns;
|
sl@0
|
175 |
}
|
sl@0
|
176 |
/*!---------------------------------------------------------------------------
|
sl@0
|
177 |
* Converts from external WFC native stream handle type to internal OWF native stream handle type.
|
sl@0
|
178 |
* The internal handle MUST be persistant. The external handle may already be persistant.
|
sl@0
|
179 |
* This method may fail, either due to memory, or due to the stream object not being supported by the compositor
|
sl@0
|
180 |
* @param publicStream The publicly defined stream handle
|
sl@0
|
181 |
* @param error Pointer to store error code - optionally can be NULL
|
sl@0
|
182 |
* @return OWFNativeStreamType an equivalent internal stream handle
|
sl@0
|
183 |
*----------------------------------------------------------------------------**/
|
sl@0
|
184 |
OWF_API_CALL OWFNativeStreamType owfNativeStreamFromWFC(WFCNativeStreamType publicStream,OWF_STREAM_ERROR* errorReturn)
|
sl@0
|
185 |
{
|
sl@0
|
186 |
SymbianStreamType rvss;
|
sl@0
|
187 |
TInt err = SymbianStreamAcquire(reinterpret_cast<SymbianStreamType>(publicStream),&rvss);
|
sl@0
|
188 |
if (err)
|
sl@0
|
189 |
{
|
sl@0
|
190 |
if (errorReturn)
|
sl@0
|
191 |
{
|
sl@0
|
192 |
*errorReturn = (err == KErrNoMemory) ? OWF_STREAM_ERROR_OUT_OF_MEMORY : OWF_STREAM_ERROR_INVALID_STREAM;
|
sl@0
|
193 |
}
|
sl@0
|
194 |
return OWF_INVALID_HANDLE;
|
sl@0
|
195 |
}
|
sl@0
|
196 |
OWF_IMAGE_FORMAT format;
|
sl@0
|
197 |
OWFNativeStreamType rvowf=reinterpret_cast<OWFNativeStreamType>(rvss);
|
sl@0
|
198 |
owfNativeStreamGetHeader(rvowf,NULL,NULL,NULL,&format,NULL);
|
sl@0
|
199 |
if (format.pixelFormat==OWF_IMAGE_NOT_SUPPORTED)
|
sl@0
|
200 |
{
|
sl@0
|
201 |
SymbianStreamRemoveReference(rvss);
|
sl@0
|
202 |
if (errorReturn)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
*errorReturn=OWF_STREAM_ERROR_INVALID_STREAM;
|
sl@0
|
205 |
}
|
sl@0
|
206 |
return OWF_INVALID_HANDLE;
|
sl@0
|
207 |
}
|
sl@0
|
208 |
if (errorReturn)
|
sl@0
|
209 |
{
|
sl@0
|
210 |
*errorReturn=OWF_STREAM_ERROR_NONE;
|
sl@0
|
211 |
}
|
sl@0
|
212 |
return rvowf;
|
sl@0
|
213 |
}
|
sl@0
|
214 |
|
sl@0
|
215 |
|
sl@0
|
216 |
|
sl@0
|
217 |
/*!---------------------------------------------------------------------------
|
sl@0
|
218 |
* Increase stream's reference count
|
sl@0
|
219 |
*
|
sl@0
|
220 |
* \param stream Stream handle
|
sl@0
|
221 |
*----------------------------------------------------------------------------*/
|
sl@0
|
222 |
OWF_API_CALL void
|
sl@0
|
223 |
owfNativeStreamAddReference(OWFNativeStreamType stream)
|
sl@0
|
224 |
{
|
sl@0
|
225 |
SymbianStreamAddReference((SymbianStreamType)stream);
|
sl@0
|
226 |
}
|
sl@0
|
227 |
|
sl@0
|
228 |
/*!---------------------------------------------------------------------------
|
sl@0
|
229 |
* Decrease stream's reference count
|
sl@0
|
230 |
*
|
sl@0
|
231 |
* \param stream Stream handle
|
sl@0
|
232 |
*----------------------------------------------------------------------------*/
|
sl@0
|
233 |
OWF_API_CALL void
|
sl@0
|
234 |
owfNativeStreamRemoveReference(OWFNativeStreamType stream)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
SymbianStreamRemoveReference((SymbianStreamType)stream);
|
sl@0
|
237 |
}
|
sl@0
|
238 |
|
sl@0
|
239 |
/*!----------------------------------------------------------------------------
|
sl@0
|
240 |
* Destroy stream. The stream isn't necessarily immediately destroyed, but
|
sl@0
|
241 |
* only when it's reference count reaches zero.
|
sl@0
|
242 |
*
|
sl@0
|
243 |
* \param stream Stream handle
|
sl@0
|
244 |
*----------------------------------------------------------------------------*/
|
sl@0
|
245 |
OWF_API_CALL void
|
sl@0
|
246 |
owfNativeStreamDestroy(OWFNativeStreamType stream)
|
sl@0
|
247 |
{
|
sl@0
|
248 |
SymbianStreamRemoveReference((SymbianStreamType)stream);
|
sl@0
|
249 |
}
|
sl@0
|
250 |
|
sl@0
|
251 |
static TInt PixelFormatConversion(TUidPixelFormat aBaseFormat, OWF_IMAGE_FORMAT& aFormat)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
// Non-alpha formats have the premultiplied flag set because the
|
sl@0
|
254 |
// code handles them more quickly that way.
|
sl@0
|
255 |
switch(aBaseFormat)
|
sl@0
|
256 |
{
|
sl@0
|
257 |
case EUidPixelFormatRGB_565:
|
sl@0
|
258 |
aFormat.linear = OWF_FALSE;
|
sl@0
|
259 |
aFormat.premultiplied = OWF_TRUE;
|
sl@0
|
260 |
aFormat.rowPadding = 2;
|
sl@0
|
261 |
aFormat.pixelFormat = OWF_IMAGE_RGB565;
|
sl@0
|
262 |
break;
|
sl@0
|
263 |
case EUidPixelFormatARGB_8888_PRE:
|
sl@0
|
264 |
aFormat.linear = OWF_FALSE;
|
sl@0
|
265 |
aFormat.premultiplied = OWF_TRUE;
|
sl@0
|
266 |
aFormat.rowPadding = 4;
|
sl@0
|
267 |
aFormat.pixelFormat = OWF_IMAGE_ARGB8888;
|
sl@0
|
268 |
break;
|
sl@0
|
269 |
case EUidPixelFormatARGB_8888:
|
sl@0
|
270 |
aFormat.linear = OWF_FALSE;
|
sl@0
|
271 |
aFormat.premultiplied = OWF_FALSE;
|
sl@0
|
272 |
aFormat.rowPadding = 4;
|
sl@0
|
273 |
aFormat.pixelFormat = OWF_IMAGE_ARGB8888;
|
sl@0
|
274 |
break;
|
sl@0
|
275 |
case EUidPixelFormatXRGB_8888 :
|
sl@0
|
276 |
aFormat.linear = OWF_FALSE;
|
sl@0
|
277 |
aFormat.premultiplied = OWF_TRUE;
|
sl@0
|
278 |
aFormat.rowPadding = 4;
|
sl@0
|
279 |
aFormat.pixelFormat = OWF_IMAGE_XRGB8888;
|
sl@0
|
280 |
break;
|
sl@0
|
281 |
case EUidPixelFormatA_8 :
|
sl@0
|
282 |
aFormat.linear = OWF_FALSE;
|
sl@0
|
283 |
aFormat.premultiplied = OWF_FALSE;
|
sl@0
|
284 |
aFormat.rowPadding = 4;
|
sl@0
|
285 |
aFormat.pixelFormat = OWF_IMAGE_L8;
|
sl@0
|
286 |
break;
|
sl@0
|
287 |
case EUidPixelFormatL_1 :
|
sl@0
|
288 |
aFormat.linear = OWF_FALSE;
|
sl@0
|
289 |
aFormat.premultiplied = OWF_FALSE;
|
sl@0
|
290 |
aFormat.rowPadding = 4;
|
sl@0
|
291 |
aFormat.pixelFormat = OWF_IMAGE_L1;
|
sl@0
|
292 |
break;
|
sl@0
|
293 |
default:
|
sl@0
|
294 |
aFormat.linear = OWF_FALSE;
|
sl@0
|
295 |
aFormat.premultiplied = OWF_FALSE;
|
sl@0
|
296 |
aFormat.rowPadding = 0;
|
sl@0
|
297 |
aFormat.pixelFormat = OWF_IMAGE_NOT_SUPPORTED;
|
sl@0
|
298 |
return KErrNotSupported;
|
sl@0
|
299 |
}
|
sl@0
|
300 |
return KErrNone;
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
/*!---------------------------------------------------------------------------
|
sl@0
|
304 |
* Get stream's image header
|
sl@0
|
305 |
*
|
sl@0
|
306 |
* \param stream Stream handle
|
sl@0
|
307 |
* \param width Stream width
|
sl@0
|
308 |
* \param height Stream height
|
sl@0
|
309 |
* \param stride Stream stride
|
sl@0
|
310 |
* \param format Stream format
|
sl@0
|
311 |
* \param pixelSize Stream pixelSize
|
sl@0
|
312 |
*
|
sl@0
|
313 |
* All the parameters above, except stream handle, are pointers to locations
|
sl@0
|
314 |
* where the particular value should be written to. Passing in a NULL
|
sl@0
|
315 |
* pointer means that the particular values is of no interest to the caller.
|
sl@0
|
316 |
*
|
sl@0
|
317 |
* E.g. to query only width & height one would call this function with
|
sl@0
|
318 |
* parameters (stream_handle, &width, &height, NULL, NULL, NULL);
|
sl@0
|
319 |
*
|
sl@0
|
320 |
*----------------------------------------------------------------------------*/
|
sl@0
|
321 |
OWF_API_CALL void
|
sl@0
|
322 |
owfNativeStreamGetHeader(OWFNativeStreamType stream,
|
sl@0
|
323 |
OWFint* width,
|
sl@0
|
324 |
OWFint* height,
|
sl@0
|
325 |
OWFint* stride,
|
sl@0
|
326 |
OWF_IMAGE_FORMAT* format,
|
sl@0
|
327 |
OWFint* pixelSize)
|
sl@0
|
328 |
{
|
sl@0
|
329 |
SymOwfPixelFormat symFormat;
|
sl@0
|
330 |
SymbianStreamGetHeader((SymbianStreamType)stream,
|
sl@0
|
331 |
width,
|
sl@0
|
332 |
height,
|
sl@0
|
333 |
stride,
|
sl@0
|
334 |
format?&symFormat:(SymOwfPixelFormat*)NULL,
|
sl@0
|
335 |
pixelSize);
|
sl@0
|
336 |
if (format)
|
sl@0
|
337 |
{ //translate format. If error then OWF_IMAGE_NOT_SUPPORTED is set.
|
sl@0
|
338 |
PixelFormatConversion(static_cast<TUidPixelFormat>(symFormat),*format);
|
sl@0
|
339 |
}
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
/*!---------------------------------------------------------------------------
|
sl@0
|
343 |
* Acquire read buffer from stream
|
sl@0
|
344 |
*
|
sl@0
|
345 |
* \param stream Stream handle
|
sl@0
|
346 |
*
|
sl@0
|
347 |
* \return Handle to next readable (unread since last write)
|
sl@0
|
348 |
* buffer from the stream or OWF_INVALID_HANDLE if no unread buffers
|
sl@0
|
349 |
* are available.
|
sl@0
|
350 |
*----------------------------------------------------------------------------*/
|
sl@0
|
351 |
OWF_API_CALL OWFNativeStreamBuffer
|
sl@0
|
352 |
owfNativeStreamAcquireReadBuffer(OWFNativeStreamType stream)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
OWFNativeStreamBuffer returnBuffer;
|
sl@0
|
355 |
SymbianStreamAcquireReadBuffer((SymbianStreamType)stream,(SymbianStreamBuffer*)&returnBuffer);
|
sl@0
|
356 |
return returnBuffer;
|
sl@0
|
357 |
}
|
sl@0
|
358 |
|
sl@0
|
359 |
/*!---------------------------------------------------------------------------
|
sl@0
|
360 |
* Release read buffer.
|
sl@0
|
361 |
*
|
sl@0
|
362 |
* \param stream Stream handle
|
sl@0
|
363 |
* \param buf Buffer handle
|
sl@0
|
364 |
*----------------------------------------------------------------------------*/
|
sl@0
|
365 |
OWF_API_CALL void
|
sl@0
|
366 |
owfNativeStreamReleaseReadBuffer(OWFNativeStreamType stream,
|
sl@0
|
367 |
OWFNativeStreamBuffer buf)
|
sl@0
|
368 |
{
|
sl@0
|
369 |
SymbianStreamReleaseReadBuffer((SymbianStreamType)stream,(SymbianStreamBuffer)buf);
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
/*!---------------------------------------------------------------------------
|
sl@0
|
373 |
* Acquires writable buffer from a stream. The caller has exclusive access
|
sl@0
|
374 |
* to returned buffer until the buffer is commited to stream by
|
sl@0
|
375 |
* calling ReleaseWriteBuffer.
|
sl@0
|
376 |
*
|
sl@0
|
377 |
* \param stream Stream handle
|
sl@0
|
378 |
*
|
sl@0
|
379 |
* \return Handle to next writable buffer or OWF_INVALID_HANDLE if no such
|
sl@0
|
380 |
* buffer is available.
|
sl@0
|
381 |
*----------------------------------------------------------------------------*/
|
sl@0
|
382 |
OWF_API_CALL OWFNativeStreamBuffer
|
sl@0
|
383 |
owfNativeStreamAcquireWriteBuffer(OWFNativeStreamType stream)
|
sl@0
|
384 |
{
|
sl@0
|
385 |
OWFNativeStreamBuffer returnBuffer;
|
sl@0
|
386 |
SymbianStreamAcquireWriteBuffer((SymbianStreamType)stream,(SymbianStreamBuffer*)&returnBuffer);
|
sl@0
|
387 |
return returnBuffer;
|
sl@0
|
388 |
}
|
sl@0
|
389 |
|
sl@0
|
390 |
/*!---------------------------------------------------------------------------
|
sl@0
|
391 |
* Commit write buffer to stream.
|
sl@0
|
392 |
*
|
sl@0
|
393 |
* \param stream Stream handle
|
sl@0
|
394 |
* \param buf Buffer handle
|
sl@0
|
395 |
*----------------------------------------------------------------------------*/
|
sl@0
|
396 |
OWF_API_CALL void
|
sl@0
|
397 |
owfNativeStreamReleaseWriteBuffer(OWFNativeStreamType stream,
|
sl@0
|
398 |
OWFNativeStreamBuffer buf,
|
sl@0
|
399 |
EGLDisplay dpy,
|
sl@0
|
400 |
EGLSyncKHR sync)
|
sl@0
|
401 |
{
|
sl@0
|
402 |
//We do not use the sync object mechanism to indicate that content has been consumed.
|
sl@0
|
403 |
//See the SUS notification support
|
sl@0
|
404 |
(void)dpy;
|
sl@0
|
405 |
(void)sync;
|
sl@0
|
406 |
SymbianStreamReleaseWriteBuffer((SymbianStreamType)stream,(SymbianStreamBuffer)buf);
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
/*!---------------------------------------------------------------------------
|
sl@0
|
410 |
* Enable/disable stream content notifications.
|
sl@0
|
411 |
*
|
sl@0
|
412 |
* \param stream Stream handle
|
sl@0
|
413 |
* \param send Boolean value indicating whether the stream should
|
sl@0
|
414 |
* send content notifications to its observers.
|
sl@0
|
415 |
*----------------------------------------------------------------------------*/
|
sl@0
|
416 |
OWF_API_CALL void
|
sl@0
|
417 |
owfNativeStreamEnableUpdateNotifications(OWFNativeStreamType /*stream*/,
|
sl@0
|
418 |
OWFboolean /*send*/)
|
sl@0
|
419 |
{
|
sl@0
|
420 |
//SymbianStream always enables update notifications.
|
sl@0
|
421 |
//It can deal efficiently with the situation where there are no registered observers.
|
sl@0
|
422 |
}
|
sl@0
|
423 |
|
sl@0
|
424 |
|
sl@0
|
425 |
|
sl@0
|
426 |
/*!---------------------------------------------------------------------------
|
sl@0
|
427 |
* Return pointer to stream buffer's pixel data. The buffer must be
|
sl@0
|
428 |
* a valid read/write buffer.
|
sl@0
|
429 |
*
|
sl@0
|
430 |
* \param stream Stream handle
|
sl@0
|
431 |
* \param buffer Buffer handle
|
sl@0
|
432 |
*
|
sl@0
|
433 |
* \return Pointer to buffers pixel data.
|
sl@0
|
434 |
*----------------------------------------------------------------------------*/
|
sl@0
|
435 |
OWF_API_CALL void*
|
sl@0
|
436 |
owfNativeStreamGetBufferPtr(OWFNativeStreamType stream,
|
sl@0
|
437 |
OWFNativeStreamBuffer buffer)
|
sl@0
|
438 |
{
|
sl@0
|
439 |
void* returnPointer = NULL;
|
sl@0
|
440 |
SymbianStreamGetBufferPointer((SymbianStreamType)stream,buffer,&returnPointer);
|
sl@0
|
441 |
return returnPointer;
|
sl@0
|
442 |
}
|
sl@0
|
443 |
|
sl@0
|
444 |
/*!---------------------------------------------------------------------------
|
sl@0
|
445 |
* Set/reset stream's protection flag. This flag is used for preventing the
|
sl@0
|
446 |
* user from deleting a stream that s/he doesn't really own or should
|
sl@0
|
447 |
* not twiddle with too much (on-screen context's target stream, for example)
|
sl@0
|
448 |
*
|
sl@0
|
449 |
* \param stream Stream handle
|
sl@0
|
450 |
* \param flag Protection status
|
sl@0
|
451 |
*----------------------------------------------------------------------------*/
|
sl@0
|
452 |
OWF_API_CALL void
|
sl@0
|
453 |
owfNativeStreamSetProtectionFlag(OWFNativeStreamType stream,
|
sl@0
|
454 |
OWFboolean flag)
|
sl@0
|
455 |
{
|
sl@0
|
456 |
SymbianStreamSetProtectionFlag((SymbianStreamType)stream,flag);
|
sl@0
|
457 |
}
|
sl@0
|
458 |
|
sl@0
|
459 |
/*!---------------------------------------------------------------------------
|
sl@0
|
460 |
* Set/reset stream's flip state. When the flip state is OWF_TRUE, the stream
|
sl@0
|
461 |
* attributes returned by owfNativeStreamGetHeader are affected as follows:
|
sl@0
|
462 |
* -# The width and height attributes are swapped.
|
sl@0
|
463 |
* -# The stride attribute is derived from the height value instead of the
|
sl@0
|
464 |
* width.
|
sl@0
|
465 |
*
|
sl@0
|
466 |
* Note: the attributes of the underlying surface as retrieved using Surface
|
sl@0
|
467 |
* Manager are not affected by this flag.
|
sl@0
|
468 |
*
|
sl@0
|
469 |
* \param stream Stream handle
|
sl@0
|
470 |
* \param flip New flip state
|
sl@0
|
471 |
*----------------------------------------------------------------------------*/
|
sl@0
|
472 |
OWF_API_CALL void
|
sl@0
|
473 |
owfSetStreamFlipState(OWFNativeStreamType stream, OWFboolean flip)
|
sl@0
|
474 |
{
|
sl@0
|
475 |
SymbianStreamSetFlipState((SymbianStreamType)stream, flip);
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
#ifdef __cplusplus
|
sl@0
|
479 |
}
|
sl@0
|
480 |
#endif
|
sl@0
|
481 |
|
sl@0
|
482 |
|