os/graphics/graphicscomposition/openwfsupport/inc/symbianstream.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicscomposition/openwfsupport/inc/symbianstream.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,669 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// symbianstream.h
    1.18 +// C API for surface stream implementation of OpenWF-C NativeStream
    1.19 +//
    1.20 +
    1.21 +#ifndef __SYMBIANSTREAM_H__
    1.22 +#define __SYMBIANSTREAM_H__
    1.23 +
    1.24 +
    1.25 +#ifdef __cplusplus
    1.26 +class TSurfaceId;
    1.27 +class RSurfaceManager;
    1.28 +#else
    1.29 +typedef struct struct_TSurfaceId TSurfaceId;
    1.30 +#endif
    1.31 +#include <KHR/khrplatform.h>
    1.32 +typedef khronos_int32_t khronos_bool;
    1.33 +typedef khronos_int32_t TErrCode;
    1.34 +
    1.35 +/*!
    1.36 + * \brief Image stream implementation
    1.37 + *
    1.38 + * WF native stream is an abstraction of image stream or
    1.39 + * a content pipe that can be used to deliver image data from
    1.40 + * place to another. A stream has a producer (source) and a consumer
    1.41 + * (sink) as its users.
    1.42 + *
    1.43 + * Streams operate on buffers, whose count is fixed at creation
    1.44 + * time (minimum is 1, but for non-blocking behavior values
    1.45 + * greater than 1 should be used.) Streams are meant to be used
    1.46 + * strictly on "point-to-point" basis, i.e. there should be only
    1.47 + * one producer and one consumer for each stream.
    1.48 + *
    1.49 + */
    1.50 +#	ifdef __cplusplus
    1.51 +extern "C" {
    1.52 +#	endif
    1.53 +
    1.54 +#define KInitialContextSerialNumber 0
    1.55 +#define KNoAssociatedScreenNumber (-1)
    1.56 +
    1.57 +typedef const TSurfaceId*	SymbianStreamType;
    1.58 +
    1.59 +typedef
    1.60 +    enum type_SymbianStreamEventBits   {       //note reservations are internal and reorderable
    1.61 +    ESOWF_NoEvent                       = 0x00000000, // no event field: used to invalidate an observer
    1.62 +                                                        // entry in the observer container
    1.63 +    ESOWF_EventComposed                 = 0x00000001, // identifies the callback called when tha internal a stream is updated
    1.64 +    
    1.65 +    ESOWF_EventUpdated                  = 0x00000010, // identifies the content update
    1.66 +                                                        //callback used to trigger a new composition
    1.67 +    ESOWF_SIEventsMask                  = ESOWF_EventComposed | ESOWF_EventUpdated,
    1.68 +
    1.69 +    // the following events identify the SUS events
    1.70 +    ESOWF_EventAvailable                = 0x00000100, // SUS notification
    1.71 +    ESOWF_EventDisplayed                = 0x00000200, // SUS notification
    1.72 +    ESOWF_EventDisplayedX               = 0x00000400, // SUS notification
    1.73 +    ESOWF_SUSEventsMask                 = ESOWF_EventDisplayed | ESOWF_EventAvailable | ESOWF_EventDisplayedX,
    1.74 +
    1.75 +    ESOWF_AllEventsMask                 = (ESOWF_SIEventsMask | ESOWF_SUSEventsMask),
    1.76 +
    1.77 +    // the following fields are additional operations, extending the observer behaviour
    1.78 +    ESOWF_ObserverReturnDefaultEvent    = 0x00010000,
    1.79 +    ESOWF_ObserverProcessing            = 0x00020000,
    1.80 +    ESOWF_ObserverCheckVisible          = 0x00040000,
    1.81 +    ESOWF_ObserverCancel                = 0x00080000,
    1.82 +
    1.83 +    // reserved for future extensions
    1.84 +    ESOWF_RESERVED_MASK                 = 0xff000000
    1.85 +    } SymbianStreamEventBits;
    1.86 +
    1.87 +typedef khronos_int32_t SymOwfNativeStreamBuffer;
    1.88 +
    1.89 +#define SYMBIAN_INVALID_HANDLE  0
    1.90 +
    1.91 +typedef khronos_int32_t	MultipleSymbianStreamEventBits;
    1.92 +typedef khronos_int32_t	SymNativeStreamEvent;
    1.93 +typedef khronos_int32_t SymbianStreamBuffer;
    1.94 +typedef khronos_int32_t	SymOwfPixelFormat;
    1.95 +typedef	khronos_int32_t SymOwfBool;
    1.96 +
    1.97 +typedef enum
    1.98 +{
    1.99 +    SOWF_STREAM_ERROR_NONE               = 0,
   1.100 +    SOWF_STREAM_ERROR_INVALID_STREAM     = -1,
   1.101 +    SOWF_STREAM_ERROR_INVALID_OBSERVER   = -2,
   1.102 +    SOWF_STREAM_ERROR_OUT_OF_MEMORY      = -3
   1.103 +} SOWF_STREAM_ERROR;
   1.104 +
   1.105 +/*! Native stream callback function type */
   1.106 +typedef void (*SymOwfStreamCallback)(SymbianStreamType, SymNativeStreamEvent, void*);
   1.107 +/*! Native stream callback function type */
   1.108 +typedef void (*SymbianStreamCallback)(SymbianStreamType, MultipleSymbianStreamEventBits, void*, void*);
   1.109 +
   1.110 +typedef struct{
   1.111 +    TInt32      length;
   1.112 +    TInt32      id;
   1.113 +    TInt32      par;
   1.114 +    TInt32      serialNumber;
   1.115 +    TInt32      immediateAvailable;
   1.116 +    TInt32      immediateVisibility;
   1.117 +} SYMOWF_CONTENT_UPDATED_PARAM;
   1.118 +
   1.119 +typedef struct{
   1.120 +    TInt32      length;
   1.121 +    TInt32      event;
   1.122 +} SYMOWF_DEFAULT_EVENT_PARAM;
   1.123 +
   1.124 +typedef enum
   1.125 +{
   1.126 +    SYM_CONTENT_UPDATE_BEGIN               = 0x00000001,
   1.127 +    SYM_CONTENT_UPDATE_END                 = 0x00000002,
   1.128 +    SYM_CONTENT_UPDATE                     = 0x00000003,
   1.129 +    SYM_CONTENT_UPDATE_MAX                 = 0xffffffff
   1.130 +} SymContentUpdatedCommandsId;
   1.131 +
   1.132 +typedef enum
   1.133 +{
   1.134 +    SYM_CONTENT_VISIBLE_NOT_SET            = 0x00000000,
   1.135 +    SYM_CONTENT_VISIBLE                    = 0x00000001,
   1.136 +    SYM_CONTENT_NOT_VISIBLE                = 0x00000002,
   1.137 +    SYM_CONTENT_MAX                        = 0xffffffff
   1.138 +} SymContextVisibilityState;
   1.139 +
   1.140 +typedef enum
   1.141 +{
   1.142 +    SYM_CONTENT_PREVIOUS_COMMIT_FALSE      = 0x00000000,
   1.143 +    SYM_CONTENT_PREVIOUS_COMMIT_TRUE       = 0x00000001,
   1.144 +    SYM_CONTENT_COMMIT_MAX                 = 0xffffffff
   1.145 +} SymContextCommitState;
   1.146 +
   1.147 +
   1.148 +/** Finds, and creates if necessary, a Native Stream object encapsulating the specified surface.
   1.149 +
   1.150 +@param  aId The TSurfaceId for the surface to encapsulate.
   1.151 +@param  aReturnHandle   The Native Stream handle created.
   1.152 +
   1.153 +@pre
   1.154 +    -   aId must not be a NULL pointer
   1.155 +    -   aReturnHandle must not be a NULL pointer, and must point to writable storage for the handle.
   1.156 +    -   aId must be a valid active Surface ID created by the Surface Manager.
   1.157 +        -   In particular, aId->IsNull() should return EFalse.
   1.158 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.159 +@post
   1.160 +    The location pointed to by aReturnHandle is set to a valid Native Stream object and KErrNone is returned, or NULL is set and an error code is returned appropriately.
   1.161 +    The method may fail due to memory allocation if the Native Stream does not already exist.
   1.162 +    If a stream object is successfully created, then the reference on the stream is increased to ensure it remains live following the method call. See SymbianStreamRemoveReference to release the reference.
   1.163 +
   1.164 +@panic  NativeStream 1000001 Null Surface ID
   1.165 +@panic  NativeStream  1000002 Null return value pointer
   1.166 +@return Symbian error code
   1.167 +    -  KErrNone    Method Succeeded
   1.168 +    -  KErrBadHandle   aId was not created by the Surface Manager, or has been destroyed.
   1.169 +    -  KErrNoMemory    Internal allocation of resources for the Native Stream failed.
   1.170 +**/
   1.171 +  IMPORT_C TErrCode SymbianStreamAcquire( const TSurfaceId* aId, SymbianStreamType* aReturnHandle);
   1.172 +
   1.173 +/** Opens the current output buffer of the Native Stream object for non-exclusive reading.
   1.174 +
   1.175 +@param  aStream Native Stream handle that is to be accessed.
   1.176 +@param  aReturnBuffer   Filled with the handle to use to access the current read buffer
   1.177 +
   1.178 +@pre
   1.179 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.180 +    -   aReturnBuffer must not be a NULL pointer, and must point to writable storage for the handle.
   1.181 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.182 +    -   To simplify composition, SymbianStreamAcquireReadBuffer will never fail. It will arbitrarily select a buffer if the stream has never been written to or updated.
   1.183 +@post
   1.184 +    -   This method always succeeds and returns quickly.
   1.185 +    -   The current read buffer is locked for reading.
   1.186 +    -   The location pointed to by aReturnBuffer is set to a handle representing the read buffer at the time of this call.
   1.187 +    -   Many readers may access the same buffer, but if the Native Stream represents a multi-buffered TSurfaceId content, writers are blocked from overwriting the current read buffer, which will be the last buffer successfully written to.
   1.188 +        -   In single-buffered streams, the content of the buffer may be overwritten while the reader is reading it, leading to tearing, but this behavior is generally considered preferable to blocking the reader.
   1.189 +    -   The Native Stream will not be destroyed while buffers are acquired.
   1.190 +    -   Note that no operations likely to cause failure will occur during the acquire method, but successful acquire does not guarantee that the buffer pixel data can be successfully mapped using NativeStreamGetBufferPointer.
   1.191 +
   1.192 +@panic NativeStream 1000002 Null return value pointer
   1.193 +@panic NativeStream 1000003 Null Native Stream
   1.194 +@return Symbian error code
   1.195 +    -  KErrNone    Method Succeeded
   1.196 +    -  KErrNoMemory    Internal allocation of resources for the Native Stream failed.
   1.197 +**/
   1.198 +  IMPORT_C TErrCode SymbianStreamAcquireReadBuffer( SymbianStreamType aStream, SymbianStreamBuffer* aReturnBuffer);
   1.199 +  
   1.200 + 
   1.201 +/** Opens the write buffer of the Native Stream for exclusive writable access.
   1.202 +
   1.203 +@param  aStream Native Stream handle that is to be accessed.
   1.204 +@param  aReturnBuffer   Filled with the handle to use to access the current write buffer
   1.205 +
   1.206 +@pre
   1.207 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.208 +    -   aReturnBuffer must not be a NULL pointer, and must point to writable storage for the handle.
   1.209 +    -   In single-buffered Native Streams, access is not controlled, any number of readers and/or writer(s) may access the buffer simultaneously, potentially leading to tearing, but this behavior is generally considered preferable to blocking the reader.
   1.210 +    -   In multi-buffered Native Streams, the next write buffer must be available, or the method call will fail and return an error. It may fail in three scenarios:
   1.211 +        -   There is already an active writer
   1.212 +        -   There are still readers attached to the next write buffer candidate (in buffer swapping architectures)
   1.213 +        -   The copy from write buffer to read buffer is ongoing, or waiting for readers (in buffer copying architectures)
   1.214 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.215 +@post
   1.216 +    -   This method returns quickly.
   1.217 +    -   If the write buffer cannot be acquired immediately then an error code is returned, indicating why exclusive access to a writable buffer could not be obtained.
   1.218 +    -   If the write buffer is acquired the KErrNone is returned, and the contents referenced by aReturnBuffer are filled with a handle representing the current write buffer. The current write buffer is locked for writing.
   1.219 +    -   The Native Stream will not be destroyed while buffers are acquired.
   1.220 +    -   Note that no resource operations likely to cause failure will occur during the acquire method, but successful acquire does not guarantee that the buffer pixel data can be successfully mapped using NativeStreamGetBufferPointer.
   1.221 +@panic NativeStream 1000002 Null return value pointer
   1.222 +@panic NativeStream 1000003 Null Native Stream
   1.223 +@return Symbian error code
   1.224 +    -   KErrNone    Method Succeeded
   1.225 +    -   KErrInUse   Write buffer could not be exclusively acquired
   1.226 +**/ 
   1.227 +  IMPORT_C TErrCode SymbianStreamAcquireWriteBuffer( SymbianStreamType aStream, SymbianStreamBuffer* aReturnBuffer);
   1.228 +  
   1.229 +
   1.230 +/** Registers observers for OpenWF-C SI specified events.
   1.231 +@code   typedef void (*SymOwfStreamCallback)(
   1.232 +    SymbianStreamType, SymNativeStreamEvent, void*);
   1.233 +@endcode
   1.234 +@param  aStream Native Stream handle that is to be accessed.
   1.235 +@param  aObserver   Client function to be called when any event is called.
   1.236 +@param  aData   Data supplied by client which will be passed to the method call.
   1.237 +
   1.238 +@pre
   1.239 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.240 +    -   aObserver must not be NULL
   1.241 +    -   aData may be NULL
   1.242 +    -   The combination of observer and data may be already registered, in which case it will be called twice if an event occurs.
   1.243 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.244 +@post
   1.245 +    -   The method may fail to add the observer to an internal list of observers, due to memory failure.
   1.246 +    -   The observer function will be called when any event occurs which was specified in the OpenWF-C SI and has been implemented by OpenWF Support. Symbian OS-specific extension events will not be delivered to observers registering using this method.
   1.247 +@panic NativeStream 1000003 Null Native Stream
   1.248 +@panic NativeStream 1000004 Null aObserver
   1.249 +@return Symbian error code
   1.250 +    -   KErrNone    Method Succeeded
   1.251 +    -   KErrNoMemory    Internal allocation of resources for the Native Stream failed.
   1.252 +**/
   1.253 +  IMPORT_C TErrCode SymbianStreamAddObserver( SymbianStreamType aStream, SymbianStreamCallback aObserver, void* aData);
   1.254 +
   1.255 +/** Registers observers for specific events including Symbian OS-specified events.
   1.256 +@param  aStream Native Stream handle that is to be accessed.
   1.257 +@param  aObserver   Client function to be called when any specified event is called.
   1.258 +@param  aData   Client data passed to the function.
   1.259 +@param  aScreenNumber   Screen Number of the consumer, where relevant.
   1.260 +@param  aEvents Events for which this observer will be called.
   1.261 +
   1.262 +@pre
   1.263 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.264 +    -   aObserver must not be NULL
   1.265 +    -   aEvents must specify 1 or more event flags
   1.266 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.267 +    -   aScreenNumber should be one of:
   1.268 +        -   zero:   Screen number 0 associated with the first on-screen composition context
   1.269 +        -   positive:   A real screen number associated other on-screen composition contexts
   1.270 +        -   A good value for aScreenNumber may not be required for all event registrations, and should be set to EScreenNumberAllNoEvents when not required.
   1.271 +
   1.272 +@post
   1.273 +    -   The method may fail to add the observer to an internal list of observers, due to memory failure.
   1.274 +    -   The observer function will be called when an event specified in the parameter list occurs.
   1.275 +    -   If the screen number is zero or positive, or EScreenNumberAllEvents and the event includes ESOWF_EVENTUPDATED 
   1.276 +        then this client may be expected to handle bit flagged events - see SymbianStreamEventBits. Such an Observer must 
   1.277 +        also send back Available and Displayed notifications to Symbian Stream as required.
   1.278 +@panic NativeStream 1000003 Null Native Stream
   1.279 +@panic NativeStream 1000004 Null aObserver
   1.280 +@return Symbian error code
   1.281 +    -   KErrNone    Method Succeeded
   1.282 +    -   KErrNoMemory    Internal allocation of resources for the Native Stream failed.
   1.283 +    -   KErrArgument    aEvents does not flag any supported events, or aScreenNumber out of range
   1.284 +**/
   1.285 +  IMPORT_C TErrCode SymbianStreamAddExtendedObserver( SymbianStreamType aStream, SymbianStreamCallback aObserver, void* aData, khronos_int32_t aScreenNumber, SymbianStreamEventBits aEvents);
   1.286 +
   1.287 +
   1.288 +/** Increases the reference on the Native Stream object, extending its lifetime.
   1.289 +@param  aStream Native Stream handle that is to be accessed.
   1.290 +
   1.291 +@pre
   1.292 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.293 +@post
   1.294 +    -   The object will not be destroyed until an equivalent number of calls to SymbianStreamRemoveReference.
   1.295 +@panic NativeStream 1000003 Null Native Stream
   1.296 +@panic NativeStream 1000004 Null aObserver
   1.297 +**/
   1.298 +  IMPORT_C void SymbianStreamAddReference(SymbianStreamType aStream);
   1.299 +
   1.300 +/** Provides Symbian OS-aware clients access to extended features of the currently open buffer via Surface Manager.
   1.301 +@param  aStream Native Stream handle that is to be accessed.
   1.302 +@param  aBufferHandle   Handle to acquired read or write buffer.
   1.303 +@param  aReturnIndex    Returns internal buffer number.
   1.304 +@param  aReturnSurface  Returns internal TSurfaceId.
   1.305 +
   1.306 +@pre
   1.307 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.308 +    -   aBufferHandle must be a valid acquired buffer on that native stream that has not yet been released.
   1.309 +    -   aReturnIndex must not be a NULL pointer, and must point to writable storage for the index value.
   1.310 +    -   aReturnSurface must not be a NULL pointer, and must point to writable storage for the TSurfaceId pointer.
   1.311 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.312 +    -   SymbianStreamGetBufferPointer or SymbianStreamGetBufferId can only be called after a call to SymbianStreamAcquireReadBuffer or SymbianStreamAcquireWriteBuffer, and before the call to SymbianStreamReleaseReadBuffer or SymbianStreamReleaseWriteBuffer.
   1.313 +    -   They can be called multiple times in this period, but each call is not guaranteed to return the same information, and the information returned by an earlier call should not be used after repeating the call or after calling SymbianStreamReleaseReadBuffer or SymbianStreamReleaseWriteBuffer.
   1.314 +
   1.315 +@panic NativeStream 1000002 Null return value pointer
   1.316 +@panic NativeStream 1000003 Null Native Stream
   1.317 +@return Symbian error code
   1.318 +    -   KErrNone    Method Succeeded
   1.319 +    -   KErrBadHandle   aBufferNumber was NULL or not acquired on this Native Stream
   1.320 +**/
   1.321 +  IMPORT_C TErrCode SymbianStreamGetBufferId( SymbianStreamType aStream, SymbianStreamBuffer aBufferHandle, khronos_int32_t* aReturnIndex, const TSurfaceId** aReturnSurface);
   1.322 +
   1.323 +/** Finds the persistent Native Stream instance associated with the surface ID. If the association does not exist then this method fails - it does not attempt to create the association.
   1.324 +@param  aId Surface ID handle that is to be accessed.
   1.325 +@param  aReturnStream   Filled with the handle of the equivalent Native Stream
   1.326 +@pre
   1.327 +    -   aId must not be NULL.
   1.328 +    -   aReturnStream must not be a NULL pointer, and must point to writable storage for the handle.
   1.329 +    -   [Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.]
   1.330 +@post
   1.331 +    -   If a Native Stream has been successfully acquired, using SymbianStreamAcquire, for the surface ID, then that Native Stream is returned.
   1.332 +    -   The reference on the stream is increased to ensure it remains live following the method call. See SymbianStreamRemoveReference to release the reference.
   1.333 +    -   If the identified stream is not currently acquired, then NULL is returned, and an error code is set.
   1.334 +    -   The error codes set by this method may not distinguish between Surface IDs that have not been Acquired and bad values for the surface ID, such as IsNull() or destroyed surfaces.
   1.335 +
   1.336 +@panic NativeStream 1000001 Null Surface ID
   1.337 +@panic NativeStream 1000002 Null return value pointer
   1.338 +@return Symbian error code
   1.339 +    -   KErrNone    Method Succeeded
   1.340 +    -   KErrNoMemory    Internal allocation of resources for the Native Stream failed.
   1.341 +    -   KErrNotFound    No Native Stream already exists that encapsulates aId.
   1.342 +**/
   1.343 +  IMPORT_C TErrCode SymbianStreamFind( const TSurfaceId* aId, SymbianStreamType* aReturnStream);
   1.344 +
   1.345 +/** Returns a pointer to the pixel data associated with the acquired buffer.
   1.346 +@param  aStream Native Stream handle that is to be accessed.
   1.347 +@param  aBuffer Acquired buffer handle.
   1.348 +@param  aReturnPointer  Filled with the handle to use to access the current read buffer
   1.349 +@pre
   1.350 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.351 +    -   aBuffer should not be NULL
   1.352 +    -   aReturnPointer must not be a NULL pointer, and must point to writable storage for the pointer.
   1.353 +    -   aBuffer must be a currently acquired read or write buffer handle on the specified Native Stream.
   1.354 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.355 +    -   SymbianStreamGetBufferPointer or SymbianStreamGetBufferId should not be called more than once for each buffer acquire. Correct cleanup behavior is not guaranteed if these methods are called multiple times.
   1.356 +    -   The pixel data must be mappable to CPU-accessible RAM. For some multimedia content types this may not be possible, and the method will fail. The error reported will be forwarded from Surface Manager.
   1.357 +@post
   1.358 +    If unsuccessful, an error code is returned.
   1.359 +    -   The method may fail if the pixel data cannot be made available in the caller's address space, for a variety of reasons including running out of virtual memory.
   1.360 +    If Successful:
   1.361 +    -   Pixel data is made available and a pointer to the first pixel is returned.
   1.362 +    -   The layout of the pixel data will be as specified by SymbianStreamGetHeader.
   1.363 +    -   The memory may be tagged as read-only if the buffer was generated using AcquireReadBuffer.
   1.364 +    -   This layout implies a maximum size to the buffer data. The client should not access data outside that range of addresses.
   1.365 +
   1.366 +@panic NativeStream 1000001 Null Surface ID
   1.367 +@panic NativeStream 1000002 Null return value pointer
   1.368 +@return Symbian error code
   1.369 +    -   KErrNone    Method Succeeded
   1.370 +    -   KErrBadHandle   aBuffer was NULL or not acquired on this Native Stream
   1.371 +    -   <<other>>   mapping of the TSurfaceId failed - reporting the internal error.
   1.372 +**/
   1.373 +  IMPORT_C TErrCode SymbianStreamGetBufferPointer( SymbianStreamType aStream, SymbianStreamBuffer aBuffer, void** aReturnPointer);
   1.374 +
   1.375 +/** Returns a description of the format of the image data stored in the Native Stream.
   1.376 +@param  aStream Native Stream handle that is to be accessed.
   1.377 +@param  aWidth  Pointer to fill in width in pixels of accessible buffer.
   1.378 +@param  aHeight Pointer to fill in height in pixels of accessible buffer.
   1.379 +@param  aStride Pointer to fill in offset between rows of pixels.
   1.380 +@param  aFormat Pointer to fill in format code matching well known Symbian OS surface format UIDs.
   1.381 +@param  aFixelSize  Pointer to fill in number of bytes per pixel for the given format.
   1.382 +
   1.383 +@pre
   1.384 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.385 +    -   The remaining parameters are each either NULL, or point to local data storage which will be modified.
   1.386 +@post
   1.387 +    -   Targets of non-NULL parameters will be filled in with values describing the surface encapsulated by the Native Stream.
   1.388 +    -   [Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.]
   1.389 +    -   In the current implementation, this information is stored locally and can be efficiently accessed.
   1.390 +@panic NativeStream 1000002 Null return value pointer
   1.391 +@panic NativeStream 1000003 Null Native Stream
   1.392 +**/
   1.393 +  IMPORT_C void SymbianStreamGetHeader( SymbianStreamType aStream, khronos_int32_t* aWidth, khronos_int32_t* aHeight, khronos_int32_t* aStride, khronos_int32_t* aFormat, khronos_int32_t* aPixelSize);
   1.394 +
   1.395 +/** Returns extra details of the format of the image data stored in the Native Stream.
   1.396 + This method is intended to allow compositors to access the SurfaceManager hints associated with the 
   1.397 + stream without using SurfaceManager-explicit code.
   1.398 + It is possible in future that some of the hint IDs could be resolved locally rather than calling surface manager.  
   1.399 +@prototype  @internal
   1.400 +@param  aStream Native Stream handle that is to be accessed.
   1.401 +@param  aHint   Well known unique ID for specific hint property
   1.402 +@param  aValueReturn    Pointer to fill in current value for property
   1.403 +@param  aMutableReturn  Pointer to fill in to flag whether the property value is fixed or mutable
   1.404 +
   1.405 +@pre
   1.406 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.407 +    -   aHint may be any UID value, but only hint UIDs are likely to be successful.
   1.408 +    -   aValueReturn may be NULL, in which case the return value will indicate whether the hint is present
   1.409 +    -   aMutableeReturn may be NULL, in which case the client must presume the property may be mutable.
   1.410 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.411 +@post
   1.412 +    -   If the hint aHint is not associated with the underlying surface then an error is returned.
   1.413 +    -   If the hint is available, KErrNone is returned, and if aValueReturn is not NULL, the location pointed to will be filled with the current value of the hint. If not NULL the location pointed to by aMutableReturn indicates whether the hint is mutable.
   1.414 +
   1.415 +@panic NativeStream 1000003 Null Native Stream
   1.416 +@return Symbian error code
   1.417 +    -   KErrNone    Method Succeeded
   1.418 +    -   KErrArgument    hint not found (from  RSurfaceManager::GetSurfaceHint)
   1.419 +    -   <<other>>   error reported from  RSurfaceManager::GetSurfaceHint
   1.420 +**/
   1.421 +  IMPORT_C TErrCode SymbianStreamGetHint( SymbianStreamType aStream, khronos_int32_t aUid, khronos_int32_t* aValueReturn, khronos_bool* aMutableReturn);
   1.422 +
   1.423 +
   1.424 +/** Debug method which indicates whether a particular screen number has been registered for screen notifications (from SUS).
   1.425 +@param  aScreenNumber   Any valid screen number.
   1.426 +@param  aReturnState    Points to a Pointer to hold the returned registered object.
   1.427 +
   1.428 +@pre
   1.429 +    -   aReturnState    may be NULL, or must point to a location to receive the internal object registered with SUS
   1.430 +    -   [Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.]
   1.431 +@post
   1.432 +    -   aReturnState void*  opaque handle is NULL if the given screen number is not registered. The type of the internal object returned by this method is subject to change.
   1.433 +    -   A change in the value of aReturnState in subsequent calls indicates that the screen has been re-registered.
   1.434 +@return Symbian error code
   1.435 +    -   KErrNone    The screen number is registered with SUS.
   1.436 +    -   KErrNotFound    The screen number is not registered.
   1.437 +    -   KErrNotReady    SUS is not active, but the screen would be registered.
   1.438 +    -   KErrAlreadyExists   The screen number is already registered with SUS.
   1.439 +**/
   1.440 +  IMPORT_C TErrCode SymbianStreamHasRegisteredScreenNotifications( khronos_int32_t aScreenNumber,void** aReturnState);
   1.441 +
   1.442 +/** Generates a registration with Surface Update Server (SUS) for the given screen number at the given priority.
   1.443 +@param  aScreenNumber   Number of screen to be registered. This number should be acceptable to SUS.
   1.444 +@param  aPriority   Nominal priority of the screen for global updates. Higher values have higher priority.
   1.445 +@param  aInternalVersion    internal compositor version number to be reported to SUS.
   1.446 +
   1.447 +@pre
   1.448 +    -   aScreenNumber and aPriority should be within acceptable value ranges for SUS.
   1.449 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.450 +    -   The thread used to register screen notifications must have an active scheduler and generally run in scheduling mode.
   1.451 +@post
   1.452 +    -   Surface Update Server will be started if it has not already been started.
   1.453 +    -   The given screen number is registered or re-registered with SUS at the given priority.
   1.454 +    -   If SUS cannot be started, for example in debug environments, then an error is returned, but a screen update object is still created, as returned by SymbianStreamHasRegisteredScreenNotifications.
   1.455 +    -   The default heap specified when calling this method will be activated when SUS notifies the Native Stream of an update.
   1.456 +@return Symbian error code
   1.457 +    -   KErrNone    Method Succeeded
   1.458 +    -   KErrNoMemory    Internal allocation of resources for the Native Stream failed.
   1.459 +    -   KErrNotReady    SUS was not launched (may occur in unit testing)
   1.460 +    -   KErrAlreadyExists   the given screen number is already registered
   1.461 +    -   <<other>>   as returned by SUS
   1.462 +**/
   1.463 +  IMPORT_C TErrCode SymbianStreamRegisterScreenNotifications( khronos_int32_t aScreenNumber, khronos_int32_t aPriority, khronos_int32_t aInternalVersion);
   1.464 +
   1.465 +/** Releases the buffer previously acquired with SymbianStreamAcquireReadBuffer.
   1.466 +@param  aStream Native Stream handle that is to be accessed.
   1.467 +@param  aBuffer Buffer handle that is to be released.
   1.468 +
   1.469 +@pre
   1.470 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.471 +    -   aBuffer must be a buffer handle acquired on this stream using SymbianStreamAcquireReadBuffer and not yet released.
   1.472 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.473 +@post
   1.474 +    -   The non-exclusive buffer lock is released, potentially allowing writers to modify the content of the buffer.
   1.475 +    -   Any memory made available using SymbianStreamGetBufferPointer on this buffer handle may become unmapped from the caller's address space. The pointer must not continue to be used.
   1.476 +    -   Clients using SymbianStreamBufferId to efficiently access multimedia resources should release those resources before calling this method; otherwise they risk the contents being overwritten.
   1.477 +@panic NativeStream 1000003 Null Native Stream
   1.478 +@return Symbian error code
   1.479 +    -   KErrNone    Method Succeeded
   1.480 +    -   KErrBadHandle   aBuffer is not a currently open read buffer on this Native Stream;
   1.481 +**/
   1.482 +  IMPORT_C TErrCode SymbianStreamReleaseReadBuffer( SymbianStreamType aStream, SymbianStreamBuffer aBuffer);
   1.483 +
   1.484 +/** Releases the buffer previously acquired with SymbianStreamAcquireWriteBuffer.
   1.485 +@param  aStream Native Stream handle that is to be accessed.
   1.486 +@param  aBuffer Buffer handle that is to be released.
   1.487 +
   1.488 +@pre
   1.489 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.490 +    -   aBuffer must be a buffer handle successfully acquired on this stream using SymbianStreamAcquireWriteBuffer and not yet released.
   1.491 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.492 +@post
   1.493 +    -   This buffer content becomes the read buffer for all subsequent calls to SymbianStreamAcquireReadBuffer
   1.494 +    -   The exclusive buffer lock is released.
   1.495 +    -   Any memory made available using SymbianStreamGetBufferPointer on this buffer handle may become unmapped from the caller's address space. The pointer should not continue to be used.
   1.496 +    -   Clients using SymbianStreamBufferId to access multimedia resources should release those resources before calling this method; otherwise they risk the changes being ignored.
   1.497 +    -   Any registered observers will be called with the ESOWF_EVENTUpdated notification.
   1.498 +    -   If the surface is multi-buffered, subsequent attempts to SymbianStreamAcquireWriteBuffer will succeed and will select a different buffer to write to, presuming clients do not still have a non-exclusive read lock on the available write buffers.
   1.499 +@panic NativeStream 1000003 Null Native Stream
   1.500 +@return Symbian error code
   1.501 +    -   KErrNone    Method Succeeded
   1.502 +    -   KErrBadHandle   aBuffer is not a currently open write buffer on this Native Stream;
   1.503 +**/
   1.504 +  IMPORT_C TErrCode      SymbianStreamReleaseWriteBuffer( SymbianStreamType aStream, SymbianStreamBuffer aBuffer);
   1.505 +
   1.506 +/** Removes the observer inserted using SymbianStreamAddObserver.
   1.507 +@param  aStream Native Stream handle that is to be accessed.
   1.508 +@param  aObserver   identifies the registered observer.
   1.509 +@param  aData   Client data supplied when registering the observer.
   1.510 +@param  aEvents Events to remove registration from.
   1.511 +
   1.512 +@pre
   1.513 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.514 +    -   aData should have been provided as the client data when the observer was registered.
   1.515 +    -   aEvents indicates which events should no longer be notified, and should match the original extended events list.
   1.516 +    -   If aEvents is empty then the observer is removed from all events.
   1.517 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.518 +@post
   1.519 +    -   The observer function will no longer be called when the specified events occur, unless the observer was registered more than once, in which case the number of notifications will be reduced.
   1.520 +    -   There is a small window of opportunity that events triggered on one thread may complete after the observer has been removed from another thread. Clients should be aware of this potential false call.
   1.521 +    
   1.522 +@panic NativeStream 1000006 Null for all search parameters
   1.523 +@panic NativeStream 1000003 Null Native Stream
   1.524 +@return Symbian error code
   1.525 +    -   KErrNone    Method Succeeded
   1.526 +    -   KErrNotFound    The observer function was not found for this Native Stream.
   1.527 +    -   KErrArgument    aEvents does not flag any supported events
   1.528 +**/
   1.529 +  IMPORT_C TErrCode SymbianStreamRemoveObserver( SymbianStreamType aStream, void* aData, SymbianStreamEventBits aEvents);
   1.530 +
   1.531 +/** Reduces the references on the Native Stream object and potentially destroys the object.
   1.532 +@param  aStream Native Stream handle that is to be accessed.
   1.533 +
   1.534 +@pre
   1.535 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.536 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.537 +@post
   1.538 +    -   The recorded references are reduced. If this is the final reference then the Native Stream is destroyed.
   1.539 +@panic NativeStream 1000003 Null Native Stream
   1.540 +**/
   1.541 +  IMPORT_C void      SymbianStreamRemoveReference(SymbianStreamType aStream);
   1.542 +
   1.543 +/** Changes the state of the deletion protection flag. The protection state effectively increases the reference, blocking deletion. Direct use of the reference mechanism is preferred.
   1.544 +@deprecated The protection flag is used for off-screen composition in the current compositor implementation. Direct use of the reference mechanism is preferred.
   1.545 +    Parameters:
   1.546 +@param  aStream Native Stream handle that is to be accessed.
   1.547 +@param  aFlag   Set true to activate protection - set false to deactivate protection.
   1.548 +
   1.549 +@pre
   1.550 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.551 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.552 +@post
   1.553 +    If the aFlag is different to the internal protection state then the reference is modified:
   1.554 +    -   If aFlag is set then the reference is effectively artificially raised to protect the Native Stream against deletion.
   1.555 +    -   If aFlag is clear then the reference returns to normal mode, and the Native Stream may be destroyed.
   1.556 +@panic NativeStream 1000003 Null Native Stream
   1.557 +**/
   1.558 +  IMPORT_C void SymbianStreamSetProtectionFlag( SymbianStreamType aStream, khronos_bool aFlag);
   1.559 +
   1.560 +/** Compares two Native Stream handles for equivalency. 
   1.561 + It is probable that the actual handle value is not unique for a particular surface, 
   1.562 + but binary different handles in fact refer to the same internal object.
   1.563 +
   1.564 +
   1.565 +@param  aStream First Native Stream handle that is to be compared.
   1.566 +@param  aStream2    Second Native Stream handle that is to be compared.
   1.567 +
   1.568 +@pre
   1.569 +    -   aStream must be an active Native Stream object, or it may be NULL.
   1.570 +    -   aStream2 must be an active Native Stream object, or it may be NULL.
   1.571 +    -   [Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack. ]
   1.572 +    -   Direct comparison will be performed first. No allocations or system calls will be made to resolve this comparison, returning false where, for example the surface IDs refer to the same Surface Manager controlled object.
   1.573 +@post
   1.574 +    The given handles are compared, and if necessary the internal objects are compared.
   1.575 +
   1.576 +
   1.577 +@return khronos_bool If they reference the same TSurfaceId then TRUE is returned, else FALSE is returned.
   1.578 +**/
   1.579 +  IMPORT_C khronos_bool      SymbianStreamSame(SymbianStreamType aStream, SymbianStreamType aStream2);
   1.580 +
   1.581 +/** Removes the screen number from SUS registration.
   1.582 +    Parameters:
   1.583 +    aScreenNumber   Screen number to be unregistered.
   1.584 +
   1.585 +@pre
   1.586 +    -   aScreenNumber should have previously been registered using SymbianStreamRegisterScreenNotifications.
   1.587 +    -   Calls can be safely made from any thread, but the same default heap must be in place for all calls. The thread should have an activated clean-up stack.
   1.588 +    -   Out of range screen numbers will not have been registered, and will naturally not be found to unregister. No specific error code will indicate these screen numbers.
   1.589 +@post
   1.590 +    Notifications of content updated will no longer be received by the Native Stream for that screen number or passed on to any observer.
   1.591 +@return Symbian error code
   1.592 +    -   KErrNone    Method Succeeded - screen unregistered
   1.593 +    -   KErrNotReady    The Surface Update Server is not present (in test harnesses).
   1.594 +    -   KErrArgument    aScreennNum was not registered
   1.595 +**/
   1.596 +  IMPORT_C TErrCode      SymbianStreamUnregisterScreenNotifications(khronos_int32_t aScreenNumber);
   1.597 +  
   1.598 +
   1.599 +/** Indication that the stream has been displayed in the scene.  
   1.600 + This function is called by a client after it has consumed a buffer following an update notification 
   1.601 + and indicates the state of that consumption.
   1.602 + 
   1.603 +@param  aStream Native Stream handle that is to be accessed.
   1.604 +@param  aEvent  The type of consumption notification event.
   1.605 +@param  aScreenNumber   The screen number to which the event applies.
   1.606 +@param  aSerialNumber  The serial number to which the event applies. Changes after each composition, allowing repeat calls within one composition to be detected
   1.607 +@param  aReturnMask Used by the recipient to enable repeating of the ESOWF_EventDisplayedX event.
   1.608 +
   1.609 +@pre
   1.610 +	-	aSerialNumber must be changed after each composition, and allows the Native stream to detect multiple calls from the same composition.
   1.611 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.612 +    -   This method, or CheckVisible must be called exactly once after receiving ESOWF_EVENTUpdated, for each type of notification requested in the ESOWF_EVENTUpdated call by any context that has registered both SymbianStreamRegisteredScreenNotifications and SymbianStreamAddObserver (or SymbianStreamAddObserver with ESOWF_EventUpdated).
   1.613 +    -   Not calling this method when expected may cause deadlocks, and the result code delivered to SUS after calling the method too often with conflicting result codes is not defined.
   1.614 +    -   aEvent indicates which event has occurred. It may be one or more of:
   1.615 +        -   ESOWF_EventAvailable    Content is available
   1.616 +        -   ESOWF_EventDisplayed    Content is displayed
   1.617 +        -   ESOWF_EventDisplayedX   Content is displayed and repeated
   1.618 +@post
   1.619 +    -   Matching notifications to the Surface Update Server for this screen number may be completed (via callbacks).
   1.620 +    -   If the notification is to be repeated then aReturnMask is modified to indicate which notifications should be repeated.
   1.621 +
   1.622 +**/
   1.623 +  IMPORT_C void SymbianStreamProcessNotifications( SymbianStreamType aStream, khronos_int32_t aEvent, khronos_int32_t aScreenNumber, khronos_int32_t aSerialNumber, khronos_int32_t* aReturnMask);
   1.624 +  
   1.625 +/** Indication that the stream is not visible in the scene. 
   1.626 + This function is called by a client after it has consumed a buffer following an update notification 
   1.627 + and indicates the state of that consumption was "not visible".
   1.628 + Currently this is fired for any remaining streams at the end of composition 
   1.629 + after all positive SymbianStreamProcessNotifications have been made.
   1.630 +@param  aStream Native Stream handle that is to be accessed.
   1.631 +@param  aEvent  The type of consumption notification event.
   1.632 +@param  aScreenNumber   The screen number to which the event applies.
   1.633 +@param  aSerialNumber  The serial number to which the event applies. Changes after each composition, allowing repeat calls within one composition to be detected.
   1.634 +
   1.635 +@pre
   1.636 +	-	aSerialNumber must be changed after each composition event, and allows the Native stream to detect multiple calls from the same composition.
   1.637 +    -   aStream must be an active Native Stream object. It must not be NULL.
   1.638 +    -   This method, or ProcessNotifications must be called exactly once after receiving ESOWF_EVENTUpdated, for each type of notification requested in the ESOWF_EVENTUpdated call by any context that has registered both SymbianStreamRegisteredScreenNotifications and SymbianStreamAddObserver (or SymbianStreamAddObserver with ESOWF_EventUpdated).
   1.639 +    -   aEvent indicates which event has occurred. It may be one or more of:
   1.640 +        -   ESOWF_EventAvailable    Content is available
   1.641 +        -   ESOWF_EventDisplayed    Content is displayed
   1.642 +        -   ESOWF_EventDisplayedX   Content is displayed and repeated
   1.643 +@post
   1.644 +    Notifications to the Surface Update Server may be completed (via callbacks).
   1.645 +
   1.646 +**/
   1.647 +  IMPORT_C void  SymbianStreamCheckVisible(SymbianStreamType aStream, khronos_int32_t aEvent, khronos_int32_t aScreenNumber, khronos_int32_t aSerialNumber);
   1.648 +
   1.649 +  /** This function is called by a client to adjust the shape of the target stream.
   1.650 +   This only effects the results discovered by SymbianStreamGetHeader(),
   1.651 +   and has no effect on the underlying SurfaceManager Surface.
   1.652 +   The flag should only be called when the stream is opened for writing, 
   1.653 +   and it only effects calls to SymbianStreamGetHeader(0 after the write buffer is closed. 
   1.654 +   When the aFlip flag is not set the width, height and stride are passed to clients as discovered during construction. 
   1.655 +   When the aFlip flag is set, the width and height parameters are exchanged for SymbianStreamGetHeader(), 
   1.656 +   and a calculated value for stride is returned.
   1.657 +  @param  aStream Native Stream handle that is to be accessed.
   1.658 +  @param  aFlip  The flip state
   1.659 +
   1.660 +  @post
   1.661 +      The flip state is updated when SymbianStreamReleaseWriteBuffer() call is made
   1.662 +
   1.663 +  **/
   1.664 +  IMPORT_C void  SymbianStreamSetFlipState(SymbianStreamType aStream, SymOwfBool aFlip);
   1.665 +  
   1.666 +  IMPORT_C TErrCode SymbianStreamGetChunkHandle(SymbianStreamType aStream, TInt* aHandle);
   1.667 +  
   1.668 +#	ifdef __cplusplus
   1.669 +	}
   1.670 +#	endif
   1.671 +
   1.672 +#endif  // __SYMBIANSTREAM_H__