khronosfws/openmax_al/src/adptcommon/xaadptbasectx.h
changeset 16 43d09473c595
child 21 2ed61feeead6
child 31 8dfd592727cb
equal deleted inserted replaced
14:80975da52420 16:43d09473c595
       
     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 XAADPTBASECTX_H_
       
    19 #define XAADPTBASECTX_H_
       
    20 
       
    21 #include <glib.h>
       
    22 #include "openmaxalwrapper.h"
       
    23 #include "xaglobals.h"
       
    24 #include "xaframeworkmgr.h"
       
    25 #include "xacapabilitiesmgr.h"
       
    26 #include "xaplatform.h"
       
    27 /* ENUMERATIONS */
       
    28 
       
    29 /**
       
    30 GLOBAL ENUMERATIONS
       
    31  */
       
    32 
       
    33 typedef enum {
       
    34     XAMediaPlayerAdaptation = 0,
       
    35     XAMediaRecorderAdaptation,
       
    36     XARadioAdaptation,
       
    37     XACameraAdaptation,
       
    38     XAOutputMixAdaptation,
       
    39     XAVibraAdaptation,
       
    40     XALedArrayAdaptation,
       
    41     XAMDAdaptation,
       
    42     XAEngineAdaptation
       
    43 }AdaptationContextIDS;
       
    44 
       
    45 #define XA_ADAPT_PU_INTERVAL 50                     /* position update interval */
       
    46 #define XA_ADAPT_ASYNC_TIMEOUT 3000                 /* timeout to wait async events */
       
    47 #define XA_ADAPT_ASYNC_TIMEOUT_SHORT 1000           /* timeout to wait async events */
       
    48 #define XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC 1000000   /* timeout to wait async events */
       
    49 
       
    50 #define XA_ADAPT_POSITION_UPDATE_EVT 0xf0           /* position update event */
       
    51 #define XA_ADAPT_SNAPSHOT_TAKEN 0xf1                /* snapshot taken event */
       
    52 #define XA_ADAPT_SNAPSHOT_INITIATED 0xf2            /* snapshot intitiated event */
       
    53 #define XA_ADAPT_MDE_TAGS_AVAILABLE 0xf3            /* metadata taglist changed */
       
    54 #define XA_ADAPT_OMIX_DEVICESET_CHANGED 0xf4        /* Output mix device changed event */
       
    55 #define XA_ADAPT_RADIO_FREQUENCY_CHANGED 0xf6       /* Radio frequency changed event */
       
    56 #define XA_ADAPT_RADIO_FREQUENCY_RANGE_CHANGED 0xf7 /* Radio frequency range changed event */
       
    57 #define XA_ADAPT_RADIO_SEEK_COMPLETE 0xf8           /* Radio seek complete changed event */
       
    58 #define XA_ADAPT_RDS_GET_ODA_GROUP_DONE 0xf9        /* RDS get oda group done event */
       
    59 #define XA_ADAPT_BUFFERING 0xfa
       
    60 #define XA_ADAPT_MDE_TAGS_WRITTEN 0xfb
       
    61 /* TYPEDEFS */
       
    62 
       
    63 #define RADIO_DEFAULT_FREQ_RANGE XA_FREQRANGE_FMEUROAMERICA
       
    64 #define RADIO_DEFAULT_FREQ 88000000
       
    65 
       
    66 
       
    67 /* TYPEDEFS */
       
    68 
       
    69 /* Adaptation device IDs */
       
    70 //#define XA_ADAPTID_ALSASRC          0xAD7E5001  //Krishna commented
       
    71 #define XA_ADAPTID_DEVSOUNDSRC          0xAD7E5001
       
    72 //#define XA_ADAPTID_ALSASINK         0xAD7E5002
       
    73 #define XA_ADAPTID_DEVSOUNDSINK     0xAD7E5002
       
    74 #define XA_ADAPTID_AUTOAUDIOSINK    0xAD7E5003
       
    75 #define XA_ADAPTID_AUDIOTESTSRC     0xAD7E5004
       
    76 #define XA_ADAPTID_AUTOVIDEOSINK    0xAD7E5005
       
    77 #define XA_ADAPTID_VIDEOTESTSRC     0xAD7E5006
       
    78 #define XA_ADAPTID_V4L2SRC          0xAD7E5007
       
    79 #define XA_ADAPTID_JACKSINK         0xAD7E5008
       
    80 #define XA_ADAPTID_MOTIONJPEG       0xAD7E5009
       
    81 #define XA_ADAPTID_THEORA           0xAD7E500A
       
    82 #define XA_ADAPTID_VORBIS           0xAD7E500B
       
    83 
       
    84 #define XA_ADAPTID_VIBRA            0xAD7E500C
       
    85 #define XA_ADAPTID_LEDARRAY         0xAD7E500D
       
    86 
       
    87 #define XA_ADAPTID_RAWVIDEO         0xAD7E500E
       
    88 
       
    89 //#define XA_ADAPT_DEFAULTAUDIOOUTPUT XA_ADAPTID_ALSASINK
       
    90 #define XA_ADAPT_DEFAULTAUDIOOUTPUT XA_ADAPTID_DEVSOUNDSINK
       
    91 
       
    92 #ifdef XA_USE_TEST_PLUGINS
       
    93 #define XA_ADAPT_DEFAULTAUDIOINPUT  XA_ADAPTID_AUDIOTESTSRC
       
    94 #else
       
    95 #define XA_ADAPT_DEFAULTAUDIOINPUT  XA_ADAPTID_DEVSOUNDSRC
       
    96 #endif
       
    97 
       
    98 
       
    99 #define XA_ADAPT_OGGPROFILE_UNKNOWN 0x1
       
   100 
       
   101 #define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_8   0x1
       
   102 #define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_16  0x2
       
   103 #define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_20  0x4
       
   104 #define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_24  0x8
       
   105 #define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_28  0x10
       
   106 #define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_32  0x20
       
   107 
       
   108 #define XA_ADAPT_MAX_BITRATE_COUNT 10
       
   109 
       
   110 #define XA_ADAPTID_UNINITED 0
       
   111 
       
   112 #define XA_ADAPT_VOLUME_VOLUME_CHANGED          0xfb			 /* volume changed */
       
   113 #define XA_ADAPT_VOLUME_MUTE_CHANGED            0xfc         	/* mute changed */
       
   114 #define XA_ADAPT_VULOME_STEREOPOSITION_CHANGED  0xfd
       
   115 
       
   116 /* Adaptation event structure */
       
   117 typedef struct XAAdaptEvent_
       
   118 {
       
   119     XAAdaptEventTypes  eventtype; /* what kind of event, e.g. playitf event  */
       
   120     XAuint8            eventid;   /* eventtype-specific event, e.g. XA_PLAYEVENT macro */
       
   121     XAuint32           datasize;  /* event data size */
       
   122     void*              data;      /* event data if needed */
       
   123 } XAAdaptEvent;
       
   124 
       
   125 /* Forward declaration of adaptation basecontext */
       
   126 typedef struct XAAdaptationBaseCtx_ XAAdaptationBaseCtx;
       
   127 
       
   128 /*
       
   129  * Structure that holds all common variables for every
       
   130  * Gst-Adaptation context structures.
       
   131  */
       
   132 typedef struct XAAdaptationBaseCtx_
       
   133 {
       
   134 /*     Common Variables for all adaptation elements */
       
   135     XAuint32        ctxId;
       
   136     GArray*         evtHdlrs;     /*array of event handlers */
       
   137     FrameworkMap*   fwkmapper;
       
   138     FWMgrFwType     fwtype;
       
   139     XACapabilities* capslist;
       
   140     
       
   141 } XAAdaptationBaseCtx_;
       
   142 
       
   143 
       
   144 /* Adaptation event callback */
       
   145 typedef void (*xaAdaptEventHandler) ( void *pHandlerCtx, XAAdaptEvent* event );
       
   146 
       
   147 typedef struct XAAdaptEvtHdlr_
       
   148 {
       
   149     xaAdaptEventHandler handlerfunc;    /* function handling the callback */
       
   150     void               *handlercontext; /* context of handler */
       
   151     XAuint32            eventtypes;     /* what kind of events this handles */
       
   152 } XAAdaptEvtHdlr;
       
   153 
       
   154 
       
   155 
       
   156 
       
   157 /* FUNCTIONS */
       
   158 XAresult XAAdaptationBase_Init( XAAdaptationBaseCtx* pSelf, XAuint32 ctxId );
       
   159 XAresult XAAdaptationBase_PostInit( XAAdaptationBaseCtx* ctx );
       
   160 XAresult XAAdaptationBase_AddEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler,
       
   161                                     XAuint32 evtTypes,void *pHandlerCtx );
       
   162 XAresult XAAdaptationBase_RemoveEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler );
       
   163 void XAAdaptationBase_SendAdaptEvents(XAAdaptationBaseCtx* ctx, XAAdaptEvent* event);
       
   164 XAresult XAAdaptationBase_ThreadEntry(XAAdaptationBaseCtx *adaptCtx);
       
   165 XAresult XAAdaptationBase_ThreadExit(XAAdaptationBaseCtx *adaptCtx);
       
   166 void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx );
       
   167 
       
   168 #endif /* XAADPTBASE_H_ */