khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.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 XAADAPTATION_H_
       
    19 #define XAADAPTATION_H_
       
    20 
       
    21 #include <pthread.h>
       
    22 #include <semaphore.h>
       
    23 #include <garray.h>
       
    24 #include <string.h>
       
    25 #include <unistd.h>
       
    26 #include "openmaxalwrapper.h"
       
    27 #include "xaadaptationcontextbasemmf.h"
       
    28 #include "xaglobals.h"
       
    29 //#include "OpenMAXAL_ContentPipe.h"
       
    30 #include "xaplatform.h"
       
    31 
       
    32 #ifdef XA_IMPL_MEASURE_GST_DELAY
       
    33 #include <time.h>
       
    34 #endif /* XA_IMPL_MEASURE_GST_DELAY */
       
    35 
       
    36 /* MACROS */
       
    37 #define FLIP_NONE               0
       
    38 #define FLIP_CLOCKWISE          1 /* Rotate clockwise 90 degrees */
       
    39 #define FLIP_ROTATE_180         2 /* Rotate 180 degrees */
       
    40 #define FLIP_COUNTERCLOCKWISE   3 /* Rotate counter-clockwise 90 degrees */
       
    41 #define FLIP_HORIZONTAL         4 /* Flip image horizontally */
       
    42 #define FLIP_VERTICAL           5 /* Flip image vertically */
       
    43 
       
    44 /* TYPEDEFS */
       
    45 //typedef gboolean (*GstBusCb)( GstBus *bus, GstMessage *message, gpointer data );
       
    46 #define XA_IMPL_SUPPORTED_AUDIO_OUT_NUM 3
       
    47 #define XA_IMPL_OMIX_MAX_CONNECTED_MEDIAPLAYERS 10
       
    48 #define CONTENT_PIPE_BUFFER_SIZE 1000
       
    49 #define TEST_VIDEO_WIDTH     640
       
    50 #define TEST_VIDEO_HEIGHT    480
       
    51 
       
    52 typedef enum
       
    53 {
       
    54     XA_AUDIO_WAVENC = 0,
       
    55     XA_AUDIO_VORBISENC,
       
    56     XA_AUDIO_PCM,
       
    57     XA_NUM_OF_AUDIOENCODERS /* Do not move this line */
       
    58 } XAAudioEnc;
       
    59 
       
    60 typedef enum
       
    61 {
       
    62     XA_VIDEO_JPEGENC = 0,
       
    63     XA_VIDEO_THEORAENC,
       
    64     XA_NUM_OF_VIDEOENCODERS /* Do not move this line */
       
    65 } XAVideoEnc;
       
    66 
       
    67 typedef enum CP_STATE
       
    68 {
       
    69 	CPStateNull =0,
       
    70 	CPStateInitialized,
       
    71 	CPStatePrerolling,
       
    72 	CPStateStarted,
       
    73 	CPStateRunning,
       
    74 	CPStatePaused,
       
    75 	CPStateStopped,
       
    76 	CPStateWaitForData,
       
    77 	CPStateEOS,
       
    78 	CPStateError
       
    79 }CP_STATE;
       
    80 
       
    81 typedef struct XAAdaptEvtHdlrMMF_
       
    82 {
       
    83     xaAdaptEventHandlerMMF handlerfunc;    /* function handling the callback */
       
    84     void               *handlercontext; /* context of handler */
       
    85     XAuint32            eventtypes;     /* what kind of events this handles */
       
    86 } XAAdaptEvtHdlrMMF;
       
    87 
       
    88 /*
       
    89  * Structure that holds all common variables for every
       
    90  * mmf-Adaptation context structures.
       
    91  */
       
    92 typedef struct XAAdaptationBaseMMFCtx_
       
    93 {
       
    94     /* Common Variables for all adaptation elements */
       
    95     GArray*         evtHdlrs;    /* array of event handlers */
       
    96     XAuint32        ctxId;
       
    97     XAboolean       placeholder;
       
    98 
       
    99 } XAAdaptationBaseMMFCtx_;
       
   100 
       
   101 typedef struct XAEngineAdaptationMMFCtx_
       
   102 {
       
   103     /* Parent*/
       
   104     XAAdaptationBaseMMFCtx_    baseObj;
       
   105 
       
   106 } XAEngineAdaptationMMFCtx_;
       
   107 
       
   108 /*
       
   109  * Structure for Media Player specific gst-adaptation.
       
   110  */
       
   111 typedef struct XAMediaPlayerAdaptationMMFCtx_
       
   112 {
       
   113     /* Parent*/
       
   114     XAAdaptationBaseMMFCtx_    baseObj;
       
   115 
       
   116     /* OMX-AL Variables */
       
   117     XADataSource            *xaSource, *xaBankSrc;
       
   118     XADataSink              *xaAudioSink, *xaVideoSink, *xaLEDArray, *xaVibra;
       
   119 
       
   120     /* MMF elements */
       
   121     XAboolean               isobjsrc;    /*is source another XA object?*/
       
   122 
       
   123     XAboolean               isobjasink;   /*is audio sink another XA object?*/
       
   124     XAboolean               isobjvsink;   /*is video sink another XA object?*/
       
   125 
       
   126     XAboolean               mute;
       
   127     XAuint32                imageEffectID;
       
   128     XAboolean               isStereoPosition;
       
   129     XAmillidegree           curRotation;
       
   130     XAuint32                curMirror;
       
   131 
       
   132     XAint32                 buffering;
       
   133 
       
   134     /* internals */
       
   135     XAboolean               trackpositionenabled;
       
   136 
       
   137 
       
   138     XAboolean               loopingenabled;
       
   139 
       
   140     XAboolean		            cameraSinkSynced;
       
   141     void*                   mmfContext;
       
   142 
       
   143 
       
   144 } XAMediaPlayerAdaptationMMFCtx_;
       
   145 
       
   146 typedef struct XAMediaRecorderAdaptationMMFCtx_
       
   147 {
       
   148     /* Parent*/
       
   149     XAAdaptationBaseMMFCtx_ baseObj;
       
   150 
       
   151     /* OMX-AL Variables */
       
   152     XADataSource            *xaAudioSource, *xaVideoSource;
       
   153     XADataSink              *xaSink;
       
   154     XAuint8                 recModes;
       
   155 
       
   156     /* GST elements */
       
   157     XAboolean               isobjsink;   /*is sink another XA object?*/
       
   158     XAboolean               isobjasrc;    /*is audio source another XA object?*/
       
   159     XAboolean               isobjvsrc;    /*is video source another XA object?*/
       
   160     XAboolean               encodingchanged;
       
   161 
       
   162     XAboolean               mute;
       
   163     XAuint32                imageEffectID;
       
   164     XAboolean               isStereoPosition;
       
   165     XAuint32                xaRecordState;
       
   166     XAmillidegree           curRotation;
       
   167     XAuint32                curMirror;
       
   168     XAboolean               isRecord;
       
   169 
       
   170     /* internals */
       
   171     XAboolean               trackpositionenabled;
       
   172     gboolean                runpositiontimer;
       
   173 
       
   174     XAImplThreadHandle      recordingEventThr;
       
   175 
       
   176     /* Variables for encoders */
       
   177     XAAudioEncoderSettings  audioEncSettings;
       
   178     XAVideoSettings         videoEncSettings;
       
   179     XAImageSettings         imageEncSettings;
       
   180     
       
   181     void*                   mmfContext;
       
   182 
       
   183 
       
   184 } XAMediaRecorderAdaptationMMFCtx_;
       
   185 
       
   186 
       
   187 /* FUNCTIONS */
       
   188 /*
       
   189  * gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data );
       
   190  * Default CallBack handler for gst-bus messages. This will be called if object specific callback is
       
   191  * not implemented.
       
   192  */
       
   193 
       
   194 
       
   195 void XAAdaptationBaseMMF_SendAdaptEvents(XAAdaptationBaseMMFCtx* ctx, XAAdaptEventMMF* event);
       
   196 
       
   197 //void XAAdaptationBase_PrepareAsyncWait(XAAdaptationBaseCtx* ctx);
       
   198 //void XAAdaptationBase_StartAsyncWait(XAAdaptationBaseCtx* ctx);
       
   199 //gboolean XAAdaptationBase_CancelAsyncWait(gpointer ctx);
       
   200 //void XAAdaptationBase_CompleteAsyncWait(XAAdaptationBaseCtx* ctx);
       
   201 
       
   202 
       
   203 //XAresult XAMediaPlayerAdapt_UpdatePositionCbTimer(XAMediaPlayerAdaptationCtx_* mCtx);
       
   204 
       
   205 //XAresult XAMediaRecorderAdapt_ChangeEncoders( XAMediaRecorderAdaptationCtx_* mCtx );
       
   206 //XAresult XAMediaRecorderAdapt_CheckCodec( XAMediaRecorderAdaptationCtx_* mCtx, XACapsType encType, XAuint32 encoderId );
       
   207 
       
   208 //XAresult XAMetadataAdapt_TryWriteTags(XAAdaptationBaseCtx* mCtx, GstBin* binToWriteTo);
       
   209 //void XAMetadataAdapt_FreeVars(XAMetadataAdaptVars *vars);
       
   210 
       
   211 //GstElement* XAOutputMixAdapt_GetSink(XAAdaptationBaseCtx* bCtx);
       
   212 
       
   213 
       
   214 //XAresult XAOutputMixAdapt_ConnectObject(XAAdaptationBaseCtx* omCtx, XAAdaptationBaseCtx* bCtx, GstElement* usedMix);
       
   215 //XAresult XAOutputMixAdapt_DisconnectObject(XAAdaptationBaseCtx* omCtx, XAAdaptationBaseCtx* bCtx);
       
   216 //void* XAAdaptationBase_ContentPipeScrThrFunc( void* arg);
       
   217 //void* XAAdaptationBase_ContentPipeSinkThrFunc( void* arg);
       
   218 //CPresult XAAdaptationBase_ContentPipeSrcCb(CP_EVENTTYPE eEvent, CPuint iParam);
       
   219 //CPresult XAAdaptationBase_ContentPipeSinkCb(CP_EVENTTYPE eEvent, CPuint iParam);
       
   220 
       
   221 #endif /* XAADAPTATION_H_ */