khronosfws/openmax_al/src/common/xaobjectitf.h
changeset 12 5a06f39ad45b
child 16 43d09473c595
equal deleted inserted replaced
0:71ca22bcf22a 12:5a06f39ad45b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef XAOBJECTITF_H
       
    19 #define XAOBJECTITF_H
       
    20 
       
    21 #include "openmaxalwrapper.h"
       
    22 #include "xaglobals.h"
       
    23 #include "xaplatform.h"
       
    24 
       
    25 /** MACROS **/
       
    26 
       
    27 /** TYPES **/
       
    28 /* object-specific function pointers */
       
    29 typedef XAresult (*xaDoRealizeImpl)(XAObjectItf self);
       
    30 typedef XAresult (*xaDoResumeImpl)(XAObjectItf self);
       
    31 typedef void (*xaFreeResourcesImpl)(XAObjectItf self);
       
    32 
       
    33 /** ENUMERATIONS **/
       
    34 
       
    35 /** STRUCTURES **/
       
    36 typedef struct XAObjItfMapEntry_
       
    37 {
       
    38     XAInterfaceID iid;
       
    39     XAuint8       mapIdx;
       
    40     void          *pItf;
       
    41     XAboolean     locEnabled;
       
    42     XAboolean     required;
       
    43     XAboolean     isDynamic;
       
    44 } XAObjItfMapEntry;
       
    45 
       
    46 /* Definition of XAObjectItf implementation */
       
    47 typedef struct XAObjectItfImpl_
       
    48 {
       
    49     /* parent interface */
       
    50     struct XAObjectItf_ itf;
       
    51     /* pointer to self */
       
    52     struct XAObjectItfImpl_* self;
       
    53 
       
    54     /* variables */
       
    55     XAint32 priority;
       
    56     XAboolean preemptable;
       
    57     XAuint32 state;
       
    58 
       
    59     /* array of available interfaces */
       
    60     XAObjItfMapEntry *interfaceMap;
       
    61     XAuint32 interfaceCount;
       
    62 
       
    63     /* async related variables */
       
    64     XAImplThreadHandle asyncThr;
       
    65     XAboolean asyncOngoing;
       
    66     xaObjectCallback callBack;
       
    67     void *context;
       
    68     XAObjectItf cbPtrToSelf;
       
    69 
       
    70     /* object-specific function implementation pointers */
       
    71     /* (must be implemented by every object) */
       
    72     xaDoRealizeImpl DoRealizeImpl;
       
    73     xaDoResumeImpl DoResumeImpl;
       
    74     xaFreeResourcesImpl FreeResourcesImpl;
       
    75 } XAObjectItfImpl;
       
    76 
       
    77 
       
    78 /** METHODS **/
       
    79 
       
    80 /* Base interface XAObjectItf implementation */
       
    81 XAresult XAObjectItfImpl_Realize(XAObjectItf self, XAboolean async);
       
    82 
       
    83 XAresult XAObjectItfImpl_Resume(XAObjectItf self, XAboolean async);
       
    84 
       
    85 XAresult XAObjectItfImpl_GetState(XAObjectItf self, XAuint32 *pState);
       
    86 
       
    87 XAresult XAObjectItfImpl_GetInterface(XAObjectItf self,
       
    88                                        const XAInterfaceID iid,
       
    89                                        void *pInterface);
       
    90 
       
    91 XAresult XAObjectItfImpl_RegisterCallback(XAObjectItf self,
       
    92                                            xaObjectCallback callback,
       
    93                                            void *pContext);
       
    94 
       
    95 void XAObjectItfImpl_AbortAsyncOperation(XAObjectItf self);
       
    96 
       
    97 void XAObjectItfImpl_Destroy(XAObjectItf self);
       
    98 
       
    99 XAresult XAObjectItfImpl_SetPriority(XAObjectItf self, XAint32 priority,
       
   100                                       XAboolean preemptable);
       
   101 
       
   102 XAresult XAObjectItfImpl_GetPriority(XAObjectItf self, XAint32 *pPriority,
       
   103                                       XAboolean *pPreemptable);
       
   104 
       
   105 XAresult XAObjectItfImpl_SetLossOfControlInterfaces(XAObjectItf self,
       
   106                                                      XAint16 numInterfaces,
       
   107                                                      XAInterfaceID *pInterfaceIDs,
       
   108                                                      XAboolean enabled);
       
   109 
       
   110 /* XAObjectItfImpl -specific methods */
       
   111 
       
   112 /* Allocate and initialize base object */
       
   113 XAresult XAObjectItfImpl_Init(XAObjectItfImpl* self,
       
   114                               XAuint32 itfCount,
       
   115                               const XAInterfaceID** itfIIDs,
       
   116                               xaDoRealizeImpl doRealizeImpl,
       
   117                               xaDoResumeImpl doResumeImpl,
       
   118                               xaFreeResourcesImpl freeResourcesImpl);
       
   119 
       
   120 /* methods for asynchronous service */
       
   121 void* XAObjectItfImpl_AsyncRealize(void* args);
       
   122 void* XAObjectItfImpl_AsyncResume(void* args);
       
   123 void XAObjectItfImpl_AsyncCleanup(void* args);
       
   124 
       
   125 XAObjItfMapEntry* XAObjectItfImpl_GetItfEntry(const XAObjectItf self,
       
   126                                               const XAInterfaceID iid);
       
   127 
       
   128 #endif /* XAOBJECTITF_H */