khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.h
changeset 19 4a629bc82c5e
parent 12 5a06f39ad45b
child 21 2ed61feeead6
child 31 8dfd592727cb
equal deleted inserted replaced
14:80975da52420 19:4a629bc82c5e
    13 *
    13 *
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #ifndef XAADAPTATION_H_
    18 #ifndef XAADAPTATIONMMF_H_
    19 #define XAADAPTATION_H_
    19 #define XAADAPTATIONMMF_H_
    20 
    20 
    21 #include <pthread.h>
    21 #include <pthread.h>
    22 #include <semaphore.h>
    22 #include <semaphore.h>
    23 #include <garray.h>
    23 #include <garray.h>
    24 #include <string.h>
    24 #include <string.h>
    25 #include <unistd.h>
    25 #include <unistd.h>
    26 #include "openmaxalwrapper.h"
    26 #include "openmaxalwrapper.h"
    27 #include "xaadaptationcontextbasemmf.h"
       
    28 #include "xaglobals.h"
    27 #include "xaglobals.h"
    29 //#include "OpenMAXAL_ContentPipe.h"
    28 //#include "OpenMAXAL_ContentPipe.h"
    30 #include "xaplatform.h"
    29 #include "xaplatform.h"
    31 
    30 #include "xaadptbasectx.h"
    32 #ifdef XA_IMPL_MEASURE_GST_DELAY
    31 #ifdef XA_IMPL_MEASURE_GST_DELAY
    33 #include <time.h>
    32 #include <time.h>
    34 #endif /* XA_IMPL_MEASURE_GST_DELAY */
    33 #endif /* XA_IMPL_MEASURE_GST_DELAY */
    35 
    34 
    36 /* MACROS */
    35 /* MACROS */
    41 #define FLIP_HORIZONTAL         4 /* Flip image horizontally */
    40 #define FLIP_HORIZONTAL         4 /* Flip image horizontally */
    42 #define FLIP_VERTICAL           5 /* Flip image vertically */
    41 #define FLIP_VERTICAL           5 /* Flip image vertically */
    43 
    42 
    44 /* TYPEDEFS */
    43 /* TYPEDEFS */
    45 //typedef gboolean (*GstBusCb)( GstBus *bus, GstMessage *message, gpointer data );
    44 //typedef gboolean (*GstBusCb)( GstBus *bus, GstMessage *message, gpointer data );
    46 #define XA_IMPL_SUPPORTED_AUDIO_OUT_NUM 3
    45 
    47 #define XA_IMPL_OMIX_MAX_CONNECTED_MEDIAPLAYERS 10
       
    48 #define CONTENT_PIPE_BUFFER_SIZE 1000
    46 #define CONTENT_PIPE_BUFFER_SIZE 1000
    49 #define TEST_VIDEO_WIDTH     640
    47 #define TEST_VIDEO_WIDTH     640
    50 #define TEST_VIDEO_HEIGHT    480
    48 #define TEST_VIDEO_HEIGHT    480
    51 
    49 
       
    50 /*
    52 typedef enum
    51 typedef enum
    53 {
    52 {
    54     XA_AUDIO_WAVENC = 0,
    53     XA_AUDIO_WAVENC = 0,
    55     XA_AUDIO_VORBISENC,
    54     XA_AUDIO_VORBISENC,
    56     XA_AUDIO_PCM,
    55     XA_AUDIO_PCM,
    57     XA_NUM_OF_AUDIOENCODERS /* Do not move this line */
    56     XA_NUM_OF_AUDIOENCODERS  Do not move this line 
    58 } XAAudioEnc;
    57 } XAAudioEnc;
    59 
    58 
    60 typedef enum
    59 typedef enum
    61 {
    60 {
    62     XA_VIDEO_JPEGENC = 0,
    61     XA_VIDEO_JPEGENC = 0,
    63     XA_VIDEO_THEORAENC,
    62     XA_VIDEO_THEORAENC,
    64     XA_NUM_OF_VIDEOENCODERS /* Do not move this line */
    63     XA_NUM_OF_VIDEOENCODERS  Do not move this line 
    65 } XAVideoEnc;
    64 } XAVideoEnc;
    66 
    65 
    67 typedef enum CP_STATE
    66 typedef enum CP_STATE
    68 {
    67 {
    69 	CPStateNull =0,
    68 	CPStateNull =0,
    75 	CPStateStopped,
    74 	CPStateStopped,
    76 	CPStateWaitForData,
    75 	CPStateWaitForData,
    77 	CPStateEOS,
    76 	CPStateEOS,
    78 	CPStateError
    77 	CPStateError
    79 }CP_STATE;
    78 }CP_STATE;
       
    79 */
    80 
    80 
    81 typedef struct XAAdaptEvtHdlrMMF_
    81 /* Forward declaration of adaptation basecontext */
    82 {
    82 typedef struct XAAdaptationMMFCtx_ XAAdaptationMMFCtx;
    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 
    83 
    88 /*
    84 /*
    89  * Structure that holds all common variables for every
    85  * Structure that holds all common variables for every
    90  * mmf-Adaptation context structures.
    86  * mmf-Adaptation context structures.
    91  */
    87  */
    92 typedef struct XAAdaptationBaseMMFCtx_
    88 typedef struct XAAdaptationMMFCtx_
    93 {
    89 {
    94     /* Common Variables for all adaptation elements */
    90 XAAdaptationBaseCtx baseObj;
    95     GArray*         evtHdlrs;    /* array of event handlers */
       
    96     XAuint32        ctxId;
       
    97     XAboolean       placeholder;
       
    98 
    91 
    99 } XAAdaptationBaseMMFCtx_;
    92 } XAAdaptationMMFCtx_;
   100 
    93 
   101 typedef struct XAEngineAdaptationMMFCtx_
    94 typedef struct XAEngineAdaptationMMFCtx_
   102 {
    95 {
   103     /* Parent*/
    96     /* Parent*/
   104     XAAdaptationBaseMMFCtx_    baseObj;
    97     XAAdaptationMMFCtx_    baseObj;
   105 
    98 
   106 } XAEngineAdaptationMMFCtx_;
    99 } XAEngineAdaptationMMFCtx_;
   107 
   100 
   108 /*
   101 /*
   109  * Structure for Media Player specific gst-adaptation.
   102  * Structure for Media Player specific gst-adaptation.
   110  */
   103  */
   111 typedef struct XAMediaPlayerAdaptationMMFCtx_
   104 typedef struct XAMediaPlayerAdaptationMMFCtx_
   112 {
   105 {
   113     /* Parent*/
   106     /* Parent*/
   114     XAAdaptationBaseMMFCtx_    baseObj;
   107     XAAdaptationMMFCtx_    baseObj;
   115 
   108 
   116     /* OMX-AL Variables */
   109     /* OMX-AL Variables */
   117     XADataSource            *xaSource, *xaBankSrc;
   110     XADataSource            *xaSource, *xaBankSrc;
   118     XADataSink              *xaAudioSink, *xaVideoSink, *xaLEDArray, *xaVibra;
   111     XADataSink              *xaAudioSink, *xaVideoSink, *xaLEDArray, *xaVibra;
   119 
   112 
   122 
   115 
   123     XAboolean               isobjasink;   /*is audio sink another XA object?*/
   116     XAboolean               isobjasink;   /*is audio sink another XA object?*/
   124     XAboolean               isobjvsink;   /*is video sink another XA object?*/
   117     XAboolean               isobjvsink;   /*is video sink another XA object?*/
   125 
   118 
   126     XAboolean               mute;
   119     XAboolean               mute;
       
   120     XAuint32                premutevol;
   127     XAuint32                imageEffectID;
   121     XAuint32                imageEffectID;
   128     XAboolean               isStereoPosition;
   122     XAboolean               isStereoPosition;
   129     XAmillidegree           curRotation;
   123     XAmillidegree           curRotation;
   130     XAuint32                curMirror;
   124     XAuint32                curMirror;
   131 
       
   132     XAint32                 buffering;
   125     XAint32                 buffering;
   133 
   126 
   134     /* internals */
   127     /* internals */
   135     XAboolean               trackpositionenabled;
   128     XAboolean               trackpositionenabled;
   136 
       
   137 
       
   138     XAboolean               loopingenabled;
   129     XAboolean               loopingenabled;
   139 
   130     XAboolean		        cameraSinkSynced;
   140     XAboolean		            cameraSinkSynced;
       
   141     void*                   mmfContext;
   131     void*                   mmfContext;
   142 
   132 	void* 					mmfMetadataContext;
       
   133 /*
       
   134     XAuint32                playerState;
       
   135 */
   143 
   136 
   144 } XAMediaPlayerAdaptationMMFCtx_;
   137 } XAMediaPlayerAdaptationMMFCtx_;
   145 
   138 
   146 typedef struct XAMediaRecorderAdaptationMMFCtx_
   139 
       
   140 typedef struct XAMetadataAdaptationMMFCtx_
   147 {
   141 {
   148     /* Parent*/
   142     /* Parent*/
   149     XAAdaptationBaseMMFCtx_ baseObj;
   143     XAAdaptationMMFCtx_    baseObj;
   150 
   144 
   151     /* OMX-AL Variables */
   145     /* OMX-AL Variables */
   152     XADataSource            *xaAudioSource, *xaVideoSource;
   146     XADataSource            *xaSource;
   153     XADataSink              *xaSink;
       
   154     XAuint8                 recModes;
       
   155 
   147 
   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;
   148     void*                   mmfContext;
   182 
   149 } XAMetadataAdaptationMMFCtx_;
   183 
       
   184 } XAMediaRecorderAdaptationMMFCtx_;
       
   185 
       
   186 
   150 
   187 /* FUNCTIONS */
   151 /* FUNCTIONS */
   188 /*
   152 /*
   189  * gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data );
   153  * 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
   154  * Default CallBack handler for gst-bus messages. This will be called if object specific callback is
   191  * not implemented.
   155  * not implemented.
   192  */
   156  */
   193 
   157 
       
   158 XAresult XAAdaptationBaseMMF_Init( XAAdaptationMMFCtx* pSelf, XAuint32 ctxId );
       
   159 XAresult XAAdaptationBaseMMF_PostInit( XAAdaptationMMFCtx* ctx );
       
   160 void XAAdaptationBaseMMF_Free( XAAdaptationMMFCtx* ctx );
   194 
   161 
   195 void XAAdaptationBaseMMF_SendAdaptEvents(XAAdaptationBaseMMFCtx* ctx, XAAdaptEventMMF* event);
   162 #endif /* XAADAPTATIONMMF_H_ */
   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_ */