# HG changeset patch # User hgs # Date 1276304363 18000 # Node ID 6f7ceef7b1d1d7fd3168815fbdec17316ef6622e # Parent 2ed61feeead60bdb457624a6af0b720fa91f7509 201023 diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/inc/openmaxalwrapper.h --- a/khronosfws/openmax_al/inc/openmaxalwrapper.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/inc/openmaxalwrapper.h Fri Jun 11 19:59:23 2010 -0500 @@ -11,7 +11,9 @@ * * Contributors: * -* Description: +* Description: Internal Header to Include Khronos Headers in One Place. +* Also redefining the XA_API macro to export the IID value +* to DEF files. * */ #ifndef _OPENMAXAL_WRAPPER_H_ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/inc/profileutilmacro.h --- a/khronosfws/openmax_al/inc/profileutilmacro.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/inc/profileutilmacro.h Fri Jun 11 19:59:23 2010 -0500 @@ -11,7 +11,8 @@ * * Contributors: * -* Description: +* Description: Internal Header to define Performance Profiling macros. +* The MACROS can be defined in the MMP file to enable profiling. * */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/rom/openmax_al.iby --- a/khronosfws/openmax_al/rom/openmax_al.iby Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/rom/openmax_al.iby Fri Jun 11 19:59:23 2010 -0500 @@ -11,13 +11,9 @@ * * Contributors: * -* Description: OpenMAX AL +* Description: OpenMAX AL iby file for exporting dll to ROM/ROFS. * */ -/* - * openmax_al.iby - * - */ #ifndef OPENMAX_AL_IBY #define OPENMAX_AL_IBY diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/adptcommon/xaadptbasectx.c --- a/khronosfws/openmax_al/src/adptcommon/xaadptbasectx.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/adptcommon/xaadptbasectx.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Base Adaptation Initialization Functionality + * + */ #include #include @@ -25,175 +25,188 @@ * 1st phase initialization function for Adaptation Base context structure. * Reserves memory for base context and initializes GStreamer FW. */ -XAresult XAAdaptationBase_Init( XAAdaptationBaseCtx* pSelf, XAuint32 ctxId ) -{ +XAresult XAAdaptationBase_Init(XAAdaptationBaseCtx* pSelf, XAuint32 ctxId) + { DEBUG_API("->XAAdaptationBase_Init"); - if ( pSelf ) - { - if(!pSelf->evtHdlrs) + if (pSelf) { - pSelf->evtHdlrs = g_array_new (FALSE, FALSE, sizeof (XAAdaptEvtHdlr)); - if(!pSelf->evtHdlrs) + if (!pSelf->evtHdlrs) { - DEBUG_ERR("Memory allocation failure in Base Ctx.") - return XA_RESULT_MEMORY_FAILURE; + pSelf->evtHdlrs = g_array_new(FALSE, FALSE, + sizeof(XAAdaptEvtHdlr)); + if (!pSelf->evtHdlrs) + { + DEBUG_ERR("Memory allocation failure in Base Ctx.") + return XA_RESULT_MEMORY_FAILURE; + } } + pSelf->ctxId = ctxId; } - pSelf->ctxId = ctxId; - } else - { + { DEBUG_ERR("Invalid Adaptation Base Context.") return XA_RESULT_PARAMETER_INVALID; - } + } DEBUG_API("<-XAAdaptationBase_Init"); return XA_RESULT_SUCCESS; -} + } /* * XAresult XAAdaptationBase_PostInit() * 2nd phase initialization for Adaptation Base. */ -XAresult XAAdaptationBase_PostInit( XAAdaptationBaseCtx* ctx ) -{ +XAresult XAAdaptationBase_PostInit(XAAdaptationBaseCtx* ctx) + { XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAAdaptationBase_PostInit"); DEBUG_API("<-XAAdaptationBase_PostInit"); return ret; -} + } /* * void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx ) * Frees all Base context variables . */ -void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx ) -{ +void XAAdaptationBase_Free(XAAdaptationBaseCtx* ctx) + { g_array_free(ctx->evtHdlrs, TRUE); ctx->evtHdlrs = NULL; DEBUG_API("<-XAAdaptationBase_Free"); -} + } /* * XAresult XAAdaptationBase_AddEventHandler * Adds event handler for certain event types. */ -XAresult XAAdaptationBase_AddEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler, - XAuint32 evtTypes, void *pHandlerCtx ) -{ +XAresult XAAdaptationBase_AddEventHandler(XAAdaptationBaseCtx* ctx, + xaAdaptEventHandler evtHandler, XAuint32 evtTypes, void *pHandlerCtx) + { XAuint32 i; XAAdaptEvtHdlr tmp; DEBUG_API("->XAAdaptationBase_AddEventHandler"); - if(!ctx) - { + if (!ctx) + { DEBUG_ERR("no context"); return XA_RESULT_PARAMETER_INVALID; - } + } - for(i=0; ievtHdlrs->len; i++) - { - if( (g_array_index(ctx->evtHdlrs, XAAdaptEvtHdlr, i)).handlerfunc == evtHandler ) + for (i = 0; i < ctx->evtHdlrs->len; i++) { + if ((g_array_index(ctx->evtHdlrs, XAAdaptEvtHdlr, i)).handlerfunc + == evtHandler) + { return XA_RESULT_PARAMETER_INVALID; + } } - } tmp.handlerfunc = evtHandler; tmp.handlercontext = pHandlerCtx; tmp.eventtypes = evtTypes; g_array_append_val(ctx->evtHdlrs, tmp); DEBUG_API("<-XAAdaptationBase_AddEventHandler"); return XA_RESULT_SUCCESS; -} + } /* * XAresult XAAdaptationBase_RemoveEventHandler * Removes event handler for certain event types. */ -XAresult XAAdaptationBase_RemoveEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler) -{ +XAresult XAAdaptationBase_RemoveEventHandler(XAAdaptationBaseCtx* ctx, + xaAdaptEventHandler evtHandler) + { XAuint32 i; DEBUG_API("->XAAdaptationBase_RemoveEventHandler"); - if(!ctx) - { + if (!ctx) + { DEBUG_ERR("no context"); return XA_RESULT_PARAMETER_INVALID; - } - for(i=0; ievtHdlrs->len; i++) - { - if( (g_array_index(ctx->evtHdlrs, XAAdaptEvtHdlr, i)).handlerfunc == evtHandler ) + } + for (i = 0; i < ctx->evtHdlrs->len; i++) { + if ((g_array_index(ctx->evtHdlrs, XAAdaptEvtHdlr, i)).handlerfunc + == evtHandler) + { g_array_remove_index(ctx->evtHdlrs, i); return XA_RESULT_SUCCESS; + } } - } DEBUG_API("<-XAAdaptationBase_RemoveEventHandler"); /*did not find, return error*/ return XA_RESULT_PARAMETER_INVALID; -} + } -void XAAdaptationBase_SendAdaptEvents(XAAdaptationBaseCtx* ctx, XAAdaptEvent* event) -{ +void XAAdaptationBase_SendAdaptEvents(XAAdaptationBaseCtx* ctx, + XAAdaptEvent* event) + { XAuint32 i; XAAdaptEvtHdlr* tmp; - for(i=0; ievtHdlrs->len; i++) - { + for (i = 0; i < ctx->evtHdlrs->len; i++) + { tmp = &g_array_index(ctx->evtHdlrs, XAAdaptEvtHdlr, i); - if( tmp->eventtypes & event->eventtype ) - { + if (tmp->eventtypes & event->eventtype) + { (tmp->handlerfunc)(tmp->handlercontext, event); + } } } -} /* * XAresult XAEqualizerItfAdapt_ThreadEntry(XAAdaptationGstCtx *adapCtx) * Description: Safety thread entry */ XAresult XAAdaptationBase_ThreadEntry(XAAdaptationBaseCtx *adaptCtx) -{ + { XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAAdaptationBase_ThreadEntry"); - if(!adaptCtx ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAAdaptationBase_ThreadEntry"); + if (!adaptCtx) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAAdaptationBase_ThreadEntry"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; + } - } - - switch(adaptCtx->ctxId) + switch (adaptCtx->ctxId) { case XAMediaPlayerAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); + XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer) + ; break; case XAMediaRecorderAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); + XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder) + ; break; case XARadioAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); + XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio) + ; break; case XACameraAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); + XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera) + ; break; case XAOutputMixAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSOutputMix); + XA_IMPL_THREAD_SAFETY_ENTRY(XATSOutputMix) + ; break; case XAVibraAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSVibra); + XA_IMPL_THREAD_SAFETY_ENTRY(XATSVibra) + ; break; case XALedArrayAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSLEDArray); + XA_IMPL_THREAD_SAFETY_ENTRY(XATSLEDArray) + ; break; case XAMDAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMetaDataExtractor); + XA_IMPL_THREAD_SAFETY_ENTRY(XATSMetaDataExtractor) + ; break; case XAEngineAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSEngine); + XA_IMPL_THREAD_SAFETY_ENTRY(XATSEngine) + ; break; default: - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID") + ; /* invalid parameter */ res = XA_RESULT_PARAMETER_INVALID; break; @@ -201,55 +214,63 @@ DEBUG_API("<-XAAdaptationBase_ThreadEntry"); return res; -} + } /* * XAresult XAEqualizerItfAdapt_ThreadExit(XAAdaptationGstCtx *adaptCtx) * Description: Safety thread exit */ XAresult XAAdaptationBase_ThreadExit(XAAdaptationBaseCtx *adaptCtx) -{ + { XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAAdaptationBase_ThreadExit"); - if(!adaptCtx ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAAdaptationBase_ThreadExit"); + if (!adaptCtx) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAAdaptationBase_ThreadExit"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; + } - } - - switch(adaptCtx->ctxId) + switch (adaptCtx->ctxId) { case XAMediaPlayerAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); + XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer) + ; break; case XAMediaRecorderAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); + XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder) + ; break; case XARadioAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); + XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio) + ; break; case XACameraAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); + XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera) + ; break; case XAOutputMixAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); + XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix) + ; break; case XAVibraAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSVibra); + XA_IMPL_THREAD_SAFETY_EXIT(XATSVibra) + ; break; case XALedArrayAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); + XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray) + ; break; case XAMDAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSMetaDataExtractor); + XA_IMPL_THREAD_SAFETY_EXIT(XATSMetaDataExtractor) + ; break; case XAEngineAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSEngine); + XA_IMPL_THREAD_SAFETY_EXIT(XATSEngine) + ; break; default: - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID") + ; /* invalid parameter */ res = XA_RESULT_PARAMETER_INVALID; break; @@ -257,4 +278,4 @@ DEBUG_API("<-XAAdaptationBase_ThreadExit"); return res; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/adptcommon/xaadptbasectx.h --- a/khronosfws/openmax_al/src/adptcommon/xaadptbasectx.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/adptcommon/xaadptbasectx.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Base Adaptation Macros common between adaptations. + * + */ #ifndef XAADPTBASECTX_H_ #define XAADPTBASECTX_H_ @@ -27,10 +27,11 @@ /* ENUMERATIONS */ /** -GLOBAL ENUMERATIONS + GLOBAL ENUMERATIONS */ -typedef enum { +typedef enum + { XAMediaPlayerAdaptation = 0, XAMediaRecorderAdaptation, XARadioAdaptation, @@ -40,7 +41,7 @@ XALedArrayAdaptation, XAMDAdaptation, XAEngineAdaptation -}AdaptationContextIDS; + } AdaptationContextIDS; #define XA_ADAPT_PU_INTERVAL 50 /* position update interval */ #define XA_ADAPT_ASYNC_TIMEOUT 3000 /* timeout to wait async events */ @@ -63,13 +64,10 @@ #define RADIO_DEFAULT_FREQ_RANGE XA_FREQRANGE_FMEUROAMERICA #define RADIO_DEFAULT_FREQ 88000000 - /* TYPEDEFS */ /* Adaptation device IDs */ -//#define XA_ADAPTID_ALSASRC 0xAD7E5001 //Krishna commented -#define XA_ADAPTID_DEVSOUNDSRC 0xAD7E5001 -//#define XA_ADAPTID_ALSASINK 0xAD7E5002 +#define XA_ADAPTID_DEVSOUNDSRC 0xAD7E5001 #define XA_ADAPTID_DEVSOUNDSINK 0xAD7E5002 #define XA_ADAPTID_AUTOAUDIOSINK 0xAD7E5003 #define XA_ADAPTID_AUDIOTESTSRC 0xAD7E5004 @@ -86,7 +84,6 @@ #define XA_ADAPTID_RAWVIDEO 0xAD7E500E -//#define XA_ADAPT_DEFAULTAUDIOOUTPUT XA_ADAPTID_ALSASINK #define XA_ADAPT_DEFAULTAUDIOOUTPUT XA_ADAPTID_DEVSOUNDSINK #ifdef XA_USE_TEST_PLUGINS @@ -95,7 +92,6 @@ #define XA_ADAPT_DEFAULTAUDIOINPUT XA_ADAPTID_DEVSOUNDSRC #endif - #define XA_ADAPT_OGGPROFILE_UNKNOWN 0x1 #define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_8 0x1 @@ -121,12 +117,12 @@ /* Adaptation event structure */ typedef struct XAAdaptEvent_ -{ - XAAdaptEventTypes eventtype; /* what kind of event, e.g. playitf event */ - XAuint8 eventid; /* eventtype-specific event, e.g. XA_PLAYEVENT macro */ - XAuint32 datasize; /* event data size */ - void* data; /* event data if needed */ -} XAAdaptEvent; + { + XAAdaptEventTypes eventtype; /* what kind of event, e.g. playitf event */ + XAuint8 eventid; /* eventtype-specific event, e.g. XA_PLAYEVENT macro */ + XAuint32 datasize; /* event data size */ + void* data; /* event data if needed */ + } XAAdaptEvent; /* Forward declaration of adaptation basecontext */ typedef struct XAAdaptationBaseCtx_ XAAdaptationBaseCtx; @@ -136,39 +132,37 @@ * Gst-Adaptation context structures. */ typedef struct XAAdaptationBaseCtx_ -{ -/* Common Variables for all adaptation elements */ - XAuint32 ctxId; - GArray* evtHdlrs; /*array of event handlers */ - FrameworkMap* fwkmapper; - FWMgrFwType fwtype; + { + /* Common Variables for all adaptation elements */ + XAuint32 ctxId; + GArray* evtHdlrs; /*array of event handlers */ + FrameworkMap* fwkmapper; + FWMgrFwType fwtype; XACapabilities* capslist; - -} XAAdaptationBaseCtx_; + } XAAdaptationBaseCtx_; /* Adaptation event callback */ -typedef void (*xaAdaptEventHandler) ( void *pHandlerCtx, XAAdaptEvent* event ); +typedef void (*xaAdaptEventHandler)(void *pHandlerCtx, XAAdaptEvent* event); typedef struct XAAdaptEvtHdlr_ -{ - xaAdaptEventHandler handlerfunc; /* function handling the callback */ - void *handlercontext; /* context of handler */ - XAuint32 eventtypes; /* what kind of events this handles */ -} XAAdaptEvtHdlr; - - - + { + xaAdaptEventHandler handlerfunc; /* function handling the callback */ + void *handlercontext; /* context of handler */ + XAuint32 eventtypes; /* what kind of events this handles */ + } XAAdaptEvtHdlr; /* FUNCTIONS */ -XAresult XAAdaptationBase_Init( XAAdaptationBaseCtx* pSelf, XAuint32 ctxId ); -XAresult XAAdaptationBase_PostInit( XAAdaptationBaseCtx* ctx ); -XAresult XAAdaptationBase_AddEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler, - XAuint32 evtTypes,void *pHandlerCtx ); -XAresult XAAdaptationBase_RemoveEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler ); -void XAAdaptationBase_SendAdaptEvents(XAAdaptationBaseCtx* ctx, XAAdaptEvent* event); +XAresult XAAdaptationBase_Init(XAAdaptationBaseCtx* pSelf, XAuint32 ctxId); +XAresult XAAdaptationBase_PostInit(XAAdaptationBaseCtx* ctx); +XAresult XAAdaptationBase_AddEventHandler(XAAdaptationBaseCtx* ctx, + xaAdaptEventHandler evtHandler, XAuint32 evtTypes, void *pHandlerCtx); +XAresult XAAdaptationBase_RemoveEventHandler(XAAdaptationBaseCtx* ctx, + xaAdaptEventHandler evtHandler); +void XAAdaptationBase_SendAdaptEvents(XAAdaptationBaseCtx* ctx, + XAAdaptEvent* event); XAresult XAAdaptationBase_ThreadEntry(XAAdaptationBaseCtx *adaptCtx); XAresult XAAdaptationBase_ThreadExit(XAAdaptationBaseCtx *adaptCtx); -void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx ); +void XAAdaptationBase_Free(XAAdaptationBaseCtx* ctx); -#endif /* XAADPTBASE_H_ */ +#endif /* XAADPTBASECTX_H_ */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/adptcommon/xacapabilitiesmgr.c --- a/khronosfws/openmax_al/src/adptcommon/xacapabilitiesmgr.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/adptcommon/xacapabilitiesmgr.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,20 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Capability Manager to query capabilities from different + * adaptations and store it in a linked list. + * + */ #include "xacapabilitiesmgr.h" #include "xammfcapabilitiesmgr.h" @@ -21,41 +22,39 @@ #include #include -static XAresult XACapabilitiesMgr_GetAudioInputDeviceCapabilities(XACapabilities **ppNode); -static XAresult XACapabilitiesMgr_GetAudioOutputDeviceCapabilities(XACapabilities **ppNode); +static XAresult XACapabilitiesMgr_GetAudioInputDeviceCapabilities( + XACapabilities **ppNode); +static XAresult XACapabilitiesMgr_GetAudioOutputDeviceCapabilities( + XACapabilities **ppNode); /* XAresult XAGSTCapabilitiesMgr_UpdateAudioIOCapabilitieList * Description: Update the capabilities list supported by GStreamer framework. */ XAresult XACapabilitiesMgr_UpdateAudioIOCapabilitieList( - FrameworkMap *frameworkMap, - XACapabilities **ppListHead) + FrameworkMap *frameworkMap, XACapabilities **ppListHead) -{ + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *lastNode; - XACapabilities *firstNode ; + XACapabilities *firstNode; XACapabilities *newNode = NULL; - - if(!frameworkMap || !ppListHead) - { + + if (!frameworkMap || !ppListHead) + { res = XA_RESULT_PARAMETER_INVALID; return res; - } - - lastNode = *ppListHead; - firstNode = *ppListHead; - + } + + lastNode = *ppListHead; + firstNode = *ppListHead; DEBUG_API("->XACapabilitiesMgr_UpdateAudioIOCapabilitieList"); - - /* traverse and point to the last node in the list */ - while(lastNode && lastNode->next) - { + while (lastNode && lastNode->next) + { lastNode = lastNode->next; - } + } /* If no input devices are supported, the function returns * XA_RESULT_SUCCESS and newNode will be NULL*/ @@ -65,18 +64,18 @@ { return res; } - + if (lastNode) - { + { lastNode->next = newNode; - } + } if (newNode) - { /* if a new node is created move lastNode to the new item */ + { /* if a new node is created move lastNode to the new item */ if (!firstNode) firstNode = newNode; lastNode = newNode; - } - + } + /* If no input devices are supported, the function returns * XA_RESULT_SUCCESS and newNode will be NULL*/ newNode = NULL; @@ -85,346 +84,353 @@ { return res; } - + if (lastNode) - { + { lastNode->next = newNode; - } + } if (newNode) - { /* if a new node is created move lastNode to the new item */ + { /* if a new node is created move lastNode to the new item */ if (!firstNode) firstNode = newNode; lastNode = newNode; - } + } /* if empty list, then append first node as the head */ if (!(*ppListHead)) { *ppListHead = firstNode; - } - DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList"); + }DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList"); return res; -} + } -XAresult XACapabilitiesMgr_CreateCapabilitieList( - FrameworkMap* frameworkMap, - XACapabilities** ppListHead) -{ +XAresult XACapabilitiesMgr_CreateCapabilitieList(FrameworkMap* frameworkMap, + XACapabilities** ppListHead) + { XACapabilities* list = NULL; XAresult res = XA_RESULT_SUCCESS; - if(!ppListHead) - { + if (!ppListHead) + { res = XA_RESULT_PARAMETER_INVALID; return res; - } + } *ppListHead = NULL; res = XACapabilitiesMgr_UpdateAudioIOCapabilitieList(frameworkMap, &list); if (res != XA_RESULT_SUCCESS) - { + { XACapabilitiesMgr_DeleteCapabilitieList(&list); return res; - } - + } + res = XAGSTCapabilitiesMgr_UpdateCapabilitieList(frameworkMap, &list); if (res != XA_RESULT_SUCCESS) - { + { XACapabilitiesMgr_DeleteCapabilitieList(&list); return res; - } + } res = XAMMFCapabilitiesMgr_UpdateCapabilitieList(frameworkMap, &list); if (res != XA_RESULT_SUCCESS) - { + { XACapabilitiesMgr_DeleteCapabilitieList(&list); return res; - } + } *ppListHead = list; return res; -} + } XAresult XACapabilitiesMgr_DeleteCapabilitieList(XACapabilities** ppListHead) -{ + { XACapabilities* currNode = NULL; XACapabilities* nextNode = NULL; XAresult res = XA_RESULT_SUCCESS; - - if(!ppListHead) - { + + if (!ppListHead) + { res = XA_RESULT_PARAMETER_INVALID; return res; - } + } currNode = *ppListHead; while (currNode) - { + { if (currNode->capsType == AUD_I) - { - XAAudioInputDescriptor* entries = (XAAudioInputDescriptor*)currNode->pEntry; + { + XAAudioInputDescriptor* entries = + (XAAudioInputDescriptor*) currNode->pEntry; XAint32 i; - for(i=0;i< currNode->noOfEntries;i++) - { + for (i = 0; i < currNode->noOfEntries; i++) + { free(entries[i].samplingRatesSupported); free(entries[i].deviceName); - } + } free(entries); - } + } else if (currNode->capsType == AUD_O) - { - XAAudioOutputDescriptor* entries = (XAAudioOutputDescriptor*)currNode->pEntry; + { + XAAudioOutputDescriptor* entries = + (XAAudioOutputDescriptor*) currNode->pEntry; XAint32 i; - for(i=0;i< currNode->noOfEntries;i++) - { + for (i = 0; i < currNode->noOfEntries; i++) + { free(entries[i].samplingRatesSupported); free(entries[i].pDeviceName); - } + } free(entries); - } + } else if (currNode->capsType == AUD_E) - { - XAAudioCodecDescriptor* entries = (XAAudioCodecDescriptor*)currNode->pEntry; + { + XAAudioCodecDescriptor* entries = + (XAAudioCodecDescriptor*) currNode->pEntry; XAint32 i; - for(i=0;i< currNode->noOfEntries;i++) - { + for (i = 0; i < currNode->noOfEntries; i++) + { free(entries[i].pSampleRatesSupported); free(entries[i].pBitratesSupported); - } + } free(entries); - } + } - if(currNode->adaptId) + if (currNode->adaptId) { free(currNode->adaptId); } - + nextNode = currNode->next; free(currNode); currNode = nextNode; - } + } *ppListHead = NULL; return res; -} - + } /* XAresult XACapabilitiesMgr_GetCapsCount * Description: Count capabilities of certain type. Filter is specified by * bitmasking XACapsType values. */ -XAresult XACapabilitiesMgr_GetCapsCount(XACapabilities* pListHead, XACapsType filter, XAuint32* count) -{ +XAresult XACapabilitiesMgr_GetCapsCount(XACapabilities* pListHead, + XACapsType filter, XAuint32* count) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities* currNode = pListHead; DEBUG_API("->XACapabilitiesMgr_GetCapsCount"); - if(!currNode || !count) - { + if (!currNode || !count) + { res = XA_RESULT_PARAMETER_INVALID; return res; - } + } - (*count)=0; + (*count) = 0; while (currNode) - { - if ( (currNode->capsType & filter) == filter ) { + if ((currNode->capsType & filter) == filter) + { (*count)++; - } + } currNode = currNode->next; - } + } DEBUG_API("<-XACapabilitiesMgr_GetCapsCount"); return res; -} + } /* XAresult XACapabilitiesMgr_GetCapsById * Description: Get capabilities of type XACapsType and matching id */ -XAresult XACapabilitiesMgr_GetCapsById(XACapabilities* pListHead, XACapsType filter, XAuint32 maxId, XACapabilities* data) -{ +XAresult XACapabilitiesMgr_GetCapsById(XACapabilities* pListHead, + XACapsType filter, XAuint32 maxId, XACapabilities* data) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities* currNode = pListHead; XAboolean found = XA_BOOLEAN_FALSE; DEBUG_API("->XACapabilitiesMgr_GetCapsById"); - if(!currNode) - { + if (!currNode) + { res = XA_RESULT_PARAMETER_INVALID; return res; - } + } while (currNode) - { - if (((currNode->capsType & filter) == filter ) && (maxId==currNode->xaid)) { + if (((currNode->capsType & filter) == filter) && (maxId + == currNode->xaid)) + { memcpy(data, currNode, sizeof(XACapabilities)); found = XA_BOOLEAN_TRUE; break; - } + } currNode = currNode->next; - } + } - if(!found) - { - res = XA_RESULT_FEATURE_UNSUPPORTED; - return res; - } + if (!found) + { + res = XA_RESULT_FEATURE_UNSUPPORTED; + return res; + } DEBUG_API("<-XACapabilitiesMgr_GetCapsById"); return res; -} + } /* XAresult XACapabilitiesMgr_GetCapsByIdx * Description: Get n'th capabilities of type XACapsType */ -XAresult XACapabilitiesMgr_GetCapsByIdx(XACapabilities* pListHead, XACapsType filter, XAuint32 idx, XACapabilities* data) -{ +XAresult XACapabilitiesMgr_GetCapsByIdx(XACapabilities* pListHead, + XACapsType filter, XAuint32 idx, XACapabilities* data) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities* currNode = pListHead; XAboolean found = XA_BOOLEAN_FALSE; XAuint32 j = 0; - DEBUG_API("->XACapabilitiesMgr_GetCapsByIdx"); - if(!currNode) - { + if (!currNode) + { res = XA_RESULT_PARAMETER_INVALID; return res; - } - + } while (currNode) - { - if ((currNode->capsType & filter) == filter ) { - if( idx == j++ ) + if ((currNode->capsType & filter) == filter) { + if (idx == j++) + { memcpy(data, currNode, sizeof(XACapabilities)); found = XA_BOOLEAN_TRUE; break; + } } + currNode = currNode->next; } - currNode = currNode->next; - } - if(!found) - { - res = XA_RESULT_PARAMETER_INVALID; - return res; - } + if (!found) + { + res = XA_RESULT_PARAMETER_INVALID; + return res; + } DEBUG_API("<-XACapabilitiesMgr_GetCapsByIdx"); return res; -} + } /* XAresult XACapabilitiesMgr_QueryColorFormats * Description: Get color formats associated with the XA_IMAGECODEC_RAW codec. */ -XAresult XACapabilitiesMgr_QueryColorFormats(XACapabilities* pListHead, XAuint32* pIndex, XAuint32* pColorFormats) -{ +XAresult XACapabilitiesMgr_QueryColorFormats(XACapabilities* pListHead, + XAuint32* pIndex, XAuint32* pColorFormats) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities temp; DEBUG_API("->XACapabilitiesMgr_QueryColorFormats"); - if( !pIndex ) - { + if (!pIndex) + { DEBUG_ERR("illegal NULL parameter"); res = XA_RESULT_PARAMETER_INVALID; return res; - } + } - res = XACapabilitiesMgr_GetCapsById(pListHead, (XACapsType)((XACapsType)(XACAP_ENCODER|XACAP_IMAGE)), XA_IMAGECODEC_RAW, &temp); - if( res == XA_RESULT_SUCCESS ) - { - if( !pColorFormats ) - { /* query number of color formats */ + res = XACapabilitiesMgr_GetCapsById(pListHead, + (XACapsType) ((XACapsType) (XACAP_ENCODER | XACAP_IMAGE)), + XA_IMAGECODEC_RAW, &temp); + if (res == XA_RESULT_SUCCESS) + { + if (!pColorFormats) + { /* query number of color formats */ *pIndex = 1; /* one used by camera context */ - } + } else - { /* query color format */ - if( *pIndex >= 1 ) /* one used by camera context */ - { + { /* query color format */ + if (*pIndex >= 1) /* one used by camera context */ + { DEBUG_ERR("index parameter invalid"); res = XA_RESULT_PARAMETER_INVALID; - } + } else - { /* internal format used by pipeline, look camera context for details */ + { /* internal format used by pipeline, look camera context for details */ *pColorFormats = XA_COLORFORMAT_YUV420PLANAR; + } } } - } else - { + { *pIndex = 0; - } + } DEBUG_API("<-XACapabilitiesMgr_QueryColorFormats"); return res; -} + } /* Add AudioInputDeviceCaps */ -XAresult XACapabilitiesMgr_GetAudioInputDeviceCapabilities(XACapabilities** ppNode) -{ +XAresult XACapabilitiesMgr_GetAudioInputDeviceCapabilities( + XACapabilities** ppNode) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *newNode = NULL; XAAudioInputDescriptor *entries = NULL; -/* XAAudioInputDescriptor *entries = NULL;*/ XAchar micDeviceName[] = "Default Mic"; int strLen = 0; - newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities)); + newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities)); if (!newNode) - { + { res = XA_RESULT_MEMORY_FAILURE; return res; - } + } newNode->capsType = AUD_I; newNode->xaid = 0xAD7E5001; newNode->noOfEntries = 1; /* Allocate array */ - entries = (XAAudioInputDescriptor*) calloc(1 , sizeof(XAAudioInputDescriptor)); + entries = (XAAudioInputDescriptor*) calloc(1, + sizeof(XAAudioInputDescriptor)); if (!entries) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } + + newNode->pEntry = (void*) entries; - newNode->pEntry = (void*)entries; - - strLen = strlen((char*)micDeviceName); - entries->deviceName = (XAchar *)calloc(strLen + 1, sizeof(XAchar)); + strLen = strlen((char*) micDeviceName); + entries->deviceName = (XAchar *) calloc(strLen + 1, sizeof(XAchar)); if (!entries->deviceName) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } - strncpy((char*)entries->deviceName, (char*)micDeviceName, strLen); + strncpy((char*) entries->deviceName, (char*) micDeviceName, strLen); entries->deviceName[strLen] = '\0'; /*Null terminate it*/ entries->deviceConnection = XA_DEVCONNECTION_INTEGRATED; entries->deviceScope = XA_DEVSCOPE_ENVIRONMENT; entries->deviceLocation = XA_DEVLOCATION_HANDSET; entries->isForTelephony = XA_BOOLEAN_FALSE; - entries->minSampleRate=8000000; /* milliHz */ + entries->minSampleRate = 8000000; /* milliHz */ entries->maxSampleRate = 96000000; /* milliHz */ - entries->isFreqRangeContinuous=XA_BOOLEAN_FALSE; + entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE; entries->numOfSamplingRatesSupported = 12; - entries->samplingRatesSupported = (XAmilliHertz*)calloc(entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz)); + entries->samplingRatesSupported = (XAmilliHertz*) calloc( + entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz)); if (!entries->samplingRatesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } /* entries in milliHz */ entries->samplingRatesSupported[0] = 8000000; entries->samplingRatesSupported[1] = 11025000; @@ -440,52 +446,53 @@ entries->samplingRatesSupported[11] = 96000000; entries->maxChannels = 2; - newNode->pEntry = (void*)entries; + newNode->pEntry = (void*) entries; *ppNode = newNode; return res; -} + } -XAresult XACapabilitiesMgr_GetAudioOutputDeviceCapabilities(XACapabilities **ppNode) -{ +XAresult XACapabilitiesMgr_GetAudioOutputDeviceCapabilities( + XACapabilities **ppNode) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *newNode = NULL; XAAudioOutputDescriptor *entries = NULL; -/* XAAudioOutputDescriptor *entries = NULL;*/ XAchar outputDeviceName[] = "Default Speaker"; int strLen = 0; - newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities)); + newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities)); if (!newNode) - { + { res = XA_RESULT_MEMORY_FAILURE; return res; - } + } newNode->capsType = AUD_O; newNode->xaid = 0xAD7E5002; newNode->noOfEntries = 1; /* Allocate array */ - entries = (XAAudioOutputDescriptor*)calloc(1, sizeof(XAAudioOutputDescriptor)); + entries = (XAAudioOutputDescriptor*) calloc(1, + sizeof(XAAudioOutputDescriptor)); if (!entries) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } - newNode->pEntry = (void*)entries; + newNode->pEntry = (void*) entries; - strLen = strlen((char*)outputDeviceName); - entries->pDeviceName = (XAchar *)calloc(strLen + 1, sizeof(XAchar)); + strLen = strlen((char*) outputDeviceName); + entries->pDeviceName = (XAchar *) calloc(strLen + 1, sizeof(XAchar)); if (!entries->pDeviceName) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } - strncpy((char*)entries->pDeviceName, (char*)outputDeviceName, strLen); + } + strncpy((char*) entries->pDeviceName, (char*) outputDeviceName, strLen); entries->pDeviceName[strLen] = '\0'; /*Null terminate it*/ entries->deviceConnection = XA_DEVCONNECTION_INTEGRATED; entries->deviceScope = XA_DEVSCOPE_ENVIRONMENT; @@ -495,13 +502,14 @@ entries->maxSampleRate = 96000000; /* milliHz */ entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE; entries->numOfSamplingRatesSupported = 12; - entries->samplingRatesSupported = (XAmilliHertz*)calloc(entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz)); + entries->samplingRatesSupported = (XAmilliHertz*) calloc( + entries->numOfSamplingRatesSupported, sizeof(XAmilliHertz)); if (!entries->samplingRatesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } /* entries in milliHz */ entries->samplingRatesSupported[0] = 8000000; entries->samplingRatesSupported[1] = 11025000; @@ -517,9 +525,9 @@ entries->samplingRatesSupported[11] = 96000000; entries->maxChannels = 2; - newNode->pEntry = (void*)entries; + newNode->pEntry = (void*) entries; *ppNode = newNode; return res; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/adptcommon/xacapabilitiesmgr.h --- a/khronosfws/openmax_al/src/adptcommon/xacapabilitiesmgr.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/adptcommon/xacapabilitiesmgr.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Header File + * + */ #ifndef XACAPABILITIESMGR_H #define XACAPABILITIESMGR_H @@ -22,7 +22,6 @@ #include "openmaxalwrapper.h" #include "xaglobals.h" - #define AUD_D (XACAP_DECODER|XACAP_AUDIO) #define AUD_E (XACAP_ENCODER|XACAP_AUDIO) #define VID_D (XACAP_DECODER|XACAP_VIDEO) @@ -40,45 +39,32 @@ typedef struct XACapabilities_ XACapabilities; struct XACapabilities_ -{ - XAuint32 capsType; - XAuint32 xaid; /* OpenMAX id (e.g. XA_VIDEOCODEC macro) */ - XAchar* adaptId; /* TODO fill this */ - /* TODO Do we need a flag for default device id? */ - XAuint32 noOfEntries; - void* pEntry; + { + XAuint32 capsType; + XAuint32 xaid; /* OpenMAX id (e.g. XA_VIDEOCODEC macro) */ + XAchar* adaptId; /* Internal Adaptation Device IDs */ + XAuint32 noOfEntries; + void* pEntry; /*add if/when needed*/ XACapabilities* next; -}; - + }; -XAresult XACapabilitiesMgr_CreateCapabilitieList( - FrameworkMap* frameworkMap, - XACapabilities** ppListHead); +XAresult XACapabilitiesMgr_CreateCapabilitieList(FrameworkMap* frameworkMap, + XACapabilities** ppListHead); XAresult XACapabilitiesMgr_DeleteCapabilitieList(XACapabilities** ppListHead); -XAresult XACapabilitiesMgr_GetCapsCount( - XACapabilities* pListHead, - XACapsType filter, - XAuint32* count); +XAresult XACapabilitiesMgr_GetCapsCount(XACapabilities* pListHead, + XACapsType filter, XAuint32* count); -XAresult XACapabilitiesMgr_GetCapsById( - XACapabilities* pListHead, - XACapsType filter, - XAuint32 maxId, - XACapabilities* data); +XAresult XACapabilitiesMgr_GetCapsById(XACapabilities* pListHead, + XACapsType filter, XAuint32 maxId, XACapabilities* data); -XAresult XACapabilitiesMgr_GetCapsByIdx( - XACapabilities* pListHead, - XACapsType filter, - XAuint32 idx, - XACapabilities* data); +XAresult XACapabilitiesMgr_GetCapsByIdx(XACapabilities* pListHead, + XACapsType filter, XAuint32 idx, XACapabilities* data); -XAresult XACapabilitiesMgr_QueryColorFormats( - XACapabilities* pListHead, - XAuint32* pIndex, - XAuint32* pColorFormats); +XAresult XACapabilitiesMgr_QueryColorFormats(XACapabilities* pListHead, + XAuint32* pIndex, XAuint32* pColorFormats); #endif /* XACAPABILITIESMGR_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/adptcommon/xaframeworkmgr.c --- a/khronosfws/openmax_al/src/adptcommon/xaframeworkmgr.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/adptcommon/xaframeworkmgr.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,34 +1,33 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Framework Manager. Parses the CFG file + * + */ -#include "xaframeworkmgr.h" #include #include +#include "xaframeworkmgr.h" /* Default line width permitted in the cfg file + 2 to hold "\r\n"*/ #define LINEWIDTH 82 typedef enum -{ + { FWMgrTagNone, FWMgrTagURIScheme, FWMgrTagFileExt -} FWMgrTagType; - + } FWMgrTagType; /* Config file location */ const char configFileLocationZ[] = "z:/openmaxal/openmaxal.cfg"; @@ -50,24 +49,19 @@ /* Local function definitions */ /* returns FWMgrTrue if processed successfully */ -static FWMgrBool processConfigEntry( - const char* buffer, - FWMgrMOType *mediaType, - FWMgrFwType *frameworkType, - FWMgrTagType *tagType, - FWMgrBool *newNode, +static FWMgrBool processConfigEntry(const char* buffer, + FWMgrMOType *mediaType, FWMgrFwType *frameworkType, + FWMgrTagType *tagType, FWMgrBool *newNode, FrameworkMap **node); + +/* returns FWMgrTrue if processed successfully */ +static FWMgrBool processTagType(const char* buffer, + FWMgrFwType *frameworkType, FWMgrTagType *tagType, FrameworkMap **node); /* returns FWMgrTrue if processed successfully */ -static FWMgrBool processTagType( - const char* buffer, - FWMgrFwType *frameworkType, - FWMgrTagType *tagType, +static FWMgrBool tokenizeTag(FWMgrTagType tagType, const char* buffer, FrameworkMap **node); -/* returns FWMgrTrue if processed successfully */ -static FWMgrBool tokenizeTag(FWMgrTagType tagType, const char* buffer, FrameworkMap **node); - /* Crates a default rules config file */ static int createDefaultRules(const char * filename); @@ -77,7 +71,7 @@ * Description: Creates a list of framework and use-case map. */ FrameworkMap* XAFrameworkMgr_CreateFrameworkMap() -{ + { char buffer[LINEWIDTH]; int readSize; int lineNumber = 0; @@ -89,7 +83,7 @@ FWMgrBool newNode; FrameworkMap *frameworkMap = NULL; FILE* fp = fopen(configFileLocationZ, "r"); - + if (fp == NULL) { createDefaultRules(configFileLocationC); @@ -98,9 +92,9 @@ } if (fp != NULL) - { - while((fgets(buffer, LINEWIDTH, fp) != NULL) && processedEntry) { + while ((fgets(buffer, LINEWIDTH, fp) != NULL) && processedEntry) + { /* keep looping until NULL pointer OR error... */ lineNumber++; readSize = strlen(buffer); @@ -109,58 +103,55 @@ continue; /* Ignore replace "\r\n" with '\0' */ - if ((readSize >= 2) && (buffer[readSize-2]=='\r') && (buffer[readSize-1]=='\n')) - buffer[readSize-2]='\0'; + if ((readSize >= 2) && (buffer[readSize - 2] == '\r') + && (buffer[readSize - 1] == '\n')) + buffer[readSize - 2] = '\0'; /* Ignore new line... */ if (readSize == 2) continue; - processedEntry = processConfigEntry( - buffer, - ¤tMediaType, - ¤tFrameworkType, - ¤tTagType, - &newNode, - &curNode); + processedEntry = processConfigEntry(buffer, ¤tMediaType, + ¤tFrameworkType, ¤tTagType, &newNode, + &curNode); if (newNode) - { + { /*Just link to the last element in the chain*/ if (!frameworkMap) - { + { frameworkMap = curNode; - } + } else - { + { FrameworkMap *lastNode = frameworkMap; while (lastNode->next) - { + { lastNode = lastNode->next; + } + lastNode->next = curNode; } - lastNode->next = curNode; } } + fclose(fp); } - fclose(fp); - } else - { + { printf("unable to open config file!\n"); + } + return frameworkMap; } - return frameworkMap; -} #ifdef _DEBUG /* void XAFrameworkMgr_DumpFrameworkMap * Description: Prints map to std console. */ void XAFrameworkMgr_DumpFrameworkMap(FrameworkMap *map) -{ + { FrameworkMap *node = map; int i; int loopIndex = 0; while (node) - { + { loopIndex++; printf("%d>", loopIndex); if (node->moType == FWMgrMOPlayer) @@ -176,50 +167,48 @@ else printf("UKNOWN-"); printf("Scheme["); - for(i=0;iuriSchemeCount;i++) + for (i = 0; i < node->uriSchemeCount; i++) printf(" %s", node->uriSchemes[i]); printf("]FileExt["); - for(i=0;ifileExtCount;i++) + for (i = 0; i < node->fileExtCount; i++) printf(" %s", node->fileExts[i]); printf("]\n"); node = node->next; + } } -} #endif /* void XAFrameworkMgr_DeleteFrameworkMap * Description: Deletes the list of framework and use-case map. */ void XAFrameworkMgr_DeleteFrameworkMap(FrameworkMap **map) -{ + { FrameworkMap *node = *map; FrameworkMap *nextNode = NULL; int i; while (node) - { - for(i=0;iuriSchemeCount;i++) - free (node->uriSchemes[i]); - free (node->uriSchemes); + { + for (i = 0; i < node->uriSchemeCount; i++) + free(node->uriSchemes[i]); + free(node->uriSchemes); - for(i=0;ifileExtCount;i++) - free (node->fileExts[i]); - free (node->fileExts); + for (i = 0; i < node->fileExtCount; i++) + free(node->fileExts[i]); + free(node->fileExts); nextNode = node->next; - free (node); + free(node); node = nextNode; + } + *map = NULL; } - *map = NULL; -} /* FWMgrFwType XAFrameworkMgr_GetFramework * Description: Returns the framework enum that handles uri. */ -FWMgrFwType XAFrameworkMgr_GetFramework( - FrameworkMap *map, - const char *uri, - FWMgrMOType mediaObject) -{ +FWMgrFwType XAFrameworkMgr_GetFramework(FrameworkMap *map, const char *uri, + FWMgrMOType mediaObject) + { FWMgrFwType retVal = FWMgrFWUknown; char fileScheme[] = "file"; char *uriScheme = NULL; @@ -231,272 +220,305 @@ int copyLen = 0; if (!map || !uri) - { + { /* TODO Log invalid uri */ return retVal; - } + } /* Get uri scheme */ uriScheme = strchr(uri, ':'); - if ( uriScheme == NULL) - { + if (uriScheme == NULL) + { /* TODO Log invalid uri */ return retVal; - } + } copyLen = (uriScheme - uri); - uriScheme = (char*)calloc(copyLen + 1, sizeof(char)); + uriScheme = (char*) calloc(copyLen + 1, sizeof(char)); strncpy(uriScheme, uri, copyLen); uriScheme[copyLen] = '\0'; /*Null terminate it*/ if (strcasecmp(uriScheme, fileScheme) == 0) - { + { /* Get uri extension */ char* dotLoc = strrchr(uri, '.'); - if ( dotLoc == NULL) - { + if (dotLoc == NULL) + { /* TODO Log invalid uri */ free(uriScheme); return retVal; - } + } /* We need to add 1 to exclude '.'*/ copyLen = strlen(uri) - (dotLoc + 1 - uri); - fileExt = (char*)calloc(copyLen + 1, sizeof(char)); + fileExt = (char*) calloc(copyLen + 1, sizeof(char)); strncpy(fileExt, dotLoc + 1, copyLen); fileExt[copyLen] = '\0'; /*Null terminate it*/ - } + } while (node) - { + { if (mediaObject == node->moType) { uriMatchFound = FWMgrFalse; fileExtMatchFound = FWMgrFalse; /* Match for uri*/ - for(i = 0; i < node->uriSchemeCount; i++) - { + for (i = 0; i < node->uriSchemeCount; i++) + { if (strcasecmp(uriScheme, node->uriSchemes[i]) == 0) { - uriMatchFound = FWMgrTrue; - break; + uriMatchFound = FWMgrTrue; + break; } - } + } /* if uri scheme is not file, we only need to check for uri */ if (!fileExt) - { + { fileExtMatchFound = FWMgrTrue; - } + } else - { - for(i = 0; i < node->fileExtCount; i++) { + for (i = 0; i < node->fileExtCount; i++) + { if (strcasecmp(fileExt, node->fileExts[i]) == 0) - { + { fileExtMatchFound = FWMgrTrue; break; + } } } - } - if ((uriMatchFound == FWMgrTrue) && - (fileExtMatchFound == FWMgrTrue)) + if ((uriMatchFound == FWMgrTrue) && (fileExtMatchFound + == FWMgrTrue)) { - retVal = node->fwType; - break; + retVal = node->fwType; + break; } } node = node->next; - } + } free(uriScheme); free(fileExt); return retVal; -} + } /* Local functions */ /* FWMgrBool processConfigEntry * Description: Processes a single line entry from the config file. */ -FWMgrBool processConfigEntry( - const char* buffer, - FWMgrMOType *mediaType, - FWMgrFwType *frameworkType, - FWMgrTagType *tagType, - FWMgrBool *newNode, - FrameworkMap **node) -{ +FWMgrBool processConfigEntry(const char* buffer, FWMgrMOType *mediaType, + FWMgrFwType *frameworkType, FWMgrTagType *tagType, + FWMgrBool *newNode, FrameworkMap **node) + { FWMgrBool processedSuccessfully = FWMgrTrue; - *newNode = FWMgrFalse; + + if (!buffer || !mediaType || !frameworkType || !tagType || !newNode) + { + processedSuccessfully = FWMgrFalse; + return processedSuccessfully; + } + + *newNode = FWMgrFalse; switch (*mediaType) - { + { case FWMgrMOUnknown: - { + { if (strcmp(buffer, mediaPlayerBeginTag) == 0) - { + { *mediaType = FWMgrMOPlayer; *frameworkType = FWMgrFWUknown; *tagType = FWMgrTagNone; *node = NULL; - } + } else if (strcmp(buffer, mediaRecorderBeginTag) == 0) - { + { *mediaType = FWMgrMORecorder; *frameworkType = FWMgrFWUknown; *tagType = FWMgrTagNone; *node = NULL; + } } - } break; case FWMgrMOPlayer: case FWMgrMORecorder: - { + { switch (*frameworkType) - { - case FWMgrFWUknown: { - if ((*mediaType == FWMgrMOPlayer) && (strcmp(buffer, mediaPlayerEndTag) == 0)) - *mediaType = FWMgrMOUnknown; - else if ((*mediaType == FWMgrMORecorder) && (strcmp(buffer, mediaRecorderEndTag) == 0)) + case FWMgrFWUknown: + { + if ((*mediaType == FWMgrMOPlayer) && (strcmp(buffer, + mediaPlayerEndTag) == 0)) *mediaType = FWMgrMOUnknown; - else if ( (strcmp(buffer, mediaFrameworkMmfBeginTag) == 0) || - (strcmp(buffer, mediaFrameworkGstBeginTag) == 0) ) - { + else if ((*mediaType == FWMgrMORecorder) && (strcmp( + buffer, mediaRecorderEndTag) == 0)) + *mediaType = FWMgrMOUnknown; + else if ((strcmp(buffer, mediaFrameworkMmfBeginTag) == 0) + || (strcmp(buffer, mediaFrameworkGstBeginTag) + == 0)) + { + *frameworkType = FWMgrFWMMF; if (strcmp(buffer, mediaFrameworkGstBeginTag) == 0) *frameworkType = FWMgrFWGST; if (*node) - { - printf("Fatal error error. Entry already exists and creating another one!!!"); - return FWMgrFalse; + { + printf( + "Fatal error error. Entry already exists and creating another one!!!"); + processedSuccessfully = FWMgrFalse; + } + else + { + *node = (FrameworkMap*) calloc(1, + sizeof(FrameworkMap)); + if (!(*node)) + { + printf( + "Fatal error. No memory to create an Entry!!!"); + processedSuccessfully = FWMgrFalse; + } + else + { + *newNode = FWMgrTrue; + (*node)->moType = *mediaType; + (*node)->fwType = *frameworkType; + } + } } - *node = (FrameworkMap*)calloc(1, sizeof(FrameworkMap)); - if (!(*node)) - { - printf("Fatal error. No memory to create an Entry!!!"); - return FWMgrFalse; - } - *newNode = FWMgrTrue; - (*node)->moType = *mediaType; - (*node)->fwType = *frameworkType; } - } break; case FWMgrFWMMF: - { - processedSuccessfully = processTagType( - buffer, - frameworkType, - tagType, - node); - } + { + processedSuccessfully = processTagType(buffer, + frameworkType, tagType, node); + } break; case FWMgrFWGST: - { - processedSuccessfully = processTagType( - buffer, - frameworkType, - tagType, - node); - } + { + processedSuccessfully = processTagType(buffer, + frameworkType, tagType, node); + } break; default: processedSuccessfully = FWMgrFalse; break; - }; - } + }; + } break; default: processedSuccessfully = FWMgrFalse; break; - }; + }; return processedSuccessfully; -} + } /* FWMgrBool processTagType - * Description: Processes a framework type, uri, file tags entry from the config file. + * Description: Processes a framework type, uri, file tags entry from + * the config file. */ -FWMgrBool processTagType(const char* buffer, - FWMgrFwType *frameworkType, - FWMgrTagType *tagType, - FrameworkMap **node) -{ +FWMgrBool processTagType(const char* buffer, FWMgrFwType *frameworkType, + FWMgrTagType *tagType, FrameworkMap **node) + { FWMgrBool processedSuccessfully = FWMgrTrue; - switch (*tagType) - { - case FWMgrTagNone: + + if (!buffer || !frameworkType || !tagType || (*node == NULL)) { - if (((*frameworkType == FWMgrFWMMF) && (strcmp(buffer, mediaFrameworkMmfEndTag) == 0)) || - ((*frameworkType == FWMgrFWGST) && (strcmp(buffer, mediaFrameworkGstEndTag) == 0))) + processedSuccessfully = FWMgrFalse; + return processedSuccessfully; + } + + switch (*tagType) + { + case FWMgrTagNone: { + if (((*frameworkType == FWMgrFWMMF) && (strcmp(buffer, + mediaFrameworkMmfEndTag) == 0)) || ((*frameworkType + == FWMgrFWGST) + && (strcmp(buffer, mediaFrameworkGstEndTag) == 0))) + { *node = NULL; *frameworkType = FWMgrFWUknown; - } + } else if (strcmp(buffer, uriSchemeBeginTag) == 0) *tagType = FWMgrTagURIScheme; else if (strcmp(buffer, fileExtBeginTag) == 0) *tagType = FWMgrTagFileExt; - } + } break; case FWMgrTagURIScheme: - { + { if (strcmp(buffer, uriSchemeEndTag) == 0) *tagType = FWMgrTagNone; else - { + { processedSuccessfully = FWMgrFalse; if (*node) - processedSuccessfully = tokenizeTag(FWMgrTagURIScheme, buffer, node); + processedSuccessfully = tokenizeTag(FWMgrTagURIScheme, + buffer, node); + } } - } break; case FWMgrTagFileExt: - { + { if (strcmp(buffer, fileExtEndTag) == 0) *tagType = FWMgrTagNone; else - { + { processedSuccessfully = FWMgrFalse; if (*node) - processedSuccessfully = tokenizeTag(FWMgrTagFileExt, buffer, node); + processedSuccessfully = tokenizeTag(FWMgrTagFileExt, + buffer, node); + } } - } break; default: + processedSuccessfully = FWMgrFalse; break; - }; + }; return processedSuccessfully; -} + } /* FWMgrBool processTagType - * Description: Processes a framework type, uri, file tags entry from the config file. + * Description: Processes a framework type, uri, file tags entry from + * the config file. */ -FWMgrBool tokenizeTag(FWMgrTagType tagType, const char* buffer, FrameworkMap **node) -{ - char* tempStartPtr = /*const_cast*/(char*)(buffer); - char* tempEndPtr = /*const_cast*/(char*)(buffer); +FWMgrBool tokenizeTag(FWMgrTagType tagType, const char* buffer, + FrameworkMap **node) + { + char* tempStartPtr; + char* tempEndPtr; int index = 0; int strLen = 0; + if (!buffer || (*node == NULL)) + { + return FWMgrFalse; + } + + tempStartPtr = /*const_cast*/(char*) (buffer); + tempEndPtr = /*const_cast*/(char*) (buffer); + if (tagType == FWMgrTagURIScheme) - { + { (*node)->uriSchemeCount = atoi(buffer); - (*node)->uriSchemes = (char**)calloc((*node)->uriSchemeCount, sizeof (*((*node)->uriSchemes))); + (*node)->uriSchemes = (char**) calloc((*node)->uriSchemeCount, + sizeof(*((*node)->uriSchemes))); if (!(*node)->uriSchemes) - { + { printf("Fatal error. No memory to create an Entry!!!"); return FWMgrFalse; + } } - } else if (tagType == FWMgrTagFileExt) - { + { (*node)->fileExtCount = atoi(buffer); - (*node)->fileExts = (char**)calloc((*node)->fileExtCount, sizeof (*((*node)->fileExts))); + (*node)->fileExts = (char**) calloc((*node)->fileExtCount, + sizeof(*((*node)->fileExts))); if (!(*node)->fileExts) - { + { printf("Fatal error. No memory to create an Entry!!!"); return FWMgrFalse; + } } - } else return FWMgrFalse; @@ -504,71 +526,90 @@ tempStartPtr = strchr(tempStartPtr, ','); index = 0; while (tempStartPtr && (strlen(tempStartPtr) > 1)) - { + { tempStartPtr++; /* Ignore separator ','*/ tempEndPtr = strchr(tempStartPtr, ','); strLen = (tempEndPtr - tempStartPtr) + 1; /* To hold null terminator */ if (strLen > 0) - { + { if (tagType == FWMgrTagURIScheme) - { - (*node)->uriSchemes[index] = (char*)calloc(strLen, sizeof(char)); + { + (*node)->uriSchemes[index] = (char*) calloc(strLen, + sizeof(char)); strncpy((*node)->uriSchemes[index], tempStartPtr, strLen); - (*node)->uriSchemes[index][strLen-1] = '\0'; /*Null terminate it*/ + (*node)->uriSchemes[index][strLen - 1] = '\0'; /*Null terminate it*/ index++; - } + } else if (tagType == FWMgrTagFileExt) - { - (*node)->fileExts[index] = (char*)calloc(strLen, sizeof(char)); + { + (*node)->fileExts[index] = (char*) calloc(strLen, + sizeof(char)); strncpy((*node)->fileExts[index], tempStartPtr, strLen); - (*node)->fileExts[index][strLen-1] = '\0'; /*Null terminate it*/ + (*node)->fileExts[index][strLen - 1] = '\0'; /*Null terminate it*/ index++; + } } + tempStartPtr = tempEndPtr; } - tempStartPtr = tempEndPtr; + return FWMgrTrue; } - return FWMgrTrue; -} int createDefaultRules(const char * filename) -{ + { FILE* fp = fopen(filename, "w"); if (fp == NULL) return /*KErrAccessDenied*/-21; fputs("#/*\r\n", fp); - fputs("#* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).\r\n", fp); + fputs( + "#* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).\r\n", + fp); fputs("#* All rights reserved.\r\n", fp); - fputs("#* This component and the accompanying materials are made available\r\n", fp); + fputs( + "#* This component and the accompanying materials are made available\r\n", + fp); fputs("#* under the terms of \"Eclipse Public License v1.0\"\r\n", fp); fputs("#* which accompanies this distribution, and is available\r\n", fp); - fputs("#* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\r\n", fp); + fputs("#* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\r\n", + fp); fputs("#*\r\n", fp); fputs("#* Initial Contributors:\r\n", fp); fputs("#* Nokia Corporation - initial contribution.\r\n", fp); fputs("#*\r\n", fp); fputs("#* Contributors:\r\n", fp); fputs("#*\r\n", fp); - fputs("#* Description:\r\n", fp); + fputs("#* Description:\r\n", fp); fputs("#*\r\n", fp); fputs("#*/\r\n", fp); - fputs("#============================================================================>|\r\n", fp); - fputs("# Must not exceed 80 chars each line=========================================>|\r\n", fp); - fputs("#============================================================================>|\r\n", fp); + fputs( + "#============================================================================>|\r\n", + fp); + fputs( + "# Must not exceed 80 chars each line=========================================>|\r\n", + fp); + fputs( + "#============================================================================>|\r\n", + fp); fputs("\r\n", fp); fputs("\r\n", fp); fputs("\r\n", fp); - fputs("# Num of entries followed by actual entries all ending with a comma\r\n", fp); + fputs( + "# Num of entries followed by actual entries all ending with a comma\r\n", + fp); fputs("6,file,http,rtsp,rtspu,rtspt,mms,\r\n", fp); fputs("\r\n", fp); fputs("\r\n", fp); - fputs("15,3gp,wma,wmv,wav,amr,mp3,mp4,rm,ra,avi,mkv,aac,mid,awb,3g2,\r\n", fp); + fputs( + "15,3gp,wma,wmv,wav,amr,mp3,mp4,rm,ra,avi,mkv,aac,mid,awb,3g2,\r\n", + fp); fputs("\r\n", fp); fputs("\r\n", fp); fputs("\r\n", fp); fputs("\r\n", fp); fputs("\r\n", fp); fputs("\r\n", fp); - fputs("# Num of entries followed by actual entries all ending with a comma\r\n", fp); + fputs( + "# Num of entries followed by actual entries all ending with a comma\r\n", + fp); fputs("1,file,\r\n", fp); fputs("\r\n", fp); fputs("\r\n", fp); @@ -578,4 +619,4 @@ fputs("\r\n", fp); fclose(fp); return 0; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/adptcommon/xaframeworkmgr.h --- a/khronosfws/openmax_al/src/adptcommon/xaframeworkmgr.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/adptcommon/xaframeworkmgr.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,20 +1,19 @@ - /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Header File for Framework Manager + * + */ #ifndef XAFRAMEWORKMANAGER_H #define XAFRAMEWORKMANAGER_H @@ -22,29 +21,29 @@ #include typedef enum -{ + { FWMgrMOUnknown, FWMgrMOPlayer, FWMgrMORecorder -} FWMgrMOType; + } FWMgrMOType; typedef enum -{ + { FWMgrFWUknown, FWMgrFWMMF, FWMgrFWGST -} FWMgrFwType; + } FWMgrFwType; typedef enum -{ + { FWMgrFalse, FWMgrTrue -} FWMgrBool; + } FWMgrBool; typedef struct FrameworkMap_ FrameworkMap; struct FrameworkMap_ -{ + { FWMgrMOType moType; int uriSchemeCount; char **uriSchemes; @@ -52,8 +51,7 @@ char **fileExts; FWMgrFwType fwType; FrameworkMap *next; -}; - + }; FrameworkMap* XAFrameworkMgr_CreateFrameworkMap(void); #ifdef _DEBUG @@ -61,9 +59,7 @@ #endif void XAFrameworkMgr_DeleteFrameworkMap(FrameworkMap **map); -FWMgrFwType XAFrameworkMgr_GetFramework( - FrameworkMap *map, - const char *uri, - FWMgrMOType mediaObject); +FWMgrFwType XAFrameworkMgr_GetFramework(FrameworkMap *map, const char *uri, + FWMgrMOType mediaObject); #endif //XAFRAMEWORKMANAGER_H diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/openmaxal.c --- a/khronosfws/openmax_al/src/common/openmaxal.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/openmaxal.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,20 +1,22 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Entry Point to the OpenMAX AL Core from the Client + * Application. Implementation of the OpenMAX AL Global + * Functions. + * + * + */ #include #include @@ -24,39 +26,35 @@ #include "xaglobals.h" #include "xaobjects.h" -EXPORT_C XAresult XAAPIENTRY xaCreateEngine(XAObjectItf *pEngine, XAuint32 numOptions, - const XAEngineOption *pEngineOptions, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ +EXPORT_C XAresult XAAPIENTRY xaCreateEngine(XAObjectItf *pEngine, + XAuint32 numOptions, const XAEngineOption *pEngineOptions, + XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { XAresult ret; DEBUG_API("->xaCreateEngine"); - ret = XAEngineImpl_Create(pEngine, numOptions, - pEngineOptions, - numInterfaces, - pInterfaceIds, - pInterfaceRequired); + ret = XAEngineImpl_Create(pEngine, numOptions, pEngineOptions, + numInterfaces, pInterfaceIds, pInterfaceRequired); DEBUG_API_A1("<-xaCreateEngine: 0x%x",(int)ret); return ret; -} + } -EXPORT_C XAresult XAAPIENTRY xaQueryNumSupportedEngineInterfaces(XAuint32 *pNumSupportedInterfaces) -{ +EXPORT_C XAresult XAAPIENTRY xaQueryNumSupportedEngineInterfaces( + XAuint32 *pNumSupportedInterfaces) + { XAresult ret; DEBUG_API("->xaQueryNumSupportedEngineInterfaces"); ret = XAEngineImpl_QueryNumSupportedInterfaces(pNumSupportedInterfaces); DEBUG_API_A1("<-xaQueryNumSupportedEngineInterfaces: 0x%x",(int)ret); return ret; -} + } EXPORT_C XAresult XAAPIENTRY xaQuerySupportedEngineInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId) -{ + XAInterfaceID *pInterfaceId) + { XAresult ret; DEBUG_API("->xaQuerySupportedEngineInterfaces"); - ret = XAEngineImpl_QuerySupportedInterfaces( - index, pInterfaceId); + ret = XAEngineImpl_QuerySupportedInterfaces(index, pInterfaceId); DEBUG_API_A1("<-xaQuerySupportedEngineInterfaces: 0x%x",(int)ret); return ret; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xacommon.c --- a/khronosfws/openmax_al/src/common/xacommon.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xacommon.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Common Openmax AL utility functions + * + */ #include #include @@ -27,32 +27,33 @@ * compare two XAInterfaceIDs, return true if same */ XAboolean XACommon_EqualIIds(XAInterfaceID idA, XAInterfaceID idB) -{ + { XAboolean nodeOk; XAuint16 nodeIdx; - if(idA==idB) return XA_BOOLEAN_TRUE; - if(!idA||!idB) return XA_BOOLEAN_FALSE; - if( idA->time_low == idB->time_low && - idA->time_mid == idB->time_mid && - idA->time_hi_and_version == idB->time_hi_and_version && - idA->clock_seq == idB->clock_seq) + if (idA == idB) + return XA_BOOLEAN_TRUE; + if (!idA || !idB) + return XA_BOOLEAN_FALSE; + if (idA->time_low == idB->time_low && idA->time_mid == idB->time_mid + && idA->time_hi_and_version == idB->time_hi_and_version + && idA->clock_seq == idB->clock_seq) { - nodeOk = XA_BOOLEAN_TRUE; - for(nodeIdx = 0; nodeIdx < sizeof(idA->node); nodeIdx++ ) + nodeOk = XA_BOOLEAN_TRUE; + for (nodeIdx = 0; nodeIdx < sizeof(idA->node); nodeIdx++) { - if(idA->node[nodeIdx] != idB->node[nodeIdx]) + if (idA->node[nodeIdx] != idB->node[nodeIdx]) { - nodeOk = XA_BOOLEAN_FALSE; - break; + nodeOk = XA_BOOLEAN_FALSE; + break; } } - if(nodeOk) + if (nodeOk) { - return XA_BOOLEAN_TRUE; + return XA_BOOLEAN_TRUE; } } return XA_BOOLEAN_FALSE; -} + } /* Check source availability and content type. Return error only if we are sure * content is not valid, otherwise let adaptation try to identify and use content. @@ -60,83 +61,82 @@ * @return Success code */ XAresult XACommon_CheckDataSource(XADataSource* source, XAMediaType* type) -{ - XAresult ret=XA_RESULT_SUCCESS; - XAchar* fname=NULL; - XAchar* mime=NULL; - XAboolean isLocal=XA_BOOLEAN_FALSE; + { + XAresult ret = XA_RESULT_SUCCESS; + XAchar* fname = NULL; + XAchar* mime = NULL; + XAboolean isLocal = XA_BOOLEAN_FALSE; - - if(!source || !source->pLocator) - { + if (!source || !source->pLocator) + { DEBUG_ERR("Invalid XADataSource structure!!"); return XA_RESULT_PARAMETER_INVALID; - } + } /* check URI availability */ - if( *(XAuint32*)(source->pLocator) == XA_DATALOCATOR_URI ) - { - fname = (XAchar*)((XADataLocator_URI*)(source->pLocator))->URI; - /* check protocol prefix */ - if(strstr((char*)fname,"://")) + if (*(XAuint32*) (source->pLocator) == XA_DATALOCATOR_URI) { - if(strncmp((char*)fname, "file:///", 8) == 0) + fname = (XAchar*) ((XADataLocator_URI*) (source->pLocator))->URI; + /* check protocol prefix */ + if (strstr((char*) fname, "://")) { - isLocal=XA_BOOLEAN_TRUE; + if (strncmp((char*) fname, "file:///", 8) == 0) + { + isLocal = XA_BOOLEAN_TRUE; fname += 8; - } + } else - { /* add support for other protocols if needed */ - isLocal=XA_BOOLEAN_FALSE; + { /* add support for other protocols if needed */ + isLocal = XA_BOOLEAN_FALSE; + } + } + else + { + isLocal = XA_BOOLEAN_TRUE; + } + if (isLocal) + { + FILE* file = fopen((char*) fname, "r"); + if (!file) + { + DEBUG_INFO_A1("%s not found from filesystem", fname); + ret = XA_RESULT_CONTENT_NOT_FOUND; + } + else + { + fclose(file); + } } } - else - { - isLocal=XA_BOOLEAN_TRUE; - } - if(isLocal) - { - FILE* file=fopen((char*)fname, "r"); - if(!file) - { - DEBUG_INFO_A1("%s not found from filesystem", fname); - ret = XA_RESULT_CONTENT_NOT_FOUND; - } - else - { - fclose(file); - } - } - } /* check content type */ - if( type ) - { - if(source->pFormat) + if (type) { - switch( *(XAuint32*)source->pFormat ) + if (source->pFormat) { + switch (*(XAuint32*) source->pFormat) + { case XA_DATAFORMAT_MIME: - { + { /* try to parse mimetype first */ - mime = ((XADataFormat_MIME*)(source->pFormat))->mimeType; - if(mime && (strncmp((char*)mime,"audio",5)==0)) - { + mime = ((XADataFormat_MIME*) (source->pFormat))->mimeType; + if (mime && (strncmp((char*) mime, "audio", 5) == 0)) + { *type = XA_MEDIATYPE_AUDIO; - } - else if(mime && (strncmp((char*)mime,"video",5)==0)) - { + } + else if (mime && (strncmp((char*) mime, "video", 5) == 0)) + { *type = XA_MEDIATYPE_VIDEO; - } - else if(mime && (strncmp((char*)mime,"image",5)==0)) - { + } + else if (mime && (strncmp((char*) mime, "image", 5) == 0)) + { *type = XA_MEDIATYPE_IMAGE; - } + } else - { + { /* try to parse containertype next */ - switch( ((XADataFormat_MIME*)(source->pFormat))->containerType ) - { + switch (((XADataFormat_MIME*) (source->pFormat))->containerType) + { case XA_CONTAINERTYPE_M4A: case XA_CONTAINERTYPE_MP3: case XA_CONTAINERTYPE_WAV: @@ -177,58 +177,60 @@ default: *type = XA_MEDIATYPE_UNKNOWN; break; + } } } - } - break; + break; case XA_DATAFORMAT_PCM: *type = XA_MEDIATYPE_AUDIO; - break; + break; case XA_DATAFORMAT_RAWIMAGE: *type = XA_MEDIATYPE_IMAGE; - break; + break; default: *type = XA_MEDIATYPE_UNKNOWN; - DEBUG_INFO("Warning: unknown dataformat"); - break; + DEBUG_INFO("Warning: unknown dataformat") + ; + break; + } } - } else - { + { DEBUG_ERR("Warning: no data format set"); *type = XA_MEDIATYPE_UNKNOWN; - } + } /* Expand this list if add new supported media type */ /* If media type unknow check it from file extension */ - if(*type == XA_MEDIATYPE_UNKNOWN && fname) - { - if( (strstr((char*)fname,".wav")) || (strstr((char*)fname,".mid")) - || (strstr((char*)fname,".amr"))) + if (*type == XA_MEDIATYPE_UNKNOWN && fname) { + if ((strstr((char*) fname, ".wav")) || (strstr((char*) fname, + ".mid")) || (strstr((char*) fname, ".amr"))) + { *type = XA_MEDIATYPE_AUDIO; - } - if( (strstr((char*)fname,".avi")) || (strstr((char*)fname,".ogg")) ) - { + } + if ((strstr((char*) fname, ".avi")) || (strstr((char*) fname, + ".ogg"))) + { - } - if(strstr((char*)fname,".jpg")) - { + } + if (strstr((char*) fname, ".jpg")) + { *type = XA_MEDIATYPE_IMAGE; + } } } + return ret; } - return ret; -} /* Validate XADataSink and XADataSrc object creation parameters. * @return Success code */ -XAresult XACommon_ValidateDataLocator(XAuint32 pCounter, void* pSnk, ... ) -{ +XAresult XACommon_ValidateDataLocator(XAuint32 pCounter, void* pSnk, ...) + { va_list argptr; XAuint32 counter = 0; XADataLocator_URI* uri = NULL; @@ -240,91 +242,94 @@ XADataSink* xaSnk = NULL; DEBUG_API("->XACommon_ValidateDataLocator"); - xaSnk = (XADataSink*)pSnk; + xaSnk = (XADataSink*) pSnk; /* Initialize variable arguments. */ - //va_start (argptr, xaSnk); TL: Replaced with: - va_start (argptr, pSnk); - while( counter < pCounter ) - { - if( counter > 0) + va_start (argptr, pSnk); + while (counter < pCounter) { + if (counter > 0) + { /*XADataSink and XADataSrc are equivalent, use XADataSink for both*/ - xaSnk = va_arg(argptr, XADataSink*); - } +xaSnk = va_arg(argptr, XADataSink*); + } if( !xaSnk ) - { /*NULL sinks/sources are possible, not checked here*/ + { /*NULL sinks/sources are possible, not checked here*/ counter++; continue; - } + } else if( !xaSnk->pLocator ) - { + { DEBUG_ERR_A1("NULL XADataLocator in parameter %d",(int)counter); ret = XA_RESULT_PARAMETER_INVALID; va_end(argptr); - DEBUG_API("<-XACommon_ValidateDataLocator"); - return ret; - } + DEBUG_API("<-XACommon_ValidateDataLocator"); + return ret; + } switch ( *(XAuint32*)(xaSnk->pLocator) ) - { + { + case XA_DEFAULTDEVICEID_AUDIOOUTPUT: + DEBUG_INFO("XA_DEFAULTDEVICEID_AUDIOOUTPUT"); + uri = (XADataLocator_URI*)xaSnk->pLocator; + break; case XA_DATALOCATOR_URI: - DEBUG_INFO("XA_DATALOCATOR_URI"); - uri = (XADataLocator_URI*)xaSnk->pLocator; - if( !uri->URI && !xaSnk->pFormat ) + DEBUG_INFO("XA_DATALOCATOR_URI"); + uri = (XADataLocator_URI*)xaSnk->pLocator; + if( !uri->URI && !xaSnk->pFormat ) { - DEBUG_ERR("Invalid parameter set for uri "); - ret = XA_RESULT_PARAMETER_INVALID; + DEBUG_ERR("Invalid parameter set for uri "); + ret = XA_RESULT_PARAMETER_INVALID; } - break; + break; case XA_DATALOCATOR_NATIVEDISPLAY: - DEBUG_INFO("Sink locator type - XA_DATALOCATOR_NATIVEDISPLAY"); - display = (XADataLocator_NativeDisplay*)(xaSnk->pLocator); - if( !display->hDisplay || !display->hWindow ) + DEBUG_INFO("Sink locator type - XA_DATALOCATOR_NATIVEDISPLAY"); + display = (XADataLocator_NativeDisplay*)(xaSnk->pLocator); + if( !display->hDisplay || !display->hWindow ) { - /*No action at this time*/ - DEBUG_INFO("Warning - no display or window handle set"); + /*No action at this time*/ + DEBUG_INFO("Warning - no display or window handle set"); } - break; + break; case XA_DATALOCATOR_OUTPUTMIX: - DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX"); + DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX"); { - omix = (XADataLocator_OutputMix*)(xaSnk->pLocator); - if ( !omix->outputMix ) + omix = (XADataLocator_OutputMix*)(xaSnk->pLocator); + if ( !omix->outputMix ) { - DEBUG_ERR("Invalid parameter set for outputmix"); - ret = XA_RESULT_PARAMETER_INVALID; + DEBUG_ERR("Invalid parameter set for outputmix"); + ret = XA_RESULT_PARAMETER_INVALID; } } - break; + break; case XA_DATALOCATOR_ADDRESS: - DEBUG_INFO("XA_DATALOCATOR_ADDRESS"); - address = (XADataLocator_Address*)(xaSnk->pLocator); - if( !address->pAddress && !xaSnk->pFormat ) + DEBUG_INFO("XA_DATALOCATOR_ADDRESS"); + address = (XADataLocator_Address*)(xaSnk->pLocator); + if( !address->pAddress && !xaSnk->pFormat ) { - DEBUG_ERR("Invalid parameter set for address"); - ret = XA_RESULT_PARAMETER_INVALID; + DEBUG_ERR("Invalid parameter set for address"); + ret = XA_RESULT_PARAMETER_INVALID; } - break; + break; case XA_DATALOCATOR_IODEVICE: - DEBUG_INFO("XA_DATALOCATOR_IODEVICE"); - iodevice = (XADataLocator_IODevice*)(xaSnk->pLocator); - if( iodevice->device ) + DEBUG_INFO("XA_DATALOCATOR_IODEVICE"); + iodevice = (XADataLocator_IODevice*)(xaSnk->pLocator); + if( iodevice->device ) { - DEBUG_INFO("Media object as IODevice"); + DEBUG_INFO("Media object as IODevice"); } - else + else { - DEBUG_INFO("Iodevice id used"); + DEBUG_INFO("Iodevice id used"); } - break; + break; default: - DEBUG_ERR("Incorrect data locator for sink.") - ret = XA_RESULT_PARAMETER_INVALID; - break; + DEBUG_ERR("Incorrect data locator for sink.") + ret = XA_RESULT_PARAMETER_INVALID; + break; + } + counter ++; } - counter ++; - } va_end(argptr); DEBUG_API("<-XACommon_ValidateDataLocator"); return ret; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xadynamicsourceitf.c --- a/khronosfws/openmax_al/src/common/xadynamicsourceitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xadynamicsourceitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,29 +1,28 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Dynamic Source Interface Implementation + * + */ #include #include #include #include "xadynamicsourceitf.h" - + #include "xadynamicsourceitfadaptation.h" #include "xadynamicsourceitfadaptationmmf.h" - /***************************************************************************** * Base interface XADynamicSourceItf implementation *****************************************************************************/ @@ -32,45 +31,44 @@ * Description: Sets the data source for the object. */ XAresult XADynamicSourceItfImpl_SetSource(XADynamicSourceItf self, - XADataSource *pDataSource) -{ + XADataSource *pDataSource) + { XAresult res = XA_RESULT_SUCCESS; - XADynamicSourceItfImpl* impl = (XADynamicSourceItfImpl*)(*self); + XADynamicSourceItfImpl* impl = (XADynamicSourceItfImpl*) (*self); DEBUG_API("->XADynamicSourceItfImpl_SetSource"); /* check casting */ - if( !impl || impl != impl->self || !pDataSource ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); + if (!impl || impl != impl->self || !pDataSource) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); return XA_RESULT_PARAMETER_INVALID; - } - - if( !impl->adaptCtx ) - { - DEBUG_ERR("Adaptation not ready!!"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); + } + + if (!impl->adaptCtx) + { + DEBUG_ERR("Adaptation not ready!!");DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); res = XA_RESULT_INTERNAL_ERROR; - } + } else - { - res = XACommon_CheckDataSource(pDataSource,NULL); - if(res==XA_RESULT_SUCCESS) { - if(impl->adaptCtx->fwtype == FWMgrFWGST) + res = XACommon_CheckDataSource(pDataSource, NULL); + if (res == XA_RESULT_SUCCESS) + { + if (impl->adaptCtx->fwtype == FWMgrFWGST) { - res = XADynamicSourceItfAdapt_SetSource((XAAdaptationGstCtx*)impl->adaptCtx, pDataSource ); + res = XADynamicSourceItfAdapt_SetSource( + (XAAdaptationGstCtx*) impl->adaptCtx, pDataSource); } else { - res = XADynamicSourceItfAdaptMMF_SetSource((XAAdaptationMMFCtx*)impl->adaptCtx, pDataSource ); + res = XADynamicSourceItfAdaptMMF_SetSource( + (XAAdaptationMMFCtx*) impl->adaptCtx, pDataSource); } + } } - } DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); return res; -} + } /***************************************************************************** * XADynamicSourceItfImpl -specific methods @@ -79,33 +77,32 @@ /* XADynamicSourceItfImpl* XADynamicSourceItfImpl_Create() * Description: Allocate and initialize DynamicSourceItfImpl */ -XADynamicSourceItfImpl* XADynamicSourceItfImpl_Create( XAAdaptationBaseCtx *adaptCtx ) -{ - XADynamicSourceItfImpl* self = (XADynamicSourceItfImpl*) - calloc(1,sizeof(XADynamicSourceItfImpl)); - +XADynamicSourceItfImpl* XADynamicSourceItfImpl_Create( + XAAdaptationBaseCtx *adaptCtx) + { + XADynamicSourceItfImpl* self = (XADynamicSourceItfImpl*) calloc(1, + sizeof(XADynamicSourceItfImpl)); + DEBUG_API("->XADynamicSourceItfImpl_Create"); - if( self ) - { + if (self) + { /* init itf default implementation */ self->itf.SetSource = XADynamicSourceItfImpl_SetSource; /* init variables */ self->adaptCtx = adaptCtx; self->self = self; + }DEBUG_API("<-XADynamicSourceItfImpl_Create"); + return self; } - DEBUG_API("<-XADynamicSourceItfImpl_Create"); - return self; -} /* void XADynamicSourceItfImpl_Free(XADynamicSourceItfImpl* self) * Description: Free all resources reserved at XADynamicSourceItfImpl_Create */ void XADynamicSourceItfImpl_Free(XADynamicSourceItfImpl* self) -{ + { DEBUG_API("->XADynamicSourceItfImpl_Free"); assert( self==self->self ); - free( self ); + free(self); DEBUG_API("<-XADynamicSourceItfImpl_Free"); -} + } - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xadynamicsourceitf.h --- a/khronosfws/openmax_al/src/common/xadynamicsourceitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xadynamicsourceitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Dynamic Source Interface Implementation Header + * + */ #ifndef XADYNAMICSOURCEITF_H #define XADYNAMICSOURCEITF_H @@ -29,7 +29,7 @@ /** STRUCTURES **/ /* Definition of XADynamicSourceItf implementation */ typedef struct XADynamicSourceItfImpl_ -{ + { /* parent interface */ struct XADynamicSourceItf_ itf; /* pointer to self */ @@ -37,7 +37,7 @@ /* variables */ XAAdaptationBaseCtx *adaptCtx; -} XADynamicSourceItfImpl; + } XADynamicSourceItfImpl; /** METHODS **/ @@ -45,10 +45,11 @@ * See API Specification for method documentation */ XAresult XADynamicSourceItfImpl_SetSource(XADynamicSourceItf self, - XADataSource *pDataSource); + XADataSource *pDataSource); /* XADynamicSourceItfImpl -specific methods */ -XADynamicSourceItfImpl* XADynamicSourceItfImpl_Create(XAAdaptationBaseCtx *adaptCtx); +XADynamicSourceItfImpl* XADynamicSourceItfImpl_Create( + XAAdaptationBaseCtx *adaptCtx); void XADynamicSourceItfImpl_Free(XADynamicSourceItfImpl* self); #endif /* XADYNAMICSOURCEITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xadynintmgmtitf.c --- a/khronosfws/openmax_al/src/common/xadynintmgmtitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xadynintmgmtitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Dynamic Management Interface Implementation + * + */ #include #include @@ -26,17 +26,17 @@ * Description: Validate interface pointer and cast it to implementation pointer. */ static XADIMItfImpl* GetImpl(XADynamicInterfaceManagementItf self) -{ - if( self ) { - XADIMItfImpl* impl = (XADIMItfImpl*)(*self); - if( impl && (impl == impl->self) ) + if (self) { + XADIMItfImpl* impl = (XADIMItfImpl*) (*self); + if (impl && (impl == impl->self)) + { return impl; + } } + return NULL; } - return NULL; -} /** * Base Interface XADynamicInterfaceManagementItf implementation @@ -46,177 +46,171 @@ * Optionally asynchronous method for exposing an interface on an object. */ XAresult XADIMItfImpl_AddInterface(XADynamicInterfaceManagementItf self, - const XAInterfaceID iid, - XAboolean async) -{ + const XAInterfaceID iid, XAboolean async) + { XADIMItfImpl* impl = GetImpl(self); XAresult retval = XA_RESULT_SUCCESS; DEBUG_API("->XADIMItfImpl_AddInterface"); - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADIMItfImpl_AddInterface"); + if (!impl) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADIMItfImpl_AddInterface"); return XA_RESULT_PARAMETER_INVALID; - } + } - if( async ) - { + if (async) + { /* invoke asynchronously */ /* check if another async operation is processed */ - if(impl->asyncOngoing) - { + if (impl->asyncOngoing) + { /* abort ongoing operation */ XAImpl_CancelThread(impl->asyncThr); - } + } impl->asyncOngoing = XA_BOOLEAN_TRUE; impl->asyncID = iid; - if(XAImpl_StartThread(impl->asyncThr, NULL, - &XADIMItfImpl_AsyncAddItf,(void*)(self))) - { + if (XAImpl_StartThread(impl->asyncThr, NULL, + &XADIMItfImpl_AsyncAddItf, (void*) (self))) + { impl->asyncOngoing = XA_BOOLEAN_FALSE; retval = XA_RESULT_RESOURCE_ERROR; - } + } else - { + { retval = XA_RESULT_SUCCESS; + } } - } else - { + { /* invoke synchronously */ retval = XADIMItfImpl_DoAddItf(impl, iid); - } + } DEBUG_API_A1("<-XADIMItfImpl_AddInterface %lu", retval); return retval; -} + } /* XAresult XADIMItfImpl_RemoveInterface * Synchronous method for removing a dynamically exposed interface on an object. */ XAresult XADIMItfImpl_RemoveInterface(XADynamicInterfaceManagementItf self, - const XAInterfaceID iid) -{ + const XAInterfaceID iid) + { XADIMItfImpl* impl = GetImpl(self); XAresult retval = XA_RESULT_SUCCESS; DEBUG_API("->XADIMItfImpl_RemoveInterface"); - if( impl ) - { - XAObjItfMapEntry *mapEntry = NULL; - if(impl->parent) - { - mapEntry = XAObjectItfImpl_GetItfEntry(impl->parent, iid); - } - if( mapEntry && mapEntry->isDynamic ) + if (impl) { - if( (mapEntry->pItf) ) + XAObjItfMapEntry *mapEntry = NULL; + if (impl->parent) { - if( impl->DoRemoveItfImpl ) + mapEntry = XAObjectItfImpl_GetItfEntry(impl->parent, iid); + } + if (mapEntry && mapEntry->isDynamic) + { + if ((mapEntry->pItf)) { + if (impl->DoRemoveItfImpl) + { retval = impl->DoRemoveItfImpl(impl->parent, mapEntry); - } + } else - { + { DEBUG_ERR("XADIMItfImpl_RemoveInterface: Object has specified dynamic itfs but not implemented DoRemoveItfImpl!!!"); retval = XA_RESULT_INTERNAL_ERROR; + } + } + else + { + DEBUG_ERR("XADIMItfImpl_RemoveInterface interface not exposed"); + retval = XA_RESULT_PRECONDITIONS_VIOLATED; } } - else - { - DEBUG_ERR("XADIMItfImpl_RemoveInterface interface not exposed"); - retval = XA_RESULT_PRECONDITIONS_VIOLATED; + else /*( mapEntry && mapEntry->isDynamic )*/ + { /* interface is not supported for dynamic management */ + DEBUG_ERR("XADIMItfImpl_RemoveInterface interface not supported"); + retval = XA_RESULT_FEATURE_UNSUPPORTED; } } - else /*( mapEntry && mapEntry->isDynamic )*/ - { /* interface is not supported for dynamic management */ - DEBUG_ERR("XADIMItfImpl_RemoveInterface interface not supported"); - retval = XA_RESULT_FEATURE_UNSUPPORTED; - } - } else - { + { retval = XA_RESULT_PARAMETER_INVALID; DEBUG_ERR("XADIMItfImpl_RemoveInterface: INVALID args"); - } + } DEBUG_API_A1("<-XADIMItfImpl_RemoveInterface %lu", retval); return retval; -} + } /* XAresult XADIMItfImpl_ResumeInterface * Optionally asynchronous method for resuming a dynamically exposed interface on the object. */ XAresult XADIMItfImpl_ResumeInterface(XADynamicInterfaceManagementItf self, - const XAInterfaceID iid, - XAboolean async) -{ + const XAInterfaceID iid, XAboolean async) + { XADIMItfImpl* impl = GetImpl(self); XAresult retval = XA_RESULT_SUCCESS; DEBUG_API("->XADIMItfImpl_ResumeInterface"); - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADIMItfImpl_ResumeInterface"); + if (!impl) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADIMItfImpl_ResumeInterface"); return XA_RESULT_PARAMETER_INVALID; - } + } - if( async ) - { + if (async) + { /* invoke asynchronously */ /* check if another async operation is processed */ - if(impl->asyncOngoing) - { + if (impl->asyncOngoing) + { /* abort ongoing operation */ XAImpl_CancelThread(impl->asyncThr); - } + } impl->asyncOngoing = XA_BOOLEAN_TRUE; impl->asyncID = iid; - if(XAImpl_StartThread(impl->asyncThr, NULL, - &XADIMItfImpl_AsyncResumeItf,(void*)(self))) - { + if (XAImpl_StartThread(impl->asyncThr, NULL, + &XADIMItfImpl_AsyncResumeItf, (void*) (self))) + { impl->asyncOngoing = XA_BOOLEAN_FALSE; retval = XA_RESULT_RESOURCE_ERROR; - } + } else - { + { retval = XA_RESULT_SUCCESS; + } } - } else - { + { /* invoke synchronously */ retval = XADIMItfImpl_DoResumeItf(impl, iid); - } + } DEBUG_API_A1("<-XADIMItfImpl_ResumeInterface %lu", retval); return retval; -} + } /* XAresult XADIMItfImpl_RegisterCallback * Registers a callback on the object */ XAresult XADIMItfImpl_RegisterCallback(XADynamicInterfaceManagementItf self, - xaDynamicInterfaceManagementCallback callback, - void * pContext) -{ + xaDynamicInterfaceManagementCallback callback, void * pContext) + { XADIMItfImpl* impl = GetImpl(self); DEBUG_API("->XADIMItfImpl_RegisterCallback"); - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADIMItfImpl_RegisterCallback"); + if (!impl) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADIMItfImpl_RegisterCallback"); return XA_RESULT_PARAMETER_INVALID; - } + } impl->dimCb = callback; impl->dimCbContext = pContext; impl->dimCbPtrToSelf = self; DEBUG_API("<-XADIMItfImpl_RegisterCallback"); return XA_RESULT_SUCCESS; -} + } /** * XADIMItfImpl -specific methods @@ -226,12 +220,12 @@ * Description: Allocate and initialize DIMItfImpl */ XADIMItfImpl* XADIMItfImpl_Create() -{ - XADIMItfImpl *self = (XADIMItfImpl*)calloc(1,sizeof(XADIMItfImpl)); + { + XADIMItfImpl *self = (XADIMItfImpl*) calloc(1, sizeof(XADIMItfImpl)); DEBUG_API("->XADIMItfImpl_Create"); - if( self ) - { + if (self) + { /* init itf default implementation */ self->itf.AddInterface = XADIMItfImpl_AddInterface; self->itf.RemoveInterface = XADIMItfImpl_RemoveInterface; @@ -243,38 +237,35 @@ self->dimCbPtrToSelf = NULL; self->self = self; - if( XAImpl_CreateThreadHandle(&(self->asyncThr)) != XA_RESULT_SUCCESS ) - { + if (XAImpl_CreateThreadHandle(&(self->asyncThr)) != XA_RESULT_SUCCESS) + { free(self); self = NULL; - } + } + }DEBUG_API("<-XADIMItfImpl_Create"); + return self; } - DEBUG_API("<-XADIMItfImpl_Create"); - return self; -} /* void XADIMItfImpl_Free(XADIMItfImpl* self) * Description: Free all resources reserved at XADIMItfImpl_Create */ void XADIMItfImpl_Free(XADIMItfImpl* self) -{ + { DEBUG_API("->XADIMItfImpl_Free"); assert(self==self->self); XAImpl_DeleteThreadHandle(self->asyncThr); free(self); DEBUG_API("<-XADIMItfImpl_Free"); -} + } /* void XADIMItfImpl_Init * Description: Initialize DIM interface. Mandatory to call if dynamic * interfaces are supported by object. */ -void XADIMItfImpl_Init( XADIMItfImpl* self, - XAObjectItf parent, - xaDoAddItfImpl doAdd, - xaDoResumeItfImpl doResume, - xaDoRemoveItfImpl doRemove) -{ +void XADIMItfImpl_Init(XADIMItfImpl* self, XAObjectItf parent, + xaDoAddItfImpl doAdd, xaDoResumeItfImpl doResume, + xaDoRemoveItfImpl doRemove) + { DEBUG_API("->XADIMItfImpl_Init"); assert(self==self->self && parent && doAdd && doResume && doRemove); @@ -284,184 +275,182 @@ self->DoRemoveItfImpl = doRemove; DEBUG_API("<-XADIMItfImpl_Init"); -} + } /* void XADIMItfImpl_SendCbEvent * Description: Object can use this method to send resource events */ -void XADIMItfImpl_SendCbEvent( XADIMItfImpl* self, - XAuint32 event, - XAresult result, - const XAInterfaceID iid ) -{ +void XADIMItfImpl_SendCbEvent(XADIMItfImpl* self, XAuint32 event, + XAresult result, const XAInterfaceID iid) + { DEBUG_API("->XADIMItfImpl_SendCbEvent"); - if( self->dimCb ) - { - self->dimCb((XADynamicInterfaceManagementItf)(self), self->dimCbContext, - event, result, iid); - } - DEBUG_API("<-XADIMItfImpl_SendCbEvent"); -} + if (self->dimCb) + { + self->dimCb((XADynamicInterfaceManagementItf) (self), + self->dimCbContext, event, result, iid); + }DEBUG_API("<-XADIMItfImpl_SendCbEvent"); + } /* void* XADIMItfImpl_AsyncAddItf * Description: Launch AddItf from async thread. */ void* XADIMItfImpl_AsyncAddItf(void* args) -{ + { XAresult retval = XA_RESULT_SUCCESS; XADIMItfImpl* impl = GetImpl(args); DEBUG_API("->XADIMItfImpl_AsyncAddItf"); - if( impl ) - { + if (impl) + { retval = XADIMItfImpl_DoAddItf(impl, impl->asyncID); - if( impl->dimCb ) - { - impl->dimCb((XADynamicInterfaceManagementItf)(args), impl->dimCbContext, - XA_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, retval, impl->asyncID); - } + if (impl->dimCb) + { + impl->dimCb((XADynamicInterfaceManagementItf) (args), + impl->dimCbContext, + XA_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, retval, + impl->asyncID); + } impl->asyncOngoing = XA_BOOLEAN_FALSE; XAImpl_ExitThread(impl->asyncThr); - } + } else - { + { DEBUG_ERR("XADIMItfImpl_AsyncAddItf: INVALID args"); - } - + } DEBUG_API("<-XADIMItfImpl_AsyncAddItf"); return NULL; -} + } /* XAresult XADIMItfImpl_DoAddItf * Description: Handle Itf dynamic addition and call object-specific parts. * Launched either from async thread or directly. */ -XAresult XADIMItfImpl_DoAddItf(XADIMItfImpl* impl, - const XAInterfaceID iid) -{ +XAresult XADIMItfImpl_DoAddItf(XADIMItfImpl* impl, const XAInterfaceID iid) + { XAresult retval = XA_RESULT_SUCCESS; DEBUG_API("->XADIMItfImpl_DoAddItf"); - if( impl ) - { - XAObjItfMapEntry *mapEntry = NULL; - if(impl->parent) - { - mapEntry = XAObjectItfImpl_GetItfEntry(impl->parent, iid); - } - if( mapEntry && mapEntry->isDynamic ) + if (impl) { - if( !(mapEntry->pItf) ) + XAObjItfMapEntry *mapEntry = NULL; + if (impl->parent) { - if( impl->DoAddItfImpl ) + mapEntry = XAObjectItfImpl_GetItfEntry(impl->parent, iid); + } + if (mapEntry && mapEntry->isDynamic) + { + if (!(mapEntry->pItf)) { + if (impl->DoAddItfImpl) + { retval = impl->DoAddItfImpl(impl->parent, mapEntry); - } + } else - { + { DEBUG_ERR("XADIMItfImpl_DoAddItf: Object has specified dynamic itfs but not implemented DoAddItfImpl!!!"); retval = XA_RESULT_INTERNAL_ERROR; + } + } + else + { + DEBUG_ERR("XADIMItfImpl_DoAddItf interface already exposed"); + retval = XA_RESULT_PRECONDITIONS_VIOLATED; } } - else - { - DEBUG_ERR("XADIMItfImpl_DoAddItf interface already exposed"); - retval = XA_RESULT_PRECONDITIONS_VIOLATED; + else /*( mapEntry && mapEntry->isDynamic )*/ + { /* interface is not supported for dynamic management */ + DEBUG_ERR("XADIMItfImpl_DoAddItf interface not supported"); + retval = XA_RESULT_FEATURE_UNSUPPORTED; } } - else /*( mapEntry && mapEntry->isDynamic )*/ - { /* interface is not supported for dynamic management */ - DEBUG_ERR("XADIMItfImpl_DoAddItf interface not supported"); - retval = XA_RESULT_FEATURE_UNSUPPORTED; - } - } else - { + { retval = XA_RESULT_INTERNAL_ERROR; DEBUG_ERR("XADIMItfImpl_DoAddItf: INVALID args"); - } + } DEBUG_API("<-XADIMItfImpl_DoAddItf"); return retval; -} + } /* void* XADIMItfImpl_AsyncResumeItf * Description: Launch ResumeItf from async thread. */ void* XADIMItfImpl_AsyncResumeItf(void* args) -{ + { XAresult retval = XA_RESULT_SUCCESS; XADIMItfImpl* impl = GetImpl(args); DEBUG_API("->XADIMItfImpl_AsyncResumeItf"); - if( impl ) - { + if (impl) + { retval = XADIMItfImpl_DoResumeItf(impl, impl->asyncID); - if( impl->dimCb ) - { - impl->dimCb((XADynamicInterfaceManagementItf)(args), impl->dimCbContext, - XA_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, retval, impl->asyncID); - } + if (impl->dimCb) + { + impl->dimCb((XADynamicInterfaceManagementItf) (args), + impl->dimCbContext, + XA_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, retval, + impl->asyncID); + } impl->asyncOngoing = XA_BOOLEAN_FALSE; XAImpl_ExitThread(impl->asyncThr); - } + } else - { + { DEBUG_ERR("XADIMItfImpl_AsyncResumeItf: INVALID args"); - } - + } DEBUG_API("<-XADIMItfImpl_AsyncResumeItf"); return NULL; -} + } /* void XADIMItfImpl_DoResumeItf * Description: Handle Itf dynamic resuming and call object-specific parts. * Launched either from async thread or directly. */ -XAresult XADIMItfImpl_DoResumeItf(XADIMItfImpl* impl, - const XAInterfaceID iid) -{ +XAresult XADIMItfImpl_DoResumeItf(XADIMItfImpl* impl, const XAInterfaceID iid) + { XAresult retval = XA_RESULT_SUCCESS; DEBUG_API("->XADIMItfImpl_DoResumeItf"); - if( impl ) - { - XAObjItfMapEntry *mapEntry = XAObjectItfImpl_GetItfEntry(impl->parent, iid); - if( mapEntry && mapEntry->isDynamic ) + if (impl) { - if( (!mapEntry->pItf) ) + XAObjItfMapEntry *mapEntry = XAObjectItfImpl_GetItfEntry( + impl->parent, iid); + if (mapEntry && mapEntry->isDynamic) { - if( impl->DoResumeItfImpl ) + if ((!mapEntry->pItf)) { + if (impl->DoResumeItfImpl) + { retval = impl->DoResumeItfImpl(impl->parent, mapEntry); - } + } else - { + { DEBUG_ERR("XADIMItfImpl_DoResumeItf: Object has specified dynamic itfs but not implemented DoResumeItfImpl!!!"); retval = XA_RESULT_INTERNAL_ERROR; + } + } + else + { + DEBUG_ERR("XADIMItfImpl_DoResumeItf interface already exposed"); + retval = XA_RESULT_PRECONDITIONS_VIOLATED; } } - else - { - DEBUG_ERR("XADIMItfImpl_DoResumeItf interface already exposed"); - retval = XA_RESULT_PRECONDITIONS_VIOLATED; + else /*( mapEntry && mapEntry->isDynamic )*/ + { /* interface is not supported for dynamic management */ + DEBUG_ERR("XADIMItfImpl_DoResumeItf interface not supported"); + retval = XA_RESULT_FEATURE_UNSUPPORTED; } } - else /*( mapEntry && mapEntry->isDynamic )*/ - { /* interface is not supported for dynamic management */ - DEBUG_ERR("XADIMItfImpl_DoResumeItf interface not supported"); - retval = XA_RESULT_FEATURE_UNSUPPORTED; - } - } else - { + { retval = XA_RESULT_INTERNAL_ERROR; DEBUG_ERR("XADIMItfImpl_DoResumeItf: INVALID args"); - } + } DEBUG_API("<-XADIMItfImpl_DoResumeItf"); return retval; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xadynintmgmtitf.h --- a/khronosfws/openmax_al/src/common/xadynintmgmtitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xadynintmgmtitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Dynamic Mgmt Interface Header + * + */ #ifndef XADYNINTMGMTITF_H #define XADYNINTMGMTITF_H @@ -26,16 +26,19 @@ /** TYPES **/ /* object implementation-specific DIM methods */ -typedef XAresult (*xaDoAddItfImpl)(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -typedef XAresult (*xaDoResumeItfImpl)(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -typedef XAresult (*xaDoRemoveItfImpl)(XAObjectItf self, XAObjItfMapEntry *mapEntry ); +typedef XAresult (*xaDoAddItfImpl)(XAObjectItf self, + XAObjItfMapEntry *mapEntry); +typedef XAresult (*xaDoResumeItfImpl)(XAObjectItf self, + XAObjItfMapEntry *mapEntry); +typedef XAresult (*xaDoRemoveItfImpl)(XAObjectItf self, + XAObjItfMapEntry *mapEntry); /** ENUMERATIONS **/ /** STRUCTURES **/ /* Definition of XADynamicInterfaceManagementItf implementation */ typedef struct XADIMItfImpl_ -{ + { /* parent interface */ struct XADynamicInterfaceManagementItf_ itf; /* pointer to self */ @@ -45,7 +48,7 @@ /* pointer to parent object */ XAObjectItf parent; /* pointers to implementation-specific methods */ - xaDoAddItfImpl DoAddItfImpl; + xaDoAddItfImpl DoAddItfImpl; xaDoResumeItfImpl DoResumeItfImpl; xaDoRemoveItfImpl DoRemoveItfImpl; @@ -57,42 +60,37 @@ XAboolean asyncOngoing; XAInterfaceID asyncID; -} XADIMItfImpl; + } XADIMItfImpl; /* Base interface XADynamicInterfaceManagementItf implementation */ XAresult XADIMItfImpl_AddInterface(XADynamicInterfaceManagementItf self, - const XAInterfaceID iid, XAboolean async); + const XAInterfaceID iid, XAboolean async); XAresult XADIMItfImpl_RemoveInterface(XADynamicInterfaceManagementItf self, - const XAInterfaceID iid); + const XAInterfaceID iid); XAresult XADIMItfImpl_ResumeInterface(XADynamicInterfaceManagementItf self, - const XAInterfaceID iid, XAboolean async); + const XAInterfaceID iid, XAboolean async); XAresult XADIMItfImpl_RegisterCallback(XADynamicInterfaceManagementItf self, - xaDynamicInterfaceManagementCallback callback, - void * pContext); + xaDynamicInterfaceManagementCallback callback, void * pContext); /* XADIMItfImpl -specific methods */ XADIMItfImpl* XADIMItfImpl_Create(void); void XADIMItfImpl_Free(XADIMItfImpl* self); -void XADIMItfImpl_Init( XADIMItfImpl* self, - XAObjectItf parent, - xaDoAddItfImpl doAdd, - xaDoResumeItfImpl doResume, - xaDoRemoveItfImpl doRemove); +void XADIMItfImpl_Init(XADIMItfImpl* self, XAObjectItf parent, + xaDoAddItfImpl doAdd, xaDoResumeItfImpl doResume, + xaDoRemoveItfImpl doRemove); -void XADIMItfImpl_SendCbEvent( XADIMItfImpl* self, - XAuint32 event, - XAresult result, - const XAInterfaceID iid ); +void XADIMItfImpl_SendCbEvent(XADIMItfImpl* self, XAuint32 event, + XAresult result, const XAInterfaceID iid); /* methods for asynchronous service */ void* XADIMItfImpl_AsyncAddItf(void* args); XAresult XADIMItfImpl_DoAddItf(XADIMItfImpl* impl, const XAInterfaceID iid); void* XADIMItfImpl_AsyncResumeItf(void* args); -XAresult XADIMItfImpl_DoResumeItf(XADIMItfImpl* impl, const XAInterfaceID iid); - +XAresult + XADIMItfImpl_DoResumeItf(XADIMItfImpl* impl, const XAInterfaceID iid); #endif /* XADYNINTMGMTITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xaglobals.h --- a/khronosfws/openmax_al/src/common/xaglobals.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xaglobals.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Header File for common AL enums, functions. + * + */ /*All global definitions and declarations here */ #ifndef XAGLOBALS_H @@ -23,13 +23,14 @@ #include "xadebug.h" /** -GLOBAL ENUMERATIONS + GLOBAL ENUMERATIONS */ /** * enumeration for different adaptation event types. * add more types when needed, use single bit values. **/ -typedef enum { +typedef enum + { XA_GENERICEVENTS = 0x1, XA_PLAYITFEVENTS = 0x2, XA_RECORDITFEVENTS = 0x4, @@ -42,40 +43,34 @@ XA_METADATAEVENTS = 0x200, XA_VOLUMEITFEVENTS = 0x400, XA_NOKIALINEARVOLITFEVENTS = 0x800, - XA_NOKIAEXTVOLITFEVENTS = 0x1000, - XA_ADDMORETYPES = 0x2000 -}XAAdaptEventTypes; - + XA_NOKIAEXTVOLITFEVENTS = 0x1000, + XA_ADDMORETYPES = 0x2000 + } XAAdaptEventTypes; typedef enum -{ - XACAP_DECODER = 0x1, - XACAP_ENCODER = 0x2, - XACAP_DEVSNK = 0x4, - XACAP_DEVSRC = 0x8, + { + XACAP_DECODER = 0x1, + XACAP_ENCODER = 0x2, + XACAP_DEVSNK = 0x4, + XACAP_DEVSRC = 0x8, - XACAP_AUDIO = 0x10, - XACAP_VIDEO = 0x20, - XACAP_IMAGE = 0x40 -} XACapsType; - + XACAP_AUDIO = 0x10, + XACAP_VIDEO = 0x20, + XACAP_IMAGE = 0x40 + } XACapsType; typedef enum -{ - XA_UNDEFINED = 0, - XA_READBUFFER, - XA_WRITEBUFFER, - XA_READ, - XA_WRITE -} XAConfigExtensionCpKey; + { + XA_UNDEFINED = 0, XA_READBUFFER, XA_WRITEBUFFER, XA_READ, XA_WRITE + } XAConfigExtensionCpKey; typedef enum -{ + { XA_MEDIATYPE_AUDIO = 0, XA_MEDIATYPE_VIDEO, XA_MEDIATYPE_IMAGE, XA_MEDIATYPE_UNKNOWN -} XAMediaType; + } XAMediaType; #define CPCONFIGKEY "TestAppPipeConfig" @@ -103,8 +98,6 @@ * GLOBAL METHODS */ - - /* * Check if interface IDs are equal */ @@ -115,5 +108,5 @@ */ XAresult XACommon_CheckDataSource(XADataSource* source, XAMediaType* type); -XAresult XACommon_ValidateDataLocator( XAuint32 pCounter, void* pSnk, ... ); +XAresult XACommon_ValidateDataLocator(XAuint32 pCounter, void* pSnk, ...); #endif /*XAGLOBALS_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xametadataextractionitf.c --- a/khronosfws/openmax_al/src/common/xametadataextractionitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xametadataextractionitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata Extraction Interface Implementation + * + */ #include #include @@ -34,32 +34,36 @@ * Description: Validate interface pointer and cast it to implementation pointer. **/ static XAMetadataExtractionItfImpl* GetImpl(XAMetadataExtractionItf self) -{ - if( self ) { - XAMetadataExtractionItfImpl* impl = (XAMetadataExtractionItfImpl*)(*self); - if( impl && (impl == impl->self) ) + if (self) { + XAMetadataExtractionItfImpl* impl = + (XAMetadataExtractionItfImpl*) (*self); + if (impl && (impl == impl->self)) + { return impl; + } } + return NULL; } - return NULL; -} static void* GetMetadataUtilityContext(XAAdaptationMMFCtx* adaptCtx) -{ - switch(adaptCtx->baseObj.ctxId) - { - case XAMediaPlayerAdaptation: - return ((XAMediaPlayerAdaptationMMFCtx*)adaptCtx)->mmfMetadataContext; - case XAMDAdaptation: - return ((XAMetadataAdaptationMMFCtx*)adaptCtx)->mmfContext; - default: - break; - } + { + if (adaptCtx) + { + switch (adaptCtx->baseObj.ctxId) + { + case XAMediaPlayerAdaptation: + return ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfMetadataContext; + case XAMDAdaptation: + return ((XAMetadataAdaptationMMFCtx*) adaptCtx)->mmfContext; + default: + break; + } - return NULL; -} + } + return NULL; + } /***************************************************************************** * Base interface XAMetadataExtractionItf implementation *****************************************************************************/ @@ -69,62 +73,63 @@ * @XAuint32 *pItemCount * Number of metadata items. Must be non-NULL */ -XAresult XAMetadataExtractionItfImpl_GetItemCount(XAMetadataExtractionItf self, - XAuint32 *pItemCount) -{ +XAresult XAMetadataExtractionItfImpl_GetItemCount( + XAMetadataExtractionItf self, XAuint32 *pItemCount) + { XAMetadataExtractionItfImpl *impl = NULL; XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataExtractionItfImpl_GetItemCount"); impl = GetImpl(self); /* check parameters */ - if( !impl || !pItemCount ) - { + if (!impl || !pItemCount) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; - } + } else - { - - if( impl->adaptCtx ) { - - if(impl->adaptCtx->fwtype == FWMgrFWMMF) - { - void *mmfCtx = GetMetadataUtilityContext((XAAdaptationMMFCtx*)impl->adaptCtx); - if(mmfCtx) - { - res = mmf_get_item_count(mmfCtx, pItemCount); - } - else - { - res = XA_RESULT_PARAMETER_INVALID; - } - } - else - { - if(impl->filteringOn) - { - *pItemCount = impl->filteredcount; - } - else - { - *pItemCount = impl->currentTags.itemcount; - } - res = XA_RESULT_SUCCESS; - } - } + + if (impl->adaptCtx) + { + + if (impl->adaptCtx->fwtype == FWMgrFWMMF) + { + void *mmfCtx = GetMetadataUtilityContext( + (XAAdaptationMMFCtx*) impl->adaptCtx); + if (mmfCtx) + { + res = mmf_get_item_count(mmfCtx, pItemCount); + } + else + { + res = XA_RESULT_PARAMETER_INVALID; + } + } + else + { + if (impl->filteringOn) + { + *pItemCount = impl->filteredcount; + } + else + { + *pItemCount = impl->currentTags.itemcount; + } + res = XA_RESULT_SUCCESS; + } + } else - { + { res = XA_RESULT_INTERNAL_ERROR; - } + } DEBUG_INFO_A1("itemCount = %d", (int)*pItemCount); - } + } DEBUG_API_A1("<-XAMetadataExtractionItfImpl_GetItemCount (%d)", (int)res); return res; -} + } /* * Returns the byte size of a given metadata key @@ -135,52 +140,51 @@ * Address to store key size. size must be greater than 0. Must be non-NULL */ XAresult XAMetadataExtractionItfImpl_GetKeySize(XAMetadataExtractionItf self, - XAuint32 index, - XAuint32 *pKeySize) -{ + XAuint32 index, XAuint32 *pKeySize) + { XAMetadataExtractionItfImpl *impl = NULL; XAresult res = XA_RESULT_SUCCESS; XAuint32 newidx = 0; DEBUG_API("->XAMetadataExtractionItfImpl_GetKeySize"); impl = GetImpl(self); - if( !impl || !pKeySize ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataExtractionItfImpl_GetKeySize"); + if (!impl || !pKeySize) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetKeySize"); return XA_RESULT_PARAMETER_INVALID; - } + } *pKeySize = 0; - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) - { - void *mmfCtx = GetMetadataUtilityContext((XAAdaptationMMFCtx*)impl->adaptCtx); - if(mmfCtx) - { - res = mmf_get_key_size(mmfCtx, index, pKeySize); - } - else - { - res = XA_RESULT_PARAMETER_INVALID; - } - } - else - { - /* check index and return unfiltered index */ - if( CheckAndUnfilterIndex(impl,index,&newidx) != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataExtractionItfImpl_GetKeySize"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* size = size of struct + size of data - 1 (struct size already includes one char) */ - *pKeySize = sizeof(XAMetadataInfo) + impl->currentTags.mdeKeys[newidx]->size - 1; - } + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) + { + void *mmfCtx = GetMetadataUtilityContext( + (XAAdaptationMMFCtx*) impl->adaptCtx); + if (mmfCtx) + { + res = mmf_get_key_size(mmfCtx, index, pKeySize); + } + else + { + res = XA_RESULT_PARAMETER_INVALID; + } + } + else + { + /* check index and return unfiltered index */ + if (CheckAndUnfilterIndex(impl, index, &newidx) != XA_RESULT_SUCCESS) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetKeySize"); + return XA_RESULT_PARAMETER_INVALID; + } + + /* size = size of struct + size of data - 1 (struct size already includes one char) */ + *pKeySize = sizeof(XAMetadataInfo) + + impl->currentTags.mdeKeys[newidx]->size - 1; + } DEBUG_API_A1("<-XAMetadataExtractionItfImpl_GetKeySize (%d)", (int)res); return res; -} + } /* * Returns a XAMetadataInfo structure and associated data referenced by the structure for a key. @@ -192,78 +196,75 @@ * Address to store the key. Must be non-NULL */ XAresult XAMetadataExtractionItfImpl_GetKey(XAMetadataExtractionItf self, - XAuint32 index, - XAuint32 keySize, - XAMetadataInfo *pKey) -{ + XAuint32 index, XAuint32 keySize, XAMetadataInfo *pKey) + { XAMetadataExtractionItfImpl *impl = NULL; XAresult res = XA_RESULT_SUCCESS; XAuint32 newidx = 0; - + XAuint32 neededsize = 0; XAuint32 newdatasize = 0; DEBUG_API("->XAMetadataExtractionItfImpl_GetKey"); impl = GetImpl(self); - if( !impl || !pKey ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataExtractionItfImpl_GetKey"); + if (!impl || !pKey) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetKey"); return XA_RESULT_PARAMETER_INVALID; - } + } + + memset(pKey, 0, keySize); - memset(pKey,0,keySize); - - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) - { - void *mmfCtx = GetMetadataUtilityContext((XAAdaptationMMFCtx*)impl->adaptCtx); - if(mmfCtx) - { - res = mmf_get_key(mmfCtx, index, keySize, pKey); - } - else - { - res = XA_RESULT_PARAMETER_INVALID; - } - } - else - { + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) + { + void *mmfCtx = GetMetadataUtilityContext( + (XAAdaptationMMFCtx*) impl->adaptCtx); + if (mmfCtx) + { + res = mmf_get_key(mmfCtx, index, keySize, pKey); + } + else + { + res = XA_RESULT_PARAMETER_INVALID; + } + } + else + { - /* check index and return unfiltered index */ - if(CheckAndUnfilterIndex(impl,index,&newidx) != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataExtractionItfImpl_GetKey"); - return XA_RESULT_PARAMETER_INVALID; - } + /* check index and return unfiltered index */ + if (CheckAndUnfilterIndex(impl, index, &newidx) != XA_RESULT_SUCCESS) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetKey"); + return XA_RESULT_PARAMETER_INVALID; + } - - /* needed size = size of struct + size of data - 1 (struct size already includes one char) */ - neededsize = sizeof(XAMetadataInfo) + impl->currentTags.mdeKeys[newidx]->size - 1; - if( keySizecurrentTags.mdeKeys[newidx]->size - (neededsize-keySize); - DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); - res = XA_RESULT_BUFFER_INSUFFICIENT; - } - else - { - newdatasize = impl->currentTags.mdeKeys[newidx]->size; - res = XA_RESULT_SUCCESS; - } - /* copy data up to given size */ - memcpy(pKey,impl->currentTags.mdeKeys[newidx],keySize-1); - /* ensure null-termination */ - - memset(pKey->data+newdatasize-1,0,1); - pKey->size = newdatasize; - } + /* needed size = size of struct + size of data - 1 (struct size already includes one char) */ + neededsize = sizeof(XAMetadataInfo) + + impl->currentTags.mdeKeys[newidx]->size - 1; + if (keySize < neededsize) + { /* cannot fit all of key data */ + newdatasize = impl->currentTags.mdeKeys[newidx]->size + - (neededsize - keySize); + DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); + res = XA_RESULT_BUFFER_INSUFFICIENT; + } + else + { + newdatasize = impl->currentTags.mdeKeys[newidx]->size; + res = XA_RESULT_SUCCESS; + } + /* copy data up to given size */ + memcpy(pKey, impl->currentTags.mdeKeys[newidx], keySize - 1); + /* ensure null-termination */ + + memset(pKey->data + newdatasize - 1, 0, 1); + pKey->size = newdatasize; + } DEBUG_API_A1("<-XAMetadataExtractionItfImpl_GetKey (%d)", (int)res); return res; -} - + } /* * Returns the byte size of a given metadata value @@ -272,53 +273,52 @@ * @XAuint32 *pValueSize * Address to store value size. size must be greater than 0. Must be non-NULL */ -XAresult XAMetadataExtractionItfImpl_GetValueSize(XAMetadataExtractionItf self, - XAuint32 index, - XAuint32 *pValueSize) -{ +XAresult XAMetadataExtractionItfImpl_GetValueSize( + XAMetadataExtractionItf self, XAuint32 index, XAuint32 *pValueSize) + { XAMetadataExtractionItfImpl *impl = NULL; XAresult res = XA_RESULT_SUCCESS; XAuint32 newidx = 0; DEBUG_API("->XAMetadataExtractionItfImpl_GetValueSize"); impl = GetImpl(self); - if( !impl || !pValueSize ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataExtractionItfImpl_GetValueSize"); + if (!impl || !pValueSize) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetValueSize"); return XA_RESULT_PARAMETER_INVALID; - } + } *pValueSize = 0; - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) - { - void *mmfCtx = GetMetadataUtilityContext((XAAdaptationMMFCtx*)impl->adaptCtx); - if(mmfCtx) - { - res = mmf_get_value_size(mmfCtx, index,pValueSize); - } - else - { - res = XA_RESULT_PARAMETER_INVALID; - } - } - else - { - /* check index and return unfiltered index */ - if(CheckAndUnfilterIndex(impl,index,&newidx) != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataExtractionItfImpl_GetValueSize"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* size = size of struct + size of data - 1 (struct size already includes one char) */ - *pValueSize = sizeof(XAMetadataInfo) + impl->currentTags.mdeValues[newidx]->size - 1; - } + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) + { + void *mmfCtx = GetMetadataUtilityContext( + (XAAdaptationMMFCtx*) impl->adaptCtx); + if (mmfCtx) + { + res = mmf_get_value_size(mmfCtx, index, pValueSize); + } + else + { + res = XA_RESULT_PARAMETER_INVALID; + } + } + else + { + /* check index and return unfiltered index */ + if (CheckAndUnfilterIndex(impl, index, &newidx) != XA_RESULT_SUCCESS) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetValueSize"); + return XA_RESULT_PARAMETER_INVALID; + } + + /* size = size of struct + size of data - 1 (struct size already includes one char) */ + *pValueSize = sizeof(XAMetadataInfo) + + impl->currentTags.mdeValues[newidx]->size - 1; + } DEBUG_API_A1("<-XAMetadataExtractionItfImpl_GetValueSize (%d)", (int)res); return res; -} + } /* * Returns a XAMetadataInfo structure and associated data referenced by the structure for a value. @@ -330,77 +330,75 @@ * Address to store the value. Must be non-NULL */ XAresult XAMetadataExtractionItfImpl_GetValue(XAMetadataExtractionItf self, - XAuint32 index, - XAuint32 valueSize, - XAMetadataInfo *pValue) -{ + XAuint32 index, XAuint32 valueSize, XAMetadataInfo *pValue) + { XAMetadataExtractionItfImpl *impl = NULL; XAresult res = XA_RESULT_SUCCESS; XAuint32 newidx = 0; - + XAuint32 neededsize = 0; XAuint32 newdatasize = 0; DEBUG_API("->XAMetadataExtractionItfImpl_GetValue"); impl = GetImpl(self); - if( !impl || !pValue ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataExtractionItfImpl_GetValue"); + if (!impl || !pValue) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetValue"); return XA_RESULT_PARAMETER_INVALID; - } + } - memset(pValue,0,valueSize); + memset(pValue, 0, valueSize); - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) - { - void *mmfCtx = GetMetadataUtilityContext((XAAdaptationMMFCtx*)impl->adaptCtx); - if(mmfCtx) - { - res = mmf_get_value(mmfCtx, index, valueSize, pValue); - } - else - { - res = XA_RESULT_PARAMETER_INVALID; - } - } - else - { - /* check index and return unfiltered index */ - if(CheckAndUnfilterIndex(impl,index,&newidx) != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataExtractionItfImpl_GetValue"); - return XA_RESULT_PARAMETER_INVALID; - } + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) + { + void *mmfCtx = GetMetadataUtilityContext( + (XAAdaptationMMFCtx*) impl->adaptCtx); + if (mmfCtx) + { + res = mmf_get_value(mmfCtx, index, valueSize, pValue); + } + else + { + res = XA_RESULT_PARAMETER_INVALID; + } + } + else + { + /* check index and return unfiltered index */ + if (CheckAndUnfilterIndex(impl, index, &newidx) != XA_RESULT_SUCCESS) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetValue"); + return XA_RESULT_PARAMETER_INVALID; + } - /* needed size = size of struct + size of data - 1 (struct size already includes one char) */ - neededsize = sizeof(XAMetadataInfo) + impl->currentTags.mdeValues[newidx]->size - 1; - if( valueSizecurrentTags.mdeValues[newidx]->size - (neededsize-valueSize); - DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); - res = XA_RESULT_BUFFER_INSUFFICIENT; - } - else - { - newdatasize = impl->currentTags.mdeValues[newidx]->size; - res = XA_RESULT_SUCCESS; - } - /* copy data up to given size */ - memcpy(pValue,impl->currentTags.mdeValues[newidx],valueSize-1); - /* ensure null-termination */ + /* needed size = size of struct + size of data - 1 (struct size already includes one char) */ + neededsize = sizeof(XAMetadataInfo) + + impl->currentTags.mdeValues[newidx]->size - 1; + if (valueSize < neededsize) + { /* cannot fit all of key data */ + newdatasize = impl->currentTags.mdeValues[newidx]->size + - (neededsize - valueSize); + DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); + res = XA_RESULT_BUFFER_INSUFFICIENT; + } + else + { + newdatasize = impl->currentTags.mdeValues[newidx]->size; + res = XA_RESULT_SUCCESS; + } + /* copy data up to given size */ + memcpy(pValue, impl->currentTags.mdeValues[newidx], valueSize - 1); + /* ensure null-termination */ - memset(pValue->data+newdatasize-1,0,1); + memset(pValue->data + newdatasize - 1, 0, 1); - pValue->size = newdatasize; - } + pValue->size = newdatasize; + } DEBUG_API_A1("<-XAMetadataExtractionItfImpl_GetValue (%d)",(int)res); return res; -} - + } /* * Adds a filter for a specific key @@ -417,137 +415,135 @@ * @XAuint8 filterMask * Bitmask indicating which criteria to filter by. Should be one of the XA_METADATA_FILTER macros */ -XAresult XAMetadataExtractionItfImpl_AddKeyFilter(XAMetadataExtractionItf self, - XAuint32 keySize, - const void *pKey, - XAuint32 keyEncoding, - const XAchar *pValueLangCountry, - XAuint32 valueEncoding, - XAuint8 filterMask) -{ +XAresult XAMetadataExtractionItfImpl_AddKeyFilter( + XAMetadataExtractionItf self, XAuint32 keySize, const void *pKey, + XAuint32 keyEncoding, const XAchar *pValueLangCountry, + XAuint32 valueEncoding, XAuint8 filterMask) + { XAresult res = XA_RESULT_SUCCESS; - + XAuint32 idx = 0; XAuint8 matchMask = 0; - - + XAMetadataExtractionItfImpl *impl = NULL; const XAchar* parsedkey; impl = GetImpl(self); DEBUG_API("->XAMetadataExtractionItfImpl_AddKeyFilter"); - - - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataExtractionItfImpl_AddKeyFilter"); + if (!impl) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_AddKeyFilter"); return XA_RESULT_PARAMETER_INVALID; - } + } else - { - - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) - { - DEBUG_API("<-XAMetadataExtractionItfImpl_AddKeyFilter Not Supported in MMF"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - impl->filteringOn = XA_BOOLEAN_TRUE; - for(idx=0; idx < impl->currentTags.itemcount; idx++) - { - if((filterMask & XA_METADATA_FILTER_KEY) && pKey) - { - parsedkey = XAMetadataAdapt_ParseKhronosKey(pKey); - if( strcmp((char*)parsedkey, - (char*)impl->currentTags.mdeKeys[idx]->data) == 0 ) - { - matchMask |= XA_METADATA_FILTER_KEY; - } - } - if(filterMask & XA_METADATA_FILTER_LANG && pValueLangCountry) - { - if( strcmp((char*)pValueLangCountry, - (char*)impl->currentTags.mdeKeys[idx]->langCountry) == 0 ) - { - matchMask |= XA_METADATA_FILTER_LANG; - } - } - if(filterMask & XA_METADATA_FILTER_ENCODING) - { - if(keyEncoding==impl->currentTags.mdeKeys[idx]->encoding) - { - matchMask |= XA_METADATA_FILTER_ENCODING; - } - if(valueEncoding==impl->currentTags.mdeValues[idx]->encoding) - { - matchMask |= XA_METADATA_FILTER_ENCODING; - } - } - /* check if all filters apply */ - if(filterMask == matchMask) - { - if(impl->tagmatchesfilter[idx] == XA_BOOLEAN_FALSE) - { - impl->tagmatchesfilter[idx] = XA_BOOLEAN_TRUE; - impl->filteredcount++; - } - } - /*reset matchmask*/ - matchMask=0; - } - } + { + + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) + { + DEBUG_API("<-XAMetadataExtractionItfImpl_AddKeyFilter Not Supported in MMF"); + res = XA_RESULT_PARAMETER_INVALID; + } + else + { + impl->filteringOn = XA_BOOLEAN_TRUE; + for (idx = 0; idx < impl->currentTags.itemcount; idx++) + { + if ((filterMask & XA_METADATA_FILTER_KEY) && pKey) + { + parsedkey = XAMetadataAdapt_ParseKhronosKey(pKey); + if (strcmp((char*) parsedkey, + (char*) impl->currentTags.mdeKeys[idx]->data) + == 0) + { + matchMask |= XA_METADATA_FILTER_KEY; + } + } + if (filterMask & XA_METADATA_FILTER_LANG && pValueLangCountry) + { + if (strcmp( + (char*) pValueLangCountry, + (char*) impl->currentTags.mdeKeys[idx]->langCountry) + == 0) + { + matchMask |= XA_METADATA_FILTER_LANG; + } + } + if (filterMask & XA_METADATA_FILTER_ENCODING) + { + if (keyEncoding + == impl->currentTags.mdeKeys[idx]->encoding) + { + matchMask |= XA_METADATA_FILTER_ENCODING; + } + if (valueEncoding + == impl->currentTags.mdeValues[idx]->encoding) + { + matchMask |= XA_METADATA_FILTER_ENCODING; + } + } + /* check if all filters apply */ + if (filterMask == matchMask) + { + if (impl->tagmatchesfilter[idx] == XA_BOOLEAN_FALSE) + { + impl->tagmatchesfilter[idx] = XA_BOOLEAN_TRUE; + impl->filteredcount++; + } + } + /*reset matchmask*/ + matchMask = 0; + } + } + }DEBUG_API_A1("<-XAMetadataExtractionItfImpl_AddKeyFilter (%d)", (int)res); + return res; } - DEBUG_API_A1("<-XAMetadataExtractionItfImpl_AddKeyFilter (%d)", (int)res); - return res; - } /* * Clears the key filter */ -XAresult XAMetadataExtractionItfImpl_ClearKeyFilter(XAMetadataExtractionItf self) -{ +XAresult XAMetadataExtractionItfImpl_ClearKeyFilter( + XAMetadataExtractionItf self) + { XAMetadataExtractionItfImpl *impl = NULL; XAresult res = XA_RESULT_SUCCESS; - + XAuint32 idx = 0; DEBUG_API("->XAMetadataExtractionItfImpl_ClearKeyFilter"); impl = GetImpl(self); - if( !impl ) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; - } + } else - { - - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) - { - DEBUG_API("<-XAMetadataExtractionItfImpl_ClearKeyFilter Not Supported in MMF"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if(impl->tagmatchesfilter) - { - - for(idx=0; idx < impl->currentTags.itemcount; idx++) - { - impl->tagmatchesfilter[idx] = XA_BOOLEAN_FALSE; - } + { - } - impl->filteredcount = 0; - impl->filteringOn = XA_BOOLEAN_FALSE; - } - } + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWMMF) + { + DEBUG_API("<-XAMetadataExtractionItfImpl_ClearKeyFilter Not Supported in MMF"); + res = XA_RESULT_PARAMETER_INVALID; + } + else + { + if (impl->tagmatchesfilter) + { + + for (idx = 0; idx < impl->currentTags.itemcount; idx++) + { + impl->tagmatchesfilter[idx] = XA_BOOLEAN_FALSE; + } + + } + impl->filteredcount = 0; + impl->filteringOn = XA_BOOLEAN_FALSE; + } + } DEBUG_API_A1("<-XAMetadataExtractionItfImpl_ClearKeyFilter (%d)", (int)res); return res; -} + } /***************************************************************************** * XAMetadataExtractionItfImpl -specific methods @@ -556,15 +552,17 @@ /* XAMetadataExtractionItfImpl* XAMetadataExtractionItfImpl_Create() * Description: Allocate and initialize XAMetadataExtractionItfImpl */ -XAMetadataExtractionItfImpl* XAMetadataExtractionItfImpl_Create(XAAdaptationBaseCtx *adaptCtx) -{ +XAMetadataExtractionItfImpl* XAMetadataExtractionItfImpl_Create( + XAAdaptationBaseCtx *adaptCtx) + { XAMetadataExtractionItfImpl *self = NULL; DEBUG_API("->XAMetadataExtractionItfImpl_Create"); - self = (XAMetadataExtractionItfImpl*)calloc(1,sizeof(XAMetadataExtractionItfImpl)); + self = (XAMetadataExtractionItfImpl*) calloc(1, + sizeof(XAMetadataExtractionItfImpl)); - if( self ) - { + if (self) + { /* init itf default implementation */ self->itf.GetItemCount = XAMetadataExtractionItfImpl_GetItemCount; self->itf.GetKeySize = XAMetadataExtractionItfImpl_GetKeySize; @@ -580,120 +578,121 @@ self->adaptCtx = adaptCtx; - if(self->adaptCtx->fwtype != FWMgrFWMMF) - { - XAAdaptationBase_AddEventHandler( adaptCtx, &XAMetadataExtractionItfImp_AdaptCb, XA_METADATAEVENTS, self ); - } + if (self->adaptCtx->fwtype != FWMgrFWMMF) + { + XAAdaptationBase_AddEventHandler(adaptCtx, + &XAMetadataExtractionItfImp_AdaptCb, XA_METADATAEVENTS, + self); + } self->self = self; - } + } DEBUG_API("<-XAMetadataExtractionItfImpl_Create"); return self; -} + } /* void XAMetadataExtractionItfImpl_Free(XAMetadataExtractionItfImpl* self) * Description: Free all resources reserved at XAMetadataExtractionItfImpl_Create */ void XAMetadataExtractionItfImpl_Free(XAMetadataExtractionItfImpl* self) -{ + { DEBUG_API("->XAMetadataExtractionItfImpl_Free"); assert(self==self->self); - - if(self->adaptCtx->fwtype != FWMgrFWMMF) - { - XAAdaptationBase_RemoveEventHandler( self->adaptCtx, &XAMetadataExtractionItfImp_AdaptCb ); - XAMetadataAdapt_FreeImplTagList(&(self->currentTags), XA_BOOLEAN_TRUE); - - if(self->tagmatchesfilter) - { - free(self->tagmatchesfilter); - } - } + + if (self->adaptCtx->fwtype != FWMgrFWMMF) + { + XAAdaptationBase_RemoveEventHandler(self->adaptCtx, + &XAMetadataExtractionItfImp_AdaptCb); + XAMetadataAdapt_FreeImplTagList(&(self->currentTags), XA_BOOLEAN_TRUE); + + if (self->tagmatchesfilter) + { + free(self->tagmatchesfilter); + } + } free(self); DEBUG_API("<-XAMetadataExtractionItfImpl_Free"); -} + } - /* With this method, adaptation infroms that new tags are found (e.g. if source, * has changed, live stream contains metadata...) */ -void XAMetadataExtractionItfImp_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ +void XAMetadataExtractionItfImp_AdaptCb(void *pHandlerCtx, + XAAdaptEvent *event) + { XAMetadataExtractionItfImpl* impl = NULL; DEBUG_API("->XAMetadataExtractionItfImp_AdaptCb"); - impl = (XAMetadataExtractionItfImpl*)pHandlerCtx; - if(!impl) - { - DEBUG_ERR("XAMetadataExtractionItfImp_AdaptCb, invalid context pointer!"); - DEBUG_API("<-XAMetadataExtractionItfImp_AdaptCb"); + impl = (XAMetadataExtractionItfImpl*) pHandlerCtx; + if (!impl) + { + DEBUG_ERR("XAMetadataExtractionItfImp_AdaptCb, invalid context pointer!");DEBUG_API("<-XAMetadataExtractionItfImp_AdaptCb"); return; - } - if( event && event->eventid == XA_ADAPT_MDE_TAGS_AVAILABLE ) - { - /* get the tag list */ - XAMetadataExtractionItfAdapt_FillTagList( (XAAdaptationGstCtx*)impl->adaptCtx, &(impl->currentTags) ); - if(impl->tagmatchesfilter) + } + if (event && event->eventid == XA_ADAPT_MDE_TAGS_AVAILABLE) { + /* get the tag list */ + XAMetadataExtractionItfAdapt_FillTagList( + (XAAdaptationGstCtx*) impl->adaptCtx, &(impl->currentTags)); + if (impl->tagmatchesfilter) + { free(impl->tagmatchesfilter); + } + impl->tagmatchesfilter = calloc(impl->currentTags.itemcount, + sizeof(XAboolean)); + impl->filteredcount = 0; } - impl->tagmatchesfilter = calloc(impl->currentTags.itemcount,sizeof(XAboolean)); - impl->filteredcount = 0; - } else - { + { DEBUG_INFO("unhandled"); + }DEBUG_API("<-XAMetadataExtractionItfImp_AdaptCb"); } - DEBUG_API("<-XAMetadataExtractionItfImp_AdaptCb"); -} - /* For given index over filtered array, return index over whole array */ XAresult CheckAndUnfilterIndex(XAMetadataExtractionItfImpl *impl, - XAuint32 oldidx, XAuint32 *newidx) -{ + XAuint32 oldidx, XAuint32 *newidx) + { DEBUG_API("->CheckAndUnfilterIndex"); - - if( impl->filteringOn ) - { - XAint16 i=-1; - if(oldidx>=impl->filteredcount) + + if (impl->filteringOn) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-CheckAndUnfilterIndex"); + XAint16 i = -1; + if (oldidx >= impl->filteredcount) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-CheckAndUnfilterIndex"); return XA_RESULT_PARAMETER_INVALID; - } - *newidx=0; - while(*newidxcurrentTags.itemcount) - { - if(impl->tagmatchesfilter[*newidx]) i++; - if(icurrentTags.itemcount) + { + if (impl->tagmatchesfilter[*newidx]) + i++; + if (i < oldidx) + (*newidx)++; + else + break; + } + if (*newidx == impl->currentTags.itemcount) + { + /* should not end up here */ + *newidx = 0; + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-CheckAndUnfilterIndex"); + return XA_RESULT_PARAMETER_INVALID; + } } - if(*newidx==impl->currentTags.itemcount) + else { - /* should not end up here */ - *newidx=0; - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-CheckAndUnfilterIndex"); + if (oldidx >= impl->currentTags.itemcount) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-CheckAndUnfilterIndex"); return XA_RESULT_PARAMETER_INVALID; + } + *newidx = oldidx; } - } - else - { - if(oldidx>=impl->currentTags.itemcount) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-CheckAndUnfilterIndex"); - return XA_RESULT_PARAMETER_INVALID; - } - *newidx=oldidx; - } DEBUG_API("<-CheckAndUnfilterIndex"); return XA_RESULT_SUCCESS; -} + } - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xametadataextractionitf.h --- a/khronosfws/openmax_al/src/common/xametadataextractionitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xametadataextractionitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata Extraction Implementation Header + * + */ #ifndef XAMETADATAEXTRACTIONITF_H #define XAMETADATAEXTRACTIONITF_H @@ -30,65 +30,58 @@ /** STRUCTURES **/ /* Definition of XAMetadataExtractionItf implementation */ typedef struct XAMetadataExtractionItfImpl_ -{ + { /* parent interface */ struct XAMetadataExtractionItf_ itf; /* pointer to self */ struct XAMetadataExtractionItfImpl_* self; /* variables */ - XAuint32 filteredcount; - XAboolean* tagmatchesfilter; - XAboolean filteringOn; - - XAMetadataImplTagList currentTags; + XAuint32 filteredcount; + XAboolean* tagmatchesfilter; + XAboolean filteringOn; + + XAMetadataImplTagList currentTags; XAAdaptationBaseCtx *adaptCtx; -} XAMetadataExtractionItfImpl; + } XAMetadataExtractionItfImpl; /** METHODS **/ /* Base interface XAMetadataExtractionItf implementation */ -XAresult XAMetadataExtractionItfImpl_GetItemCount(XAMetadataExtractionItf self, - XAuint32 *pItemCount); +XAresult XAMetadataExtractionItfImpl_GetItemCount( + XAMetadataExtractionItf self, XAuint32 *pItemCount); XAresult XAMetadataExtractionItfImpl_GetKeySize(XAMetadataExtractionItf self, - XAuint32 index, - XAuint32 *pKeySize); + XAuint32 index, XAuint32 *pKeySize); XAresult XAMetadataExtractionItfImpl_GetKey(XAMetadataExtractionItf self, - XAuint32 index, - XAuint32 keySize, - XAMetadataInfo *pKey); + XAuint32 index, XAuint32 keySize, XAMetadataInfo *pKey); -XAresult XAMetadataExtractionItfImpl_GetValueSize(XAMetadataExtractionItf self, - XAuint32 index, - XAuint32 *pValueSize); +XAresult XAMetadataExtractionItfImpl_GetValueSize( + XAMetadataExtractionItf self, XAuint32 index, XAuint32 *pValueSize); XAresult XAMetadataExtractionItfImpl_GetValue(XAMetadataExtractionItf self, - XAuint32 index, - XAuint32 valueSize, - XAMetadataInfo *pValue); + XAuint32 index, XAuint32 valueSize, XAMetadataInfo *pValue); -XAresult XAMetadataExtractionItfImpl_AddKeyFilter(XAMetadataExtractionItf self, - XAuint32 keySize, - const void *pKey, - XAuint32 keyEncoding, - const XAchar *pValueLangCountry, - XAuint32 valueEncoding, - XAuint8 filterMask); +XAresult XAMetadataExtractionItfImpl_AddKeyFilter( + XAMetadataExtractionItf self, XAuint32 keySize, const void *pKey, + XAuint32 keyEncoding, const XAchar *pValueLangCountry, + XAuint32 valueEncoding, XAuint8 filterMask); -XAresult XAMetadataExtractionItfImpl_ClearKeyFilter(XAMetadataExtractionItf self); - +XAresult XAMetadataExtractionItfImpl_ClearKeyFilter( + XAMetadataExtractionItf self); /* XAMetadataExtractionItfImpl -specific methods */ -XAMetadataExtractionItfImpl* XAMetadataExtractionItfImpl_Create( XAAdaptationBaseCtx *adaptCtx); -void XAMetadataExtractionItfImp_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); +XAMetadataExtractionItfImpl* XAMetadataExtractionItfImpl_Create( + XAAdaptationBaseCtx *adaptCtx); +void XAMetadataExtractionItfImp_AdaptCb(void *pHandlerCtx, + XAAdaptEvent *event); void XAMetadataExtractionItfImpl_Free(XAMetadataExtractionItfImpl* self); /* internal methods */ XAresult CheckAndUnfilterIndex(XAMetadataExtractionItfImpl *impl, - XAuint32 oldidx, XAuint32 *newidx); + XAuint32 oldidx, XAuint32 *newidx); #endif /* XAMETADATAEXTRACTIONITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xanlinearvolumeitf.h --- a/khronosfws/openmax_al/src/common/xanlinearvolumeitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xanlinearvolumeitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #ifndef XANLINEARVOLUMEITF_H #define XANLINEARVOLUMEITF_H @@ -30,7 +30,7 @@ /** STRUCTURES **/ /* Definition of XANokiaLinearVolumeItf implementation */ typedef struct XANokiaLinearVolumeItfImpl_ -{ + { /* parent interface */ struct XANokiaLinearVolumeItf_ itf; /* pointer to self */ @@ -38,33 +38,40 @@ XAmillibel volumeLevel; XAuint32 eventFlags; - - XANokiaLinearVolumeItf cbPtrToSelf; - xaNokiaLinearVolumeCallback callback; - void *context; - + + XANokiaLinearVolumeItf cbPtrToSelf; + xaNokiaLinearVolumeCallback callback; + void *context; + /*Adaptation variables*/ XAAdaptationBaseCtx *adapCtx; -} XANokiaLinearVolumeItfImpl; + } XANokiaLinearVolumeItfImpl; /** METHODS **/ /* Base interface XANokiaLinearVolumeItf implementation */ -XAresult XANokiaLinearVolumeItfImpl_SetVolumeLevel(XANokiaLinearVolumeItf self, XAuint32 *percentage); +XAresult XANokiaLinearVolumeItfImpl_SetVolumeLevel( + XANokiaLinearVolumeItf self, XAuint32 *percentage); -XAresult XANokiaLinearVolumeItfImpl_GetVolumeLevel(XANokiaLinearVolumeItf self, XAuint32 *percentage); +XAresult XANokiaLinearVolumeItfImpl_GetVolumeLevel( + XANokiaLinearVolumeItf self, XAuint32 *percentage); -XAresult XANokiaLinearVolumeItfImpl_GetStepCount(XANokiaLinearVolumeItf self, XAuint32 *pStepCount); +XAresult XANokiaLinearVolumeItfImpl_GetStepCount(XANokiaLinearVolumeItf self, + XAuint32 *pStepCount); -XAresult XANokiaLinearVolumeItfImpl_RegisterVolumeCallback(XANokiaLinearVolumeItf self, - xaNokiaLinearVolumeCallback callback, - void * pContext); -XAresult XANokiaLinearVolumeItfImpl_SetCallbackEventsMask(XANokiaLinearVolumeItf self, XAuint32 eventFlags ); -XAresult XANokiaLinearVolumeItfImpl_GetCallbackEventsMask(XANokiaLinearVolumeItf self, XAuint32 * pEventFlags); +XAresult XANokiaLinearVolumeItfImpl_RegisterVolumeCallback( + XANokiaLinearVolumeItf self, xaNokiaLinearVolumeCallback callback, + void * pContext); +XAresult XANokiaLinearVolumeItfImpl_SetCallbackEventsMask( + XANokiaLinearVolumeItf self, XAuint32 eventFlags); +XAresult XANokiaLinearVolumeItfImpl_GetCallbackEventsMask( + XANokiaLinearVolumeItf self, XAuint32 * pEventFlags); /* XANokiaLinearVolumeItfImpl -specific methods */ -XANokiaLinearVolumeItfImpl* XANokiaLinearVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx); +XANokiaLinearVolumeItfImpl* XANokiaLinearVolumeItfImpl_Create( + XAAdaptationBaseCtx *adapCtx); void XANokiaLinearVolumeItfImpl_Free(XANokiaLinearVolumeItfImpl* self); -void XANokiaLinearVolumeItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); +void XANokiaLinearVolumeItfImpl_AdaptCb(void *pHandlerCtx, + XAAdaptEvent *event); #endif /* XANLINEARVOLUMEITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xanokialinearvolume_iid.c --- a/khronosfws/openmax_al/src/common/xanokialinearvolume_iid.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xanokialinearvolume_iid.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,9 +1,20 @@ /* - * Copyright goes here. + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Nokia Linear Volume IID * */ - #include "openmaxalwrapper.h" /*****************************************************************************/ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xanokialinearvolumeitf.c --- a/khronosfws/openmax_al/src/common/xanokialinearvolumeitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xanokialinearvolumeitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Nokia Linear Volume Interface Implementation + * + */ #include #include @@ -27,17 +27,18 @@ * Description: Validated interface pointer and cast it to implementations pointer. **/ static XANokiaLinearVolumeItfImpl* GetImpl(XANokiaLinearVolumeItf self) -{ - if(self) { - XANokiaLinearVolumeItfImpl* impl = (XANokiaLinearVolumeItfImpl*)(*self); - if(impl && impl == impl->self) + if (self) { + XANokiaLinearVolumeItfImpl* impl = + (XANokiaLinearVolumeItfImpl*) (*self); + if (impl && impl == impl->self) + { return impl; + } } + return NULL; } - return NULL; -} /** * XAresult XANokiaLinearVolumeItfImpl_RegisterVolumeCallback(XANokiaLinearVolumeItf self, @@ -45,21 +46,21 @@ * void * pContext) * Description: Sets or clears the xaVolumeCallback. **/ -XAresult XANokiaLinearVolumeItfImpl_RegisterVolumeCallback(XANokiaLinearVolumeItf self, - xaNokiaLinearVolumeCallback callback, - void * pContext) -{ +XAresult XANokiaLinearVolumeItfImpl_RegisterVolumeCallback( + XANokiaLinearVolumeItf self, xaNokiaLinearVolumeCallback callback, + void * pContext) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaLinearVolumeItfImpl* impl = GetImpl(self); DEBUG_API("->XANokiaLinearVolumeItfImpl_RegisterVolumeCallback"); - if(!impl) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ DEBUG_API("<-XANokiaLinearVolumeItfImpl_RegisterVolumeCallback"); return XA_RESULT_PARAMETER_INVALID; - } + } impl->callback = callback; impl->context = pContext; @@ -67,7 +68,7 @@ DEBUG_API("<-XANokiaLinearVolumeItfImpl_RegisterVolumeCallback"); return ret; -} + } /** * Base interface XANokiaLinearVolumeItf implementation @@ -77,140 +78,137 @@ * XAresult XANokiaLinearVolumeItfImpl_SetVolumeLevel(XANokiaLinearVolumeItf self, XAuint32 percentage) * Description: Sets the object's volume level. **/ -XAresult XANokiaLinearVolumeItfImpl_SetVolumeLevel(XANokiaLinearVolumeItf self, XAuint32 *percentage) -{ +XAresult XANokiaLinearVolumeItfImpl_SetVolumeLevel( + XANokiaLinearVolumeItf self, XAuint32 *percentage) + { XANokiaLinearVolumeItfImpl *impl = GetImpl(self); - XAresult ret = XA_RESULT_SUCCESS; + XAresult ret = XA_RESULT_SUCCESS; XAuint32 vol = *percentage; - + DEBUG_API("->XANokiaLinearVolumeItfImpl_SetVolumeLevel"); - - if((!impl) || (vol > MAX_PERCENTAGE_VOLUME)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaLinearVolumeItfImpl_SetVolumeLevel"); + if ((!impl) || (vol > MAX_PERCENTAGE_VOLUME)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaLinearVolumeItfImpl_SetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XANokiaLinearVolumeItfImpl_SetVolumeLevel"); - return ret; - } - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (ret == XA_RESULT_SUCCESS) { - ret = XANokiaLinearVolumeItfAdapt_SetVolumeLevel((XAAdaptationMMFCtx*)impl->adapCtx, vol); + if (impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWMMF) + { + ret = XANokiaLinearVolumeItfAdapt_SetVolumeLevel( + (XAAdaptationMMFCtx*) impl->adapCtx, vol); + if (ret == XA_RESULT_SUCCESS) + { + impl->volumeLevel = vol; + } + } + XAAdaptationBase_ThreadExit(impl->adapCtx); } - - if(ret == XA_RESULT_SUCCESS) - { - impl->volumeLevel = vol; + DEBUG_API("<-XANokiaLinearVolumeItfImpl_SetVolumeLevel"); + return ret; } - XAAdaptationBase_ThreadExit(impl->adapCtx); - DEBUG_API("<-XANokiaLinearVolumeItfImpl_SetVolumeLevel"); - return ret ; -} - /** * XAresult XANokiaLinearVolumeItfImpl_GetVolumeLevel(XANokiaLinearVolumeItf self, XAmillibel *pLevel) * Description: Gets the object’s volume level. **/ -XAresult XANokiaLinearVolumeItfImpl_GetVolumeLevel(XANokiaLinearVolumeItf self, XAuint32 *percentage) -{ +XAresult XANokiaLinearVolumeItfImpl_GetVolumeLevel( + XANokiaLinearVolumeItf self, XAuint32 *percentage) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaLinearVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaLinearVolumeItfImpl_GetVolumeLevel"); - if(!impl || !percentage) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetVolumeLevel"); + if (!impl || !percentage) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *percentage = impl->volumeLevel; DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetVolumeLevel"); return ret; -} + } /** * XAresult XANokiaLinearVolumeItfImpl_GetMaxVolumeLevel(XANokiaLinearVolumeItf self, XAmillibel *pMaxLevel) * Description: Gets the maximum supported level. **/ -XAresult XANokiaLinearVolumeItfImpl_GetStepCount(XANokiaLinearVolumeItf self, XAuint32 *pStepCount) -{ +XAresult XANokiaLinearVolumeItfImpl_GetStepCount(XANokiaLinearVolumeItf self, + XAuint32 *pStepCount) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaLinearVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaLinearVolumeItfImpl_GetVolumeLevel"); - if(!impl || !pStepCount) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetMaxVolumeLevel"); + if (!impl || !pStepCount) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetMaxVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetMaxVolumeLevel"); - return ret; - } - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (ret == XA_RESULT_SUCCESS) { - ret = XANokiaLinearVolumeItfAdapt_GetStepCount((XAAdaptationMMFCtx*)impl->adapCtx, pStepCount); + if (impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWMMF) + { + ret = XANokiaLinearVolumeItfAdapt_GetStepCount( + (XAAdaptationMMFCtx*) impl->adapCtx, pStepCount); + } + + XAAdaptationBase_ThreadExit(impl->adapCtx); } - - XAAdaptationBase_ThreadExit(impl->adapCtx); DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetMaxVolumeLevel"); return ret; -} + } -XAresult XANokiaLinearVolumeItfImpl_SetCallbackEventsMask(XANokiaLinearVolumeItf self, XAuint32 eventFlags ) +XAresult XANokiaLinearVolumeItfImpl_SetCallbackEventsMask( + XANokiaLinearVolumeItf self, XAuint32 eventFlags) { XAresult ret = XA_RESULT_SUCCESS; XANokiaLinearVolumeItfImpl* impl = GetImpl(self); DEBUG_API("->XANokiaLinearVolumeItfImpl_SetCallbackEventsMask"); - if(!impl) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ DEBUG_API("<-XANokiaLinearVolumeItfImpl_SetCallbackEventsMask"); return XA_RESULT_PARAMETER_INVALID; - } + } impl->eventFlags = eventFlags; DEBUG_API("<-XANokiaLinearVolumeItfImpl_SetCallbackEventsMask"); - return ret; + return ret; } -XAresult XANokiaLinearVolumeItfImpl_GetCallbackEventsMask(XANokiaLinearVolumeItf self, XAuint32 * pEventFlags) +XAresult XANokiaLinearVolumeItfImpl_GetCallbackEventsMask( + XANokiaLinearVolumeItf self, XAuint32 * pEventFlags) { XAresult ret = XA_RESULT_SUCCESS; XANokiaLinearVolumeItfImpl* impl = GetImpl(self); DEBUG_API("->XANokiaLinearVolumeItfImpl_GetCallbackEventsMask"); - if(!impl || !pEventFlags) - { + if (!impl || !pEventFlags) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetCallbackEventsMask"); return XA_RESULT_PARAMETER_INVALID; - } + } *pEventFlags = impl->eventFlags; DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetCallbackEventsMask"); - return ret; + return ret; } /** @@ -221,76 +219,84 @@ * XANokiaLinearVolumeItfImpl* XANokiaLinearVolumeItfImpl_Create() * Description: Allocate and initialize VolumeItfImpl **/ -XANokiaLinearVolumeItfImpl* XANokiaLinearVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx ) -{ - XANokiaLinearVolumeItfImpl *self = (XANokiaLinearVolumeItfImpl*) - calloc(1,sizeof(XANokiaLinearVolumeItfImpl)); +XANokiaLinearVolumeItfImpl* XANokiaLinearVolumeItfImpl_Create( + XAAdaptationBaseCtx *adapCtx) + { + XANokiaLinearVolumeItfImpl *self = (XANokiaLinearVolumeItfImpl*) calloc( + 1, sizeof(XANokiaLinearVolumeItfImpl)); DEBUG_API("->XANokiaLinearVolumeItfImpl_Create"); - if(self) - { + if (self) + { /* init itf default implementation */ self->itf.GetStepCount = XANokiaLinearVolumeItfImpl_GetStepCount; self->itf.GetVolumeLevel = XANokiaLinearVolumeItfImpl_GetVolumeLevel; self->itf.SetVolumeLevel = XANokiaLinearVolumeItfImpl_SetVolumeLevel; - self->itf.RegisterVolumeCallback = XANokiaLinearVolumeItfImpl_RegisterVolumeCallback; - self->itf.SetCallbackEventsMask = XANokiaLinearVolumeItfImpl_SetCallbackEventsMask; - self->itf.GetCallbackEventsMask = XANokiaLinearVolumeItfImpl_GetCallbackEventsMask; + self->itf.RegisterVolumeCallback + = XANokiaLinearVolumeItfImpl_RegisterVolumeCallback; + self->itf.SetCallbackEventsMask + = XANokiaLinearVolumeItfImpl_SetCallbackEventsMask; + self->itf.GetCallbackEventsMask + = XANokiaLinearVolumeItfImpl_GetCallbackEventsMask; /* init variables */ self->volumeLevel = 0; self->adapCtx = adapCtx; - XAAdaptationBase_AddEventHandler( adapCtx, &XANokiaLinearVolumeItfImpl_AdaptCb, XA_NOKIALINEARVOLITFEVENTS, self ); - + XAAdaptationBase_AddEventHandler(adapCtx, + &XANokiaLinearVolumeItfImpl_AdaptCb, + XA_NOKIALINEARVOLITFEVENTS, self); + self->self = self; - } + } DEBUG_API("<-XANokiaLinearVolumeItfImpl_Create"); return self; -} + } /** * void XANokiaLinearVolumeItfImpl_Free(XANokiaLinearVolumeItfImpl* self) * Description: Free all resources reserved at XANokiaLinearVolumeItfImpl_Create **/ void XANokiaLinearVolumeItfImpl_Free(XANokiaLinearVolumeItfImpl* self) -{ + { DEBUG_API("->XANokiaLinearVolumeItfImpl_Free"); assert(self==self->self); free(self); DEBUG_API("<-XANokiaLinearVolumeItfImpl_Free"); -} + } /* void XANokiaLinearVolumeItfimpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) * Description: Event handler for adaptation events */ -void XANokiaLinearVolumeItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ - XANokiaLinearVolumeItfImpl* impl =(XANokiaLinearVolumeItfImpl*)pHandlerCtx; +void XANokiaLinearVolumeItfImpl_AdaptCb(void *pHandlerCtx, + XAAdaptEvent *event) + { + XANokiaLinearVolumeItfImpl* impl = + (XANokiaLinearVolumeItfImpl*) pHandlerCtx; XAboolean eventBoolean = XA_BOOLEAN_FALSE; - + DEBUG_API("->XANokiaLinearVolumeItfimpl_AdaptCb"); - if(!impl) - { - DEBUG_ERR("XANokiaLinearVolumeItfImpl_AdaptCb, invalid context pointer!"); - DEBUG_API("<-XANokiaLinearVolumeItfImpl_AdaptCb"); + if (!impl && !event) + { + DEBUG_ERR("XANokiaLinearVolumeItfImpl_AdaptCb, invalid context pointer!");DEBUG_API("<-XANokiaLinearVolumeItfImpl_AdaptCb"); return; - } + } + assert(event); - if( event->eventid == XA_ADAPT_VOLUME_VOLUME_CHANGED && impl->callback ) - { - if(XA_NOKIALINEARVOLUME_EVENT_VOLUME_CHANGED & impl->eventFlags) + if (event->eventid == XA_ADAPT_VOLUME_VOLUME_CHANGED && impl->callback) + { + if (XA_NOKIALINEARVOLUME_EVENT_VOLUME_CHANGED & impl->eventFlags) { - DEBUG_API("Volume level changed in adaptation"); - impl->callback( impl->cbPtrToSelf, impl->context, XA_NOKIALINEARVOLUME_EVENT_VOLUME_CHANGED, eventBoolean ); + DEBUG_API("Volume level changed in adaptation"); + impl->callback(impl->cbPtrToSelf, impl->context, + XA_NOKIALINEARVOLUME_EVENT_VOLUME_CHANGED, eventBoolean); } - } + } else - { + { /* do nothing */ + }DEBUG_API("<-XANokiaLinearVolumeItfimpl_AdaptCb"); } - DEBUG_API("<-XANokiaLinearVolumeItfimpl_AdaptCb"); -} diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xanokiavolumeext_iid.c --- a/khronosfws/openmax_al/src/common/xanokiavolumeext_iid.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xanokiavolumeext_iid.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,5 +1,17 @@ /* - * Copyright goes here. + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Nokia Volume Interface Extension IID * */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xanokiavolumeextitf.c --- a/khronosfws/openmax_al/src/common/xanokiavolumeextitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xanokiavolumeextitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #include #include @@ -27,17 +27,17 @@ * Description: Validated interface pointer and cast it to implementations pointer. **/ static XANokiaVolumeExtItfImpl* GetImpl(XANokiaVolumeExtItf self) -{ - if(self) { - XANokiaVolumeExtItfImpl* impl = (XANokiaVolumeExtItfImpl*)(*self); - if(impl && impl == impl->self) + if (self) { + XANokiaVolumeExtItfImpl* impl = (XANokiaVolumeExtItfImpl*) (*self); + if (impl && impl == impl->self) + { return impl; + } } + return NULL; } - return NULL; -} /** * XAresult XANokiaVolumeExtItfImpl_RegisterVolumeCallback(XANokiaVolumeExtItf self, @@ -45,21 +45,21 @@ * void * pContext) * Description: Sets or clears the xaVolumeCallback. **/ -XAresult XANokiaVolumeExtItfImpl_RegisterVolumeCallback(XANokiaVolumeExtItf self, - xaNokiaVolumeExtCallback callback, - void * pContext) -{ +XAresult XANokiaVolumeExtItfImpl_RegisterVolumeCallback( + XANokiaVolumeExtItf self, xaNokiaVolumeExtCallback callback, + void * pContext) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl* impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_RegisterVolumeCallback"); - if(!impl) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ DEBUG_API("<-XANokiaVolumeExtItfImpl_RegisterVolumeCallback"); return XA_RESULT_PARAMETER_INVALID; - } + } impl->callback = callback; impl->context = pContext; @@ -67,7 +67,7 @@ DEBUG_API("<-XANokiaVolumeExtItfImpl_RegisterVolumeCallback"); return ret; -} + } /** * Base interface XANokiaVolumeExtItf implementation @@ -77,222 +77,220 @@ * XAresult XANokiaVolumeExtItfImpl_SetVolumeLevel(XANokiaVolumeExtItf self, XAmillibel level) * Description: Sets the object's volume level. **/ -XAresult XANokiaVolumeExtItfImpl_SetVolumeLevel(XANokiaVolumeExtItf self, XAmillibel level) -{ +XAresult XANokiaVolumeExtItfImpl_SetVolumeLevel(XANokiaVolumeExtItf self, + XAmillibel level) + { XANokiaVolumeExtItfImpl *impl = GetImpl(self); XAresult ret = XA_RESULT_SUCCESS; - XAmillibel maximumLevel = 0; - + XAmillibel maximumLevel = 0; + DEBUG_API("->XANokiaVolumeExtItfImpl_SetVolumeLevel"); /* check maximum volume level */ - if(XANokiaVolumeExtItfImpl_GetMaxVolumeLevel(self, &maximumLevel) != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_SetVolumeLevel"); + if (XANokiaVolumeExtItfImpl_GetMaxVolumeLevel(self, &maximumLevel) + != XA_RESULT_SUCCESS) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_SetVolumeLevel"); /* cannot solve maximum volume level */ return XA_RESULT_PARAMETER_INVALID; - } - - if(!impl || level > maximumLevel) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_SetVolumeLevel"); + } + + if (!impl || level > maximumLevel) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_SetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } impl->volumeLevel = level; DEBUG_API("<-XANokiaVolumeExtItfImpl_SetVolumeLevel"); - return ret ; -} + return ret; + } /** * XAresult XANokiaVolumeExtItfImpl_GetVolumeLevel(XANokiaVolumeExtItf self, XAmillibel *pLevel) * Description: Gets the object’s volume level. **/ -XAresult XANokiaVolumeExtItfImpl_GetVolumeLevel(XANokiaVolumeExtItf self, XAmillibel *pLevel) -{ +XAresult XANokiaVolumeExtItfImpl_GetVolumeLevel(XANokiaVolumeExtItf self, + XAmillibel *pLevel) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_GetVolumeLevel"); - if(!impl || !pLevel) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_GetVolumeLevel"); + if (!impl || !pLevel) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_GetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pLevel = impl->volumeLevel; DEBUG_API("<-XANokiaVolumeExtItfImpl_GetVolumeLevel"); return ret; -} + } /** * XAresult XANokiaVolumeExtItfImpl_GetMaxVolumeLevel(XANokiaVolumeExtItf self, XAmillibel *pMaxLevel) * Description: Gets the maximum supported level. **/ -XAresult XANokiaVolumeExtItfImpl_GetMaxVolumeLevel(XANokiaVolumeExtItf self, XAmillibel *pMaxLevel) -{ +XAresult XANokiaVolumeExtItfImpl_GetMaxVolumeLevel(XANokiaVolumeExtItf self, + XAmillibel *pMaxLevel) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_GetVolumeLevel"); - if(!impl || !pMaxLevel) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMaxVolumeLevel"); + if (!impl || !pMaxLevel) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMaxVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pMaxLevel = MAX_SUPPORT_VOLUME_LEVEL; - + DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMaxVolumeLevel"); return ret; -} + } /** * XAresult XANokiaVolumeExtItfImpl_SetMute(XANokiaVolumeExtItf self, XAboolean mute) * Description: Mutes or unmutes the object. **/ -XAresult XANokiaVolumeExtItfImpl_SetMute(XANokiaVolumeExtItf self, XAboolean mute) -{ +XAresult XANokiaVolumeExtItfImpl_SetMute(XANokiaVolumeExtItf self, + XAboolean mute) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_SetMute"); - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_SetMute"); + if (!impl) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_SetMute"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XANokiaVolumeExtItfImpl_SetMute"); - return ret; - } - /* check is mute state changed */ - if(mute != impl->mute) - { - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (ret == XA_RESULT_SUCCESS) { - ret = XANokiaVolumeExtItfAdapt_SetMute((XAAdaptationMMFCtx*)impl->adapCtx, mute); - } + /* check is mute state changed */ + if (mute != impl->mute) + { + if (impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWMMF) + { + ret = XANokiaVolumeExtItfAdapt_SetMute( + (XAAdaptationMMFCtx*) impl->adapCtx, mute); + if (ret == XA_RESULT_SUCCESS) + { + impl->mute = mute; + } + } + } - if(ret == XA_RESULT_SUCCESS) - { - impl->mute = mute; + XAAdaptationBase_ThreadExit(impl->adapCtx); } - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); DEBUG_API("<-XANokiaVolumeExtItfImpl_SetMute"); return ret; -} + } /** * XAresult XANokiaVolumeExtItfImpl_GetMute(XANokiaVolumeExtItf self, XAboolean *pMute) * Description: Retrieves the object's state. **/ -XAresult XANokiaVolumeExtItfImpl_GetMute(XANokiaVolumeExtItf self, XAboolean *pMute) -{ +XAresult XANokiaVolumeExtItfImpl_GetMute(XANokiaVolumeExtItf self, + XAboolean *pMute) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_GetMute"); - if(!impl || !pMute) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMute"); + if (!impl || !pMute) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMute"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pMute = impl->mute; DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMute"); return ret; -} + } /** * XAresult XANokiaVolumeExtItfImpl_EnableStereoPosition(XANokiaVolumeExtItf self, XAboolean enable) * Description: Enables or disables the stereo positioning effect. **/ -XAresult XANokiaVolumeExtItfImpl_EnableStereoPosition(XANokiaVolumeExtItf self, XAboolean enable) -{ +XAresult XANokiaVolumeExtItfImpl_EnableStereoPosition( + XANokiaVolumeExtItf self, XAboolean enable) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_EnableStereoPosition"); - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_EnableStereoPosition"); + if (!impl) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_EnableStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { + if (ret == XA_RESULT_PARAMETER_INVALID || ret + == XA_RESULT_PRECONDITIONS_VIOLATED) + { DEBUG_API("<-XANokiaVolumeExtItfImpl_EnableStereoPosition"); return ret; - } + } /* Check is stereo position state changed */ - if(enable != impl->enableStereoPos) - { - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (enable != impl->enableStereoPos) { - ret = XANokiaVolumeExtItfAdapt_EnableStereoPosition((XAAdaptationMMFCtx*)impl->adapCtx, - enable); - } + if (impl->adapCtx->fwtype == FWMgrFWMMF) + { + ret = XANokiaVolumeExtItfAdapt_EnableStereoPosition( + (XAAdaptationMMFCtx*) impl->adapCtx, enable); + } - if(ret == XA_RESULT_SUCCESS) - { + if (ret == XA_RESULT_SUCCESS) + { impl->enableStereoPos = enable; + } } - } XAAdaptationBase_ThreadExit(impl->adapCtx); DEBUG_API("<-XANokiaVolumeExtItfImpl_EnableStereoPosition"); return ret; -} + } /** * XAresult XANokiaVolumeExtItfImpl_IsEnabledStereoPosition(XANokiaVolumeExtItf self, * XAboolean *pEnable) * Description: Returns the enabled state of the stereo positioning effect. **/ -XAresult XANokiaVolumeExtItfImpl_IsEnabledStereoPosition(XANokiaVolumeExtItf self, - XAboolean *pEnable) -{ +XAresult XANokiaVolumeExtItfImpl_IsEnabledStereoPosition( + XANokiaVolumeExtItf self, XAboolean *pEnable) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_IsEnabledStereoPosition"); - if(!impl || !pEnable) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_IsEnabledStereoPosition"); + if (!impl || !pEnable) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_IsEnabledStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pEnable = impl->enableStereoPos; DEBUG_API("<-XANokiaVolumeExtItfImpl_IsEnabledStereoPosition"); return ret; -} + } /** * XAresult XANokiaVolumeExtItfImpl_SetStereoPosition(XANokiaVolumeExtItf self, @@ -300,44 +298,44 @@ * Description: Sets the stereo position of the object. **/ XAresult XANokiaVolumeExtItfImpl_SetStereoPosition(XANokiaVolumeExtItf self, - XApermille stereoPosition) -{ + XApermille stereoPosition) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_SetStereoPosition"); - if(!impl || (stereoPosition < STEREO_POSITION_LEFT) || - (stereoPosition > STEREO_POSITION_RIGHT)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_SetStereoPosition"); + if (!impl || (stereoPosition < STEREO_POSITION_LEFT) || (stereoPosition + > STEREO_POSITION_RIGHT)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_SetStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } impl->stereoPosition = stereoPosition; ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { + if (ret == XA_RESULT_PARAMETER_INVALID || ret + == XA_RESULT_PRECONDITIONS_VIOLATED) + { DEBUG_API("<-XANokiaVolumeExtItfImpl_SetStereoPosition"); return ret; - } + } /* check is stereo position effect enabled if is then handle effect */ - if(impl->enableStereoPos) - { - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (impl->enableStereoPos) { - ret = XANokiaVolumeExtItfAdapt_SetStereoPosition((XAAdaptationMMFCtx*)impl->adapCtx, - stereoPosition); - + if (impl->adapCtx->fwtype == FWMgrFWMMF) + { + ret = XANokiaVolumeExtItfAdapt_SetStereoPosition( + (XAAdaptationMMFCtx*) impl->adapCtx, stereoPosition); + + } } - } XAAdaptationBase_ThreadExit(impl->adapCtx); DEBUG_API("<-XANokiaVolumeExtItfImpl_SetStereoPosition"); return ret; -} + } /** * XAresult XANokiaVolumeExtItfImpl_GetStereoPosition(XANokiaVolumeExtItf self, @@ -345,67 +343,67 @@ * Description: Gets the object’s stereo position setting. **/ XAresult XANokiaVolumeExtItfImpl_GetStereoPosition(XANokiaVolumeExtItf self, - XApermille *pStereoPosition) -{ + XApermille *pStereoPosition) + { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl *impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_GetStereoPosition"); - if(!impl || !pStereoPosition) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_GetStereoPosition"); + if (!impl || !pStereoPosition) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_GetStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pStereoPosition = impl->stereoPosition; DEBUG_API("<-XANokiaVolumeExtItfImpl_GetStereoPosition"); return ret; -} + } -XAresult XANokiaVolumeExtItfImpl_SetCallbackEventsMask(XANokiaVolumeExtItf self, XAuint32 eventFlags ) +XAresult XANokiaVolumeExtItfImpl_SetCallbackEventsMask( + XANokiaVolumeExtItf self, XAuint32 eventFlags) { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl* impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_SetCallbackEventsMask"); - if(!impl) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ DEBUG_API("<-XANokiaVolumeExtItfImpl_SetCallbackEventsMask"); return XA_RESULT_PARAMETER_INVALID; - } + } impl->eventFlags = eventFlags; DEBUG_API("<-XANokiaVolumeExtItfImpl_SetCallbackEventsMask"); - return ret; + return ret; } -XAresult XANokiaVolumeExtItfImpl_GetCallbackEventsMask(XANokiaVolumeExtItf self, XAuint32 * pEventFlags) +XAresult XANokiaVolumeExtItfImpl_GetCallbackEventsMask( + XANokiaVolumeExtItf self, XAuint32 * pEventFlags) { XAresult ret = XA_RESULT_SUCCESS; XANokiaVolumeExtItfImpl* impl = GetImpl(self); DEBUG_API("->XANokiaVolumeExtItfImpl_GetCallbackEventsMask"); - if(!impl || !pEventFlags) - { + if (!impl || !pEventFlags) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ DEBUG_API("<-XANokiaVolumeExtItfImpl_GetCallbackEventsMask"); return XA_RESULT_PARAMETER_INVALID; - } + } *pEventFlags = impl->eventFlags; DEBUG_API("<-XANokiaVolumeExtItfImpl_GetCallbackEventsMask"); - return ret; + return ret; } - /** * XANokiaVolumeExtItfImpl -specific methods **/ @@ -414,27 +412,36 @@ * XANokiaVolumeExtItfImpl* XANokiaVolumeExtItfImpl_Create() * Description: Allocate and initialize VolumeItfImpl **/ -XANokiaVolumeExtItfImpl* XANokiaVolumeExtItfImpl_Create(XAAdaptationBaseCtx *adapCtx ) -{ - XANokiaVolumeExtItfImpl *self = (XANokiaVolumeExtItfImpl*) - calloc(1,sizeof(XANokiaVolumeExtItfImpl)); +XANokiaVolumeExtItfImpl* XANokiaVolumeExtItfImpl_Create( + XAAdaptationBaseCtx *adapCtx) + { + XANokiaVolumeExtItfImpl *self = (XANokiaVolumeExtItfImpl*) calloc(1, + sizeof(XANokiaVolumeExtItfImpl)); DEBUG_API("->XANokiaVolumeExtItfImpl_Create"); - if(self) - { + if (self) + { /* init itf default implementation */ - self->itf.EnableStereoPosition = XANokiaVolumeExtItfImpl_EnableStereoPosition; - self->itf.GetMaxVolumeLevel = XANokiaVolumeExtItfImpl_GetMaxVolumeLevel; + self->itf.EnableStereoPosition + = XANokiaVolumeExtItfImpl_EnableStereoPosition; + self->itf.GetMaxVolumeLevel + = XANokiaVolumeExtItfImpl_GetMaxVolumeLevel; self->itf.GetMute = XANokiaVolumeExtItfImpl_GetMute; - self->itf.GetStereoPosition = XANokiaVolumeExtItfImpl_GetStereoPosition; + self->itf.GetStereoPosition + = XANokiaVolumeExtItfImpl_GetStereoPosition; self->itf.GetVolumeLevel = XANokiaVolumeExtItfImpl_GetVolumeLevel; - self->itf.IsEnabledStereoPosition = XANokiaVolumeExtItfImpl_IsEnabledStereoPosition; + self->itf.IsEnabledStereoPosition + = XANokiaVolumeExtItfImpl_IsEnabledStereoPosition; self->itf.SetMute = XANokiaVolumeExtItfImpl_SetMute; - self->itf.SetStereoPosition = XANokiaVolumeExtItfImpl_SetStereoPosition; + self->itf.SetStereoPosition + = XANokiaVolumeExtItfImpl_SetStereoPosition; self->itf.SetVolumeLevel = XANokiaVolumeExtItfImpl_SetVolumeLevel; - self->itf.RegisterVolumeCallback = XANokiaVolumeExtItfImpl_RegisterVolumeCallback; - self->itf.SetCallbackEventsMask = XANokiaVolumeExtItfImpl_SetCallbackEventsMask; - self->itf.GetCallbackEventsMask = XANokiaVolumeExtItfImpl_GetCallbackEventsMask; + self->itf.RegisterVolumeCallback + = XANokiaVolumeExtItfImpl_RegisterVolumeCallback; + self->itf.SetCallbackEventsMask + = XANokiaVolumeExtItfImpl_SetCallbackEventsMask; + self->itf.GetCallbackEventsMask + = XANokiaVolumeExtItfImpl_GetCallbackEventsMask; /* init variables */ self->volumeLevel = 0; @@ -444,73 +451,79 @@ self->adapCtx = adapCtx; - XAAdaptationBase_AddEventHandler(adapCtx, &XANokiaVolumeExtItfImpl_AdaptCb, XA_NOKIAEXTVOLITFEVENTS, self ); - + XAAdaptationBase_AddEventHandler(adapCtx, + &XANokiaVolumeExtItfImpl_AdaptCb, XA_NOKIAEXTVOLITFEVENTS, + self); + self->self = self; - } + } DEBUG_API("<-XANokiaVolumeExtItfImpl_Create"); return self; -} + } /** * void XANokiaVolumeExtItfImpl_Free(XANokiaVolumeExtItfImpl* self) * Description: Free all resources reserved at XANokiaVolumeExtItfImpl_Create **/ void XANokiaVolumeExtItfImpl_Free(XANokiaVolumeExtItfImpl* self) -{ + { DEBUG_API("->XANokiaVolumeExtItfImpl_Free"); assert(self==self->self); free(self); DEBUG_API("<-XANokiaVolumeExtItfImpl_Free"); -} + } /* void XANokiaVolumeExtItfimpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) * Description: Event handler for adaptation events */ -void XANokiaVolumeExtItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ - XANokiaVolumeExtItfImpl* impl =(XANokiaVolumeExtItfImpl*)pHandlerCtx; +void XANokiaVolumeExtItfImpl_AdaptCb(void *pHandlerCtx, XAAdaptEvent *event) + { + XANokiaVolumeExtItfImpl* impl = (XANokiaVolumeExtItfImpl*) pHandlerCtx; XAboolean eventBoolean = XA_BOOLEAN_FALSE; - + DEBUG_API("->XANokiaVolumeExtItfimpl_AdaptCb"); - if(!impl) - { - DEBUG_ERR("XANokiaVolumeExtItfImpl_AdaptCb, invalid context pointer!"); - DEBUG_API("<-XANokiaVolumeExtItfImpl_AdaptCb"); + if (!impl) + { + DEBUG_ERR("XANokiaVolumeExtItfImpl_AdaptCb, invalid context pointer!");DEBUG_API("<-XANokiaVolumeExtItfImpl_AdaptCb"); return; - } + } assert(event); - - if( event->eventid == XA_ADAPT_VOLUME_MUTE_CHANGED && impl->callback ) - { - if(impl->eventFlags & XA_NOKIAVOLUMEEXT_EVENT_MUTE_CHANGED) + + if (event->eventid == XA_ADAPT_VOLUME_MUTE_CHANGED && impl->callback) + { + if (impl->eventFlags & XA_NOKIAVOLUMEEXT_EVENT_MUTE_CHANGED) { DEBUG_API("Mute Status changed in adaptation"); - eventBoolean = *(XAboolean*)event->data; - impl->callback( impl->cbPtrToSelf, impl->context, XA_NOKIAVOLUMEEXT_EVENT_MUTE_CHANGED, eventBoolean ); + eventBoolean = *(XAboolean*) event->data; + impl->callback(impl->cbPtrToSelf, impl->context, + XA_NOKIAVOLUMEEXT_EVENT_MUTE_CHANGED, eventBoolean); } - } - + } + else if (event->eventid == XA_ADAPT_VOLUME_VOLUME_CHANGED) - { - if(impl->eventFlags & XA_NOKIAVOLUMEEXT_EVENT_VOLUME_CHANGED) + { + if (impl->eventFlags & XA_NOKIAVOLUMEEXT_EVENT_VOLUME_CHANGED) { DEBUG_API("Volume Status changed in adaptation"); - eventBoolean = *(XAboolean*)event->data; - impl->callback( impl->cbPtrToSelf, impl->context, XA_NOKIAVOLUMEEXT_EVENT_VOLUME_CHANGED, eventBoolean ); + eventBoolean = *(XAboolean*) event->data; + impl->callback(impl->cbPtrToSelf, impl->context, + XA_NOKIAVOLUMEEXT_EVENT_VOLUME_CHANGED, eventBoolean); } - } + } else if (event->eventid == XA_ADAPT_VULOME_STEREOPOSITION_CHANGED) - { - if(impl->eventFlags & XA_NOKIAVOLUMEEXT_EVENT_STEREO_POSITION_CHANGED) + { + if (impl->eventFlags + & XA_NOKIAVOLUMEEXT_EVENT_STEREO_POSITION_CHANGED) { DEBUG_API("StereoPosituin Status changed in adaptation"); - eventBoolean = *(XAboolean*)event->data; - impl->callback( impl->cbPtrToSelf, impl->context, XA_NOKIAVOLUMEEXT_EVENT_STEREO_POSITION_CHANGED, eventBoolean ); + eventBoolean = *(XAboolean*) event->data; + impl->callback(impl->cbPtrToSelf, impl->context, + XA_NOKIAVOLUMEEXT_EVENT_STEREO_POSITION_CHANGED, + eventBoolean); } + } + + DEBUG_API("<-XANokiaVolumeExtItfimpl_AdaptCb"); } - - DEBUG_API("<-XANokiaVolumeExtItfimpl_AdaptCb"); -} diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xanvolumeextitf.h --- a/khronosfws/openmax_al/src/common/xanvolumeextitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xanvolumeextitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #ifndef XANVOLUMEEXTITF_H #define XANVOLUMEEXTITF_H @@ -37,7 +37,7 @@ /** STRUCTURES **/ /* Definition of XANokiaVolumeExtItf implementation */ typedef struct XANokiaVolumeExtItfImpl_ -{ + { /* parent interface */ struct XANokiaVolumeExtItf_ itf; /* pointer to self */ @@ -47,46 +47,58 @@ XAboolean mute; XAboolean enableStereoPos; XApermille stereoPosition; - XAuint32 eventFlags; - XANokiaVolumeExtItf cbPtrToSelf; - xaNokiaVolumeExtCallback callback; - void *context; - + XAuint32 eventFlags; + XANokiaVolumeExtItf cbPtrToSelf; + xaNokiaVolumeExtCallback callback; + void *context; + /*Adaptation variables*/ XAAdaptationBaseCtx *adapCtx; -} XANokiaVolumeExtItfImpl; + } XANokiaVolumeExtItfImpl; /** METHODS **/ /* Base interface XANokiaVolumeExtItf implementation */ -XAresult XANokiaVolumeExtItfImpl_SetVolumeLevel(XANokiaVolumeExtItf self, XAmillibel level); +XAresult XANokiaVolumeExtItfImpl_SetVolumeLevel(XANokiaVolumeExtItf self, + XAmillibel level); -XAresult XANokiaVolumeExtItfImpl_GetVolumeLevel(XANokiaVolumeExtItf self, XAmillibel *pLevel); - -XAresult XANokiaVolumeExtItfImpl_GetMaxVolumeLevel(XANokiaVolumeExtItf self, XAmillibel *pMaxLevel); +XAresult XANokiaVolumeExtItfImpl_GetVolumeLevel(XANokiaVolumeExtItf self, + XAmillibel *pLevel); -XAresult XANokiaVolumeExtItfImpl_SetMute(XANokiaVolumeExtItf self, XAboolean mute); +XAresult XANokiaVolumeExtItfImpl_GetMaxVolumeLevel(XANokiaVolumeExtItf self, + XAmillibel *pMaxLevel); -XAresult XANokiaVolumeExtItfImpl_GetMute(XANokiaVolumeExtItf self, XAboolean *pMute); +XAresult XANokiaVolumeExtItfImpl_SetMute(XANokiaVolumeExtItf self, + XAboolean mute); -XAresult XANokiaVolumeExtItfImpl_EnableStereoPosition(XANokiaVolumeExtItf self, XAboolean enable); +XAresult XANokiaVolumeExtItfImpl_GetMute(XANokiaVolumeExtItf self, + XAboolean *pMute); -XAresult XANokiaVolumeExtItfImpl_IsEnabledStereoPosition(XANokiaVolumeExtItf self, XAboolean *pEnable); +XAresult XANokiaVolumeExtItfImpl_EnableStereoPosition( + XANokiaVolumeExtItf self, XAboolean enable); -XAresult XANokiaVolumeExtItfImpl_SetStereoPosition(XANokiaVolumeExtItf self, XApermille stereoPosition); +XAresult XANokiaVolumeExtItfImpl_IsEnabledStereoPosition( + XANokiaVolumeExtItf self, XAboolean *pEnable); -XAresult XANokiaVolumeExtItfImpl_GetStereoPosition(XANokiaVolumeExtItf self, XApermille *pStereoPosition); +XAresult XANokiaVolumeExtItfImpl_SetStereoPosition(XANokiaVolumeExtItf self, + XApermille stereoPosition); -XAresult XANokiaVolumeExtItfImpl_RegisterVolumeCallback(XANokiaVolumeExtItf self, - xaNokiaVolumeExtCallback callback, - void * pContext); -XAresult XANokiaVolumeExtItfImpl_SetCallbackEventsMask(XANokiaVolumeExtItf self, XAuint32 eventFlags ); -XAresult XANokiaVolumeExtItfImpl_GetCallbackEventsMask(XANokiaVolumeExtItf self, XAuint32 * pEventFlags); +XAresult XANokiaVolumeExtItfImpl_GetStereoPosition(XANokiaVolumeExtItf self, + XApermille *pStereoPosition); + +XAresult XANokiaVolumeExtItfImpl_RegisterVolumeCallback( + XANokiaVolumeExtItf self, xaNokiaVolumeExtCallback callback, + void * pContext); +XAresult XANokiaVolumeExtItfImpl_SetCallbackEventsMask( + XANokiaVolumeExtItf self, XAuint32 eventFlags); +XAresult XANokiaVolumeExtItfImpl_GetCallbackEventsMask( + XANokiaVolumeExtItf self, XAuint32 * pEventFlags); /* XANokiaVolumeExtItfImpl -specific methods */ -XANokiaVolumeExtItfImpl* XANokiaVolumeExtItfImpl_Create(XAAdaptationBaseCtx *adapCtx); +XANokiaVolumeExtItfImpl* XANokiaVolumeExtItfImpl_Create( + XAAdaptationBaseCtx *adapCtx); void XANokiaVolumeExtItfImpl_Free(XANokiaVolumeExtItfImpl* self); -void XANokiaVolumeExtItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); +void XANokiaVolumeExtItfImpl_AdaptCb(void *pHandlerCtx, XAAdaptEvent *event); #endif /* XANVOLUMEEXTITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xaobjectitf.c --- a/khronosfws/openmax_al/src/common/xaobjectitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xaobjectitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Object Interface Implementation + * + */ #include #include @@ -25,311 +25,305 @@ * Base interface XAObjectItf implementation */ XAresult XAObjectItfImpl_Realize(XAObjectItf self, XAboolean async) -{ - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + { + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); XAresult retval = XA_RESULT_SUCCESS; DEBUG_API("->XAObjectItfImpl_Realize"); - if( !pObjImp || pObjImp != pObjImp->self) - { + if (!pObjImp || pObjImp != pObjImp->self) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAObjectItfImpl_Realize"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - if( async ) - { - /* invoke asynchronously */ - if( !pObjImp->callBack ) + if (async) { + /* invoke asynchronously */ + if (!pObjImp->callBack) + { retval = XA_RESULT_PARAMETER_INVALID; - } + } else - { + { /* check if another async operation is processed */ - if(pObjImp->asyncOngoing) - { + if (pObjImp->asyncOngoing) + { /* abort ongoing operation */ XAImpl_CancelThread(pObjImp->asyncThr); - } + } pObjImp->asyncOngoing = XA_BOOLEAN_TRUE; - if(XAImpl_StartThread(pObjImp->asyncThr, NULL, - XAObjectItfImpl_AsyncRealize,(void*)(self))) - { + if (XAImpl_StartThread(pObjImp->asyncThr, NULL, + XAObjectItfImpl_AsyncRealize, (void*) (self))) + { pObjImp->asyncOngoing = XA_BOOLEAN_FALSE; retval = XA_RESULT_RESOURCE_ERROR; - } + } else - { + { retval = XA_RESULT_SUCCESS; + } } } - } else - { + { /* Check if the object is in unrealized state */ - if(pObjImp->state != XA_OBJECT_STATE_UNREALIZED) - { + if (pObjImp->state != XA_OBJECT_STATE_UNREALIZED) + { DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); DEBUG_API("<-XAObjectItfImpl_Realize"); return XA_RESULT_PRECONDITIONS_VIOLATED; - } + } /* invoke synchronously */ - if( pObjImp->DoRealizeImpl ) - { + if (pObjImp->DoRealizeImpl) + { retval = pObjImp->DoRealizeImpl(self); - } + } + }DEBUG_API("<-XAObjectItfImpl_Realize"); + return retval; } - DEBUG_API("<-XAObjectItfImpl_Realize"); - return retval; -} XAresult XAObjectItfImpl_Resume(XAObjectItf self, XAboolean async) -{ + { XAresult retval = XA_RESULT_SUCCESS; - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); DEBUG_API("->XAObjectItfImpl_Resume"); - if( !pObjImp || pObjImp != pObjImp->self ) - { + if (!pObjImp || pObjImp != pObjImp->self) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAObjectItfImpl_Resume"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } - if( async ) - { + } + if (async) + { /* invoke asynchronously */ - if( !pObjImp->callBack ) - { + if (!pObjImp->callBack) + { retval = XA_RESULT_PARAMETER_INVALID; - } + } else - { + { /* check if another async operation is processed */ - if(pObjImp->asyncOngoing) - { + if (pObjImp->asyncOngoing) + { /* abort ongoing operation */ XAImpl_CancelThread(pObjImp->asyncThr); - } + } pObjImp->asyncOngoing = XA_BOOLEAN_TRUE; - if(XAImpl_StartThread(pObjImp->asyncThr, NULL, - XAObjectItfImpl_AsyncResume,(void*)(self))) - { + if (XAImpl_StartThread(pObjImp->asyncThr, NULL, + XAObjectItfImpl_AsyncResume, (void*) (self))) + { pObjImp->asyncOngoing = XA_BOOLEAN_FALSE; retval = XA_RESULT_RESOURCE_ERROR; - } + } else - { + { retval = XA_RESULT_SUCCESS; + } } } - } else - { - /* invoke synchronously */ - if( pObjImp->DoResumeImpl ) { + /* invoke synchronously */ + if (pObjImp->DoResumeImpl) + { retval = pObjImp->DoResumeImpl(self); - } + } + }DEBUG_API("<-XAObjectItfImpl_Resume"); + return retval; } - DEBUG_API("<-XAObjectItfImpl_Resume"); - return retval; -} XAresult XAObjectItfImpl_GetState(XAObjectItf self, XAuint32 *pState) -{ - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + { + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); DEBUG_API("->XAObjectItfImpl_GetState"); - if( !pObjImp || pObjImp != pObjImp->self || !pState ) - { + if (!pObjImp || pObjImp != pObjImp->self || !pState) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAObjectItfImpl_GetState"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pState = pObjImp->state; DEBUG_API("<-XAObjectItfImpl_GetState"); return XA_RESULT_SUCCESS; -} + } -XAresult XAObjectItfImpl_GetInterface(XAObjectItf self, const XAInterfaceID iid, - void *pInterface) -{ - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); +XAresult XAObjectItfImpl_GetInterface(XAObjectItf self, + const XAInterfaceID iid, void *pInterface) + { + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); XAObjItfMapEntry *mapEntry = NULL; DEBUG_API("->XAObjectItfImpl_GetInterface"); - if( !pObjImp || pObjImp != pObjImp->self || !pInterface || !iid ) - { + if (!pObjImp || pObjImp != pObjImp->self || !pInterface || !iid) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAObjectItfImpl_GetInterface"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - if(pObjImp->state != XA_OBJECT_STATE_REALIZED) - { + if (pObjImp->state != XA_OBJECT_STATE_REALIZED) + { DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); DEBUG_API("<-XAObjectItfImpl_GetInterface"); /*state is not correct */ return XA_RESULT_PRECONDITIONS_VIOLATED; - } + } mapEntry = XAObjectItfImpl_GetItfEntry(self, iid); - if( mapEntry && mapEntry->pItf ) - { - *(void**)pInterface = &(mapEntry->pItf); + if (mapEntry && mapEntry->pItf) + { + *(void**) pInterface = &(mapEntry->pItf); DEBUG_API("<-XAObjectItfImpl_GetInterface"); return XA_RESULT_SUCCESS; - } + } else - { + { DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); DEBUG_API("<-XAObjectItfImpl_GetInterface"); return XA_RESULT_FEATURE_UNSUPPORTED; + } } -} - XAresult XAObjectItfImpl_RegisterCallback(XAObjectItf self, - xaObjectCallback callback, - void *pContext) -{ - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + xaObjectCallback callback, void *pContext) + { + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); DEBUG_API("->XAObjectItfImpl_RegisterCallback"); - if( !pObjImp || pObjImp != pObjImp->self ) - { + if (!pObjImp || pObjImp != pObjImp->self) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAObjectItfImpl_RegisterCallback"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } pObjImp->callBack = callback; pObjImp->context = pContext; pObjImp->cbPtrToSelf = self; DEBUG_API("<-XAObjectItfImpl_RegisterCallback"); return XA_RESULT_SUCCESS; -} + } void XAObjectItfImpl_AbortAsyncOperation(XAObjectItf self) -{ - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + { + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); DEBUG_API("->XAObjectItfImpl_AbortAsyncOperation"); - if( pObjImp && - (pObjImp == pObjImp->self) && - pObjImp->callBack && - pObjImp->asyncOngoing ) - { + if (pObjImp && (pObjImp == pObjImp->self) && pObjImp->callBack + && pObjImp->asyncOngoing) + { /* abort ongoing operation */ XAImpl_CancelThread(pObjImp->asyncThr); - } + } DEBUG_API("<-XAObjectItfImpl_AbortAsyncOperation"); -} + } void XAObjectItfImpl_Destroy(XAObjectItf self) -{ - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + { + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); DEBUG_API("->XAObjectItfImpl_Destroy"); - if( pObjImp && pObjImp == pObjImp->self ) - { - if( pObjImp->asyncOngoing ) + if (pObjImp && pObjImp == pObjImp->self) { + if (pObjImp->asyncOngoing) + { /* abort ongoing operation */ XAImpl_CancelThread(pObjImp->asyncThr); - } + } /* free object specific resources */ - if( pObjImp->FreeResourcesImpl ) - { + if (pObjImp->FreeResourcesImpl) + { pObjImp->FreeResourcesImpl(self); - } + } free(pObjImp->interfaceMap); XAImpl_DeleteThreadHandle(pObjImp->asyncThr); free(pObjImp); - } + } DEBUG_API("<-XAObjectItfImpl_Destroy"); -} + } XAresult XAObjectItfImpl_SetPriority(XAObjectItf self, XAint32 priority, - XAboolean preemptable) -{ - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + XAboolean preemptable) + { + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); DEBUG_API("->XAObjectItfImpl_SetPriority"); - if( !pObjImp || pObjImp != pObjImp->self ) - { + if (!pObjImp || pObjImp != pObjImp->self) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAObjectItfImpl_SetPriority"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } pObjImp->priority = priority; pObjImp->preemptable = preemptable; DEBUG_API("<-XAObjectItfImpl_SetPriority"); return XA_RESULT_SUCCESS; -} + } XAresult XAObjectItfImpl_GetPriority(XAObjectItf self, XAint32 *pPriority, - XAboolean *pPreemptable) -{ - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + XAboolean *pPreemptable) + { + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); DEBUG_API("->XAObjectItfImpl_GetPriority"); - if( !pObjImp || pObjImp != pObjImp->self ) - { + if (!pObjImp || pObjImp != pObjImp->self) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAObjectItfImpl_GetPriority"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pPriority = pObjImp->priority; *pPreemptable = pObjImp->preemptable; DEBUG_API("<-XAObjectItfImpl_GetPriority"); return XA_RESULT_SUCCESS; -} + } XAresult XAObjectItfImpl_SetLossOfControlInterfaces(XAObjectItf self, - XAint16 numInterfaces, - XAInterfaceID *pInterfaceIDs, - XAboolean enabled) -{ - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + XAint16 numInterfaces, XAInterfaceID *pInterfaceIDs, + XAboolean enabled) + { + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); XAint32 itfIndex = 0; XAObjItfMapEntry *mapEntry = NULL; DEBUG_API("->XAObjectItfImpl_SetLossOfControlInterfaces"); - if( !pObjImp || pObjImp != pObjImp->self || !pInterfaceIDs ) - { + if (!pObjImp || pObjImp != pObjImp->self || !pInterfaceIDs) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAObjectItfImpl_SetLossOfControlInterfaces"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } - if( pInterfaceIDs ) - { - for(itfIndex = 0; itfIndex < numInterfaces; itfIndex++) + } + if (pInterfaceIDs) { - mapEntry = XAObjectItfImpl_GetItfEntry(self, pInterfaceIDs[itfIndex]); - if( mapEntry ) + for (itfIndex = 0; itfIndex < numInterfaces; itfIndex++) { + mapEntry = XAObjectItfImpl_GetItfEntry(self, + pInterfaceIDs[itfIndex]); + if (mapEntry) + { mapEntry->locEnabled = enabled; + } } } - } DEBUG_API("<-XAObjectItfImpl_SetLossOfControlInterfaces"); return XA_RESULT_SUCCESS; -} + } /** * XAObjectItfImpl -specific methods @@ -338,43 +332,40 @@ /* * Allocate and init new object itf instance */ -XAresult XAObjectItfImpl_Init(XAObjectItfImpl* self, - XAuint32 itfCount, - const XAInterfaceID** itfIIDs, - xaDoRealizeImpl doRealizeImpl, - xaDoResumeImpl doResumeImpl, - xaFreeResourcesImpl freeResourcesImpl) -{ +XAresult XAObjectItfImpl_Init(XAObjectItfImpl* self, XAuint32 itfCount, + const XAInterfaceID** itfIIDs, xaDoRealizeImpl doRealizeImpl, + xaDoResumeImpl doResumeImpl, xaFreeResourcesImpl freeResourcesImpl) + { XAuint32 i = 0; DEBUG_API("->XAObjectItfImpl_Init"); assert( self && itfIIDs && doRealizeImpl && doResumeImpl && freeResourcesImpl ); - self->interfaceMap = - (XAObjItfMapEntry*)calloc(itfCount, sizeof(XAObjItfMapEntry)); - if( !self->interfaceMap ) - { + self->interfaceMap = (XAObjItfMapEntry*) calloc(itfCount, + sizeof(XAObjItfMapEntry)); + if (!self->interfaceMap) + { free(self); DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); DEBUG_API("<-XAObjectItfImpl_Init"); return XA_RESULT_MEMORY_FAILURE; - } - if( XAImpl_CreateThreadHandle(&(self->asyncThr)) != XA_RESULT_SUCCESS ) - { + } + if (XAImpl_CreateThreadHandle(&(self->asyncThr)) != XA_RESULT_SUCCESS) + { free(self); DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); DEBUG_API("<-XAObjectItfImpl_Init"); return XA_RESULT_MEMORY_FAILURE; - } - for(i=0;iinterfaceMap[i].mapIdx = i; self->interfaceMap[i].iid = *(itfIIDs[i]); self->interfaceMap[i].pItf = NULL; self->interfaceMap[i].locEnabled = XA_BOOLEAN_FALSE; self->interfaceMap[i].required = XA_BOOLEAN_FALSE; self->interfaceMap[i].isDynamic = XA_BOOLEAN_FALSE; - } + } self->interfaceMap[0].pItf = self; self->interfaceMap[0].required = XA_BOOLEAN_TRUE; @@ -401,111 +392,106 @@ self->itf.Destroy = XAObjectItfImpl_Destroy; self->itf.SetPriority = XAObjectItfImpl_SetPriority; self->itf.GetPriority = XAObjectItfImpl_GetPriority; - self->itf.SetLossOfControlInterfaces = XAObjectItfImpl_SetLossOfControlInterfaces; + self->itf.SetLossOfControlInterfaces + = XAObjectItfImpl_SetLossOfControlInterfaces; self->self = self; DEBUG_API("<-XAObjectItfImpl_Init"); return XA_RESULT_SUCCESS; -} + } /* * Asynchronous invocation of Realize */ void* XAObjectItfImpl_AsyncRealize(void* args) -{ + { XAresult retval = XA_RESULT_SUCCESS; - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*(XAObjectItf)(args)); + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*(XAObjectItf) (args)); DEBUG_API("->XAObjectItfImpl_AsyncRealize"); - if( pObjImp && pObjImp == pObjImp->self) - { - /* Check if the object is in unrealized state */ - if(pObjImp->state != XA_OBJECT_STATE_UNREALIZED) - { - retval = XA_RESULT_PRECONDITIONS_VIOLATED; - } - else if( pObjImp->DoRealizeImpl ) + if (pObjImp && pObjImp == pObjImp->self) { - retval = pObjImp->DoRealizeImpl((XAObjectItf)(args)); - } - if( pObjImp->callBack ) - { + /* Check if the object is in unrealized state */ + if (pObjImp->state != XA_OBJECT_STATE_UNREALIZED) + { + retval = XA_RESULT_PRECONDITIONS_VIOLATED; + } + else if (pObjImp->DoRealizeImpl) + { + retval = pObjImp->DoRealizeImpl((XAObjectItf) (args)); + } + if (pObjImp->callBack) + { pObjImp->callBack(pObjImp->cbPtrToSelf, pObjImp->context, - XA_OBJECT_EVENT_ASYNC_TERMINATION, - retval, pObjImp->state, NULL); - } + XA_OBJECT_EVENT_ASYNC_TERMINATION, retval, + pObjImp->state, NULL); + } pObjImp->asyncOngoing = XA_BOOLEAN_FALSE; XAImpl_ExitThread(pObjImp->asyncThr); - } + } else - { + { DEBUG_API("XAObjectItfImpl_AsyncRealize: INVALID args"); - } - + } DEBUG_API("<-XAObjectItfImpl_AsyncRealize"); return NULL; -} - + } /* * Asynchronous invocation of Resume */ void* XAObjectItfImpl_AsyncResume(void* args) -{ + { XAresult retval = XA_RESULT_SUCCESS; - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*(XAObjectItf)(args)); + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*(XAObjectItf) (args)); DEBUG_API("->XAObjectItfImpl_AsyncResume"); - if( pObjImp && pObjImp == pObjImp->self ) - { - if( pObjImp->DoResumeImpl ) + if (pObjImp && pObjImp == pObjImp->self) { - retval = pObjImp->DoResumeImpl((XAObjectItf)(args)); - } - if( pObjImp->callBack ) - { + if (pObjImp->DoResumeImpl) + { + retval = pObjImp->DoResumeImpl((XAObjectItf) (args)); + } + if (pObjImp->callBack) + { pObjImp->callBack(pObjImp->cbPtrToSelf, pObjImp->context, - XA_OBJECT_EVENT_ASYNC_TERMINATION, - retval, pObjImp->state, NULL); - } + XA_OBJECT_EVENT_ASYNC_TERMINATION, retval, + pObjImp->state, NULL); + } pObjImp->asyncOngoing = XA_BOOLEAN_FALSE; XAImpl_ExitThread(pObjImp->asyncThr); - } + } else - { + { DEBUG_API("XAObjectItfImpl_AsyncResume: INVALID args"); - } - + } DEBUG_API("<-XAObjectItfImpl_AsyncResume"); return NULL; -} + } XAObjItfMapEntry* XAObjectItfImpl_GetItfEntry(const XAObjectItf self, - const XAInterfaceID iid) -{ + const XAInterfaceID iid) + { XAuint32 mapIndex = 0; - XAObjectItfImpl* pObjImp = (XAObjectItfImpl*)(*self); + XAObjectItfImpl* pObjImp = (XAObjectItfImpl*) (*self); DEBUG_API("->XAObjectItfImpl_GetItfEntry"); - if( pObjImp && - (pObjImp == pObjImp->self) && - pObjImp->interfaceMap && - iid ) - { + if (pObjImp && (pObjImp == pObjImp->self) && pObjImp->interfaceMap && iid) + { /* Check interface */ - for(mapIndex = 0; mapIndex < pObjImp->interfaceCount; mapIndex++) - { - if(XACommon_EqualIIds(pObjImp->interfaceMap[mapIndex].iid, iid)) + for (mapIndex = 0; mapIndex < pObjImp->interfaceCount; mapIndex++) { + if (XACommon_EqualIIds(pObjImp->interfaceMap[mapIndex].iid, iid)) + { DEBUG_API("<-XAObjectItfImpl_GetItfEntry"); return &(pObjImp->interfaceMap[mapIndex]); + } } } - } DEBUG_API("<-XAObjectItfImpl_GetItfEntry"); return NULL; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xaobjectitf.h --- a/khronosfws/openmax_al/src/common/xaobjectitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xaobjectitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #ifndef XAOBJECTITF_H #define XAOBJECTITF_H @@ -34,18 +34,18 @@ /** STRUCTURES **/ typedef struct XAObjItfMapEntry_ -{ + { XAInterfaceID iid; - XAuint8 mapIdx; - void *pItf; - XAboolean locEnabled; - XAboolean required; - XAboolean isDynamic; -} XAObjItfMapEntry; + XAuint8 mapIdx; + void *pItf; + XAboolean locEnabled; + XAboolean required; + XAboolean isDynamic; + } XAObjItfMapEntry; /* Definition of XAObjectItf implementation */ typedef struct XAObjectItfImpl_ -{ + { /* parent interface */ struct XAObjectItf_ itf; /* pointer to self */ @@ -72,8 +72,7 @@ xaDoRealizeImpl DoRealizeImpl; xaDoResumeImpl DoResumeImpl; xaFreeResourcesImpl FreeResourcesImpl; -} XAObjectItfImpl; - + } XAObjectItfImpl; /** METHODS **/ @@ -85,43 +84,37 @@ XAresult XAObjectItfImpl_GetState(XAObjectItf self, XAuint32 *pState); XAresult XAObjectItfImpl_GetInterface(XAObjectItf self, - const XAInterfaceID iid, - void *pInterface); + const XAInterfaceID iid, void *pInterface); XAresult XAObjectItfImpl_RegisterCallback(XAObjectItf self, - xaObjectCallback callback, - void *pContext); + xaObjectCallback callback, void *pContext); void XAObjectItfImpl_AbortAsyncOperation(XAObjectItf self); void XAObjectItfImpl_Destroy(XAObjectItf self); XAresult XAObjectItfImpl_SetPriority(XAObjectItf self, XAint32 priority, - XAboolean preemptable); + XAboolean preemptable); XAresult XAObjectItfImpl_GetPriority(XAObjectItf self, XAint32 *pPriority, - XAboolean *pPreemptable); + XAboolean *pPreemptable); XAresult XAObjectItfImpl_SetLossOfControlInterfaces(XAObjectItf self, - XAint16 numInterfaces, - XAInterfaceID *pInterfaceIDs, - XAboolean enabled); + XAint16 numInterfaces, XAInterfaceID *pInterfaceIDs, + XAboolean enabled); /* XAObjectItfImpl -specific methods */ /* Allocate and initialize base object */ -XAresult XAObjectItfImpl_Init(XAObjectItfImpl* self, - XAuint32 itfCount, - const XAInterfaceID** itfIIDs, - xaDoRealizeImpl doRealizeImpl, - xaDoResumeImpl doResumeImpl, - xaFreeResourcesImpl freeResourcesImpl); +XAresult XAObjectItfImpl_Init(XAObjectItfImpl* self, XAuint32 itfCount, + const XAInterfaceID** itfIIDs, xaDoRealizeImpl doRealizeImpl, + xaDoResumeImpl doResumeImpl, xaFreeResourcesImpl freeResourcesImpl); /* methods for asynchronous service */ void* XAObjectItfImpl_AsyncRealize(void* args); void* XAObjectItfImpl_AsyncResume(void* args); XAObjItfMapEntry* XAObjectItfImpl_GetItfEntry(const XAObjectItf self, - const XAInterfaceID iid); + const XAInterfaceID iid); #endif /* XAOBJECTITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xaobjects.h --- a/khronosfws/openmax_al/src/common/xaobjects.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xaobjects.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Entry Point Functions to Create AL Objects + * + */ /*All global definitions and declarations here */ #ifndef XAOBJECTS_H @@ -28,151 +28,137 @@ * GLOBAL METHODS */ - /* * Engine */ -XAresult XAEngineImpl_Create(XAObjectItf *pEngine, - XAuint32 numOptions, - const XAEngineOption *pEngineOptions, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); +XAresult XAEngineImpl_Create(XAObjectItf *pEngine, XAuint32 numOptions, + const XAEngineOption *pEngineOptions, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); -XAresult XAEngineImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces); +XAresult XAEngineImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces); XAresult XAEngineImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId); + XAInterfaceID *pInterfaceId); /* * Media Player */ -XAresult XAMediaPlayerImpl_CreateMediaPlayer( FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf *pPlayer, - XADataSource *pDataSrc, - XADataSource *pBankSrc, - XADataSink *pAudioSnk, - XADataSink *pImageVideoSnk, - XADataSink *pVibra, - XADataSink *pLEDArray, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); +XAresult XAMediaPlayerImpl_CreateMediaPlayer(FrameworkMap* mapper, + XACapabilities* capabilities, XAObjectItf *pPlayer, + XADataSource *pDataSrc, XADataSource *pBankSrc, + XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, + XADataSink *pVibra, XADataSink *pLEDArray, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); -XAresult XAMediaPlayerImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces); +XAresult XAMediaPlayerImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces); XAresult XAMediaPlayerImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId); + XAInterfaceID *pInterfaceId); /* * Metadata Extractor */ -XAresult XAMetadataExtractorImpl_Create( FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf *pMetadataExtractor, - XADataSource *pDataSource, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired ); +XAresult XAMetadataExtractorImpl_Create(FrameworkMap* mapper, + XACapabilities* capabilities, XAObjectItf *pMetadataExtractor, + XADataSource *pDataSource, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); -XAresult XAMetadataExtractorImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces); +XAresult XAMetadataExtractorImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces); XAresult XAMetadataExtractorImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId); + XAInterfaceID *pInterfaceId); /* * Output Mix */ -XAresult XAOMixImpl_CreateOutputMix( FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf *pMix, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired ); +XAresult XAOMixImpl_CreateOutputMix(FrameworkMap* mapper, + XACapabilities* capabilities, XAObjectItf *pMix, + XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); -XAresult XAOMixImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces); +XAresult XAOMixImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces); XAresult XAOMixImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId); + XAInterfaceID *pInterfaceId); /* * Media Recorder */ XAresult XAMediaRecorderImpl_CreateMediaRecorder(FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf* pRecorder, - XADataSource* pAudioSrc, - XADataSource* pImageVideoSrc, - XADataSink* pDataSnk, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); + XACapabilities* capabilities, XAObjectItf* pRecorder, + XADataSource* pAudioSrc, XADataSource* pImageVideoSrc, + XADataSink* pDataSnk, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); -XAresult XAMediaRecorderImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces); +XAresult XAMediaRecorderImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces); XAresult XAMediaRecorderImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId); + XAInterfaceID *pInterfaceId); /* * Camera Device */ -XAresult XACameraDeviceImpl_CreateCameraDevice( FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf* pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID * pInterfaceIds, - const XAboolean * pInterfaceRequired); +XAresult XACameraDeviceImpl_CreateCameraDevice(FrameworkMap* mapper, + XACapabilities* capabilities, XAObjectItf* pDevice, + XAuint32 deviceID, XAuint32 numInterfaces, + const XAInterfaceID * pInterfaceIds, + const XAboolean * pInterfaceRequired); -XAresult XACameraDeviceImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces); +XAresult XACameraDeviceImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces); XAresult XACameraDeviceImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId); + XAInterfaceID *pInterfaceId); /* * Radio Device */ -XAresult XARadioDeviceImpl_CreateRadioDevice( FrameworkMap* mapper, - XAObjectItf* pDevice, - XAuint32 numInterfaces, - const XAInterfaceID * pInterfaceIds, - const XAboolean * pInterfaceRequired); +XAresult XARadioDeviceImpl_CreateRadioDevice( /*FrameworkMap* mapper,*/ +XAObjectItf* pDevice, XAuint32 numInterfaces, + const XAInterfaceID * pInterfaceIds, + const XAboolean * pInterfaceRequired); -XAresult XARadioDeviceImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces); +XAresult XARadioDeviceImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces); XAresult XARadioDeviceImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId); + XAInterfaceID *pInterfaceId); /* * Vibra Device */ -XAresult XAVibraDeviceImpl_CreateVibraDevice( FrameworkMap* mapper, - XAObjectItf* pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID * pInterfaceIds, - const XAboolean * pInterfaceRequired); +XAresult XAVibraDeviceImpl_CreateVibraDevice(FrameworkMap* mapper, + XAObjectItf* pDevice, XAuint32 deviceID, XAuint32 numInterfaces, + const XAInterfaceID * pInterfaceIds, + const XAboolean * pInterfaceRequired); -XAresult XAVibraDeviceImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces); +XAresult XAVibraDeviceImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces); XAresult XAVibraDeviceImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId); + XAInterfaceID *pInterfaceId); /* * LED Array */ -XAresult XALEDArrayDeviceImpl_CreateLEDArrayDevice( FrameworkMap* mapper, - XAObjectItf* pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID * pInterfaceIds, - const XAboolean * pInterfaceRequired); +XAresult XALEDArrayDeviceImpl_CreateLEDArrayDevice(FrameworkMap* mapper, + XAObjectItf* pDevice, XAuint32 deviceID, XAuint32 numInterfaces, + const XAInterfaceID * pInterfaceIds, + const XAboolean * pInterfaceRequired); -XAresult XALEDArrayDeviceImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces); +XAresult XALEDArrayDeviceImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces); XAresult XALEDArrayDeviceImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId); - + XAInterfaceID *pInterfaceId); #endif /*XAOBJECTS_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xaplatform.c --- a/khronosfws/openmax_al/src/common/xaplatform.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xaplatform.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Platform Specific Utility Functions + * + */ #include #include @@ -24,8 +24,6 @@ #include "xaplatform.h" - - /** MACROS **/ /********************************************************************** @@ -35,21 +33,21 @@ #undef _MUTEXERRORSUPPORT #ifdef _MUTEXERRORSUPPORT - typedef pthread_mutex_t XA_MTX; +typedef pthread_mutex_t XA_MTX; #else - typedef struct +typedef struct { - pthread_mutex_t mutex; - pthread_t owner; + pthread_mutex_t mutex; + pthread_t owner; } XA_MTX; #endif -XAresult XAImpl_CreateMutex( XAImplMutexHandle *mtx ) -{ - XA_MTX *pMtx = (XA_MTX *)malloc(sizeof(XA_MTX)); +XAresult XAImpl_CreateMutex(XAImplMutexHandle *mtx) + { + XA_MTX *pMtx = (XA_MTX *) malloc(sizeof(XA_MTX)); assert(mtx); - if( pMtx ) - { + if (pMtx) + { pthread_mutexattr_t *pAttr = NULL; #ifdef _MUTEXERRORSUPPORT pthread_mutexattr_t attr; @@ -58,46 +56,44 @@ pthread_mutexattr_settype(pAttr, PTHREAD_MUTEX_ERRORCHECK); if(pthread_mutex_init(pMtx, pAttr)) #else - if(pthread_mutex_init(&(pMtx->mutex), pAttr)) + if (pthread_mutex_init(&(pMtx->mutex), pAttr)) #endif - { + { free(pMtx); *mtx = NULL; return XA_RESULT_INTERNAL_ERROR; - } - *mtx = (XAImplMutexHandle)pMtx; + } + *mtx = (XAImplMutexHandle) pMtx; return XA_RESULT_SUCCESS; - } + } else - { + { return XA_RESULT_MEMORY_FAILURE; + } } -} - -XAresult XAImpl_LockMutex( XAImplMutexHandle mtx ) -{ - XA_MTX *pMtx = (XA_MTX*)mtx; +XAresult XAImpl_LockMutex(XAImplMutexHandle mtx) + { + XA_MTX *pMtx = (XA_MTX*) mtx; assert(pMtx); #ifdef _MUTEXERRORSUPPORT if(pthread_mutex_lock(pMtx)) - { + { return XA_RESULT_PRECONDITIONS_VIOLATED; - } + } #else - if( pthread_self() == pMtx->owner || - pthread_mutex_unlock(&(pMtx->mutex)) ) - { + if (pthread_self() == pMtx->owner || pthread_mutex_unlock(&(pMtx->mutex))) + { return XA_RESULT_PRECONDITIONS_VIOLATED; - } + } pMtx->owner = pthread_self(); #endif return XA_RESULT_SUCCESS; -} + } -XAresult XAImpl_TryLockMutex( XAImplMutexHandle mtx ) -{ - XA_MTX *pMtx = (XA_MTX*)mtx; +XAresult XAImpl_TryLockMutex(XAImplMutexHandle mtx) + { + XA_MTX *pMtx = (XA_MTX*) mtx; XAint32 mutexRet; XAresult ret = XA_RESULT_SUCCESS; assert(pMtx); @@ -105,179 +101,176 @@ #ifdef _MUTEXERRORSUPPORT mutexRet = pthread_ mutex_trylock(pMtx); switch (mutexRet) - { - case EBUSY: + { + case EBUSY: /* if mutex is already locked, return permission denied */ - ret = XA_RESULT_PERMISSION_DENIED; + ret = XA_RESULT_PERMISSION_DENIED; break; - case 0: - ret = XA_RESULT_SUCCESS; + case 0: + ret = XA_RESULT_SUCCESS; break; - default: + default: ret = XA_RESULT_PRECONDITIONS_VIOLATED; break; - } + } #else - if( pthread_self() == pMtx->owner ) - { + if (pthread_self() == pMtx->owner) + { return XA_RESULT_PRECONDITIONS_VIOLATED; - } + } mutexRet = pthread_mutex_trylock(&(pMtx->mutex)); switch (mutexRet) - { - case EBUSY: - /* if mutex is already locked, return permission denied */ - ret = XA_RESULT_PERMISSION_DENIED; - break; - case 0: - pMtx->owner = pthread_self(); - ret = XA_RESULT_SUCCESS; - break; - default: - ret = XA_RESULT_PRECONDITIONS_VIOLATED; - break; - } + { + case EBUSY: + /* if mutex is already locked, return permission denied */ + ret = XA_RESULT_PERMISSION_DENIED; + break; + case 0: + pMtx->owner = pthread_self(); + ret = XA_RESULT_SUCCESS; + break; + default: + ret = XA_RESULT_PRECONDITIONS_VIOLATED; + break; + } #endif return ret; -} - + } -XAresult XAImpl_UnlockMutex( XAImplMutexHandle mtx ) -{ - XA_MTX *pMtx = (XA_MTX*)mtx; +XAresult XAImpl_UnlockMutex(XAImplMutexHandle mtx) + { + XA_MTX *pMtx = (XA_MTX*) mtx; assert(pMtx); #ifdef _MUTEXERRORSUPPORT if(pthread_mutex_lock(pMtx)) - { + { return XA_RESULT_PRECONDITIONS_VIOLATED; - } + } #else - if( pthread_self() != pMtx->owner || - pthread_mutex_unlock(&(pMtx->mutex)) ) - { + if (pthread_self() != pMtx->owner || pthread_mutex_unlock(&(pMtx->mutex))) + { return XA_RESULT_PRECONDITIONS_VIOLATED; - } + } // Changing the below value to 0 since owner is an unsigned int. // pMtx->owner = -1; pMtx->owner = 0; #endif return XA_RESULT_SUCCESS; -} + } -void XAImpl_DeleteMutex( XAImplMutexHandle mtx ) -{ - XA_MTX *pMtx = (XA_MTX*)mtx; - if( pMtx ) +void XAImpl_DeleteMutex(XAImplMutexHandle mtx) { + XA_MTX *pMtx = (XA_MTX*) mtx; + if (pMtx) + { #ifdef _MUTEXERRORSUPPORT pthread_mutex_destroy(pMtx); #else pthread_mutex_destroy(&(pMtx->mutex)); #endif free(pMtx); + } } -} /********************************************************************** * semaphores **********************************************************************/ - -XAresult XAImpl_CreateSemaphore( XAImplSemHandle *sem ) -{ - sem_t *pSem = (sem_t*)malloc(sizeof(sem_t)); +XAresult XAImpl_CreateSemaphore(XAImplSemHandle *sem) + { + sem_t *pSem = (sem_t*) malloc(sizeof(sem_t)); assert(sem); - if( pSem ) - { - if(sem_init(pSem,0,0)) + if (pSem) { + if (sem_init(pSem, 0, 0)) + { free(pSem); *sem = NULL; return XA_RESULT_INTERNAL_ERROR; - } - *sem = (XAImplSemHandle)pSem; + } + *sem = (XAImplSemHandle) pSem; return XA_RESULT_SUCCESS; - } + } else - { + { return XA_RESULT_MEMORY_FAILURE; + } } -} -XAresult XAImpl_WaitSemaphore( XAImplSemHandle sem ) -{ - sem_t* pSem = (sem_t*)sem; +XAresult XAImpl_WaitSemaphore(XAImplSemHandle sem) + { + sem_t* pSem = (sem_t*) sem; assert(pSem); sem_wait(pSem); return XA_RESULT_SUCCESS; -} + } -XAresult XAImpl_PostSemaphore( XAImplSemHandle sem ) -{ - sem_t *pSem = (sem_t*)sem; +XAresult XAImpl_PostSemaphore(XAImplSemHandle sem) + { + sem_t *pSem = (sem_t*) sem; assert(pSem); sem_post(pSem); return XA_RESULT_SUCCESS; -} + } -void XAImpl_DeleteSemaphore( XAImplSemHandle sem ) -{ - sem_t *pSem = (sem_t*)sem; - if( pSem ) +void XAImpl_DeleteSemaphore(XAImplSemHandle sem) { + sem_t *pSem = (sem_t*) sem; + if (pSem) + { sem_destroy(pSem); free(pSem); + } } -} /********************************************************************** * THREADS **********************************************************************/ -XAresult XAImpl_CreateThreadHandle( XAImplThreadHandle *thd ) -{ - pthread_t *pThd = (pthread_t*)malloc(sizeof(pthread_t)); +XAresult XAImpl_CreateThreadHandle(XAImplThreadHandle *thd) + { + pthread_t *pThd = (pthread_t*) malloc(sizeof(pthread_t)); assert(thd); - if( !pThd ) - { + if (!pThd) + { return XA_RESULT_MEMORY_FAILURE; - } - *thd = (XAImplThreadHandle)pThd; + } + *thd = (XAImplThreadHandle) pThd; return XA_RESULT_SUCCESS; -} + } -XAresult XAImpl_StartThread( XAImplThreadHandle thd, - void *thdattrib, XAImplThreadFunction thdfunc, void* thdfuncargs ) -{ - pthread_t *pThd = (pthread_t*)thd; +XAresult XAImpl_StartThread(XAImplThreadHandle thd, void *thdattrib, + XAImplThreadFunction thdfunc, void* thdfuncargs) + { + pthread_t *pThd = (pthread_t*) thd; assert(thd); - if ( pthread_create(pThd, thdattrib, thdfunc, thdfuncargs) ) - { + if (pthread_create(pThd, thdattrib, thdfunc, thdfuncargs)) + { return XA_RESULT_INTERNAL_ERROR; - } + } return XA_RESULT_SUCCESS; -} + } -void XAImpl_CancelThread( XAImplThreadHandle thd ) -{ -// int res; - // TL: TODO: There is no pthread_cancel API in S60, need to replace - //res = pthread_cancel(*pThd); - -} +void XAImpl_CancelThread(XAImplThreadHandle thd) + { + // int res; + // TL: TODO: There is no pthread_cancel API in S60, need to replace + //res = pthread_cancel(*pThd); + + } -void XAImpl_ExitThread( XAImplThreadHandle thd ) -{ +void XAImpl_ExitThread(XAImplThreadHandle thd) + { pthread_exit(NULL); -} + } -void XAImpl_DeleteThreadHandle( XAImplThreadHandle thd ) -{ - pthread_t *pThd = (pthread_t*)thd; - if( pThd ) +void XAImpl_DeleteThreadHandle(XAImplThreadHandle thd) { + pthread_t *pThd = (pthread_t*) thd; + if (pThd) + { free(pThd); + } } -} diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xaplatform.h --- a/khronosfws/openmax_al/src/common/xaplatform.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xaplatform.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Platform Specfic Header File + * + */ #ifndef XAPLATFORM_H #define XAPLATFORM_H @@ -28,33 +28,30 @@ typedef void* XAImplMutexHandle; typedef void* XAImplSemHandle; typedef void* XAImplThreadHandle; -typedef void* (* XAImplThreadFunction)( - void *xaThdFunAargs -); +typedef void* (* XAImplThreadFunction)(void *xaThdFunAargs); /** METHODS **/ /* mutex management */ -XAresult XAImpl_CreateMutex( XAImplMutexHandle *mtx ); -XAresult XAImpl_TryLockMutex( XAImplMutexHandle mtx ); -XAresult XAImpl_LockMutex( XAImplMutexHandle mtx ); -XAresult XAImpl_UnlockMutex( XAImplMutexHandle mtx ); -void XAImpl_DeleteMutex( XAImplMutexHandle mtx ); +XAresult XAImpl_CreateMutex(XAImplMutexHandle *mtx); +XAresult XAImpl_TryLockMutex(XAImplMutexHandle mtx); +XAresult XAImpl_LockMutex(XAImplMutexHandle mtx); +XAresult XAImpl_UnlockMutex(XAImplMutexHandle mtx); +void XAImpl_DeleteMutex(XAImplMutexHandle mtx); /* semaphores */ -XAresult XAImpl_CreateSemaphore( XAImplSemHandle *sem ); -XAresult XAImpl_WaitSemaphore( XAImplSemHandle sem ); -XAresult XAImpl_PostSemaphore( XAImplSemHandle sem ); -void XAImpl_DeleteSemaphore( XAImplSemHandle sem ); +XAresult XAImpl_CreateSemaphore(XAImplSemHandle *sem); +XAresult XAImpl_WaitSemaphore(XAImplSemHandle sem); +XAresult XAImpl_PostSemaphore(XAImplSemHandle sem); +void XAImpl_DeleteSemaphore(XAImplSemHandle sem); /* thread management */ -XAresult XAImpl_CreateThreadHandle( XAImplThreadHandle *thd ); -XAresult XAImpl_StartThread( XAImplThreadHandle thd, - void *thdattrib, - XAImplThreadFunction thdfunc, void *thdfuncargs ); -void XAImpl_CancelThread( XAImplThreadHandle thd ); -void XAImpl_ExitThread( XAImplThreadHandle thd ); -void XAImpl_DeleteThreadHandle( XAImplThreadHandle thd ); +XAresult XAImpl_CreateThreadHandle(XAImplThreadHandle *thd); +XAresult XAImpl_StartThread(XAImplThreadHandle thd, void *thdattrib, + XAImplThreadFunction thdfunc, void *thdfuncargs); +void XAImpl_CancelThread(XAImplThreadHandle thd); +void XAImpl_ExitThread(XAImplThreadHandle thd); +void XAImpl_DeleteThreadHandle(XAImplThreadHandle thd); #endif /* XAPLATFORM_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xastreaminformationitf.c --- a/khronosfws/openmax_al/src/common/xastreaminformationitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xastreaminformationitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,10 +1,19 @@ -/** - * src\common\XAStreamInformationItf.c - * Part of OpenMAX AL Implementation - * Copyright (c) 2009 Nokia Inc. +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * - * This file contains implementation of XAStreamInformationItf - **/ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Stream Information Interface Implementation + * + */ #include @@ -16,248 +25,223 @@ * Description: Validate interface pointer and cast it to implementation pointer. */ static XAStreamInformationItfImpl* GetImpl(XAStreamInformationItf self) -{ - if(self) { - XAStreamInformationItfImpl* impl = (XAStreamInformationItfImpl*)(*self); - if(impl && impl == impl->self) + if (self) { + XAStreamInformationItfImpl* impl = + (XAStreamInformationItfImpl*) (*self); + if (impl && impl == impl->self) + { return impl; + } } + return NULL; } - return NULL; -} /** * Base interface XAPlayItf implementation */ - XAresult XAStreamInformationItfImpl_QueryMediaContainerInformation( - XAStreamInformationItf self, - XAMediaContainerInformation * info) -{ + XAStreamInformationItf self, XAMediaContainerInformation * info) + { XAresult ret = XA_RESULT_SUCCESS; XAStreamInformationItfImpl* impl = GetImpl(self); DEBUG_API("->XAStreamInformationItfImpl_QueryMediaContainerInformation"); - if(!impl || !info) - { + if (!impl || !info || !impl->adapCtx) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) + if (impl->adapCtx->fwtype == FWMgrFWGST) { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryMediaContainerInformation"); return ret; - } + } ret = XAStreamInformationItfAdapt_QueryMediaContainerInformation( - impl->adapCtx, - &(info->containerType), - &(info->mediaDuration), - &(info->numStreams)); + impl->adapCtx, &(info->containerType), + &(info->mediaDuration), &(info->numStreams)); XAAdaptationBase_ThreadExit(impl->adapCtx); } else { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryMediaContainerInformation"); return ret; - } + } ret = XAStreamInformationItfAdaptMMF_QueryMediaContainerInformation( - impl->adapCtx, - &(info->containerType), - &(info->mediaDuration), - &(info->numStreams)); - XAAdaptationBase_ThreadExit(impl->adapCtx);; + impl->adapCtx, &(info->containerType), + &(info->mediaDuration), &(info->numStreams)); + XAAdaptationBase_ThreadExit(impl->adapCtx); + ; } DEBUG_API("-XAStreamInformationItfImpl_QueryStreamType"); - if(!impl || !domain || (streamIndex == 0)) - { + if (!impl || !domain || (streamIndex == 0) || !impl->adapCtx) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) + } + if (impl->adapCtx->fwtype == FWMgrFWGST) { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamType"); return ret; - } - - ret = XAStreamInformationItfAdapt_QueryStreamType( - impl->adapCtx, - streamIndex, - domain); - + } + + ret = XAStreamInformationItfAdapt_QueryStreamType(impl->adapCtx, + streamIndex, domain); + XAAdaptationBase_ThreadExit(impl->adapCtx); } else { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamType"); return ret; - } - - ret = XAStreamInformationItfAdaptMMF_QueryStreamType( - impl->adapCtx, - streamIndex, - domain); - - XAAdaptationBase_ThreadExit(impl->adapCtx);; - } - DEBUG_API("-adapCtx, + streamIndex, domain); + + XAAdaptationBase_ThreadExit(impl->adapCtx); + ; + }DEBUG_API("-XAStreamInformationItfImpl_QueryStreamInformation"); - if(!impl || !info || (streamIndex == 0)) - { + if (!impl || !info || (streamIndex == 0) || !impl->adapCtx) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) + if (impl->adapCtx->fwtype == FWMgrFWGST) { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamInformation"); return ret; - } - + } + ret = XAStreamInformationItfAdapt_QueryStreamInformation( - impl->adapCtx, - streamIndex, - info); - + impl->adapCtx, streamIndex, info); + XAAdaptationBase_ThreadExit(impl->adapCtx); } else { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamInformation"); return ret; - } - + } + ret = XAStreamInformationItfAdaptMMF_QueryStreamInformation( - impl->adapCtx, - streamIndex, - info); - - XAAdaptationBase_ThreadExit(impl->adapCtx);; + impl->adapCtx, streamIndex, info); + + XAAdaptationBase_ThreadExit(impl->adapCtx); + ; } DEBUG_API("-XAStreamInformationItfImpl_QueryStreamName"); - if(!impl || (streamIndex == 0) || !pNameSize) - { + if (!impl || (streamIndex == 0) || !pNameSize || !impl->adapCtx) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) + if (impl->adapCtx->fwtype == FWMgrFWGST) { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamName"); return ret; - } - - ret = XAStreamInformationItfAdapt_QueryStreamName( - impl->adapCtx, - streamIndex, - pNameSize, - pName); - + } + + ret = XAStreamInformationItfAdapt_QueryStreamName(impl->adapCtx, + streamIndex, pNameSize, pName); + XAAdaptationBase_ThreadExit(impl->adapCtx); } else { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamName"); return ret; - } - - ret = XAStreamInformationItfAdaptMMF_QueryStreamName( - impl->adapCtx, - streamIndex, - pNameSize, - pName); - - XAAdaptationBase_ThreadExit(impl->adapCtx);; - } - DEBUG_API("-adapCtx, + streamIndex, pNameSize, pName); + + XAAdaptationBase_ThreadExit(impl->adapCtx); + ; + }DEBUG_API("-XAStreamInformationItfImpl_RegisterStreamChangeCallback"); - if(!impl) - { + if (!impl) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("-callback = callback; @@ -266,116 +250,105 @@ DEBUG_API("-XAStreamInformationItfImpl_QueryActiveStreams"); - if(!impl || !numStreams) - { + if (!impl || !numStreams || !impl->adapCtx) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) - { + if (impl->adapCtx->fwtype == FWMgrFWGST) + { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams"); return ret; - } - - ret = XAStreamInformationItfAdapt_QueryActiveStreams( - impl->adapCtx, - numStreams, - activeStreams); - + } + + ret = XAStreamInformationItfAdapt_QueryActiveStreams(impl->adapCtx, + numStreams, activeStreams); + XAAdaptationBase_ThreadExit(impl->adapCtx); } else { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams"); return ret; - } - + } + ret = XAStreamInformationItfAdaptMMF_QueryActiveStreams( - impl->adapCtx, - numStreams, - activeStreams); - - XAAdaptationBase_ThreadExit(impl->adapCtx);; + impl->adapCtx, numStreams, activeStreams); + + XAAdaptationBase_ThreadExit(impl->adapCtx); + ; } DEBUG_API("-XAStreamInformationItfImpl_SetActiveStream"); - if(!impl) - { + if (!impl || !impl->adapCtx) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) - { + if (impl->adapCtx->fwtype == FWMgrFWGST) + { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_SetActiveStream"); return ret; - } - - ret = XAStreamInformationItfAdapt_SetActiveStream( - impl->adapCtx, - streamNum, - active, - commitNow); - + } + + ret = XAStreamInformationItfAdapt_SetActiveStream(impl->adapCtx, + streamNum, active, commitNow); + XAAdaptationBase_ThreadExit(impl->adapCtx); } else { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID ) - { + if (ret == XA_RESULT_PARAMETER_INVALID) + { DEBUG_API("<-XAStreamInformationItfImpl_SetActiveStream"); return ret; - } - - ret = XAStreamInformationItfAdaptMMF_SetActiveStream( - impl->adapCtx, - streamNum, - active, - commitNow); - - XAAdaptationBase_ThreadExit(impl->adapCtx);; + } + + ret = XAStreamInformationItfAdaptMMF_SetActiveStream(impl->adapCtx, + streamNum, active, commitNow); + + XAAdaptationBase_ThreadExit(impl->adapCtx); + ; } DEBUG_API("-XAStreamInformationItfImpl_Create"); - self = (XAStreamInformationItfImpl*)calloc(1,sizeof(XAStreamInformationItfImpl)); - if(self) - { + self = (XAStreamInformationItfImpl*) calloc(1, + sizeof(XAStreamInformationItfImpl)); + if (self) + { /* init itf default implementation */ - self->itf.QueryMediaContainerInformation = XAStreamInformationItfImpl_QueryMediaContainerInformation; - self->itf.QueryStreamType = XAStreamInformationItfImpl_QueryStreamType; - self->itf.QueryStreamInformation = XAStreamInformationItfImpl_QueryStreamInformation; - self->itf.QueryStreamName = XAStreamInformationItfImpl_QueryStreamName; - self->itf.RegisterStreamChangeCallback = XAStreamInformationItfImpl_RegisterStreamChangeCallback; - self->itf.QueryActiveStreams = XAStreamInformationItfImpl_QueryActiveStreams; - self->itf.SetActiveStream = XAStreamInformationItfImpl_SetActiveStream; + self->itf.QueryMediaContainerInformation + = XAStreamInformationItfImpl_QueryMediaContainerInformation; + self->itf.QueryStreamType + = XAStreamInformationItfImpl_QueryStreamType; + self->itf.QueryStreamInformation + = XAStreamInformationItfImpl_QueryStreamInformation; + self->itf.QueryStreamName + = XAStreamInformationItfImpl_QueryStreamName; + self->itf.RegisterStreamChangeCallback + = XAStreamInformationItfImpl_RegisterStreamChangeCallback; + self->itf.QueryActiveStreams + = XAStreamInformationItfImpl_QueryActiveStreams; + self->itf.SetActiveStream + = XAStreamInformationItfImpl_SetActiveStream; /* init variables */ self->cbPtrToSelf = NULL; @@ -409,21 +391,23 @@ self->adapCtx = adapCtx; self->self = self; - } + } DEBUG_API("<-XAStreamInformationItfImpl_Create"); return self; -} + } /* void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self) * Description: Free all resources reserved at XAStreamInformationItfImpl_Create */ void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self) -{ + { DEBUG_API("->XAStreamInformationItfImpl_Free"); assert(self==self->self); - free(self); + if(self) + { + free(self); + } DEBUG_API("<-XAStreamInformationItfImpl_Free"); -} + } - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xastreaminformationitf.h --- a/khronosfws/openmax_al/src/common/xastreaminformationitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xastreaminformationitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,11 +1,19 @@ -/** - * src\common\XAStreamInformationItf.h - * Part of OpenMAX AL Implementation - * Copyright (c) 2009 Nokia Inc. +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * - * This file contains specification of XAStreamInformationItf + * Initial Contributors: + * Nokia Corporation - initial contribution. * - **/ + * Contributors: + * + * Description: Stream Information Interface Header + * + */ #ifndef XASTREAMINFORMATIONITF_H #define XASTREAMINFORMATIONITF_H @@ -22,7 +30,7 @@ /** STRUCTURES **/ /* Definition of XAStreamInformationItf implementation */ typedef struct XAStreamInformationItfImpl_ -{ + { /* parent interface */ struct XAStreamInformationItf_ itf; /* pointer to self */ @@ -31,53 +39,43 @@ /*Adaptation variables*/ XAStreamInformationItf cbPtrToSelf; - xaStreamEventChangeCallback callback; + xaStreamEventChangeCallback callback; void *cbcontext; XAAdaptationBaseCtx *adapCtx; -} XAStreamInformationItfImpl; + } XAStreamInformationItfImpl; /** METHODS **/ /* Base interface XAStreamInformationItf implementation */ XAresult XAStreamInformationItfImpl_QueryMediaContainerInformation( - XAStreamInformationItf self, - XAMediaContainerInformation * info); + XAStreamInformationItf self, XAMediaContainerInformation * info); XAresult XAStreamInformationItfImpl_QueryStreamType( - XAStreamInformationItf self, - XAuint32 streamIndex, - XAuint32 *domain); + XAStreamInformationItf self, XAuint32 streamIndex, XAuint32 *domain); XAresult XAStreamInformationItfImpl_QueryStreamInformation( - XAStreamInformationItf self, - XAuint32 streamIndex, - void * info); + XAStreamInformationItf self, XAuint32 streamIndex, void * info); XAresult XAStreamInformationItfImpl_QueryStreamName( - XAStreamInformationItf self, - XAuint32 streamIndex, - XAuint16 * pNameSize, - XAchar * pName); + XAStreamInformationItf self, XAuint32 streamIndex, + XAuint16 * pNameSize, XAchar * pName); XAresult XAStreamInformationItfImpl_RegisterStreamChangeCallback( - XAStreamInformationItf self, - xaStreamEventChangeCallback callback, - void * pContext); + XAStreamInformationItf self, xaStreamEventChangeCallback callback, + void * pContext); XAresult XAStreamInformationItfImpl_QueryActiveStreams( - XAStreamInformationItf self, - XAuint32 *numStreams, - XAboolean *activeStreams); + XAStreamInformationItf self, XAuint32 *numStreams, + XAboolean *activeStreams); XAresult XAStreamInformationItfImpl_SetActiveStream( - XAStreamInformationItf self, - XAuint32 streamNum, - XAboolean active, - XAboolean commitNow); + XAStreamInformationItf self, XAuint32 streamNum, XAboolean active, + XAboolean commitNow); /* XAStreamInformationItfImpl -specific methods */ -XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create(XAAdaptationBaseCtx *adapCtx); +XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create( + XAAdaptationBaseCtx *adapCtx); void XAStreamInformationItfImpl_Free(XAStreamInformationItfImpl* self); #endif /* XASTREAMINFORMATIONITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xathreadsafety.c --- a/khronosfws/openmax_al/src/common/xathreadsafety.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xathreadsafety.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,28 +1,28 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Thread Safety Implementation + * + */ #include #include "xathreadsafety.h" typedef struct -{ + { XAImplMutexHandle mutexTable[XATSCount]; XAboolean tsEnabled; -}XAThreadSafetyImpl; + } XAThreadSafetyImpl; static XAThreadSafetyImpl* threadSafety; @@ -31,79 +31,78 @@ * Description: Creates mutex table for thread safety support * @return: Success value */ -XAresult XAThreadSafety_Init( XAboolean tsEnable ) -{ +XAresult XAThreadSafety_Init(XAboolean tsEnable) + { XAresult ret = XA_RESULT_SUCCESS; XAint32 i = 0; DEBUG_API_A1("->XAThreadSafety_Init - tsEnable:%lu",tsEnable); /* Initialize thread safety only once */ - if ( !threadSafety ) - { - threadSafety = (XAThreadSafetyImpl *)calloc(1,sizeof(XAThreadSafetyImpl)); - if ( !threadSafety ) + if (!threadSafety) { - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XAThreadSafety_Init"); + threadSafety = (XAThreadSafetyImpl *) calloc(1, + sizeof(XAThreadSafetyImpl)); + if (!threadSafety) + { + DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");DEBUG_API("<-XAThreadSafety_Init"); /* memory allocation failed */ return XA_RESULT_MEMORY_FAILURE; - } + } threadSafety->tsEnabled = tsEnable; - if ( tsEnable ) - { - for( i = 0; i < XATSCount; i++ ) + if (tsEnable) { - ret = XAImpl_CreateMutex( &threadSafety->mutexTable[i] ); - if ( ret != XA_RESULT_SUCCESS ) + for (i = 0; i < XATSCount; i++) { + ret = XAImpl_CreateMutex(&threadSafety->mutexTable[i]); + if (ret != XA_RESULT_SUCCESS) + { break; + }DEBUG_INFO_A2("Created %s:%x",MEDIAOBJECTNAME(i), threadSafety->mutexTable[i] ); } - DEBUG_INFO_A2("Created %s:%x",MEDIAOBJECTNAME(i), threadSafety->mutexTable[i] ); + } + else + { + DEBUG_INFO("Thread safety: disabled."); } } - else - { - DEBUG_INFO("Thread safety: disabled."); - } - } DEBUG_API("<-XAThreadSafety_Init"); return ret; -} + } /* * XAresult XAThreadSafety_Destroy() * Description: Destroys mutex table created for thread safety support */ XAresult XAThreadSafety_Destroy() -{ + { XAresult ret = XA_RESULT_SUCCESS; XAint32 i = 0; DEBUG_API("->XAThreadSafety_Destroy"); - if ( threadSafety ) - { - if ( threadSafety->tsEnabled ) + if (threadSafety) { - for( i = 0; i < XATSCount; i++ ) + if (threadSafety->tsEnabled) { + for (i = 0; i < XATSCount; i++) + { DEBUG_INFO_A2("Free %s:%x",MEDIAOBJECTNAME(i), threadSafety->mutexTable[i] ); - XAImpl_DeleteMutex( threadSafety->mutexTable[i] ); + XAImpl_DeleteMutex(threadSafety->mutexTable[i]); + } } + free(threadSafety); } - free( threadSafety); - } else - { + { DEBUG_INFO("Thread safety: disabled."); - } + } DEBUG_API("<-XAThreadSafety_Destroy"); return ret; -} + } /* * XAresult XAThreadSafety_Unlock( XAThreadSafetyMediaObjects mediaObject ) @@ -111,57 +110,56 @@ * @param XAThreadSafetyMediaObjects mediaObject * @return */ -XAresult XAThreadSafety_Unlock( XAThreadSafetyMediaObjects mediaObject ) -{ +XAresult XAThreadSafety_Unlock(XAThreadSafetyMediaObjects mediaObject) + { XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAThreadSafety_Unlock"); - if ( threadSafety ) - { - if ( threadSafety->tsEnabled ) + if (threadSafety) { - ret = XAImpl_UnlockMutex( threadSafety->mutexTable[mediaObject] ); - if ( ret == XA_RESULT_SUCCESS) + if (threadSafety->tsEnabled) { + ret = XAImpl_UnlockMutex(threadSafety->mutexTable[mediaObject]); + if (ret == XA_RESULT_SUCCESS) + { DEBUG_INFO_A2("Released lock for %s:%x",MEDIAOBJECTNAME(mediaObject), threadSafety->mutexTable[mediaObject] ); + } } } - } else - { + { DEBUG_INFO("Thread safety: disabled."); + }DEBUG_API("<-XAThreadSafety_Unlock"); + return ret; } - DEBUG_API("<-XAThreadSafety_Unlock"); - return ret; -} /* * XAresult XAThreadSafety_TryLock( XAThreadSafetyMediaObjects mediaObject ); * Description: * @param XAThreadSafetyMediaObjects mediaObject * @return */ -XAresult XAThreadSafety_TryLock( XAThreadSafetyMediaObjects mediaObject ) -{ +XAresult XAThreadSafety_TryLock(XAThreadSafetyMediaObjects mediaObject) + { XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAThreadSafety_TryLock"); - if ( threadSafety ) - { - if ( threadSafety->tsEnabled ) + if (threadSafety) { - ret = XAImpl_TryLockMutex( threadSafety->mutexTable[mediaObject]); - if ( ret == XA_RESULT_SUCCESS) + if (threadSafety->tsEnabled) { + ret = XAImpl_TryLockMutex(threadSafety->mutexTable[mediaObject]); + if (ret == XA_RESULT_SUCCESS) + { DEBUG_INFO_A2("Locked %s:%x",MEDIAOBJECTNAME(mediaObject), threadSafety->mutexTable[mediaObject] ); + } } } - } else - { + { DEBUG_INFO("Thread safety: disabled."); - } + } DEBUG_API("<-XAThreadSafety_TryLock"); return ret; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xathreadsafety.h --- a/khronosfws/openmax_al/src/common/xathreadsafety.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xathreadsafety.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Thread Safety Header + * + */ #ifndef XATHREADSAFETY_H_ #define XATHREADSAFETY_H_ @@ -26,17 +26,17 @@ /*parse media object names for debug prints*/ static const char* mediaobjectnames[9] = -{ - "XATSMediaPlayer", - "XATSMediaRecorder", - "XATSEngine", - "XATSRadio", - "XATSCamera", - "XATSOutputMix", - "XATSVibra", - "XATSLEDArray", - "XATSMetaDataExtractor" -}; + { + "XATSMediaPlayer", + "XATSMediaRecorder", + "XATSEngine", + "XATSRadio", + "XATSCamera", + "XATSOutputMix", + "XATSVibra", + "XATSLEDArray", + "XATSMetaDataExtractor" + }; #define MEDIAOBJECTNAME(i) ((i #include #include #include "xavolumeitf.h" - + #include "xavolumeitfadaptation.h" #include "xanokiavolumeextitfadaptationmmf.h" /** @@ -28,17 +28,17 @@ * Description: Validated interface pointer and cast it to implementations pointer. **/ static XAVolumeItfImpl* GetImpl(XAVolumeItf self) -{ - if(self) { - XAVolumeItfImpl* impl = (XAVolumeItfImpl*)(*self); - if(impl && impl == impl->self) + if (self) { + XAVolumeItfImpl* impl = (XAVolumeItfImpl*) (*self); + if (impl && impl == impl->self) + { return impl; + } } + return NULL; } - return NULL; -} /** * Base interface XAVolumeItf implementation @@ -49,7 +49,7 @@ * Description: Sets the object's volume level. **/ XAresult XAVolumeItfImpl_SetVolumeLevel(XAVolumeItf self, XAmillibel level) -{ + { XAVolumeItfImpl *impl = GetImpl(self); XAresult ret = XA_RESULT_SUCCESS; @@ -57,102 +57,105 @@ DEBUG_API("->XAVolumeItfImpl_SetVolumeLevel"); /* check maximum volume level */ - if(XAVolumeItfImpl_GetMaxVolumeLevel(self, &maximumLevel) != XA_RESULT_SUCCESS) - { + if (XAVolumeItfImpl_GetMaxVolumeLevel(self, &maximumLevel) + != XA_RESULT_SUCCESS) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); /* cannot solve maximum volume level */ return XA_RESULT_PARAMETER_INVALID; - } + } - if(!impl || level > maximumLevel) - { + if (!impl || level > maximumLevel || !impl->adapCtx) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { + if (ret == XA_RESULT_PARAMETER_INVALID || ret + == XA_RESULT_PRECONDITIONS_VIOLATED) + { DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); return ret; - } - if(impl->adapCtx->fwtype == FWMgrFWGST) + } + if (impl->adapCtx->fwtype == FWMgrFWGST) { - ret = XAVolumeItfAdapt_SetVolumeLevel((XAAdaptationGstCtx*)impl->adapCtx, level); + ret = XAVolumeItfAdapt_SetVolumeLevel( + (XAAdaptationGstCtx*) impl->adapCtx, level); } else { impl->volumeLevel = level; } - - if(ret == XA_RESULT_SUCCESS) - { + + if (ret == XA_RESULT_SUCCESS) + { impl->volumeLevel = level; - } + } XAAdaptationBase_ThreadExit(impl->adapCtx); DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); - return ret ; -} + return ret; + } /** * XAresult XAVolumeItfImpl_GetVolumeLevel(XAVolumeItf self, XAmillibel *pLevel) * Description: Gets the object’s volume level. **/ XAresult XAVolumeItfImpl_GetVolumeLevel(XAVolumeItf self, XAmillibel *pLevel) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XAVolumeItfImpl_GetVolumeLevel"); - if(!impl || !pLevel) - { + if (!impl || !pLevel) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_GetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pLevel = impl->volumeLevel; DEBUG_API("<-XAVolumeItfImpl_GetVolumeLevel"); return ret; -} + } /** * XAresult XAVolumeItfImpl_GetMaxVolumeLevel(XAVolumeItf self, XAmillibel *pMaxLevel) * Description: Gets the maximum supported level. **/ -XAresult XAVolumeItfImpl_GetMaxVolumeLevel(XAVolumeItf self, XAmillibel *pMaxLevel) -{ +XAresult XAVolumeItfImpl_GetMaxVolumeLevel(XAVolumeItf self, + XAmillibel *pMaxLevel) + { XAresult ret = XA_RESULT_SUCCESS; XAVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XAVolumeItfImpl_GetVolumeLevel"); - if(!impl || !pMaxLevel) - { + if (!impl || !pMaxLevel || !impl->adapCtx) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { + if (ret == XA_RESULT_PARAMETER_INVALID || ret + == XA_RESULT_PRECONDITIONS_VIOLATED) + { DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); return ret; - } - if(impl->adapCtx->fwtype == FWMgrFWGST) + } + if (impl->adapCtx->fwtype == FWMgrFWGST) { - ret = XAVolumeItfAdapt_GetMaxVolumeLevel((XAAdaptationGstCtx*)impl->adapCtx, - pMaxLevel); + ret = XAVolumeItfAdapt_GetMaxVolumeLevel( + (XAAdaptationGstCtx*) impl->adapCtx, pMaxLevel); } else { @@ -163,130 +166,133 @@ DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); return ret; -} + } /** * XAresult XAVolumeItfImpl_SetMute(XAVolumeItf self, XAboolean mute) * Description: Mutes or unmutes the object. **/ XAresult XAVolumeItfImpl_SetMute(XAVolumeItf self, XAboolean mute) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XAVolumeItfImpl_SetMute"); - if(!impl) - { + if (!impl || !impl->adapCtx) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_SetMute"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { + if (ret == XA_RESULT_PARAMETER_INVALID || ret + == XA_RESULT_PRECONDITIONS_VIOLATED) + { DEBUG_API("<-XAVolumeItfImpl_SetMute"); return ret; - } + } /* check is mute state changed */ - if(mute != impl->mute) - { - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (mute != impl->mute) + { + if (impl->adapCtx->fwtype == FWMgrFWMMF) { - ret = XANokiaVolumeExtItfAdapt_SetMute((XAAdaptationMMFCtx*)impl->adapCtx, mute); + ret = XANokiaVolumeExtItfAdapt_SetMute( + (XAAdaptationMMFCtx*) impl->adapCtx, mute); } else { - ret = XAVolumeItfAdapt_SetMute((XAAdaptationGstCtx*)impl->adapCtx, mute); + ret = XAVolumeItfAdapt_SetMute( + (XAAdaptationGstCtx*) impl->adapCtx, mute); } - if(ret == XA_RESULT_SUCCESS) - { + if (ret == XA_RESULT_SUCCESS) + { impl->mute = mute; + } } - } XAAdaptationBase_ThreadExit(impl->adapCtx); DEBUG_API("<-XAVolumeItfImpl_SetMute"); return ret; -} + } /** * XAresult XAVolumeItfImpl_GetMute(XAVolumeItf self, XAboolean *pMute) * Description: Retrieves the object's state. **/ XAresult XAVolumeItfImpl_GetMute(XAVolumeItf self, XAboolean *pMute) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XAVolumeItfImpl_GetMute"); - if(!impl || !pMute) - { + if (!impl || !pMute) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_GetMute"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pMute = impl->mute; DEBUG_API("<-XAVolumeItfImpl_GetMute"); return ret; -} + } /** * XAresult XAVolumeItfImpl_EnableStereoPosition(XAVolumeItf self, XAboolean enable) * Description: Enables or disables the stereo positioning effect. **/ -XAresult XAVolumeItfImpl_EnableStereoPosition(XAVolumeItf self, XAboolean enable) -{ +XAresult XAVolumeItfImpl_EnableStereoPosition(XAVolumeItf self, + XAboolean enable) + { XAresult ret = XA_RESULT_SUCCESS; XAVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XAVolumeItfImpl_EnableStereoPosition"); - if(!impl) - { + if (!impl || !impl->adapCtx) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_EnableStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { + if (ret == XA_RESULT_PARAMETER_INVALID || ret + == XA_RESULT_PRECONDITIONS_VIOLATED) + { DEBUG_API("<-XAVolumeItfImpl_EnableStereoPosition"); return ret; - } - /* Check is stereo position state changed */ - if(enable != impl->enableStereoPos) - { - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XAVolumeItfAdapt_EnableStereoPosition((XAAdaptationGstCtx*)impl->adapCtx, - enable); } - else + /* Check is stereo position state changed */ + if (enable != impl->enableStereoPos) { - ret = XANokiaVolumeExtItfAdapt_EnableStereoPosition((XAAdaptationMMFCtx*)impl->adapCtx, - enable); + if (impl->adapCtx->fwtype == FWMgrFWGST) + { + ret = XAVolumeItfAdapt_EnableStereoPosition( + (XAAdaptationGstCtx*) impl->adapCtx, enable); + } + else + { + ret = XANokiaVolumeExtItfAdapt_EnableStereoPosition( + (XAAdaptationMMFCtx*) impl->adapCtx, enable); + } + if (ret == XA_RESULT_SUCCESS) + { + impl->enableStereoPos = enable; + } } - if(ret == XA_RESULT_SUCCESS) - { - impl->enableStereoPos = enable; - } - } XAAdaptationBase_ThreadExit(impl->adapCtx); DEBUG_API("<-XAVolumeItfImpl_EnableStereoPosition"); return ret; -} + } /** * XAresult XAVolumeItfImpl_IsEnabledStereoPosition(XAVolumeItf self, @@ -294,25 +300,25 @@ * Description: Returns the enabled state of the stereo positioning effect. **/ XAresult XAVolumeItfImpl_IsEnabledStereoPosition(XAVolumeItf self, - XAboolean *pEnable) -{ + XAboolean *pEnable) + { XAresult ret = XA_RESULT_SUCCESS; XAVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XAVolumeItfImpl_IsEnabledStereoPosition"); - if(!impl || !pEnable) - { + if (!impl || !pEnable) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_IsEnabledStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pEnable = impl->enableStereoPos; DEBUG_API("<-XAVolumeItfImpl_IsEnabledStereoPosition"); return ret; -} + } /** * XAresult XAVolumeItfImpl_SetStereoPosition(XAVolumeItf self, @@ -320,50 +326,50 @@ * Description: Sets the stereo position of the object. **/ XAresult XAVolumeItfImpl_SetStereoPosition(XAVolumeItf self, - XApermille stereoPosition) -{ + XApermille stereoPosition) + { XAresult ret = XA_RESULT_SUCCESS; XAVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XAVolumeItfImpl_SetStereoPosition"); - if(!impl || (stereoPosition < STEREO_POSITION_LEFT) || - (stereoPosition > STEREO_POSITION_RIGHT)) - { + if (!impl || (stereoPosition < STEREO_POSITION_LEFT) || (stereoPosition + > STEREO_POSITION_RIGHT) || !impl->adapCtx) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_SetStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } impl->stereoPosition = stereoPosition; - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { + if (ret == XA_RESULT_PARAMETER_INVALID || ret + == XA_RESULT_PRECONDITIONS_VIOLATED) + { DEBUG_API("<-XAVolumeItfImpl_SetStereoPosition"); return ret; - } + } /* check is stereo position effect enabled if is then handle effect */ - if(impl->enableStereoPos) - { - if(impl->adapCtx->fwtype == FWMgrFWGST) + if (impl->enableStereoPos) { - ret = XAVolumeItfAdapt_SetStereoPosition((XAAdaptationGstCtx*)impl->adapCtx, - stereoPosition); + if (impl->adapCtx->fwtype == FWMgrFWGST) + { + ret = XAVolumeItfAdapt_SetStereoPosition( + (XAAdaptationGstCtx*) impl->adapCtx, stereoPosition); + } + else + { + ret = XANokiaVolumeExtItfAdapt_SetStereoPosition( + (XAAdaptationMMFCtx*) impl->adapCtx, stereoPosition); + } } - else - { - ret = XANokiaVolumeExtItfAdapt_SetStereoPosition((XAAdaptationMMFCtx*)impl->adapCtx, - stereoPosition); - } - } XAAdaptationBase_ThreadExit(impl->adapCtx); DEBUG_API("<-XAVolumeItfImpl_SetStereoPosition"); return ret; -} + } /** * XAresult XAVolumeItfImpl_GetStereoPosition(XAVolumeItf self, @@ -371,50 +377,50 @@ * Description: Gets the object’s stereo position setting. **/ XAresult XAVolumeItfImpl_GetStereoPosition(XAVolumeItf self, - XApermille *pStereoPosition) -{ + XApermille *pStereoPosition) + { XAresult ret = XA_RESULT_SUCCESS; XAVolumeItfImpl *impl = GetImpl(self); DEBUG_API("->XAVolumeItfImpl_GetStereoPosition"); - if(!impl || !pStereoPosition) - { + if (!impl || !pStereoPosition) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVolumeItfImpl_GetStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pStereoPosition = impl->stereoPosition; DEBUG_API("<-XAVolumeItfImpl_GetStereoPosition"); return ret; -} + } /** * XAVolumeItfImpl -specific methods **/ - /** * XAVolumeItfImpl* XAVolumeItfImpl_Create() * Description: Allocate and initialize VolumeItfImpl **/ -XAVolumeItfImpl* XAVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx ) -{ - XAVolumeItfImpl *self = (XAVolumeItfImpl*) - calloc(1,sizeof(XAVolumeItfImpl)); +XAVolumeItfImpl* XAVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx) + { + XAVolumeItfImpl *self = (XAVolumeItfImpl*) calloc(1, + sizeof(XAVolumeItfImpl)); DEBUG_API("->XAVolumeItfImpl_Create"); - if(self) - { + if (self) + { /* init itf default implementation */ self->itf.EnableStereoPosition = XAVolumeItfImpl_EnableStereoPosition; self->itf.GetMaxVolumeLevel = XAVolumeItfImpl_GetMaxVolumeLevel; self->itf.GetMute = XAVolumeItfImpl_GetMute; self->itf.GetStereoPosition = XAVolumeItfImpl_GetStereoPosition; self->itf.GetVolumeLevel = XAVolumeItfImpl_GetVolumeLevel; - self->itf.IsEnabledStereoPosition = XAVolumeItfImpl_IsEnabledStereoPosition; + self->itf.IsEnabledStereoPosition + = XAVolumeItfImpl_IsEnabledStereoPosition; self->itf.SetMute = XAVolumeItfImpl_SetMute; self->itf.SetStereoPosition = XAVolumeItfImpl_SetStereoPosition; self->itf.SetVolumeLevel = XAVolumeItfImpl_SetVolumeLevel; @@ -428,20 +434,20 @@ self->adapCtx = adapCtx; self->self = self; - } + } DEBUG_API("<-XAVolumeItfImpl_Create"); return self; -} + } /** * void XAVolumeItfImpl_Free(XAVolumeItfImpl* self) * Description: Free all resources reserved at XAVolumeItfImpl_Create **/ void XAVolumeItfImpl_Free(XAVolumeItfImpl* self) -{ + { DEBUG_API("->XAVolumeItfImpl_Free"); assert(self==self->self); free(self); DEBUG_API("<-XAVolumeItfImpl_Free"); -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/common/xavolumeitf.h --- a/khronosfws/openmax_al/src/common/xavolumeitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xavolumeitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Volume Interface Header + * + */ #ifndef XAVOLUMEITF_H #define XAVOLUMEITF_H @@ -29,7 +29,7 @@ /** STRUCTURES **/ /* Definition of XAVolumeItf implementation */ typedef struct XAVolumeItfImpl_ -{ + { /* parent interface */ struct XAVolumeItf_ itf; /* pointer to self */ @@ -41,7 +41,7 @@ XApermille stereoPosition; /*Adaptation variables*/ XAAdaptationBaseCtx *adapCtx; -} XAVolumeItfImpl; + } XAVolumeItfImpl; /** METHODS **/ @@ -50,21 +50,25 @@ XAresult XAVolumeItfImpl_GetVolumeLevel(XAVolumeItf self, XAmillibel *pLevel); -XAresult XAVolumeItfImpl_GetMaxVolumeLevel(XAVolumeItf self, XAmillibel *pMaxLevel); +XAresult XAVolumeItfImpl_GetMaxVolumeLevel(XAVolumeItf self, + XAmillibel *pMaxLevel); XAresult XAVolumeItfImpl_SetMute(XAVolumeItf self, XAboolean mute); XAresult XAVolumeItfImpl_GetMute(XAVolumeItf self, XAboolean *pMute); -XAresult XAVolumeItfImpl_EnableStereoPosition(XAVolumeItf self, XAboolean enable); +XAresult XAVolumeItfImpl_EnableStereoPosition(XAVolumeItf self, + XAboolean enable); -XAresult XAVolumeItfImpl_IsEnabledStereoPosition(XAVolumeItf self, XAboolean *pEnable); +XAresult XAVolumeItfImpl_IsEnabledStereoPosition(XAVolumeItf self, + XAboolean *pEnable); -XAresult XAVolumeItfImpl_SetStereoPosition(XAVolumeItf self, XApermille stereoPosition); +XAresult XAVolumeItfImpl_SetStereoPosition(XAVolumeItf self, + XApermille stereoPosition); -XAresult XAVolumeItfImpl_GetStereoPosition(XAVolumeItf self, XApermille *pStereoPosition); +XAresult XAVolumeItfImpl_GetStereoPosition(XAVolumeItf self, + XApermille *pStereoPosition); - /* XAVolumeItfImpl -specific methods */ XAVolumeItfImpl* XAVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx); void XAVolumeItfImpl_Free(XAVolumeItfImpl* self); diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Audio Encoder Capabilities Interface Implementation + * + */ #include #include @@ -27,18 +27,20 @@ /* XAAudioDecoderCapabilitiesItfImpl* GetImpl * Description: Validate interface pointer and cast it to implementation pointer. */ -static XAAudioDecoderCapabilitiesItfImpl* GetImpl(XAAudioDecoderCapabilitiesItf self) -{ - if( self ) +static XAAudioDecoderCapabilitiesItfImpl* GetImpl( + XAAudioDecoderCapabilitiesItf self) { - XAAudioDecoderCapabilitiesItfImpl* impl = (XAAudioDecoderCapabilitiesItfImpl*)(*self); - if( impl && (impl == impl->self) ) + if (self) { + XAAudioDecoderCapabilitiesItfImpl* impl = + (XAAudioDecoderCapabilitiesItfImpl*) (*self); + if (impl && (impl == impl->self)) + { return impl; + } } + return NULL; } - return NULL; -} /***************************************************************************** * Base interface XAAudioDecoderCapabilitiesItf implementation @@ -48,143 +50,149 @@ * Description: Retrieves the available audio decoders. */ XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders( - XAAudioDecoderCapabilitiesItf self, - XAuint32* pNumDecoders, - XAuint32* pDecoderIds) -{ + XAAudioDecoderCapabilitiesItf self, XAuint32* pNumDecoders, + XAuint32* pDecoderIds) + { XAAudioDecoderCapabilitiesItfImpl* impl = GetImpl(self); XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders"); - if( !impl || !pNumDecoders ) - { + if (!impl || !pNumDecoders) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; - } + } else - { - if( pDecoderIds ) - { /* query array of decoders */ - if( *pNumDecoders < impl->numCodecs ) - { + { + if (pDecoderIds) + { /* query array of decoders */ + if (*pNumDecoders < impl->numCodecs) + { DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); res = XA_RESULT_BUFFER_INSUFFICIENT; - } + } else - { - - XAuint32 i = 0; - XACapabilities temp; - for( i=0; inumCodecs; i++ ) { + + XAuint32 i = 0; + XACapabilities temp; + for (i = 0; i < impl->numCodecs; i++) + { /* query decoder id from adaptation using index value */ - XACapabilitiesMgr_GetCapsByIdx(NULL, (XACapsType)(XACAP_DECODER|XACAP_AUDIO), i, &temp); + XACapabilitiesMgr_GetCapsByIdx(NULL, + (XACapsType) (XACAP_DECODER | XACAP_AUDIO), i, + &temp); pDecoderIds[i] = temp.xaid; + } + } - } - } /* return number of decoders */ *pNumDecoders = impl->numCodecs; + }DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders"); + return res; } - DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders"); - return res; -} /* XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities * Description: Queries for the audio decoder�s capabilities. */ XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities( - XAAudioDecoderCapabilitiesItf self, - XAuint32 decoderId, - XAuint32* pIndex, - XAAudioCodecDescriptor* pDescriptor) -{ + XAAudioDecoderCapabilitiesItf self, XAuint32 decoderId, + XAuint32* pIndex, XAAudioCodecDescriptor* pDescriptor) + { XAAudioDecoderCapabilitiesItfImpl* impl = GetImpl(self); XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities"); - if( !impl || !pIndex ) - { + if (!impl || !pIndex) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; - } + } else - { - if( !pDescriptor ) - { /* query number of capa structures */ + { + if (!pDescriptor) + { /* query number of capa structures */ *pIndex = 1; - } + } else - { /* query capabilities */ - if( *pIndex >= 1 ) - { + { /* query capabilities */ + if (*pIndex >= 1) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; - } + } else - { - + { + /* query capabilities from adaptation using codec id */ XACapabilities temp; - memset(pDescriptor,0,sizeof(XAAudioCodecDescriptor)); - res = XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)(XACAP_DECODER|XACAP_AUDIO), decoderId, &temp); - if( res == XA_RESULT_SUCCESS ) - { - XAAudioCodecDescriptor* desc = ((XAAudioCodecDescriptor*)(temp.pEntry)); + memset(pDescriptor, 0, sizeof(XAAudioCodecDescriptor)); + res = XACapabilitiesMgr_GetCapsById(NULL, + (XACapsType) (XACAP_DECODER | XACAP_AUDIO), + decoderId, &temp); + if (res == XA_RESULT_SUCCESS) + { + XAAudioCodecDescriptor* desc = + ((XAAudioCodecDescriptor*) (temp.pEntry)); /* map applicable values to XAAudioCodecCapabilities */ pDescriptor->maxChannels = desc->maxChannels; - pDescriptor->minSampleRate= desc->minSampleRate*1000; /* milliHz */ + pDescriptor->minSampleRate = desc->minSampleRate * 1000; /* milliHz */ if (desc->maxSampleRate < (0xFFFFFFFF / 1000)) - { - pDescriptor->maxSampleRate = desc->maxSampleRate*1000; - } + { + pDescriptor->maxSampleRate = desc->maxSampleRate + * 1000; + } else - { + { pDescriptor->maxSampleRate = 0xFFFFFFFF; - } - pDescriptor->minBitsPerSample=desc->minBitsPerSample; - pDescriptor->maxBitsPerSample=desc->maxBitsPerSample; - pDescriptor->isFreqRangeContinuous=XA_BOOLEAN_TRUE; - pDescriptor->minBitRate=desc->minBitRate; - pDescriptor->maxBitRate=desc->maxBitRate; - pDescriptor->numBitratesSupported = desc->numBitratesSupported; - pDescriptor->isBitrateRangeContinuous=XA_BOOLEAN_TRUE; - if (temp.xaid == XA_AUDIOCODEC_PCM ) - { - pDescriptor->profileSetting=XA_AUDIOPROFILE_PCM; - pDescriptor->modeSetting=0; /* no chanmode for pcm defined */ + } + pDescriptor->minBitsPerSample = desc->minBitsPerSample; + pDescriptor->maxBitsPerSample = desc->maxBitsPerSample; + pDescriptor->isFreqRangeContinuous = XA_BOOLEAN_TRUE; + pDescriptor->minBitRate = desc->minBitRate; + pDescriptor->maxBitRate = desc->maxBitRate; + pDescriptor->numBitratesSupported + = desc->numBitratesSupported; + pDescriptor->isBitrateRangeContinuous = XA_BOOLEAN_TRUE; + if (temp.xaid == XA_AUDIOCODEC_PCM) + { + pDescriptor->profileSetting = XA_AUDIOPROFILE_PCM; + pDescriptor->modeSetting = 0; /* no chanmode for pcm defined */ + } + else if (temp.xaid == XA_ADAPTID_VORBIS) /* for ogg */ + { + if (desc->maxChannels == 1) + { + pDescriptor->profileSetting + =XA_AUDIOPROFILE_MPEG1_L3; + pDescriptor->modeSetting + =XA_AUDIOCHANMODE_MP3_MONO; + } + else + { + pDescriptor->profileSetting + =XA_AUDIOPROFILE_MPEG2_L3; + pDescriptor->modeSetting + =XA_AUDIOCHANMODE_MP3_STEREO; + } + } + else + { + /* do nothing */ + } + /*other caps undefined*/ } - else if (temp.xaid == XA_ADAPTID_VORBIS) /* for ogg */ - { - if (desc->maxChannels == 1) - { - pDescriptor->profileSetting=XA_AUDIOPROFILE_MPEG1_L3; - pDescriptor->modeSetting=XA_AUDIOCHANMODE_MP3_MONO; - } - else - { - pDescriptor->profileSetting=XA_AUDIOPROFILE_MPEG2_L3; - pDescriptor->modeSetting=XA_AUDIOCHANMODE_MP3_STEREO; - } - } - else - { - /* do nothing */ - } - /*other caps undefined*/ + } - } } - } DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities"); return res; -} - + } /***************************************************************************** * XAAudioDecoderCapabilitiesItfImpl -specific methods @@ -194,38 +202,39 @@ * Description: Allocate and initialize XAAudioDecoderCapabilitiesItfImpl */ XAAudioDecoderCapabilitiesItfImpl* XAAudioDecoderCapabilitiesItfImpl_Create() -{ - XAAudioDecoderCapabilitiesItfImpl* self = (XAAudioDecoderCapabilitiesItfImpl*) - calloc(1,sizeof(XAAudioDecoderCapabilitiesItfImpl)); + { + XAAudioDecoderCapabilitiesItfImpl* self = + (XAAudioDecoderCapabilitiesItfImpl*) calloc(1, + sizeof(XAAudioDecoderCapabilitiesItfImpl)); DEBUG_API("->XAAudioDecoderCapabilitiesItfImpl_Create"); - if( self ) - { + if (self) + { /* init itf default implementation */ - self->itf.GetAudioDecoders = - XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders; - self->itf.GetAudioDecoderCapabilities = - XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities; + self->itf.GetAudioDecoders + = XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders; + self->itf.GetAudioDecoderCapabilities + = XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities; /* init variables */ - + assert( XACapabilitiesMgr_GetCapsCount(NULL, (XACapsType)(XACAP_DECODER|XACAP_AUDIO), - &(self->numCodecs) ) == XA_RESULT_SUCCESS ); + &(self->numCodecs) ) == XA_RESULT_SUCCESS ); self->self = self; + }DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_Create"); + return self; } - DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_Create"); - return self; -} /* void XAAudioDecoderCapabilitiesItfImpl_Free * Description: Free all resources reserved at XAAudioDecoderCapabilitiesItfImpl_Create */ -void XAAudioDecoderCapabilitiesItfImpl_Free(XAAudioDecoderCapabilitiesItfImpl* self) -{ +void XAAudioDecoderCapabilitiesItfImpl_Free( + XAAudioDecoderCapabilitiesItfImpl* self) + { DEBUG_API("->XAAudioDecoderCapabilitiesItfImpl_Free"); assert(self==self->self); free(self); DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_Free"); -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.h --- a/khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Audio Encoder Itf Header + * + */ #ifndef XAAUDIODECODERCAPABILITIESITF_H #define XAAUDIODECODERCAPABILITIESITF_H @@ -30,29 +30,28 @@ /** STRUCTURES **/ /* Definition of XAAudioDecoderCapabilitiesItf implementation */ typedef struct XAAudioDecoderCapabilitiesItfImpl_ -{ + { /* parent interface */ struct XAAudioDecoderCapabilitiesItf_ itf; /* pointer to self */ struct XAAudioDecoderCapabilitiesItfImpl_* self; /* variables */ XAuint32 numCodecs; -} XAAudioDecoderCapabilitiesItfImpl; + } XAAudioDecoderCapabilitiesItfImpl; /* Base interface XAAudioDecoderCapabilitiesItf implementation */ XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders( - XAAudioDecoderCapabilitiesItf self, - XAuint32* pNumDecoders, - XAuint32* pDecoderIds); + XAAudioDecoderCapabilitiesItf self, XAuint32* pNumDecoders, + XAuint32* pDecoderIds); XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities( - XAAudioDecoderCapabilitiesItf self, - XAuint32 decoderId, - XAuint32* pIndex, - XAAudioCodecDescriptor* pDescriptor); + XAAudioDecoderCapabilitiesItf self, XAuint32 decoderId, + XAuint32* pIndex, XAAudioCodecDescriptor* pDescriptor); /* XAAudioDecoderCapabilitiesItfImpl -specific methods */ -XAAudioDecoderCapabilitiesItfImpl* XAAudioDecoderCapabilitiesItfImpl_Create(void); -void XAAudioDecoderCapabilitiesItfImpl_Free(XAAudioDecoderCapabilitiesItfImpl* self); +XAAudioDecoderCapabilitiesItfImpl* XAAudioDecoderCapabilitiesItfImpl_Create( + void); +void XAAudioDecoderCapabilitiesItfImpl_Free( + XAAudioDecoderCapabilitiesItfImpl* self); #endif /* XAAUDIODECODERCAPABILITIESITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaaudioencodercapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xaaudioencodercapabilitiesitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaaudioencodercapabilitiesitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Audio Encoder capabilities Itf Implementation + * + */ #include #include @@ -28,18 +28,20 @@ /* XAAudioEncoderCapabilitiesItfImpl* GetImpl * Description: Validate interface pointer and cast it to implementation pointer. */ -static XAAudioEncoderCapabilitiesItfImpl* GetImpl(XAAudioEncoderCapabilitiesItf self) -{ - if( self ) +static XAAudioEncoderCapabilitiesItfImpl* GetImpl( + XAAudioEncoderCapabilitiesItf self) { - XAAudioEncoderCapabilitiesItfImpl* impl = (XAAudioEncoderCapabilitiesItfImpl*)(*self); - if( impl && (impl == impl->self) ) + if (self) { + XAAudioEncoderCapabilitiesItfImpl* impl = + (XAAudioEncoderCapabilitiesItfImpl*) (*self); + if (impl && (impl == impl->self)) + { return impl; + } } + return NULL; } - return NULL; -} /***************************************************************************** * Base interface XAAudioEncoderCapabilitiesItf implementation @@ -49,66 +51,63 @@ * Description: Retrieves the available audio encoders. */ XAresult XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoders( - XAAudioEncoderCapabilitiesItf self, - XAuint32* pNumEncoders, - XAuint32* pEncoderIds) -{ + XAAudioEncoderCapabilitiesItf self, XAuint32* pNumEncoders, + XAuint32* pEncoderIds) + { XAAudioEncoderCapabilitiesItfImpl* impl = GetImpl(self); XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoders"); - - if( !impl || !pNumEncoders ) - { + + if (!impl || !pNumEncoders) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; - } + } else - { - if( pEncoderIds ) - { /* query array of encoders */ - if( *pNumEncoders < impl->numCodecs ) - { + { + if (pEncoderIds) + { /* query array of encoders */ + if (*pNumEncoders < impl->numCodecs) + { DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); res = XA_RESULT_BUFFER_INSUFFICIENT; - } + } else - { - + { + XAuint32 i = 0; XACapabilities temp; - for( i=0; inumCodecs; i++ ) - { + for (i = 0; i < impl->numCodecs; i++) + { /* query encoder id from adaptation using index value */ - XACapabilitiesMgr_GetCapsByIdx(impl->capslist, (XACapsType)(XACAP_ENCODER|XACAP_AUDIO), i, &temp); + XACapabilitiesMgr_GetCapsByIdx(impl->capslist, + (XACapsType) (XACAP_ENCODER | XACAP_AUDIO), i, + &temp); pEncoderIds[i] = temp.xaid; - } + } - pEncoderIds[0] = XA_AUDIOCODEC_AMR; - pEncoderIds[1] = XA_AUDIOCODEC_AAC; - pEncoderIds[2] = XA_AUDIOCODEC_PCM; + pEncoderIds[0] = XA_AUDIOCODEC_AMR; + pEncoderIds[1] = XA_AUDIOCODEC_AAC; + pEncoderIds[2] = XA_AUDIOCODEC_PCM; + } } - } - /* return number of encoders */ - *pNumEncoders = impl->numCodecs; + /* return number of encoders */ + *pNumEncoders = impl->numCodecs; + }DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoders"); + return res; } - DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoders"); - return res; -} /* XAresult XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoderCapabilities * Description: Queries for the audio encoders capabilities. */ XAresult XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoderCapabilities( - XAAudioEncoderCapabilitiesItf self, - XAuint32 encoderId, - XAuint32 *pIndex, - XAAudioCodecDescriptor *pDescriptor) -{ + XAAudioEncoderCapabilitiesItf self, XAuint32 encoderId, + XAuint32 *pIndex, XAAudioCodecDescriptor *pDescriptor) + { XAAudioEncoderCapabilitiesItfImpl* impl = GetImpl(self); XAresult res = XA_RESULT_SUCCESS; - XACapabilities temp; DEBUG_API("->XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoderCapabilities"); @@ -117,27 +116,27 @@ /*Removing the pDescriptor because the client can pass * it as NULL to query the pIndex for number of Codec/Mode * pair capabilities for each encoder */ - if( !impl || !pIndex ) - { + if (!impl || !pIndex) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; return res; - } + } else - { - *pIndex = 1; - if(!pDescriptor) + { + *pIndex = 1; + if (!pDescriptor) { return res; } - } - - /* query capabilities from adaptation using codec id */ - memset(pDescriptor,0,sizeof(XAAudioCodecDescriptor)); - + } + + /* query capabilities from adaptation using codec id */ + memset(pDescriptor, 0, sizeof(XAAudioCodecDescriptor)); + switch (encoderId) { - case XA_AUDIOCODEC_AMR: + case XA_AUDIOCODEC_AMR: { impl->sampleRateArray[0] = 8000000; @@ -147,27 +146,29 @@ impl->bitRateArray[3] = 6700; impl->bitRateArray[4] = 7400; impl->bitRateArray[5] = 7950; - impl->bitRateArray[6] = 10200; + impl->bitRateArray[6] = 10200; impl->bitRateArray[7] = 12200; pDescriptor->maxChannels = 1; pDescriptor->minBitsPerSample = 8; pDescriptor->maxBitsPerSample = 8; - pDescriptor->minSampleRate = 8000000; /*milliHz*/ + pDescriptor->minSampleRate = 8000000; /*milliHz*/ pDescriptor->maxSampleRate = 8000000; - pDescriptor->isFreqRangeContinuous=XA_BOOLEAN_FALSE; - pDescriptor->pSampleRatesSupported = (XAmilliHertz*)(&(impl->sampleRateArray)); + pDescriptor->isFreqRangeContinuous = XA_BOOLEAN_FALSE; + pDescriptor->pSampleRatesSupported + = (XAmilliHertz*) (&(impl->sampleRateArray)); pDescriptor->numSampleRatesSupported = 1; - pDescriptor->minBitRate=4750; - pDescriptor->maxBitRate=12200; - pDescriptor->isBitrateRangeContinuous=XA_BOOLEAN_FALSE; - pDescriptor->pBitratesSupported = (XAuint32*)(&(impl->bitRateArray)); + pDescriptor->minBitRate = 4750; + pDescriptor->maxBitRate = 12200; + pDescriptor->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; + pDescriptor->pBitratesSupported + = (XAuint32*) (&(impl->bitRateArray)); pDescriptor->numBitratesSupported = 8; pDescriptor->profileSetting = XA_AUDIOPROFILE_AMR; pDescriptor->modeSetting = 0; } break; - case XA_AUDIOCODEC_AAC: + case XA_AUDIOCODEC_AAC: { impl->sampleRateArray[0] = 8000000; impl->sampleRateArray[1] = 11025000; @@ -183,27 +184,29 @@ impl->bitRateArray[3] = 128000; impl->bitRateArray[4] = 160000; impl->bitRateArray[5] = 192000; - impl->bitRateArray[6] = 224000; - impl->bitRateArray[7] = 256000; - + impl->bitRateArray[6] = 224000; + impl->bitRateArray[7] = 256000; + pDescriptor->maxChannels = 2; pDescriptor->minBitsPerSample = 16; pDescriptor->maxBitsPerSample = 16; - pDescriptor->minSampleRate = 8000*1000; /*milliHz*/ + pDescriptor->minSampleRate = 8000 * 1000; /*milliHz*/ pDescriptor->maxSampleRate = 48000 * 1000; - pDescriptor->isFreqRangeContinuous=XA_BOOLEAN_FALSE; - pDescriptor->pSampleRatesSupported = (XAmilliHertz*)(&(impl->sampleRateArray)); + pDescriptor->isFreqRangeContinuous = XA_BOOLEAN_FALSE; + pDescriptor->pSampleRatesSupported + = (XAmilliHertz*) (&(impl->sampleRateArray)); pDescriptor->numSampleRatesSupported = 7; - pDescriptor->minBitRate=32000; - pDescriptor->maxBitRate=256000; - pDescriptor->isBitrateRangeContinuous=XA_BOOLEAN_FALSE; - pDescriptor->pBitratesSupported = (XAuint32*)(&(impl->bitRateArray)); + pDescriptor->minBitRate = 32000; + pDescriptor->maxBitRate = 256000; + pDescriptor->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; + pDescriptor->pBitratesSupported + = (XAuint32*) (&(impl->bitRateArray)); pDescriptor->numBitratesSupported = 8; pDescriptor->profileSetting = XA_AUDIOPROFILE_AAC_AAC; pDescriptor->modeSetting = XA_AUDIOMODE_AAC_LC; } break; - case XA_AUDIOCODEC_PCM: + case XA_AUDIOCODEC_PCM: { impl->sampleRateArray[0] = 12000000; impl->sampleRateArray[1] = 16000000; @@ -219,75 +222,75 @@ pDescriptor->maxChannels = 2; pDescriptor->minBitsPerSample = 16; pDescriptor->maxBitsPerSample = 16; - pDescriptor->minSampleRate = 8000000; /*milliHz*/ + pDescriptor->minSampleRate = 8000000; /*milliHz*/ pDescriptor->maxSampleRate = 96000000; - pDescriptor->isFreqRangeContinuous=XA_BOOLEAN_FALSE; - pDescriptor->pSampleRatesSupported = (XAmilliHertz*)(&(impl->sampleRateArray)); + pDescriptor->isFreqRangeContinuous = XA_BOOLEAN_FALSE; + pDescriptor->pSampleRatesSupported + = (XAmilliHertz*) (&(impl->sampleRateArray)); pDescriptor->numSampleRatesSupported = 10; - pDescriptor->minBitRate= 0; - pDescriptor->maxBitRate= 0; - pDescriptor->isBitrateRangeContinuous=XA_BOOLEAN_FALSE; + pDescriptor->minBitRate = 0; + pDescriptor->maxBitRate = 0; + pDescriptor->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; pDescriptor->pBitratesSupported = NULL; pDescriptor->numBitratesSupported = 0; - pDescriptor->profileSetting = XA_AUDIOPROFILE_PCM ; - pDescriptor->modeSetting = 0; + pDescriptor->profileSetting = XA_AUDIOPROFILE_PCM; + pDescriptor->modeSetting = 0; } break; } - - - - res = XACapabilitiesMgr_GetCapsById(impl->capslist, (XACapsType)(XACAP_ENCODER|XACAP_AUDIO), encoderId, &temp); - if( res == XA_RESULT_SUCCESS ) - { - XAAudioCodecDescriptor* desc = ((XAAudioCodecDescriptor*)(temp.pEntry)); - /* map applicable values to XAAudioCodecCapabilities */ - pDescriptor->maxChannels = desc->maxChannels; - pDescriptor->minSampleRate= desc->minSampleRate*1000; /* milliHz */ - if (desc->maxSampleRate < (0xFFFFFFFF / 1000)) - { - pDescriptor->maxSampleRate = desc->maxSampleRate*1000; - } - else - { - pDescriptor->maxSampleRate = 0xFFFFFFFF; - } - pDescriptor->minBitsPerSample=desc->minBitsPerSample; - pDescriptor->maxBitsPerSample=desc->maxBitsPerSample; - pDescriptor->isFreqRangeContinuous=XA_BOOLEAN_TRUE; - pDescriptor->minBitRate=desc->minBitRate; - pDescriptor->maxBitRate=desc->maxBitRate; - pDescriptor->numBitratesSupported = desc->numBitratesSupported; - pDescriptor->isBitrateRangeContinuous=XA_BOOLEAN_TRUE; - if (temp.xaid == XA_AUDIOCODEC_PCM ) - { - pDescriptor->profileSetting=XA_AUDIOPROFILE_PCM; - pDescriptor->modeSetting=0; /* no chanmode for pcm defined */ - } - else if (temp.xaid == XA_ADAPTID_VORBIS) /* for ogg */ - { - if (desc->maxChannels == 1) - { - pDescriptor->profileSetting=XA_AUDIOPROFILE_MPEG1_L3; - pDescriptor->modeSetting=XA_AUDIOCHANMODE_MP3_MONO; - } - else - { - pDescriptor->profileSetting=XA_AUDIOPROFILE_MPEG2_L3; - pDescriptor->modeSetting=XA_AUDIOCHANMODE_MP3_STEREO; - } - } - else - { - /* do nothing */ - } - - } - + + res = XACapabilitiesMgr_GetCapsById(impl->capslist, + (XACapsType) (XACAP_ENCODER | XACAP_AUDIO), encoderId, &temp); + if (res == XA_RESULT_SUCCESS) + { + XAAudioCodecDescriptor* desc = + ((XAAudioCodecDescriptor*) (temp.pEntry)); + /* map applicable values to XAAudioCodecCapabilities */ + pDescriptor->maxChannels = desc->maxChannels; + pDescriptor->minSampleRate = desc->minSampleRate * 1000; /* milliHz */ + if (desc->maxSampleRate < (0xFFFFFFFF / 1000)) + { + pDescriptor->maxSampleRate = desc->maxSampleRate * 1000; + } + else + { + pDescriptor->maxSampleRate = 0xFFFFFFFF; + } + pDescriptor->minBitsPerSample = desc->minBitsPerSample; + pDescriptor->maxBitsPerSample = desc->maxBitsPerSample; + pDescriptor->isFreqRangeContinuous = XA_BOOLEAN_TRUE; + pDescriptor->minBitRate = desc->minBitRate; + pDescriptor->maxBitRate = desc->maxBitRate; + pDescriptor->numBitratesSupported = desc->numBitratesSupported; + pDescriptor->isBitrateRangeContinuous = XA_BOOLEAN_TRUE; + if (temp.xaid == XA_AUDIOCODEC_PCM) + { + pDescriptor->profileSetting = XA_AUDIOPROFILE_PCM; + pDescriptor->modeSetting = 0; /* no chanmode for pcm defined */ + } + else if (temp.xaid == XA_ADAPTID_VORBIS) /* for ogg */ + { + if (desc->maxChannels == 1) + { + pDescriptor->profileSetting = XA_AUDIOPROFILE_MPEG1_L3; + pDescriptor->modeSetting = XA_AUDIOCHANMODE_MP3_MONO; + } + else + { + pDescriptor->profileSetting = XA_AUDIOPROFILE_MPEG2_L3; + pDescriptor->modeSetting = XA_AUDIOCHANMODE_MP3_STEREO; + } + } + else + { + /* do nothing */ + } + + } + DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoderCapabilities"); return res; -} - + } /***************************************************************************** * XAAudioEncoderCapabilitiesItfImpl -specific methods @@ -296,42 +299,44 @@ /* XAAudioEncoderCapabilitiesItfImpl_Create * Description: Allocate and initialize XAAudioEncoderCapabilitiesItfImpl */ -XAAudioEncoderCapabilitiesItfImpl* XAAudioEncoderCapabilitiesItfImpl_Create(XACapabilities* caps) -{ - XAAudioEncoderCapabilitiesItfImpl* self = (XAAudioEncoderCapabilitiesItfImpl*) - calloc(1,sizeof(XAAudioEncoderCapabilitiesItfImpl)); +XAAudioEncoderCapabilitiesItfImpl* XAAudioEncoderCapabilitiesItfImpl_Create( + XACapabilities* caps) + { + XAAudioEncoderCapabilitiesItfImpl* self = + (XAAudioEncoderCapabilitiesItfImpl*) calloc(1, + sizeof(XAAudioEncoderCapabilitiesItfImpl)); DEBUG_API("->XAAudioEncoderCapabilitiesItfImpl_Create"); - if( self ) - { + if (self) + { /* init itf default implementation */ - self->itf.GetAudioEncoders = - XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoders; - self->itf.GetAudioEncoderCapabilities = - XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoderCapabilities; + self->itf.GetAudioEncoders + = XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoders; + self->itf.GetAudioEncoderCapabilities + = XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoderCapabilities; self->capslist = caps; - + /* init variables */ assert( XACapabilitiesMgr_GetCapsCount( caps, (XACapsType)((XACapsType)(XACAP_ENCODER|XACAP_AUDIO)), - &(self->numCodecs) ) == XA_RESULT_SUCCESS ); + &(self->numCodecs) ) == XA_RESULT_SUCCESS ); /*self->mmfEngine = (void*)mmf_capability_engine_init();*/ self->numCodecs = 3; self->self = self; - + + }DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_Create"); + return self; } - DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_Create"); - return self; -} /* void XAAudioEncoderCapabilitiesItfImpl_Free * Description: Free all resources reserved at XAAudioEncoderCapabilitiesItfImpl_Create */ -void XAAudioEncoderCapabilitiesItfImpl_Free(XAAudioEncoderCapabilitiesItfImpl* self) -{ +void XAAudioEncoderCapabilitiesItfImpl_Free( + XAAudioEncoderCapabilitiesItfImpl* self) + { DEBUG_API("->XAAudioEncoderCapabilitiesItfImpl_Free"); assert(self==self->self); free(self); DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_Free"); -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaaudioencodercapabilitiesitf.h --- a/khronosfws/openmax_al/src/engine/xaaudioencodercapabilitiesitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaaudioencodercapabilitiesitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Audio Encoder capabilities Itf Header + * + */ #ifndef XAAUDIOENCODERCAPABILITIESITF_H #define XAAUDIOENCODERCAPABILITIESITF_H @@ -30,7 +30,7 @@ /** STRUCTURES **/ /* Definition of XAAudioEncoderCapabilitiesItf implementation */ typedef struct XAAudioEncoderCapabilitiesItfImpl_ -{ + { /* parent interface */ struct XAAudioEncoderCapabilitiesItf_ itf; /* pointer to self */ @@ -41,22 +41,21 @@ XAuint32 bitRateArray[10]; void* mmfEngine; XACapabilities* capslist; -} XAAudioEncoderCapabilitiesItfImpl; + } XAAudioEncoderCapabilitiesItfImpl; /* Base interface XAAudioEncoderCapabilitiesItf implementation */ XAresult XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoders( - XAAudioEncoderCapabilitiesItf self, - XAuint32* pNumEncoders, - XAuint32* pEncoderIds); + XAAudioEncoderCapabilitiesItf self, XAuint32* pNumEncoders, + XAuint32* pEncoderIds); XAresult XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoderCapabilities( - XAAudioEncoderCapabilitiesItf self, - XAuint32 encoderId, - XAuint32* pIndex, - XAAudioCodecDescriptor* pCapabilities); + XAAudioEncoderCapabilitiesItf self, XAuint32 encoderId, + XAuint32* pIndex, XAAudioCodecDescriptor* pCapabilities); /* XAAudioEncoderCapabilitiesItfImpl -specific methods */ -XAAudioEncoderCapabilitiesItfImpl* XAAudioEncoderCapabilitiesItfImpl_Create(XACapabilities* caps); -void XAAudioEncoderCapabilitiesItfImpl_Free(XAAudioEncoderCapabilitiesItfImpl* self); +XAAudioEncoderCapabilitiesItfImpl* XAAudioEncoderCapabilitiesItfImpl_Create( + XACapabilities* caps); +void XAAudioEncoderCapabilitiesItfImpl_Free( + XAAudioEncoderCapabilitiesItfImpl* self); #endif /* XAAUDIOENCODERCAPABILITIESITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaaudioiodevicecapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xaaudioiodevicecapabilitiesitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaaudioiodevicecapabilitiesitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Audio IO Device capabilities Itf * */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaaudioiodevicecapabilitiesitf.h --- a/khronosfws/openmax_al/src/engine/xaaudioiodevicecapabilitiesitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaaudioiodevicecapabilitiesitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Audio IO Device capabilities Itf + * + */ #ifndef XAAUDIOIODEVICECAPABILITIESITF_H #define XAAUDIOIODEVICECAPABILITIESITF_H @@ -30,7 +30,7 @@ /** STRUCTURES **/ /* Definition of XAAudioIODeviceCapabilitiesItf implementation */ typedef struct XAAudIODevCapaItfImpl_ -{ + { /* parent interface */ struct XAAudioIODeviceCapabilitiesItf_ itf; /* pointer to self */ @@ -51,58 +51,54 @@ XAuint32 numOutputDevices; XAmilliHertz sampleRateArray[12]; XACapabilities* capslist; - -} XAAudIODevCapaItfImpl; + + } XAAudIODevCapaItfImpl; /* Base interface XAAudioIODeviceCapabilitiesItf implementation */ -XAresult XAAudIODevCapaItfImpl_GetAvailableAudioInputs(XAAudioIODeviceCapabilitiesItf self, - XAint32* pNumInputs, - XAuint32* pInputDeviceIDs); +XAresult XAAudIODevCapaItfImpl_GetAvailableAudioInputs( + XAAudioIODeviceCapabilitiesItf self, XAint32* pNumInputs, + XAuint32* pInputDeviceIDs); -XAresult XAAudIODevCapaItfImpl_QueryAudioInputCapabilities(XAAudioIODeviceCapabilitiesItf self, - XAuint32 deviceId, - XAAudioInputDescriptor* pDescriptor); - -XAresult XAAudIODevCapaItfImpl_RegisterAvailableAudioInputsChangedCallback(XAAudioIODeviceCapabilitiesItf self, - xaAvailableAudioInputsChangedCallback callback, - void* pContext); +XAresult XAAudIODevCapaItfImpl_QueryAudioInputCapabilities( + XAAudioIODeviceCapabilitiesItf self, XAuint32 deviceId, + XAAudioInputDescriptor* pDescriptor); -XAresult XAAudIODevCapaItfImpl_GetAvailableAudioOutputs(XAAudioIODeviceCapabilitiesItf self, - XAint32* pNumOutputs, - XAuint32* pOutputDeviceIDs); +XAresult XAAudIODevCapaItfImpl_RegisterAvailableAudioInputsChangedCallback( + XAAudioIODeviceCapabilitiesItf self, + xaAvailableAudioInputsChangedCallback callback, void* pContext); -XAresult XAAudIODevCapaItfImpl_QueryAudioOutputCapabilities(XAAudioIODeviceCapabilitiesItf self, - XAuint32 deviceId, - XAAudioOutputDescriptor* pDescriptor); +XAresult XAAudIODevCapaItfImpl_GetAvailableAudioOutputs( + XAAudioIODeviceCapabilitiesItf self, XAint32* pNumOutputs, + XAuint32* pOutputDeviceIDs); -XAresult XAAudIODevCapaItfImpl_RegisterAvailableAudioOutputsChangedCallback(XAAudioIODeviceCapabilitiesItf self, - xaAvailableAudioOutputsChangedCallback callback, - void* pContext); +XAresult XAAudIODevCapaItfImpl_QueryAudioOutputCapabilities( + XAAudioIODeviceCapabilitiesItf self, XAuint32 deviceId, + XAAudioOutputDescriptor* pDescriptor); -XAresult XAAudIODevCapaItfImpl_RegisterDefaultDeviceIDMapChangedCallback(XAAudioIODeviceCapabilitiesItf self, - xaDefaultDeviceIDMapChangedCallback callback, - void* pContext); +XAresult XAAudIODevCapaItfImpl_RegisterAvailableAudioOutputsChangedCallback( + XAAudioIODeviceCapabilitiesItf self, + xaAvailableAudioOutputsChangedCallback callback, void* pContext); -XAresult XAAudIODevCapaItfImpl_GetAssociatedAudioInputs(XAAudioIODeviceCapabilitiesItf self, - XAuint32 deviceId, - XAint32* pNumAudioInputs, - XAuint32* pAudioInputDeviceIDs); +XAresult XAAudIODevCapaItfImpl_RegisterDefaultDeviceIDMapChangedCallback( + XAAudioIODeviceCapabilitiesItf self, + xaDefaultDeviceIDMapChangedCallback callback, void* pContext); + +XAresult XAAudIODevCapaItfImpl_GetAssociatedAudioInputs( + XAAudioIODeviceCapabilitiesItf self, XAuint32 deviceId, + XAint32* pNumAudioInputs, XAuint32* pAudioInputDeviceIDs); -XAresult XAAudIODevCapaItfImpl_GetAssociatedAudioOutputs(XAAudioIODeviceCapabilitiesItf self, - XAuint32 deviceId, - XAint32* pNumAudioOutputs, - XAuint32* pAudioOutputDeviceIDs); +XAresult XAAudIODevCapaItfImpl_GetAssociatedAudioOutputs( + XAAudioIODeviceCapabilitiesItf self, XAuint32 deviceId, + XAint32* pNumAudioOutputs, XAuint32* pAudioOutputDeviceIDs); -XAresult XAAudIODevCapaItfImpl_GetDefaultAudioDevices(XAAudioIODeviceCapabilitiesItf self, - XAuint32 defaultDeviceID, - XAint32 *pNumAudioDevices, - XAuint32 *pAudioDeviceIDs); +XAresult XAAudIODevCapaItfImpl_GetDefaultAudioDevices( + XAAudioIODeviceCapabilitiesItf self, XAuint32 defaultDeviceID, + XAint32 *pNumAudioDevices, XAuint32 *pAudioDeviceIDs); -XAresult XAAudIODevCapaItfImpl_QuerySampleFormatsSupported(XAAudioIODeviceCapabilitiesItf self, - XAuint32 deviceId, - XAmilliHertz samplingRate, - XAint32* pSampleFormats, - XAint32* pNumOfSampleFormats); +XAresult XAAudIODevCapaItfImpl_QuerySampleFormatsSupported( + XAAudioIODeviceCapabilitiesItf self, XAuint32 deviceId, + XAmilliHertz samplingRate, XAint32* pSampleFormats, + XAint32* pNumOfSampleFormats); /* XAAudIODevCapaItfImpl -specific methods */ XAAudIODevCapaItfImpl* XAAudIODevCapaItfImpl_Create(XACapabilities* caps); diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaengine.c --- a/khronosfws/openmax_al/src/engine/xaengine.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaengine.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Engine Implementation + * + */ #include #include @@ -38,26 +38,26 @@ #include "xaframeworkmgr.h" #include "xastaticcameracapsadaptation.h" - /* Static mapping of enumeration XAEngineInterfaces to interface iids */ -static const XAInterfaceID* xaEngineItfIIDs[ENGINE_ITFCOUNT]={ +static const XAInterfaceID* xaEngineItfIIDs[ENGINE_ITFCOUNT] = + { &XA_IID_OBJECT, &XA_IID_ENGINE, &XA_IID_DYNAMICINTERFACEMANAGEMENT, &XA_IID_THREADSYNC, -/* &XA_IID_CONFIGEXTENSION,*/ -/* &XA_IID_DEVICEVOLUME,*/ + /* &XA_IID_CONFIGEXTENSION,*/ + /* &XA_IID_DEVICEVOLUME,*/ &XA_IID_AUDIOIODEVICECAPABILITIES, -/* &XA_IID_AUDIODECODERCAPABILITIES,*/ + /* &XA_IID_AUDIODECODERCAPABILITIES,*/ &XA_IID_AUDIOENCODERCAPABILITIES -/* + /* &XA_IID_CAMERACAPABILITIES, &XA_IID_IMAGEDECODERCAPABILITIES, &XA_IID_IMAGEENCODERCAPABILITIES, &XA_IID_VIDEODECODERCAPABILITIES, &XA_IID_VIDEOENCODERCAPABILITIES -*/ -}; + */ + }; /***************************************************************************** * Global methods @@ -66,13 +66,11 @@ /* XAResult XAEngineImpl_Create * Description: Create object */ -XAresult XAEngineImpl_Create(XAObjectItf *pEngine, - XAuint32 numOptions, - const XAEngineOption *pEngineOptions, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ +XAresult XAEngineImpl_Create(XAObjectItf *pEngine, XAuint32 numOptions, + const XAEngineOption *pEngineOptions, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { XAEngineImpl* pImpl = NULL; XAObjectItfImpl* pBaseObj = NULL; XAuint32 itfIndex = 0; @@ -80,160 +78,148 @@ XAboolean threadSafeEnabled = XA_BOOLEAN_TRUE; DEBUG_API("->XAEngineImpl_Create"); - if( !pEngine ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineImpl_Create"); + if (!pEngine) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineImpl_Create"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } /* check engine options */ - if( pEngineOptions && (numOptions != 0)) - { + if (pEngineOptions && (numOptions != 0)) + { int i; - for(i = 0; ibaseObj; /* Initialize base object default implementation */ - XAObjectItfImpl_Init(pBaseObj, - ENGINE_ITFCOUNT, - xaEngineItfIIDs, - XAEngineImpl_DoRealize, - XAEngineImpl_DoResume, - XAEngineImpl_FreeResources); - + XAObjectItfImpl_Init(pBaseObj, ENGINE_ITFCOUNT, xaEngineItfIIDs, + XAEngineImpl_DoRealize, XAEngineImpl_DoResume, + XAEngineImpl_FreeResources); /* Mark interfaces that need to be exposed */ /* Implicit and mandated interfaces */ pBaseObj->interfaceMap[ENGINE_ENGINEITF].required = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[ENGINE_DIMITF].required = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[ENGINE_THREADSYNCITF].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[ENGINE_AUDIOIODEVICECAPAITF].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[ENGINE_AUDIOENCODERCAPAITF].required = XA_BOOLEAN_TRUE; + pBaseObj->interfaceMap[ENGINE_AUDIOIODEVICECAPAITF].required + = XA_BOOLEAN_TRUE; + pBaseObj->interfaceMap[ENGINE_AUDIOENCODERCAPAITF].required + = XA_BOOLEAN_TRUE; /* Explicit interfaces */ - if( (numInterfaces != 0) && pInterfaceIds && pInterfaceRequired ) - { + if ((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) + { /* Check required interfaces */ - for(itfIndex = 0; itfIndex < numInterfaces; itfIndex++) - { + for (itfIndex = 0; itfIndex < numInterfaces; itfIndex++) + { /* If mapEntry is null then required interface is not supported.*/ - XAObjItfMapEntry *entry = - XAObjectItfImpl_GetItfEntry((XAObjectItf)&(pBaseObj), pInterfaceIds[itfIndex]); - if( !entry ) - { - if( pInterfaceRequired[itfIndex] ) + XAObjItfMapEntry *entry = XAObjectItfImpl_GetItfEntry( + (XAObjectItf) &(pBaseObj), pInterfaceIds[itfIndex]); + if (!entry) { + if (pInterfaceRequired[itfIndex]) + { /* required interface cannot be accommodated - fail creation */ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - DEBUG_ERR("Required interface not found - abort creation!"); - DEBUG_API("<-XAEngineImpl_Create"); + XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); + DEBUG_ERR("Required interface not found - abort creation!");DEBUG_API("<-XAEngineImpl_Create"); return XA_RESULT_FEATURE_UNSUPPORTED; - } + } else + { + DEBUG_INFO("Requested (not required) interface not found - continue creation"); + } + } + else { - DEBUG_INFO("Requested (not required) interface not found - continue creation"); + entry->required = XA_BOOLEAN_TRUE; } } - else - { - entry->required = XA_BOOLEAN_TRUE; - } } - } /* Initialize XAEngineImpl variables */ - if( threadSafeEnabled ) - { + if (threadSafeEnabled) + { XAresult ret = XA_RESULT_SUCCESS; pImpl->isThreadSafe = threadSafeEnabled; - ret = XAThreadSafety_Init( threadSafeEnabled ); - if ( ret != XA_RESULT_SUCCESS ) - { + ret = XAThreadSafety_Init(threadSafeEnabled); + if (ret != XA_RESULT_SUCCESS) + { DEBUG_INFO_A1("Unable to initialize thread safety - ret:%x", ret ); + } } - } -/* - - pImpl->adaptationCtx = XAEngineAdapt_Create(); - -*/ /* Set ObjectItf to point to newly created object */ - *pEngine = ((XAObjectItf)&(pBaseObj->self)); + *pEngine = ((XAObjectItf) &(pBaseObj->self)); DEBUG_API("<-XAEngineImpl_Create"); return XA_RESULT_SUCCESS; -} + } /* XAResult XAEngineImpl_QueryNumSupportedInterfaces * Description: Statically query number of supported interfaces */ XAresult XAEngineImpl_QueryNumSupportedInterfaces( - XAuint32 *pNumSupportedInterfaces) -{ + XAuint32 *pNumSupportedInterfaces) + { DEBUG_API("->XAEngineImpl_QueryNumSupportedInterfaces"); - if(pNumSupportedInterfaces) - { + if (pNumSupportedInterfaces) + { *pNumSupportedInterfaces = ENGINE_ITFCOUNT; DEBUG_API("<-XAEngineImpl_QueryNumSupportedInterfaces"); return XA_RESULT_SUCCESS; - } + } else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineImpl_QueryNumSupportedInterfaces"); + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineImpl_QueryNumSupportedInterfaces"); return XA_RESULT_PARAMETER_INVALID; + } } -} /* XAResult XAEngineImpl_QuerySupportedInterfaces * Description: Statically query supported interfaces */ -XAresult XAEngineImpl_QuerySupportedInterfaces( - XAuint32 index, - XAInterfaceID *pInterfaceId) -{ +XAresult XAEngineImpl_QuerySupportedInterfaces(XAuint32 index, + XAInterfaceID *pInterfaceId) + { DEBUG_API("->XAEngineImpl_QuerySupportedInterfaces"); - if (index >= ENGINE_ITFCOUNT || !pInterfaceId ) - { - if(pInterfaceId) + if (index >= ENGINE_ITFCOUNT || !pInterfaceId) + { + if (pInterfaceId) { *pInterfaceId = XA_IID_NULL; } DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineImpl_QuerySupportedInterfaces"); return XA_RESULT_PARAMETER_INVALID; - } + } else - { + { *pInterfaceId = *(xaEngineItfIIDs[index]); DEBUG_API("<-XAEngineImpl_QuerySupportedInterfaces"); return XA_RESULT_SUCCESS; + } } -} /***************************************************************************** * base object XAObjectItfImpl methods @@ -245,54 +231,53 @@ * Called from base object XAObjectItfImpl */ XAresult XAEngineImpl_DoRealize(XAObjectItf self) -{ + { XAuint8 itfIdx = 0; - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAEngineImpl* pObjImpl = (XAEngineImpl*)(pObj); + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAEngineImpl* pObjImpl = (XAEngineImpl*) (pObj); XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAEngineImpl_DoRealize"); /* check casting from correct pointer type */ - if( !pObjImpl || pObj != pObjImpl->baseObj.self ) - { + if (!pObjImpl || pObj != pObjImpl->baseObj.self) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineImpl_DoRealize"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - /* Table containing use-case framework map */ pObjImpl->frameworkMap = XAFrameworkMgr_CreateFrameworkMap(); if (pObjImpl->frameworkMap == NULL) - { + { DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); DEBUG_API("<-XAEngineImpl_DoRealize"); /* memory allocation failed */ return XA_RESULT_MEMORY_FAILURE; - } - + } /* Create capabilities list */ - ret = XACapabilitiesMgr_CreateCapabilitieList(pObjImpl->frameworkMap, &(pObjImpl->capabilities)); + ret = XACapabilitiesMgr_CreateCapabilitieList(pObjImpl->frameworkMap, + &(pObjImpl->capabilities)); if (ret != XA_RESULT_SUCCESS) { return ret; } - /* Realize all implicit and explicitly wanted interfaces */ - for(itfIdx=0; itfIdxinterfaceMap[itfIdx].pItf) && - pObj->interfaceMap[itfIdx].required ) + for (itfIdx = 0; itfIdx < ENGINE_ITFCOUNT; itfIdx++) { - void *pItf = NULL; - switch(itfIdx) + if (!(pObj->interfaceMap[itfIdx].pItf) + && pObj->interfaceMap[itfIdx].required) { + void *pItf = NULL; + switch (itfIdx) + { case ENGINE_ENGINEITF: - pItf = XAEngineItfImpl_Create(pObjImpl->frameworkMap, pObjImpl->capabilities); + pItf = XAEngineItfImpl_Create(pObjImpl->frameworkMap, + pObjImpl->capabilities); break; case ENGINE_THREADSYNCITF: pItf = XAThreadSyncItfImpl_Create(); @@ -301,92 +286,92 @@ pItf = XADIMItfImpl_Create(); break; case ENGINE_AUDIOIODEVICECAPAITF: - pItf = XAAudIODevCapaItfImpl_Create(pObjImpl->capabilities); + pItf = XAAudIODevCapaItfImpl_Create( + pObjImpl->capabilities); break; case ENGINE_AUDIOENCODERCAPAITF: - pItf = XAAudioEncoderCapabilitiesItfImpl_Create(pObjImpl->capabilities); - break; -/* - case ENGINE_AUDIODECODERCAPAITF: - pItf = XAAudioDecoderCapabilitiesItfImpl_Create(); + pItf = XAAudioEncoderCapabilitiesItfImpl_Create( + pObjImpl->capabilities); break; - case ENGINE_CONFIGEXTENSIONSITF: - pItf = XAConfigExtensionsItfImpl_Create(); - break; - case ENGINE_DEVICEVOLUMEITF: - pItf = XADeviceVolumeItfImpl_Create(pObjImpl->adaptationCtx); - break; - case ENGINE_CAMERACAPAITF: + /* + case ENGINE_AUDIODECODERCAPAITF: + pItf = XAAudioDecoderCapabilitiesItfImpl_Create(); + break; + case ENGINE_CONFIGEXTENSIONSITF: + pItf = XAConfigExtensionsItfImpl_Create(); + break; + case ENGINE_DEVICEVOLUMEITF: + pItf = XADeviceVolumeItfImpl_Create(pObjImpl->adaptationCtx); + break; + case ENGINE_CAMERACAPAITF: - XAStaticCameraCaps_Init(); - pItf = XACameraCapabilitiesItfImpl_Create(); - - break; - case ENGINE_IMAGEDECODERCAPAITF: - pItf = XAImageDecoderCapabilitiesItfImpl_Create(); - break; - case ENGINE_IMAGEENCODERCAPAITF: - pItf = XAImageEncoderCapabilitiesItfImpl_Create(); - break; - case ENGINE_VIDEODECODERCAPAITF: - pItf = XAVideoDecoderCapabilitiesItfImpl_Create(); - break; - case ENGINE_VIDEOENCODERCAPAITF: - pItf = XAVideoEncoderCapabilitiesItfImpl_Create(); - break; -*/ + XAStaticCameraCaps_Init(); + pItf = XACameraCapabilitiesItfImpl_Create(); + + break; + case ENGINE_IMAGEDECODERCAPAITF: + pItf = XAImageDecoderCapabilitiesItfImpl_Create(); + break; + case ENGINE_IMAGEENCODERCAPAITF: + pItf = XAImageEncoderCapabilitiesItfImpl_Create(); + break; + case ENGINE_VIDEODECODERCAPAITF: + pItf = XAVideoDecoderCapabilitiesItfImpl_Create(); + break; + case ENGINE_VIDEOENCODERCAPAITF: + pItf = XAVideoEncoderCapabilitiesItfImpl_Create(); + break; + */ default: break; - } - if(!pItf) - { - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XAEngineImpl_DoRealize"); + } + if (!pItf) + { + DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");DEBUG_API("<-XAEngineImpl_DoRealize"); /* memory allocation failed */ return XA_RESULT_MEMORY_FAILURE; - } + } else - { + { pObj->interfaceMap[itfIdx].pItf = pItf; + } } } - } pObj->state = XA_OBJECT_STATE_REALIZED; DEBUG_API("<-XAEngineImpl_DoRealize"); return XA_RESULT_SUCCESS; -} + } /* XAresult XAEngineImpl_DoResume * Description: Resume object from suspended state */ XAresult XAEngineImpl_DoResume(XAObjectItf self) -{ - DEBUG_API("->XAEngineImpl_DoResume"); - DEBUG_API("<-XAEngineImpl_DoResume"); + { + DEBUG_API("->XAEngineImpl_DoResume");DEBUG_API("<-XAEngineImpl_DoResume"); return XA_RESULT_PRECONDITIONS_VIOLATED; -} + } /* void XAEngineImpl_FreeResources * Description: Free all resources reserved at XA%ExampleObject%Impl_DoRealize() */ void XAEngineImpl_FreeResources(XAObjectItf self) -{ - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAEngineImpl* pImpl = (XAEngineImpl*)(*self); + { + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAEngineImpl* pImpl = (XAEngineImpl*) (*self); XAuint8 itfIdx = 0; DEBUG_API("->XAEngineImpl_FreeResources"); assert( pObj && pImpl && pObj == pObj->self ); /* free all allocated interfaces */ - for(itfIdx=0; itfIdxinterfaceMap[itfIdx].pItf; - if(pItf) - { - switch(itfIdx) + if (pItf) { + switch (itfIdx) + { case ENGINE_ENGINEITF: XAEngineItfImpl_Free(pItf); break; @@ -402,64 +387,53 @@ case ENGINE_AUDIOENCODERCAPAITF: XAAudioEncoderCapabilitiesItfImpl_Free(pItf); break; -/* - case ENGINE_AUDIODECODERCAPAITF: - XAAudioDecoderCapabilitiesItfImpl_Free(pItf); - break; - case ENGINE_CONFIGEXTENSIONSITF: - XAConfigExtensionsItfImpl_Free(pItf); - break; - case ENGINE_DEVICEVOLUMEITF: - XADeviceVolumeItfImpl_Free(pItf); - break; - case ENGINE_CAMERACAPAITF: + /* + case ENGINE_AUDIODECODERCAPAITF: + XAAudioDecoderCapabilitiesItfImpl_Free(pItf); + break; + case ENGINE_CONFIGEXTENSIONSITF: + XAConfigExtensionsItfImpl_Free(pItf); + break; + case ENGINE_DEVICEVOLUMEITF: + XADeviceVolumeItfImpl_Free(pItf); + break; + case ENGINE_CAMERACAPAITF: - XACameraCapabilitiesItfImpl_Free(pItf); - - break; - case ENGINE_IMAGEDECODERCAPAITF: - XAImageDecoderCapabilitiesItfImpl_Free(pItf); - break; - case ENGINE_IMAGEENCODERCAPAITF: - XAImageEncoderCapabilitiesItfImpl_Free(pItf); - break; - case ENGINE_VIDEODECODERCAPAITF: - XAVideoDecoderCapabilitiesItfImpl_Free(pItf); - break; - case ENGINE_VIDEOENCODERCAPAITF: - XAVideoEncoderCapabilitiesItfImpl_Free(pItf); - break; -*/ + XACameraCapabilitiesItfImpl_Free(pItf); + + break; + case ENGINE_IMAGEDECODERCAPAITF: + XAImageDecoderCapabilitiesItfImpl_Free(pItf); + break; + case ENGINE_IMAGEENCODERCAPAITF: + XAImageEncoderCapabilitiesItfImpl_Free(pItf); + break; + case ENGINE_VIDEODECODERCAPAITF: + XAVideoDecoderCapabilitiesItfImpl_Free(pItf); + break; + case ENGINE_VIDEOENCODERCAPAITF: + XAVideoEncoderCapabilitiesItfImpl_Free(pItf); + break; + */ default: break; - } + } pObj->interfaceMap[itfIdx].pItf = NULL; + } } - } /* free all other allocated resources*/ -/* - if ( pImpl->adaptationCtx != NULL ) - { - XAEngineAdapt_Destroy( pImpl->adaptationCtx ); - pImpl->adaptationCtx = NULL; - } - - if ( pImpl->adaptationMmfCtx != NULL ) - { - XAEngineAdaptMMF_Destroy( pImpl->adaptationMmfCtx ); - pImpl->adaptationMmfCtx = NULL; - }*/ + /* free framework map */ XAFrameworkMgr_DeleteFrameworkMap(&pImpl->frameworkMap); - - /* TODO free capabilities list */ + + /* free capabilities list */ XACapabilitiesMgr_DeleteCapabilitieList(&pImpl->capabilities); - - XAThreadSafety_Destroy(); + + XAThreadSafety_Destroy(); DEBUG_API("<-XAEngineImpl_FreeResources"); return; -} + } /* END OF FILE */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaengine.h --- a/khronosfws/openmax_al/src/engine/xaengine.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaengine.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Engine Implementation Header + * + */ #ifndef XAENGINE_H #define XAENGINE_H @@ -29,40 +29,38 @@ /** MACROS **/ - /** TYPES **/ - /** ENUMERATIONS **/ /* Enumeration for interfaces that Engine supports. */ typedef enum -{ + { ENGINE_OBJECTITF, ENGINE_ENGINEITF, ENGINE_DIMITF, ENGINE_THREADSYNCITF, -/* - ENGINE_CONFIGEXTENSIONSITF, - ENGINE_DEVICEVOLUMEITF, -*/ + /* + ENGINE_CONFIGEXTENSIONSITF, + ENGINE_DEVICEVOLUMEITF, + */ ENGINE_AUDIOIODEVICECAPAITF, -/* ENGINE_AUDIODECODERCAPAITF,*/ + /* ENGINE_AUDIODECODERCAPAITF,*/ ENGINE_AUDIOENCODERCAPAITF, -/* - ENGINE_CAMERACAPAITF, - ENGINE_IMAGEDECODERCAPAITF, - ENGINE_IMAGEENCODERCAPAITF, - ENGINE_VIDEODECODERCAPAITF, - ENGINE_VIDEOENCODERCAPAITF, -*/ + /* + ENGINE_CAMERACAPAITF, + ENGINE_IMAGEDECODERCAPAITF, + ENGINE_IMAGEENCODERCAPAITF, + ENGINE_VIDEODECODERCAPAITF, + ENGINE_VIDEOENCODERCAPAITF, + */ ENGINE_ITFCOUNT -} XAEngineInterfaces; + } XAEngineInterfaces; /** STRUCTURES **/ /* Specification for XAEngineImpl. */ typedef struct XAEngineImpl_ -{ + { /* Parent for XAEngineImpl */ XAObjectItfImpl baseObj; @@ -72,10 +70,10 @@ //actual adpatation context can point to either MMF or GST implementations FrameworkMap *frameworkMap; XACapabilities* capabilities; - -/* void* adaptationGstCtx; - void* adaptationMmfCtx;*/ -} XAEngineImpl; + + /* void* adaptationGstCtx; + void* adaptationMmfCtx;*/ + } XAEngineImpl; /** METHODS **/ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaengineitf.c --- a/khronosfws/openmax_al/src/engine/xaengineitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaengineitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Engine Interface Implementation + * + */ #include #include @@ -30,165 +30,132 @@ * Description: Validate interface pointer and cast it to implementation pointer. **/ static XAEngineItfImpl* GetImpl(XAEngineItf self) -{ - if( self ) { - XAEngineItfImpl* impl = (XAEngineItfImpl*)(*self); - if( impl && (impl == impl->self) ) + if (self) { + XAEngineItfImpl* impl = (XAEngineItfImpl*) (*self); + if (impl && (impl == impl->self)) + { return impl; + } } + return NULL; } - return NULL; -} /** * Base interface XAEngineItf implementation */ XAresult XAEngineItfImpl_CreateCameraDevice(XAEngineItf self, - XAObjectItf *pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ + XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { XAEngineItfImpl* impl = GetImpl(self); #ifdef OMAX_CAMERABIN return XACameraDeviceImpl_CreateCameraDevice( impl->mapper,impl->capabilities, - pDevice, deviceID,numInterfaces, - pInterfaceIds, pInterfaceRequired ); + pDevice, deviceID,numInterfaces, + pInterfaceIds, pInterfaceRequired ); #else return XA_RESULT_FEATURE_UNSUPPORTED; #endif -} + } XAresult XAEngineItfImpl_CreateRadioDevice(XAEngineItf self, - XAObjectItf *pDevice, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ - return XARadioDeviceImpl_CreateRadioDevice( ((XAEngineItfImpl*)self)->mapper, - pDevice, numInterfaces, - pInterfaceIds, pInterfaceRequired ); -} + XAObjectItf *pDevice, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { + return XARadioDeviceImpl_CreateRadioDevice( /*((XAEngineItfImpl*)self)->mapper,*/ + pDevice, numInterfaces, pInterfaceIds, pInterfaceRequired); + } XAresult XAEngineItfImpl_CreateLEDDevice(XAEngineItf self, - XAObjectItf *pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ - return XALEDArrayDeviceImpl_CreateLEDArrayDevice( ((XAEngineItfImpl*)self)->mapper, - pDevice, deviceID, numInterfaces, - pInterfaceIds, pInterfaceRequired ); -} + XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { + return XALEDArrayDeviceImpl_CreateLEDArrayDevice( + ((XAEngineItfImpl*) self)->mapper, pDevice, deviceID, + numInterfaces, pInterfaceIds, pInterfaceRequired); + } XAresult XAEngineItfImpl_CreateVibraDevice(XAEngineItf self, - XAObjectItf *pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ - return XAVibraDeviceImpl_CreateVibraDevice( ((XAEngineItfImpl*)self)->mapper, - pDevice, deviceID, numInterfaces, - pInterfaceIds, pInterfaceRequired); -} + XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { + return XAVibraDeviceImpl_CreateVibraDevice( + ((XAEngineItfImpl*) self)->mapper, pDevice, deviceID, + numInterfaces, pInterfaceIds, pInterfaceRequired); + } XAresult XAEngineItfImpl_CreateMediaPlayer(XAEngineItf self, - XAObjectItf *pPlayer, - XADataSource *pDataSrc, - XADataSource *pBankSrc, - XADataSink *pAudioSnk, - XADataSink *pImageVideoSnk, - XADataSink *pVibra, - XADataSink *pLEDArray, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ + XAObjectItf *pPlayer, XADataSource *pDataSrc, XADataSource *pBankSrc, + XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, + XADataSink *pVibra, XADataSink *pLEDArray, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { XAEngineItfImpl* impl = GetImpl(self); - return XAMediaPlayerImpl_CreateMediaPlayer(impl->mapper,impl->capabilities, pPlayer, - pDataSrc, pBankSrc, pAudioSnk, - pImageVideoSnk, pVibra, pLEDArray, - numInterfaces, pInterfaceIds, pInterfaceRequired); -} + return XAMediaPlayerImpl_CreateMediaPlayer(impl->mapper, + impl->capabilities, pPlayer, pDataSrc, pBankSrc, pAudioSnk, + pImageVideoSnk, pVibra, pLEDArray, numInterfaces, pInterfaceIds, + pInterfaceRequired); + } XAresult XAEngineItfImpl_CreateMediaRecorder(XAEngineItf self, - XAObjectItf * pRecorder, - XADataSource * pAudioSrc, - XADataSource * pImageVideoSrc, - XADataSink * pDataSnk, - XAuint32 numInterfaces, - const XAInterfaceID * pInterfaceIds, - const XAboolean * pInterfaceRequired) -{ + XAObjectItf * pRecorder, XADataSource * pAudioSrc, + XADataSource * pImageVideoSrc, XADataSink * pDataSnk, + XAuint32 numInterfaces, const XAInterfaceID * pInterfaceIds, + const XAboolean * pInterfaceRequired) + { XAEngineItfImpl* impl = GetImpl(self); return XAMediaRecorderImpl_CreateMediaRecorder(impl->mapper, - impl->capabilities, - pRecorder, - pAudioSrc, - pImageVideoSrc, - pDataSnk, - numInterfaces, - pInterfaceIds, - pInterfaceRequired); -} + impl->capabilities, pRecorder, pAudioSrc, pImageVideoSrc, + pDataSnk, numInterfaces, pInterfaceIds, pInterfaceRequired); + } -XAresult XAEngineItfImpl_CreateOutputMix(XAEngineItf self, - XAObjectItf *pMix, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ +XAresult XAEngineItfImpl_CreateOutputMix(XAEngineItf self, XAObjectItf *pMix, + XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { XAEngineItfImpl* impl = GetImpl(self); - return XAOMixImpl_CreateOutputMix(impl->mapper,impl->capabilities, - pMix, numInterfaces, - pInterfaceIds, pInterfaceRequired); -} + return XAOMixImpl_CreateOutputMix(impl->mapper, impl->capabilities, pMix, + numInterfaces, pInterfaceIds, pInterfaceRequired); + } XAresult XAEngineItfImpl_CreateMetadataExtractor(XAEngineItf self, - XAObjectItf *pMetadataExtractor, - XADataSource *pDataSource, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ + XAObjectItf *pMetadataExtractor, XADataSource *pDataSource, + XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { XAEngineItfImpl* impl = GetImpl(self); return XAMetadataExtractorImpl_Create(impl->mapper, impl->capabilities, - pMetadataExtractor, pDataSource, - numInterfaces, pInterfaceIds, pInterfaceRequired); -} + pMetadataExtractor, pDataSource, numInterfaces, pInterfaceIds, + pInterfaceRequired); + } XAresult XAEngineItfImpl_CreateExtensionObject(XAEngineItf self, - XAObjectItf *pObject, - void *pParameters, - XAuint32 objectID, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ + XAObjectItf *pObject, void *pParameters, XAuint32 objectID, + XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { DEBUG_API("->XAEngineItfImpl_CreateExtensionObject"); /* no supported extensions */ DEBUG_API("<-XAEngineItfImpl_CreateExtensionObject - XA_RESULT_FEATURE_UNSUPPORTED"); return XA_RESULT_FEATURE_UNSUPPORTED; -} + } XAresult XAEngineItfImpl_GetImplementationInfo(XAEngineItf self, - XAuint32 *pMajor, - XAuint32 *pMinor, - XAuint32 *pStep, - const XAchar *pImplementationText) -{ + XAuint32 *pMajor, XAuint32 *pMinor, XAuint32 *pStep, + const XAchar *pImplementationText) + { DEBUG_API("->XAEngineItfImpl_GetImplementationInfo"); - if( !pMajor || !pMinor || !pStep ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineItfImpl_GetImplementationInfo"); + if (!pMajor || !pMinor || !pStep) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineItfImpl_GetImplementationInfo"); return XA_RESULT_PARAMETER_INVALID; - } + } /* OpenMAX AL API ver 1.0.1 */ *pMajor = 1; *pMinor = 0; @@ -197,331 +164,321 @@ DEBUG_API("<-XAEngineItfImpl_GetImplementationInfo"); return XA_RESULT_SUCCESS; -} + } XAresult XAEngineItfImpl_QuerySupportedProfiles(XAEngineItf self, - XAint16 *pProfilesSupported) -{ + XAint16 *pProfilesSupported) + { DEBUG_API("->XAEngineItfImpl_QuerySupportedProfiles"); - if( !pProfilesSupported ) - { + if (!pProfilesSupported) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QuerySupportedProfiles"); return XA_RESULT_PARAMETER_INVALID; - } + } /* NOTE: enable +MIDI when/if XMF issues solved * XA_PROFILES_MEDIA_PLAYER | * XA_PROFILES_MEDIA_PLAYER_RECORDER | * XA_PROFILES_PLUS_MIDI; */ - *pProfilesSupported = XA_PROFILES_MEDIA_PLAYER | XA_PROFILES_MEDIA_PLAYER_RECORDER; + *pProfilesSupported = XA_PROFILES_MEDIA_PLAYER + | XA_PROFILES_MEDIA_PLAYER_RECORDER; DEBUG_API("<-XAEngineItfImpl_QuerySupportedProfiles"); return XA_RESULT_SUCCESS; -} + } XAresult XAEngineItfImpl_QueryNumSupportedInterfaces(XAEngineItf self, - XAuint32 objectID, - XAuint32 *pNumSupportedInterfaces) -{ + XAuint32 objectID, XAuint32 *pNumSupportedInterfaces) + { XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAEngineItfImpl_QueryNumSupportedInterfaces"); - if( !pNumSupportedInterfaces ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineItfImpl_QueryNumSupportedInterfaces"); + if (!pNumSupportedInterfaces) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineItfImpl_QueryNumSupportedInterfaces"); return XA_RESULT_PARAMETER_INVALID; - } - *pNumSupportedInterfaces=0; - switch(objectID) - { + } + *pNumSupportedInterfaces = 0; + switch (objectID) + { case XA_OBJECTID_ENGINE: res = XAEngineImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); + pNumSupportedInterfaces); break; case XA_OBJECTID_MEDIAPLAYER: res = XAMediaPlayerImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); + pNumSupportedInterfaces); break; case XA_OBJECTID_MEDIARECORDER: res = XAMediaRecorderImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); + pNumSupportedInterfaces); break; case XA_OBJECTID_OUTPUTMIX: res = XAOMixImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); + pNumSupportedInterfaces); break; #ifdef OMAX_CAMERABIN - case XA_OBJECTID_CAMERADEVICE: + case XA_OBJECTID_CAMERADEVICE: res = XACameraDeviceImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); + pNumSupportedInterfaces); break; #endif case XA_OBJECTID_RADIODEVICE: res = XARadioDeviceImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); + pNumSupportedInterfaces); break; case XA_OBJECTID_LEDDEVICE: res = XALEDArrayDeviceImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); + pNumSupportedInterfaces); break; case XA_OBJECTID_VIBRADEVICE: res = XAVibraDeviceImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); + pNumSupportedInterfaces); break; case XA_OBJECTID_METADATAEXTRACTOR: res = XAMetadataExtractorImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); + pNumSupportedInterfaces); break; default: res = XA_RESULT_FEATURE_UNSUPPORTED; break; - } + } DEBUG_API_A1("<-XAEngineItfImpl_QueryNumSupportedInterfaces %lu",res); return res; -} + } XAresult XAEngineItfImpl_QuerySupportedInterfaces(XAEngineItf self, - XAuint32 objectID, - XAuint32 index, - XAInterfaceID *pInterfaceId) -{ + XAuint32 objectID, XAuint32 index, XAInterfaceID *pInterfaceId) + { XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAEngineItfImpl_QuerySupportedInterfaces"); - if( !pInterfaceId ) - { + if (!pInterfaceId) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QuerySupportedInterfaces"); return XA_RESULT_PARAMETER_INVALID; - } + } *pInterfaceId = XA_IID_NULL; switch (objectID) - { + { case XA_OBJECTID_ENGINE: - res = XAEngineImpl_QuerySupportedInterfaces( - index, pInterfaceId); + res = XAEngineImpl_QuerySupportedInterfaces(index, pInterfaceId); break; case XA_OBJECTID_MEDIAPLAYER: - res = XAMediaPlayerImpl_QuerySupportedInterfaces( - index, pInterfaceId); + res = XAMediaPlayerImpl_QuerySupportedInterfaces(index, + pInterfaceId); break; case XA_OBJECTID_MEDIARECORDER: - res = XAMediaRecorderImpl_QuerySupportedInterfaces( - index, pInterfaceId); + res = XAMediaRecorderImpl_QuerySupportedInterfaces(index, + pInterfaceId); break; case XA_OBJECTID_OUTPUTMIX: - res = XAOMixImpl_QuerySupportedInterfaces( - index, pInterfaceId); + res = XAOMixImpl_QuerySupportedInterfaces(index, pInterfaceId); break; #ifdef OMAX_CAMERABIN - case XA_OBJECTID_CAMERADEVICE: + case XA_OBJECTID_CAMERADEVICE: res = XACameraDeviceImpl_QuerySupportedInterfaces( - index, pInterfaceId ); + index, pInterfaceId ); break; #endif case XA_OBJECTID_RADIODEVICE: - res = XARadioDeviceImpl_QuerySupportedInterfaces( - index, pInterfaceId ); + res = XARadioDeviceImpl_QuerySupportedInterfaces(index, + pInterfaceId); break; case XA_OBJECTID_LEDDEVICE: - res = XALEDArrayDeviceImpl_QuerySupportedInterfaces( - index, pInterfaceId ); + res = XALEDArrayDeviceImpl_QuerySupportedInterfaces(index, + pInterfaceId); break; case XA_OBJECTID_VIBRADEVICE: - res = XAVibraDeviceImpl_QuerySupportedInterfaces( - index, pInterfaceId ); + res = XAVibraDeviceImpl_QuerySupportedInterfaces(index, + pInterfaceId); break; case XA_OBJECTID_METADATAEXTRACTOR: - res = XAMetadataExtractorImpl_QuerySupportedInterfaces( - index, pInterfaceId); + res = XAMetadataExtractorImpl_QuerySupportedInterfaces(index, + pInterfaceId); break; default: res = XA_RESULT_FEATURE_UNSUPPORTED; - } + } DEBUG_API_A1("<-XAEngineItfImpl_QuerySupportedInterfaces %lu", res); return res; -} + } XAresult XAEngineItfImpl_QueryLEDCapabilities(XAEngineItf self, - XAuint32 *pIndex, - XAuint32 *pLEDDeviceID, - XALEDDescriptor *pDescriptor) -{ - + XAuint32 *pIndex, XAuint32 *pLEDDeviceID, + XALEDDescriptor *pDescriptor) + { + XALEDDescriptor descriptor; - + DEBUG_API("->XAEngineItfImpl_QueryLEDCapabilities"); - if( !pDescriptor ) - { /*query number of devices*/ - if( !pIndex ) - { + if (!pDescriptor) + { /*query number of devices*/ + if (!pIndex) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); return XA_RESULT_PARAMETER_INVALID; - } + } /* Number of devices */ *pIndex = 1; - } + } else - { - + { + /* query device capabilities */ - if( pIndex ) - { - if( *pIndex == 0 ) + if (pIndex) { - if( !pLEDDeviceID ) + if (*pIndex == 0) { + if (!pLEDDeviceID) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); return XA_RESULT_PARAMETER_INVALID; - } + } *pLEDDeviceID = XA_ADAPTID_LEDARRAY; - } + } else - { + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); return XA_RESULT_PARAMETER_INVALID; + } } - } - if( *pLEDDeviceID == XA_ADAPTID_LEDARRAY ) - { + if (*pLEDDeviceID == XA_ADAPTID_LEDARRAY) + { descriptor.colorMask = COLOR_MASK; descriptor.ledCount = LED_COUNT; descriptor.primaryLED = PRIMARY_LED; *pDescriptor = descriptor; - } - + } + + }DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); + return XA_RESULT_SUCCESS; } - DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); - return XA_RESULT_SUCCESS; -} XAresult XAEngineItfImpl_QueryVibraCapabilities(XAEngineItf self, - XAuint32 *pIndex, - XAuint32 *pVibraDeviceID, - XAVibraDescriptor *pDescriptor) -{ - + XAuint32 *pIndex, XAuint32 *pVibraDeviceID, + XAVibraDescriptor *pDescriptor) + { + XAVibraDescriptor descriptor; DEBUG_API("->XAEngineItfImpl_QueryVibraCapabilities"); - if( !pDescriptor ) - { /*query number of devices*/ - if( !pIndex ) - { + if (!pDescriptor) + { /*query number of devices*/ + if (!pIndex) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities"); return XA_RESULT_PARAMETER_INVALID; - } + } /* Number of devices */ *pIndex = 1; - } + } else - { - + { + /* query device capabilities */ - if( pIndex ) - { - if( *pIndex == 0 ) + if (pIndex) { - if( !pVibraDeviceID ) + if (*pIndex == 0) { + if (!pVibraDeviceID) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities"); return XA_RESULT_PARAMETER_INVALID; - } + } *pVibraDeviceID = XA_ADAPTID_VIBRA; - } + } else - { + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities"); return XA_RESULT_PARAMETER_INVALID; + } } - } - if( *pVibraDeviceID == XA_ADAPTID_VIBRA ) - { + if (*pVibraDeviceID == XA_ADAPTID_VIBRA) + { descriptor.minFrequency = MIN_FREQUENCY; descriptor.maxFrequency = MAX_FREQUENCY; descriptor.supportsFrequency = XA_BOOLEAN_TRUE; descriptor.supportsIntensity = XA_BOOLEAN_TRUE; *pDescriptor = descriptor; + } + } - - } DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities"); return XA_RESULT_SUCCESS; -} + } XAresult XAEngineItfImpl_QueryNumSupportedExtensions(XAEngineItf self, - XAuint32 *pNumExtensions) -{ - DEBUG_API("->XAEngineItfImpl_QuerySupportedExtension"); - if(pNumExtensions==NULL) + XAuint32 *pNumExtensions) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineItfImpl_QuerySupportedExtension"); - return XA_RESULT_PARAMETER_INVALID; - } + DEBUG_API("->XAEngineItfImpl_QuerySupportedExtension"); + if (pNumExtensions == NULL) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAEngineItfImpl_QuerySupportedExtension"); + return XA_RESULT_PARAMETER_INVALID; + } /* no supported extensions */ - *pNumExtensions=0; + *pNumExtensions = 0; DEBUG_API("<-XAEngineItfImpl_QuerySupportedExtension"); return XA_RESULT_SUCCESS; -} + } XAresult XAEngineItfImpl_QuerySupportedExtension(XAEngineItf self, - XAuint32 index, - XAchar *pExtensionName, - XAint16 *pNameLength) -{ + XAuint32 index, XAchar *pExtensionName, XAint16 *pNameLength) + { DEBUG_API("->XAEngineItfImpl_QuerySupportedExtension"); /* no supported extensions => index is always wrong */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QuerySupportedExtension"); return XA_RESULT_PARAMETER_INVALID; -} + } XAresult XAEngineItfImpl_IsExtensionSupported(XAEngineItf self, - const XAchar *pExtensionName, - XAboolean *pSupported) -{ + const XAchar *pExtensionName, XAboolean *pSupported) + { DEBUG_API("->XAEngineItfImpl_IsExtensionSupported"); - if(pSupported==NULL) - { + if (pSupported == NULL) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_IsExtensionSupported"); return XA_RESULT_PARAMETER_INVALID; - } + } /* no supported extensions */ - *pSupported=XA_BOOLEAN_FALSE; + *pSupported = XA_BOOLEAN_FALSE; DEBUG_API("<-XAEngineItfImpl_IsExtensionSupported"); return XA_RESULT_SUCCESS; -} + } /** * XAEngineItfImpl -specific methods **/ -XAEngineItfImpl* XAEngineItfImpl_Create(FrameworkMap* fwkmapper, XACapabilities* capabilities) -{ - XAEngineItfImpl* self = (XAEngineItfImpl*) - calloc(1,sizeof(XAEngineItfImpl)); +XAEngineItfImpl* XAEngineItfImpl_Create(FrameworkMap* fwkmapper, + XACapabilities* capabilities) + { + XAEngineItfImpl* self = (XAEngineItfImpl*) calloc(1, + sizeof(XAEngineItfImpl)); DEBUG_API("->XAEngineItfImpl_Create"); - if( self ) - { + if (self) + { /* init itf default implementation */ self->itf.CreateCameraDevice = XAEngineItfImpl_CreateCameraDevice; self->itf.CreateRadioDevice = XAEngineItfImpl_CreateRadioDevice; @@ -530,30 +487,42 @@ self->itf.CreateMediaPlayer = XAEngineItfImpl_CreateMediaPlayer; self->itf.CreateMediaRecorder = XAEngineItfImpl_CreateMediaRecorder; self->itf.CreateOutputMix = XAEngineItfImpl_CreateOutputMix; - self->itf.CreateMetadataExtractor = XAEngineItfImpl_CreateMetadataExtractor; - self->itf.CreateExtensionObject = XAEngineItfImpl_CreateExtensionObject; - self->itf.GetImplementationInfo = XAEngineItfImpl_GetImplementationInfo; - self->itf.QuerySupportedProfiles = XAEngineItfImpl_QuerySupportedProfiles; - self->itf.QueryNumSupportedInterfaces = XAEngineItfImpl_QueryNumSupportedInterfaces; - self->itf.QuerySupportedInterfaces = XAEngineItfImpl_QuerySupportedInterfaces; + self->itf.CreateMetadataExtractor + = XAEngineItfImpl_CreateMetadataExtractor; + self->itf.CreateExtensionObject + = XAEngineItfImpl_CreateExtensionObject; + self->itf.GetImplementationInfo + = XAEngineItfImpl_GetImplementationInfo; + self->itf.QuerySupportedProfiles + = XAEngineItfImpl_QuerySupportedProfiles; + self->itf.QueryNumSupportedInterfaces + = XAEngineItfImpl_QueryNumSupportedInterfaces; + self->itf.QuerySupportedInterfaces + = XAEngineItfImpl_QuerySupportedInterfaces; self->itf.QueryLEDCapabilities = XAEngineItfImpl_QueryLEDCapabilities; - self->itf.QueryVibraCapabilities = XAEngineItfImpl_QueryVibraCapabilities; - self->itf.QueryNumSupportedExtensions = XAEngineItfImpl_QueryNumSupportedExtensions; - self->itf.QuerySupportedExtension = XAEngineItfImpl_QuerySupportedExtension; + self->itf.QueryVibraCapabilities + = XAEngineItfImpl_QueryVibraCapabilities; + self->itf.QueryNumSupportedExtensions + = XAEngineItfImpl_QueryNumSupportedExtensions; + self->itf.QuerySupportedExtension + = XAEngineItfImpl_QuerySupportedExtension; self->itf.IsExtensionSupported = XAEngineItfImpl_IsExtensionSupported; self->mapper = fwkmapper; self->capabilities = capabilities; self->xyz = 50; self->self = self; - } + } DEBUG_API("<-XAEngineItfImpl_Create"); return self; -} + } void XAEngineItfImpl_Free(XAEngineItfImpl* self) -{ + { DEBUG_API("->XAEngineItfImpl_Free"); assert(self==self->self); - free(self); + if(self) + { + free(self); + } DEBUG_API("<-XAEngineItfImpl_Free"); -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xaengineitf.h --- a/khronosfws/openmax_al/src/engine/xaengineitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaengineitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Engine Interface Header + * + */ #ifndef XAENGINEITF_H #define XAENGINEITF_H @@ -31,7 +31,7 @@ /** STRUCTURES **/ /* Definition of XAEngineItf implementation */ typedef struct XAEngineItfImpl_ -{ + { /* parent interface */ struct XAEngineItf_ itf; /* pointer to self */ @@ -41,126 +41,94 @@ struct FrameworkMap_* mapper; /*Not Owned*/ struct XACapabilities_* capabilities; - + int xyz; - -} XAEngineItfImpl; + + } XAEngineItfImpl; /** METHODS **/ /* Base interface XAEngineItf implementation */ XAresult XAEngineItfImpl_CreateCameraDevice(XAEngineItf self, - XAObjectItf *pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); + XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); XAresult XAEngineItfImpl_CreateRadioDevice(XAEngineItf self, - XAObjectItf *pDevice, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); - + XAObjectItf *pDevice, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); XAresult XAEngineItfImpl_CreateLEDDevice(XAEngineItf self, - XAObjectItf *pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); + XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); XAresult XAEngineItfImpl_CreateVibraDevice(XAEngineItf self, - XAObjectItf *pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); + XAObjectItf *pDevice, XAuint32 deviceID, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); XAresult XAEngineItfImpl_CreateMediaPlayer(XAEngineItf self, - XAObjectItf *pPlayer, - XADataSource *pDataSrc, - XADataSource *pBankSrc, - XADataSink *pAudioSnk, - XADataSink *pImageVideoSnk, - XADataSink *pVibra, - XADataSink *pLEDArray, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); + XAObjectItf *pPlayer, XADataSource *pDataSrc, XADataSource *pBankSrc, + XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, + XADataSink *pVibra, XADataSink *pLEDArray, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); XAresult XAEngineItfImpl_CreateMediaRecorder(XAEngineItf self, - XAObjectItf *pRecorder, - XADataSource *pAudioSrc, - XADataSource *pImageVideoSrc, - XADataSink *pDataSnk, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); + XAObjectItf *pRecorder, XADataSource *pAudioSrc, + XADataSource *pImageVideoSrc, XADataSink *pDataSnk, + XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); -XAresult XAEngineItfImpl_CreateOutputMix(XAEngineItf self, - XAObjectItf *pMix, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); +XAresult XAEngineItfImpl_CreateOutputMix(XAEngineItf self, XAObjectItf *pMix, + XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); XAresult XAEngineItfImpl_CreateMetadataExtractor(XAEngineItf self, - XAObjectItf *pMetadataExtractor, - XADataSource *pDataSource, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); + XAObjectItf *pMetadataExtractor, XADataSource *pDataSource, + XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); XAresult XAEngineItfImpl_CreateExtensionObject(XAEngineItf self, - XAObjectItf *pObject, - void *pParameters, - XAuint32 objectID, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired); + XAObjectItf *pObject, void *pParameters, XAuint32 objectID, + XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired); XAresult XAEngineItfImpl_GetImplementationInfo(XAEngineItf self, - XAuint32 *pMajor, - XAuint32 *pMinor, - XAuint32 *pStep, - const XAchar *pImplementationText); + XAuint32 *pMajor, XAuint32 *pMinor, XAuint32 *pStep, + const XAchar *pImplementationText); XAresult XAEngineItfImpl_QuerySupportedProfiles(XAEngineItf self, - XAint16 *pProfilesSupported); + XAint16 *pProfilesSupported); XAresult XAEngineItfImpl_QueryNumSupportedInterfaces(XAEngineItf self, - XAuint32 objectID, - XAuint32 *pNumSupportedInterfaces); + XAuint32 objectID, XAuint32 *pNumSupportedInterfaces); XAresult XAEngineItfImpl_QuerySupportedInterfaces(XAEngineItf self, - XAuint32 objectID, - XAuint32 index, - XAInterfaceID *pInterfaceId); + XAuint32 objectID, XAuint32 index, XAInterfaceID *pInterfaceId); XAresult XAEngineItfImpl_QueryLEDCapabilities(XAEngineItf self, - XAuint32 *pIndex, - XAuint32 *pLEDDeviceID, - XALEDDescriptor *pDescriptor); + XAuint32 *pIndex, XAuint32 *pLEDDeviceID, + XALEDDescriptor *pDescriptor); XAresult XAEngineItfImpl_QueryVibraCapabilities(XAEngineItf self, - XAuint32 *pIndex, - XAuint32 *pVibraDeviceID, - XAVibraDescriptor *pDescriptor); + XAuint32 *pIndex, XAuint32 *pVibraDeviceID, + XAVibraDescriptor *pDescriptor); XAresult XAEngineItfImpl_QueryNumSupportedExtensions(XAEngineItf self, - XAuint32 *pNumExtensions); + XAuint32 *pNumExtensions); XAresult XAEngineItfImpl_QuerySupportedExtension(XAEngineItf self, - XAuint32 index, - XAchar *pExtensionName, - XAint16 *pNameLength); + XAuint32 index, XAchar *pExtensionName, XAint16 *pNameLength); XAresult XAEngineItfImpl_IsExtensionSupported(XAEngineItf self, - const XAchar *pExtensionName, - XAboolean *pSupported); + const XAchar *pExtensionName, XAboolean *pSupported); /* XAEngineItfImpl -specific methods */ -XAEngineItfImpl* XAEngineItfImpl_Create(FrameworkMap* fwkmapper, XACapabilities* capabilities); +XAEngineItfImpl* XAEngineItfImpl_Create(FrameworkMap* fwkmapper, + XACapabilities* capabilities); void XAEngineItfImpl_Free(XAEngineItfImpl *self); #endif /* XAENGINEITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xathreadsyncitf.c --- a/khronosfws/openmax_al/src/engine/xathreadsyncitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xathreadsyncitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: ThreadSync Itf Implementation + * + */ #include #include @@ -25,110 +25,113 @@ * Base interface XAThreadSyncItf Implementation */ XAresult XAThreadSyncItfImpl_EnterCriticalSection(XAThreadSyncItf self) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAThreadSyncItfImpl* impl = NULL; DEBUG_API("->XAThreadSyncItfImpl_EnterCriticalSection"); - impl = (XAThreadSyncItfImpl*)(*self); - if( !impl || impl != impl->self ) - { + impl = (XAThreadSyncItfImpl*) (*self); + if (!impl || impl != impl->self) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAThreadSyncItfImpl_EnterCriticalSection"); return XA_RESULT_PARAMETER_INVALID; - } + } - if( impl->engInCritical ) - { + if (impl->engInCritical) + { /* The calling context must not already be in - critical section state. */ + critical section state. */ DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); ret = XA_RESULT_PRECONDITIONS_VIOLATED; - } + } else - { - ret = XAImpl_LockMutex( impl->engCriticalSection ); - if(ret == XA_RESULT_SUCCESS) { + ret = XAImpl_LockMutex(impl->engCriticalSection); + if (ret == XA_RESULT_SUCCESS) + { impl->engInCritical = XA_BOOLEAN_TRUE; - } + } + }DEBUG_API("<-XAThreadSyncItfImpl_EnterCriticalSection"); + return ret; } - DEBUG_API("<-XAThreadSyncItfImpl_EnterCriticalSection"); - return ret; -} XAresult XAThreadSyncItfImpl_ExitCriticalSection(XAThreadSyncItf self) -{ + { XAThreadSyncItfImpl* impl = NULL; XAresult ret = XA_RESULT_SUCCESS; - impl = (XAThreadSyncItfImpl*)(*self); + impl = (XAThreadSyncItfImpl*) (*self); DEBUG_API("->XAThreadSyncItfImpl_ExitCriticalSection"); - if( !impl || impl != impl->self ) - { + if (!impl || impl != impl->self) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAThreadSyncItfImpl_ExitCriticalSection"); return XA_RESULT_PARAMETER_INVALID; - } + } - if( impl->engInCritical ) - { - ret = XAImpl_UnlockMutex( impl->engCriticalSection ); - if(ret == XA_RESULT_SUCCESS) + if (impl->engInCritical) { + ret = XAImpl_UnlockMutex(impl->engCriticalSection); + if (ret == XA_RESULT_SUCCESS) + { impl->engInCritical = XA_BOOLEAN_FALSE; + } } - } else - { + { /* The engine must be in critical section state */ DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); ret = XA_RESULT_PRECONDITIONS_VIOLATED; + }DEBUG_API("<-XAThreadSyncItfImpl_ExitCriticalSection"); + return ret; } - DEBUG_API("<-XAThreadSyncItfImpl_ExitCriticalSection"); - return ret; -} /** * XAThreadSyncItfImpl -specific methods **/ XAThreadSyncItfImpl* XAThreadSyncItfImpl_Create() -{ + { XAThreadSyncItfImpl *self = NULL; DEBUG_API("->XAThreadSyncItfImpl_Create"); - self = (XAThreadSyncItfImpl*)calloc(1,sizeof(XAThreadSyncItfImpl)); + self = (XAThreadSyncItfImpl*) calloc(1, sizeof(XAThreadSyncItfImpl)); - if( self ) - { + if (self) + { /* init itf default implementation */ - self->itf.EnterCriticalSection = XAThreadSyncItfImpl_EnterCriticalSection; - self->itf.ExitCriticalSection = XAThreadSyncItfImpl_ExitCriticalSection; + self->itf.EnterCriticalSection + = XAThreadSyncItfImpl_EnterCriticalSection; + self->itf.ExitCriticalSection + = XAThreadSyncItfImpl_ExitCriticalSection; - if( XAImpl_CreateMutex( &(self->engCriticalSection) ) - != XA_RESULT_SUCCESS ) - { + if (XAImpl_CreateMutex(&(self->engCriticalSection)) + != XA_RESULT_SUCCESS) + { DEBUG_ERR("Mutex creation failed, abort"); free(self); DEBUG_API("<-XAThreadSyncItfImpl_Create"); return NULL; - } + } self->self = self; - } + } DEBUG_API("<-XAThreadSyncItfImpl_Create"); return self; -} + } void XAThreadSyncItfImpl_Free(XAThreadSyncItfImpl* self) -{ + { DEBUG_API("->XAThreadSyncItfImpl_Free"); assert(self==self->self); - XAImpl_DeleteMutex(self->engCriticalSection); - free(self); + if(self) + { + XAImpl_DeleteMutex(self->engCriticalSection); + free(self); + } DEBUG_API("<-XAThreadSyncItfImpl_Free"); -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/engine/xathreadsyncitf.h --- a/khronosfws/openmax_al/src/engine/xathreadsyncitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xathreadsyncitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: ThreadSync Itf Header + * + */ #ifndef XATHREADSYNCITF_H #define XATHREADSYNCITF_H @@ -29,7 +29,7 @@ /** STRUCTURES **/ /* Definition of XA%ExampleItf% implementation */ typedef struct XAThreadSyncItfImpl_ -{ + { /* parent interface */ struct XAThreadSyncItf_ itf; /* pointer to self */ @@ -38,7 +38,7 @@ /* variables */ XAImplMutexHandle engCriticalSection; XAboolean engInCritical; -} XAThreadSyncItfImpl; + } XAThreadSyncItfImpl; /** METHODS **/ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,25 +1,24 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Base GStreamer Adaptation Source + * + */ #include #include -#include "gst/gst.h" -#include "gst/gstbuffer.h" -#include "gst/app/gstappsrc.h" +#include +#include #include "xaobjectitf.h" #include "xacameradevice.h" #include "xaradiodevice.h" @@ -41,13 +40,14 @@ * 1st phase initialization function for Adaptation Base context structure. * Reserves memory for base context and initializes GStreamer FW. */ -XAresult XAAdaptationGst_Init( XAAdaptationGstCtx* pSelf, XAuint32 ctxId ) -{ +XAresult XAAdaptationGst_Init(XAAdaptationGstCtx* pSelf, XAuint32 ctxId) + { DEBUG_API("->XAAdaptationGst_Init"); - if ( pSelf ) - { - if(XAAdaptationBase_Init(&(pSelf->baseObj), ctxId) != XA_RESULT_SUCCESS) + if (pSelf) + { + if (XAAdaptationBase_Init(&(pSelf->baseObj), ctxId) + != XA_RESULT_SUCCESS) { DEBUG_ERR("Failed to init base context!!!"); free(pSelf); @@ -56,94 +56,93 @@ else { GError* gerror = 0; - - /* Add default handler for Gst-bus messages */ + + /* Add default handler for Gst-bus messages */ pSelf->busCb = XAAdaptationGst_GstBusCb; - + // VASU MOD BEGINS pSelf->cond_mutx_inited = XA_BOOLEAN_FALSE; // VASU MOD ENDS - - sem_init(&(pSelf->semAsyncWait),0,0); - - - if ( !gst_init_check( NULL, NULL, &gerror ) ) + + sem_init(&(pSelf->semAsyncWait), 0, 0); + + if (!gst_init_check(NULL, NULL, &gerror)) { - DEBUG_ERR("Gst Initalization failure."); - return XA_RESULT_INTERNAL_ERROR; + DEBUG_ERR("Gst Initalization failure."); + return XA_RESULT_INTERNAL_ERROR; } - + } - } + } else - { + { DEBUG_ERR("Invalid Gst Base Context.") return XA_RESULT_PARAMETER_INVALID; - } + } DEBUG_API("<-XAAdaptationGst_Init"); return XA_RESULT_SUCCESS; -} + } /* * XAresult XAAdaptationGst_PostInit() * 2nd phase initialization for Adaptation Base. */ -XAresult XAAdaptationGst_PostInit( XAAdaptationGstCtx* ctx ) -{ +XAresult XAAdaptationGst_PostInit(XAAdaptationGstCtx* ctx) + { XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAAdaptationGst_PostInit"); // VASU MOD BEGINS XAAdaptationBase_PostInit(&ctx->baseObj); - + ctx->thread_launched = XA_BOOLEAN_FALSE; pthread_mutex_init(&(ctx->ds_mutex), NULL); pthread_cond_init(&(ctx->ds_condition), NULL); ctx->cond_mutx_inited = XA_BOOLEAN_TRUE; - - + // VASU MOD ENDS DEBUG_API("<-XAAdaptationGst_PostInit"); return ret; -} + } /* * void XAAdaptationGst_Free( XAAdaptationGstCtx* ctx ) * Frees all Base context variables . */ -void XAAdaptationGst_Free( XAAdaptationGstCtx* ctx ) -{ - GstElement* fakesink = NULL; +void XAAdaptationGst_Free(XAAdaptationGstCtx* ctx) + { + GstElement* fakesink = NULL; DEBUG_API("->XAAdaptationGst_Free"); - if ( ctx->bin ) - { - fakesink = gst_bin_get_by_name(GST_BIN(ctx->bin), "fakesink"); - if ( fakesink ) - { - gst_element_set_state( GST_ELEMENT(fakesink), GST_STATE_NULL); - gst_object_unref(fakesink); - } + if (ctx->bin) + { + fakesink = gst_bin_get_by_name(GST_BIN(ctx->bin), "fakesink"); + if (fakesink) + { + gst_element_set_state(GST_ELEMENT(fakesink), GST_STATE_NULL); + gst_object_unref(fakesink); + } - if ( gst_element_set_state(GST_ELEMENT(ctx->bin), GST_STATE_NULL )!=GST_STATE_CHANGE_SUCCESS ) - { /*not much we can do*/ + if (gst_element_set_state(GST_ELEMENT(ctx->bin), GST_STATE_NULL) + != GST_STATE_CHANGE_SUCCESS) + { /*not much we can do*/ DEBUG_ERR("WARNING: Failed to change to NULL state before deletion!!") + } } - } - if(ctx->asynctimer) - { /*cancel timer*/ + if (ctx->asynctimer) + { /*cancel timer*/ g_source_remove(ctx->asynctimer); - } + } sem_post(&(ctx->semAsyncWait)); sem_destroy(&(ctx->semAsyncWait)); XAAdaptationGst_StopGstListener(ctx); - if ( ctx->bin ) - { + if (ctx->bin) + { gst_object_unref(ctx->bin); - } + } //g_array_free(ctx->evtHdlrs, TRUE); // VASU MOD BEGINS @@ -156,29 +155,29 @@ } // VASU MOD ENDS XAAdaptationBase_Free(&ctx->baseObj); - + DEBUG_API("<-XAAdaptationGst_Free"); -} - + } /* * gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) * Default Gst-bus message handler (Callback) */ -gboolean XAAdaptationGst_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) -{ +gboolean XAAdaptationGst_GstBusCb(GstBus *bus, GstMessage *message, + gpointer data) + { GError *error; gchar *debug; - DEBUG_API("->XAAdaptationGst_GstBusCb"); - DEBUG_INFO_A2("Received Gst callback \"%s\" from \"%s\"", - GST_MESSAGE_TYPE_NAME(message), - GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); + DEBUG_API("->XAAdaptationGst_GstBusCb");DEBUG_INFO_A2("Received Gst callback \"%s\" from \"%s\"", + GST_MESSAGE_TYPE_NAME(message), + GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - switch( GST_MESSAGE_TYPE(message)) - { + switch (GST_MESSAGE_TYPE(message)) + { case GST_MESSAGE_ERROR: - gst_message_parse_error( message, &error, &debug ); - DEBUG_INFO_A1("%s", debug); + gst_message_parse_error(message, &error, &debug); + DEBUG_INFO_A1("%s", debug) + ; break; case GST_MESSAGE_EOS: break; @@ -227,48 +226,48 @@ case GST_MESSAGE_ANY: break; default: - DEBUG_INFO("Unhandled Gst-Bus message"); + DEBUG_INFO("Unhandled Gst-Bus message") + ; break; + }DEBUG_API("<-XAAdaptationGst_GstBusCb"); + return TRUE; } - DEBUG_API("<-XAAdaptationGst_GstBusCb"); - return TRUE; -} XAresult XAAdaptationGst_InitGstListener(XAAdaptationGstCtx* ctx) -{ + { int ret; DEBUG_API("->XAAdaptationGst_InitGstListener"); - if ( ctx->bin ) - { - ctx->bus = gst_pipeline_get_bus( GST_PIPELINE( ctx->bin )); - } - if( !ctx->bus ) - { + if (ctx->bin) + { + ctx->bus = gst_pipeline_get_bus(GST_PIPELINE( ctx->bin )); + } + if (!ctx->bus) + { DEBUG_ERR("could not get gst bus!") return XA_RESULT_INTERNAL_ERROR; - } - ret = pthread_create(&(ctx->busloopThr), NULL, (XAAdaptationGst_LaunchGstListener),(void*)ctx); + } + ret = pthread_create(&(ctx->busloopThr), NULL, + (XAAdaptationGst_LaunchGstListener), (void*) ctx); // VASU MOD BEGINS - if ( ctx->thread_launched == XA_BOOLEAN_FALSE ) - { + if (ctx->thread_launched == XA_BOOLEAN_FALSE) + { // Wait until the thread is created pthread_mutex_lock(&(ctx->ds_mutex)); pthread_cond_wait(&(ctx->ds_condition), &(ctx->ds_mutex)); pthread_mutex_unlock(&(ctx->ds_mutex)); // VASU MOD ENDS - } - if(ret) - { + } + if (ret) + { DEBUG_ERR_A1("could not create thread!! (%d)",ret) return XA_RESULT_INTERNAL_ERROR; + }DEBUG_API("<-XAAdaptationGst_InitGstListener"); + return XA_RESULT_SUCCESS; } - DEBUG_API("<-XAAdaptationGst_InitGstListener"); - return XA_RESULT_SUCCESS; -} void * XAAdaptationGst_LaunchGstListener(void* args) -{ - XAAdaptationGstCtx* ctx = (XAAdaptationGstCtx*)args; + { + XAAdaptationGstCtx* ctx = (XAAdaptationGstCtx*) args; DEBUG_API("->XAAdaptationGst_LaunchGstListener"); // VASU MOD BEGINS // Signal calling thread that this thread creation is completed @@ -278,39 +277,38 @@ pthread_mutex_unlock(&(ctx->ds_mutex)); // VASU MOD ENDS - ctx->busloop = g_main_loop_new( NULL, FALSE ); - if ( !ctx->busloop ) - { - DEBUG_ERR("Glib main loop failure.") + ctx->busloop = g_main_loop_new(NULL, FALSE); + if (!ctx->busloop) + { + DEBUG_ERR("Glib main loop failure."); DEBUG_API("<-XAAdaptationGst_LaunchGstListener"); assert(0); - } + } else - { + { DEBUG_INFO("Start Glib main loop") g_main_loop_run(ctx->busloop); - DEBUG_INFO("Glib main loop stopped - exiting thread") + DEBUG_INFO("Glib main loop stopped - exiting thread"); DEBUG_API("<-XAAdaptationGst_LaunchGstListener"); pthread_exit(NULL); + } + return NULL; } - return NULL; -} void XAAdaptationGst_StopGstListener(XAAdaptationGstCtx* ctx) -{ + { DEBUG_API("->XAAdaptationGst_StopGstListener"); - if(ctx->busloop) - { - g_main_loop_quit (ctx->busloop); + if (ctx->busloop) + { + g_main_loop_quit(ctx->busloop); g_main_loop_unref(ctx->busloop); - } - if(ctx->bus) - { + } + if (ctx->bus) + { gst_object_unref(ctx->bus); ctx->bus = NULL; + }DEBUG_API("<-XAAdaptationGst_StopGstListener"); } - DEBUG_API("<-XAAdaptationGst_StopGstListener"); -} /* * ASynchronous operation managing @@ -319,87 +317,85 @@ /* NOTE: This should NOT be called from gst callbacks - danger of deadlock!! */ void XAAdaptationGst_PrepareAsyncWait(XAAdaptationGstCtx* ctx) -{ + { DEBUG_API("->XAAdaptationGst_PrepareAsyncWait"); - if( ctx->waitingasyncop ) - { /*wait previous async op*/ + if (ctx->waitingasyncop) + { /*wait previous async op*/ DEBUG_INFO("::WARNING:: previous asynch still ongoing!!!"); DEBUG_INFO(">>>> WAIT PREVIOUS"); sem_wait(&(ctx->semAsyncWait)); DEBUG_INFO("<<<< PREVIOUS COMPLETED"); - } - sem_init(&(ctx->semAsyncWait),0,0); + } + sem_init(&(ctx->semAsyncWait), 0, 0); ctx->waitingasyncop = XA_BOOLEAN_TRUE; DEBUG_API("<-XAAdaptationGst_PrepareAsyncWait"); -} + } void XAAdaptationGst_StartAsyncWait(XAAdaptationGstCtx* ctx) -{ + { DEBUG_API("->XAAdaptationGst_StartAsyncWait"); /* timeout to try to avoid gst freeze in rollup */ ctx->asynctimer = g_timeout_add(XA_ADAPT_ASYNC_TIMEOUT, - XAAdaptationGst_CancelAsyncWait, ctx); + XAAdaptationGst_CancelAsyncWait, ctx); /* check flag once again if callback already happened before wait */ - if(ctx->waitingasyncop) - { + if (ctx->waitingasyncop) + { DEBUG_INFO(">>>> ASYNC STARTS"); sem_wait(&(ctx->semAsyncWait)); DEBUG_INFO("<<<< ASYNC COMPLETED"); - } + } else - { + { DEBUG_INFO("<> async completed already"); - } + } /*cancel timer*/ - if(ctx->asynctimer) - { + if (ctx->asynctimer) + { g_source_remove(ctx->asynctimer); - } + } ctx->waitingasyncop = XA_BOOLEAN_FALSE; DEBUG_API("<-XAAdaptationGst_StartAsyncWait"); -} + } /* async operation timeout callback*/ gboolean XAAdaptationGst_CancelAsyncWait(gpointer ctx) -{ - XAAdaptationGstCtx* bCtx = (XAAdaptationGstCtx*)ctx; + { + XAAdaptationGstCtx* bCtx = (XAAdaptationGstCtx*) ctx; DEBUG_API("->XAAdaptationGst_CancelAsyncWait"); - if( bCtx->waitingasyncop ) - { + if (bCtx->waitingasyncop) + { DEBUG_ERR_A3("ASYNC TIMED OUT : current %d, gsttarget %d, wanted %d", - GST_STATE(bCtx->bin), GST_STATE_TARGET(bCtx->bin), bCtx->binWantedState); + GST_STATE(bCtx->bin), GST_STATE_TARGET(bCtx->bin), bCtx->binWantedState); bCtx->waitingasyncop = XA_BOOLEAN_FALSE; sem_post(&(bCtx->semAsyncWait)); - } - DEBUG_API("<-XAAdaptationGst_CancelAsyncWait"); + }DEBUG_API("<-XAAdaptationGst_CancelAsyncWait"); /* return false to remove timer */ return FALSE; -} + } void XAAdaptationGst_CompleteAsyncWait(XAAdaptationGstCtx* ctx) -{ + { DEBUG_API("->XAAdaptationGst_CompleteAsyncWait"); - if( ctx->waitingasyncop ) - { + if (ctx->waitingasyncop) + { int i; ctx->waitingasyncop = XA_BOOLEAN_FALSE; - sem_getvalue(&(ctx->semAsyncWait),&i); + sem_getvalue(&(ctx->semAsyncWait), &i); DEBUG_INFO_A1("Asynch operation succeeded, sem value %d",i); - if(i<=0) - { /* only post if locked */ + if (i <= 0) + { /* only post if locked */ sem_post(&(ctx->semAsyncWait)); - } - else if(i>0) - { /* should not be, reset semaphore */ - sem_init(&(ctx->semAsyncWait),0,0); - } + } + else if (i > 0) + { /* should not be, reset semaphore */ + sem_init(&(ctx->semAsyncWait), 0, 0); + } + }DEBUG_API("<-XAAdaptationGst_CompleteAsyncWait"); } - DEBUG_API("<-XAAdaptationGst_CompleteAsyncWait"); -} /** * GstElement* XAAdaptationGst_CreateGstSource( XADataSource* xaSrc, const XAchar *name ) @@ -409,11 +405,13 @@ * @return GstElement* - return newly created gst source element * Description: Create gst source element corresponding to XA source structure */ -GstElement* XAAdaptationGst_CreateGstSource( XADataSource* xaSrc, const char *name, XAboolean *isobj, XAboolean *isPCM, XAboolean *isRawImage ) -{ +GstElement* XAAdaptationGst_CreateGstSource(XADataSource* xaSrc, + const char *name, XAboolean *isobj, XAboolean *isPCM, + XAboolean *isRawImage) + { XAuint32 locType = 0; GstElement* gstSrc = NULL; - char* fname=NULL; + char* fname = NULL; XADataLocator_URI* uri = NULL; XADataLocator_IODevice* ioDevice = NULL; #ifdef OMAX_CAMERABIN @@ -423,189 +421,192 @@ XARadioDeviceImpl* radioDevice = NULL; DEBUG_API("->XAAdaptationGst_CreateGstSource"); - if( !xaSrc || !xaSrc->pLocator || !isobj ) - { + if (!xaSrc || !xaSrc->pLocator || !isobj) + { return NULL; - } + } *isobj = XA_BOOLEAN_FALSE; - if( xaSrc && xaSrc->pFormat && *((XAuint32*)(xaSrc->pFormat))==XA_DATAFORMAT_PCM && isPCM ) - { + if (xaSrc && xaSrc->pFormat && *((XAuint32*) (xaSrc->pFormat)) + ==XA_DATAFORMAT_PCM && isPCM) + { *isPCM = XA_BOOLEAN_TRUE; - } - if( xaSrc && xaSrc->pFormat && *((XAuint32*)(xaSrc->pFormat))==XA_DATAFORMAT_RAWIMAGE && isRawImage ) - { + } + if (xaSrc && xaSrc->pFormat && *((XAuint32*) (xaSrc->pFormat)) + ==XA_DATAFORMAT_RAWIMAGE && isRawImage) + { *isRawImage = XA_BOOLEAN_TRUE; - } - locType = *((XAuint32*)(xaSrc->pLocator)); - switch ( locType ) - { + } + locType = *((XAuint32*) (xaSrc->pLocator)); + switch (locType) + { case XA_DATALOCATOR_URI: - DEBUG_INFO("XA_DATALOCATOR_URI"); - uri = (XADataLocator_URI*)xaSrc->pLocator; - gstSrc = gst_element_factory_make("filesrc",name); - if ( uri->URI != NULL ) - { + DEBUG_INFO("XA_DATALOCATOR_URI") + ; + uri = (XADataLocator_URI*) xaSrc->pLocator; + gstSrc = gst_element_factory_make("filesrc", name); + if (uri->URI != NULL) + { DEBUG_INFO_A1("URI: %s", uri->URI); - if(strncmp((char *)uri->URI, "file:///", 8) == 0) + if (strncmp((char *) uri->URI, "file:///", 8) == 0) { - fname = (char *)&((uri->URI)[8]); + fname = (char *) &((uri->URI)[8]); } else { - fname = (char *)uri->URI; + fname = (char *) uri->URI; + }DEBUG_INFO_A1("->filesystem path %s", fname); + g_object_set(G_OBJECT(gstSrc), "location", fname, NULL); + /*check for pcm - decodebin does not know how to handle raw PCM files */ + if (isPCM && strstr(fname, ".pcm")) + { + DEBUG_INFO("PCM file detected"); + *isPCM = XA_BOOLEAN_TRUE; } - DEBUG_INFO_A1("->filesystem path %s", fname); - g_object_set( G_OBJECT(gstSrc), "location", fname, NULL ); - /*check for pcm - decodebin does not know how to handle raw PCM files */ - if( isPCM && strstr(fname, ".pcm") ) + } + else { - DEBUG_INFO("PCM file detected"); - *isPCM=XA_BOOLEAN_TRUE; - } - } - else - { DEBUG_ERR("No uri specified."); return NULL; - } + } break; /* XA_DATALOCATOR_URI */ - case XA_DATALOCATOR_IODEVICE: - DEBUG_INFO("XA_DATALOCATOR_IODEVICE"); - ioDevice = (XADataLocator_IODevice*)(xaSrc->pLocator); - switch ( ioDevice->deviceType ) - { + DEBUG_INFO("XA_DATALOCATOR_IODEVICE") + ; + ioDevice = (XADataLocator_IODevice*) (xaSrc->pLocator); + switch (ioDevice->deviceType) + { case XA_IODEVICE_AUDIOINPUT: - { + { DEBUG_INFO("XA_IODEVICE_AUDIOINPUT"); DEBUG_INFO_A1("ioDevice->deviceID: %x", ioDevice->deviceID); - switch (ioDevice->deviceID ) - { - //case XA_ADAPTID_ALSASRC: //Krishna - case XA_ADAPTID_DEVSOUNDSRC: - //DEBUG_INFO("alsasrc"); //Krishna - DEBUG_INFO("devsoundsrc"); - gstSrc = gst_element_factory_make("devsoundsrc",name); //Krishna - changed to devsoundsrc - g_object_set (G_OBJECT (gstSrc), "num-buffers", 80, NULL); - break; - case XA_ADAPTID_AUDIOTESTSRC: - /*fall through*/ - default: - DEBUG_INFO("audiotestsrc"); - gstSrc = gst_element_factory_make("audiotestsrc",name); - break; - } - break; - } -#ifdef OMAX_CAMERABIN - - case XA_IODEVICE_CAMERA: - { - DEBUG_INFO("XA_IODEVICE_CAMERA"); - if ( ioDevice->device ) - { /*source is camera object*/ - DEBUG_INFO("Use camerabin as source."); - /* Get camerabin from source object */ - pObj = (XAObjectItfImpl*)(*ioDevice->device); - cameraDevice = (XACameraDeviceImpl*)(pObj); - /*TODO we had to remove this line below since adaptationCtx - * was not a member of structure*/ - - gstSrc = GST_ELEMENT(((XAAdaptationGstCtx*)(cameraDevice->adaptationCtx))->bin); - /* refcount increase is needed to keep this not being deleted after use */ - gst_object_ref(GST_OBJECT(gstSrc)); - *isobj = XA_BOOLEAN_TRUE; - } - else - { - DEBUG_INFO_A1("ioDevice->deviceID: %x", ioDevice->deviceID); - switch (ioDevice->deviceID ) + switch (ioDevice->deviceID) { - case XA_ADAPTID_V4L2SRC: - DEBUG_INFO("Camera deviceID: v4l2src "); - + //case XA_ADAPTID_ALSASRC: //Krishna + case XA_ADAPTID_DEVSOUNDSRC: + //DEBUG_INFO("alsasrc"); //Krishna + DEBUG_INFO("devsoundsrc") + ; + gstSrc = gst_element_factory_make("devsoundsrc", + name); //Krishna - changed to devsoundsrc + g_object_set(G_OBJECT (gstSrc), "num-buffers", + 80, NULL); break; - case XA_ADAPTID_VIDEOTESTSRC: - DEBUG_INFO("Camera deviceID: videotestsrc"); - - break; + case XA_ADAPTID_AUDIOTESTSRC: + /*fall through*/ default: - case XA_DEFAULTDEVICEID_CAMERA: - DEBUG_INFO("Camera deviceID:Default"); - + DEBUG_INFO("audiotestsrc") + ; + gstSrc = gst_element_factory_make("audiotestsrc", + name); break; } - if ( cameraCtx ) - { - gstSrc = GST_ELEMENT(cameraCtx->baseObj.bin); - gst_object_ref(GST_OBJECT(gstSrc)); - *isobj = XA_BOOLEAN_TRUE; - } - else - { - DEBUG_ERR("No camera object created!"); - return NULL; - } + break; } - break; - } +#ifdef OMAX_CAMERABIN + + case XA_IODEVICE_CAMERA: + { + DEBUG_INFO("XA_IODEVICE_CAMERA"); + if ( ioDevice->device ) + { /*source is camera object*/ + DEBUG_INFO("Use camerabin as source."); + /* Get camerabin from source object */ + pObj = (XAObjectItfImpl*)(*ioDevice->device); + cameraDevice = (XACameraDeviceImpl*)(pObj); + /*TODO we had to remove this line below since adaptationCtx + * was not a member of structure*/ + + gstSrc = GST_ELEMENT(((XAAdaptationGstCtx*)(cameraDevice->adaptationCtx))->bin); + /* refcount increase is needed to keep this not being deleted after use */ + gst_object_ref(GST_OBJECT(gstSrc)); + *isobj = XA_BOOLEAN_TRUE; + } + else + { + DEBUG_INFO_A1("ioDevice->deviceID: %x", ioDevice->deviceID); + switch (ioDevice->deviceID ) + { + case XA_ADAPTID_V4L2SRC: + DEBUG_INFO("Camera deviceID: v4l2src "); + + break; + case XA_ADAPTID_VIDEOTESTSRC: + DEBUG_INFO("Camera deviceID: videotestsrc"); + + break; + default: + case XA_DEFAULTDEVICEID_CAMERA: + DEBUG_INFO("Camera deviceID:Default"); + + break; + } + if ( cameraCtx ) + { + gstSrc = GST_ELEMENT(cameraCtx->baseObj.bin); + gst_object_ref(GST_OBJECT(gstSrc)); + *isobj = XA_BOOLEAN_TRUE; + } + else + { + DEBUG_ERR("No camera object created!"); + return NULL; + } + } + break; + } #endif case XA_IODEVICE_RADIO: - DEBUG_INFO("XA_IODEVICE_RADIO"); - if ( ioDevice->device ) - { + DEBUG_INFO("XA_IODEVICE_RADIO") + ; + if (ioDevice->device) + { DEBUG_INFO("Use radio pipeline as source."); /* Get radio_pipeline and set it to base context */ - radioDevice = (XARadioDeviceImpl*)(*ioDevice->device); + radioDevice = (XARadioDeviceImpl*) (*ioDevice->device); /* radio does not have actual bin, only source element*/ gstSrc = GST_ELEMENT(((XAAdaptationGstCtx*)radioDevice->adaptationCtx)->bin); /* refcount increase is needed to keep this not being deleted after use */ gst_object_ref(GST_OBJECT(gstSrc)); /**isobj = XA_BOOLEAN_TRUE;*/ - } + } break; default: - { + { DEBUG_ERR("Unsupported IODevice."); break; + } } - } break; /* XA_DATALOCATOR_IODEVICE */ -/* case XA_DATALOCATOR_CONTENTPIPE: - { - DEBUG_INFO("XA_DATALOCATOR_CONTENTPIPE"); - gstSrc = gst_element_factory_make("appsrc",name); - break; - }*/ case XA_DATALOCATOR_ADDRESS: { - XADataLocator_Address* address = (XADataLocator_Address*)(xaSrc->pLocator); - gstSrc = gst_element_factory_make("appsrc", name); - /* init gst buffer from datalocator */ - if( gstSrc ) + XADataLocator_Address* address = + (XADataLocator_Address*) (xaSrc->pLocator); + gstSrc = gst_element_factory_make("appsrc", name); + /* init gst buffer from datalocator */ + if (gstSrc) { - /* init GST buffer from XADataLocator*/ - GstBuffer* userBuf = gst_buffer_new(); - if( userBuf ) + /* init GST buffer from XADataLocator*/ + GstBuffer* userBuf = gst_buffer_new(); + if (userBuf) { - userBuf->size = address->length; - userBuf->data = address->pAddress; - /* push the whole buffer to appsrc so it is ready for preroll */ - DEBUG_INFO("Pushing buffer"); - gst_app_src_push_buffer( GST_APP_SRC(gstSrc), userBuf ); - DEBUG_INFO_A1("Sent buffer at 0x%x to appsrc", userBuf ); - gst_app_src_end_of_stream( GST_APP_SRC(gstSrc) ); + userBuf->size = address->length; + userBuf->data = address->pAddress; + /* push the whole buffer to appsrc so it is ready for preroll */ + DEBUG_INFO("Pushing buffer"); + gst_app_src_push_buffer(GST_APP_SRC(gstSrc), userBuf); + DEBUG_INFO_A1("Sent buffer at 0x%x to appsrc", userBuf ); + gst_app_src_end_of_stream(GST_APP_SRC(gstSrc)); } - else + else { - DEBUG_ERR("Failure allocating buffer!"); + DEBUG_ERR("Failure allocating buffer!"); } } - else + else { - DEBUG_ERR("Failure creating appsrc!"); + DEBUG_ERR("Failure creating appsrc!"); } } break; @@ -613,17 +614,16 @@ default: DEBUG_ERR("Incorrect data locator for source.") break; - } + } - if ( gstSrc ) - { + if (gstSrc) + { DEBUG_INFO_A1("Created gstreamer source element at %x", gstSrc); - } + } DEBUG_API("<-XAAdaptationGst_CreateGstSource"); return gstSrc; -} - + } /** * GstElement* XAAdaptationGst_CreateGstSink( XADataSink* xaSnk, const XAchar *name ) @@ -632,129 +632,128 @@ * @return GstElement* - return newly created gst sink element * Description: Create gst sink element corresponding to XA sink structure */ -GstElement* XAAdaptationGst_CreateGstSink( XADataSink* xaSnk, const char *name, XAboolean *isobj ) -{ +GstElement* XAAdaptationGst_CreateGstSink(XADataSink* xaSnk, + const char *name, XAboolean *isobj) + { XAuint32 locType = 0; GstElement* gstSnk = NULL; XADataLocator_URI* uri = NULL; DEBUG_API("->XAAdaptationGst_CreateGstSink"); - if(!xaSnk || !xaSnk->pLocator) - { + if (!xaSnk || !xaSnk->pLocator) + { DEBUG_INFO("Warning! No sink specified, use fakesink"); - gstSnk = gst_element_factory_make("fakesink",name); - if(!gstSnk) - { + gstSnk = gst_element_factory_make("fakesink", name); + if (!gstSnk) + { DEBUG_ERR("Cannot create sink!"); return NULL; + } + g_object_set(G_OBJECT(gstSnk), "async", FALSE, NULL); } - g_object_set( G_OBJECT(gstSnk),"async", FALSE, NULL); - } else - { - locType = *((XAuint32*)(xaSnk->pLocator)); - switch ( locType ) { + locType = *((XAuint32*) (xaSnk->pLocator)); + switch (locType) + { case XA_DATALOCATOR_URI: - DEBUG_INFO("XA_DATALOCATOR_URI"); - uri = (XADataLocator_URI*)xaSnk->pLocator; - gstSnk = gst_element_factory_make("filesink",name); - if(!gstSnk) - { + DEBUG_INFO("XA_DATALOCATOR_URI") + ; + uri = (XADataLocator_URI*) xaSnk->pLocator; + gstSnk = gst_element_factory_make("filesink", name); + if (!gstSnk) + { DEBUG_ERR("Cannot create sink!"); return NULL; - } - if ( uri->URI != NULL ) - { + } + if (uri->URI != NULL) + { XAchar *fname; DEBUG_INFO_A1("URI: %s", uri->URI); - if(strncmp((char *)uri->URI, "file:///", 8) == 0) - { + if (strncmp((char *) uri->URI, "file:///", 8) == 0) + { fname = &((uri->URI)[8]); - } + } else - { + { fname = uri->URI; + }DEBUG_INFO_A1("->filesystem path %s", fname); + g_object_set(G_OBJECT(gstSnk), "location", fname, + "async", FALSE, "qos", FALSE, "max-lateness", + (gint64) (-1), NULL); } - DEBUG_INFO_A1("->filesystem path %s", fname); - g_object_set( G_OBJECT(gstSnk),"location", fname, - "async", FALSE, - "qos", FALSE, - "max-lateness", (gint64)(-1), - NULL); - } else - { + { DEBUG_ERR("No recording output uri specified."); return NULL; - } + } break; case XA_DATALOCATOR_NATIVEDISPLAY: - DEBUG_INFO("Sink locator type - XA_DATALOCATOR_NATIVEDISPLAY"); + DEBUG_INFO("Sink locator type - XA_DATALOCATOR_NATIVEDISPLAY") + ; #ifdef USE_NGA_SURFACES - gstSnk = gst_element_factory_make("devvideosink","devvideosink"); + gstSnk = gst_element_factory_make("devvideosink", + "devvideosink"); #else gstSnk = gst_element_factory_make("ximagesink",name); #endif /*USE_NGA_SURFACES*/ - if(!gstSnk) - { + if (!gstSnk) + { DEBUG_ERR("Cannot create sink!"); return NULL; - } - g_object_set( G_OBJECT(gstSnk), "force-aspect-ratio", TRUE, - "async", FALSE, - "qos", FALSE, - "handle-events", TRUE, - "handle-expose", TRUE, - "max-lateness", (gint64)(-1), - NULL); + } + g_object_set(G_OBJECT(gstSnk), "force-aspect-ratio", TRUE, + "async", FALSE, "qos", FALSE, "handle-events", TRUE, + "handle-expose", TRUE, "max-lateness", (gint64) (-1), + NULL); break; case XA_DATALOCATOR_OUTPUTMIX: - DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX"); - { + DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX") + ; + { /* Get OutputMix adaptation from data locator */ - XADataLocator_OutputMix* omix = (XADataLocator_OutputMix*)(xaSnk->pLocator); - if ( omix->outputMix ) - { - XAOMixImpl* omixDevice = (XAOMixImpl*)(*omix->outputMix); + XADataLocator_OutputMix* omix = + (XADataLocator_OutputMix*) (xaSnk->pLocator); + if (omix->outputMix) + { + XAOMixImpl* omixDevice = + (XAOMixImpl*) (*omix->outputMix); - if(omixDevice) - { + if (omixDevice) + { /*TODO we had to remove this line below since adaptationCtx * was not a member of structure*/ - + /*gstSnk = XAOutputMixAdapt_GetSink(omixDevice->adaptationCtx);*/ - if(!gstSnk) - { + if (!gstSnk) + { DEBUG_ERR("Cannot create sink!"); return NULL; - } + } *isobj = XA_BOOLEAN_TRUE; - } + } else - { + { DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); - gstSnk = gst_element_factory_make("alsasink",name); + gstSnk = gst_element_factory_make("alsasink", + name); + } } - } else - { + { DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); - gstSnk = gst_element_factory_make("alsasink",name); - } + gstSnk = gst_element_factory_make("alsasink", name); + } - } + } break; -/* case XA_DATALOCATOR_CONTENTPIPE: - DEBUG_INFO("XA_DATALOCATOR_CONTENTPIPE"); - gstSnk = gst_element_factory_make("appsink",name); - break;*/ + case XA_DATALOCATOR_ADDRESS: { - gstSnk = gst_element_factory_make("appsink", name); - /* Not actually object sink, but attribute used to notify recorder - * about appsink (no object sinks applicable in this use case) - **/ - *isobj=TRUE; + gstSnk = gst_element_factory_make("appsink", name); + /* Not actually object sink, but attribute used to notify recorder + * about appsink (no object sinks applicable in this use case) + **/ + *isobj = TRUE; } break; case XA_DATALOCATOR_IODEVICE: @@ -765,718 +764,690 @@ default: DEBUG_ERR("Incorrect data locator for sink.") break; + } } - } - if (gstSnk ) - { + if (gstSnk) + { DEBUG_INFO_A1("Created gstreamer sink element at %x", gstSnk); + }DEBUG_API("<-XAAdaptationGst_CreateGstSink"); + return gstSnk; } - DEBUG_API("<-XAAdaptationGst_CreateGstSink"); - return gstSnk; -} /** * GstElement* XAAdaptationGst_CreateVideoPP( ) * @return GstElement* - return newly created gst pipeline element * Description: Create video processing pipeline */ -GstElement* XAAdaptationGst_CreateVideoPP( ) -{ +GstElement* XAAdaptationGst_CreateVideoPP() + { GstElement *vpp; DEBUG_API("->XAAdaptationGst_CreateVideoPP"); vpp = gst_pipeline_new("videopp"); - if( vpp ) - { + if (vpp) + { GstPad *ghostsink, *ghostsrc; - GstElement *col1, - *col2, - *rotate, - *mirror, - *box, - *crop, - *gamma, - *balance, - *scale, - *scale2, + GstElement *col1, *col2, *rotate, *mirror, *box, *crop, *gamma, + *balance, *scale, *scale2, #ifdef USE_NGA_SURFACES - *identity, + *identity, #endif /*USE_NGA_SURFACES*/ - *queue; - + *queue; /* Crete ffmpegcolorspace to convert stream to correct format */ - col1 = gst_element_factory_make( "ffmpegcolorspace", "pp_colsp1"); - if(col1) - { + col1 = gst_element_factory_make("ffmpegcolorspace", "pp_colsp1"); + if (col1) + { DEBUG_INFO("Created ffmpegcolorspace element"); gst_bin_add(GST_BIN(vpp), col1); - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(col1,"sink"); - if(ghostsink) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink",ghostsink)); + /* make this bin link point*/ + ghostsink = gst_element_get_static_pad(col1, "sink"); + if (ghostsink) + { + gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink", + ghostsink)); gst_object_unref(GST_OBJECT(ghostsink)); + } } - } /* create video crop, this will be sink for videoPP pipeline */ - crop = gst_element_factory_make( "videocrop", "pp_crop"); - if(crop) - { + crop = gst_element_factory_make("videocrop", "pp_crop"); + if (crop) + { DEBUG_INFO("Created crop element"); gst_bin_add(GST_BIN(vpp), crop); - } + } /* create video rotate */ - rotate = gst_element_factory_make( "videoflip", "pp_rotate"); - if(rotate) - { + rotate = gst_element_factory_make("videoflip", "pp_rotate"); + if (rotate) + { DEBUG_INFO("Created rotate element"); g_object_set(G_OBJECT(rotate), "method", FLIP_NONE, NULL); gst_bin_add(GST_BIN(vpp), rotate); - } + } /* create video mirror */ - mirror = gst_element_factory_make( "videoflip", "pp_mirror"); - if(mirror) - { + mirror = gst_element_factory_make("videoflip", "pp_mirror"); + if (mirror) + { DEBUG_INFO("Created mirror element"); g_object_set(G_OBJECT(mirror), "method", FLIP_NONE, NULL); gst_bin_add(GST_BIN(vpp), mirror); - } + } /* create video box */ - box = gst_element_factory_make( "videobox", "pp_box"); - if(box) - { + box = gst_element_factory_make("videobox", "pp_box"); + if (box) + { DEBUG_INFO("Created videobox element"); gst_bin_add(GST_BIN(vpp), box); - } + } /* create video balance */ - balance = gst_element_factory_make( "videobalance", "pp_balance"); - if(balance) - { + balance = gst_element_factory_make("videobalance", "pp_balance"); + if (balance) + { DEBUG_INFO("Created balance element"); gst_bin_add(GST_BIN(vpp), balance); - } + } /* create video gamma */ - gamma = gst_element_factory_make( "gamma", "pp_gamma"); - if(gamma) - { + gamma = gst_element_factory_make("gamma", "pp_gamma"); + if (gamma) + { DEBUG_INFO("Created gamma element"); gst_bin_add(GST_BIN(vpp), gamma); - } + } /* Create videoscale element to scale postprocessed output to correct size */ scale = gst_element_factory_make("videoscale", "pp_scale"); - if ( scale ) - { + if (scale) + { DEBUG_INFO("Created videoscale element"); gst_bin_add(GST_BIN(vpp), scale); - } + } scale2 = gst_element_factory_make("videoscale", "pp_scale2"); - if ( scale2 ) - { - GstPad *pad = NULL; - GstCaps *caps = NULL; - DEBUG_INFO("Created videoscale element"); - pad = gst_element_get_static_pad(scale2,"src"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); - gst_pad_set_caps(pad, caps); - gst_bin_add(GST_BIN(vpp), scale2); - } + if (scale2) + { + GstPad *pad = NULL; + GstCaps *caps = NULL; + DEBUG_INFO("Created videoscale element"); + pad = gst_element_get_static_pad(scale2, "src"); + caps = gst_caps_new_simple("video/x-raw-yuv", "width", + G_TYPE_INT, 0, "height", G_TYPE_INT, 0, NULL); + gst_pad_set_caps(pad, caps); + gst_bin_add(GST_BIN(vpp), scale2); + } /* create video queue */ - queue = gst_element_factory_make( "queue", "vpp_queue"); - if(queue) - { + queue = gst_element_factory_make("queue", "vpp_queue"); + if (queue) + { DEBUG_INFO("Created queue element"); gst_bin_add(GST_BIN(vpp), queue); #ifdef USE_NGA_SURFACES /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(queue,"sink"); - if(ghostsink) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src",ghostsink)); + ghostsink = gst_element_get_static_pad(queue, "sink"); + if (ghostsink) + { + gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src", + ghostsink)); gst_object_unref(GST_OBJECT(ghostsink)); - } + } #endif /*USE_NGA_SURFACES*/ - } - + } /* Crete ffmpegcolorspace to convert stream to correct format */ - col2 = gst_element_factory_make( "ffmpegcolorspace", "pp_colsp2"); - if(col2) - { + col2 = gst_element_factory_make("ffmpegcolorspace", "pp_colsp2"); + if (col2) + { DEBUG_INFO("Created ffmpegcolorspace element"); gst_bin_add(GST_BIN(vpp), col2); /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(col2,"src"); - if(ghostsrc) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src",ghostsrc)); + ghostsrc = gst_element_get_static_pad(col2, "src"); + if (ghostsrc) + { + gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src", + ghostsrc)); gst_object_unref(GST_OBJECT(ghostsrc)); + } } - } #ifdef USE_NGA_SURFACES //shyward /* create identity element */ - identity = gst_element_factory_make( "identity", "identity" ); - if(identity) - { - DEBUG_INFO("Created identity element"); - gst_bin_add(GST_BIN(vpp), identity); - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(identity,"src"); - if(ghostsrc) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - } - if( !(gst_element_link_many(queue,identity,NULL)) ) + identity = gst_element_factory_make("identity", "identity"); + if (identity) + { + DEBUG_INFO("Created identity element"); + gst_bin_add(GST_BIN(vpp), identity); + /* make this bin link point*/ + ghostsrc = gst_element_get_static_pad(identity, "src"); + if (ghostsrc) + { + gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink", + ghostsrc)); + gst_object_unref(GST_OBJECT(ghostsrc)); + } + } + if (!(gst_element_link_many(queue, identity, NULL))) #else //shyward - thins code assumes all the elements will have been created, which is not true if( !(gst_element_link_many(col1, - scale, - crop, - rotate, - mirror, - box, - balance, - gamma, - queue, - scale2, + scale, + crop, + rotate, + mirror, + box, + balance, + gamma, + queue, + scale2, #ifdef USE_NGA_SURFACES - identity, + identity, #endif /*USE_NGA_SURFACES*/ - col2, - NULL) - ) ) + col2, + NULL) + ) ) #endif /*USE_NGA_SURFACES*/ - { + { DEBUG_ERR("Could not link videopp elements!!"); gst_object_unref(vpp); vpp = NULL; - } + } + }DEBUG_API("<-XAAdaptationGst_CreateVideoPP"); + return vpp; } - DEBUG_API("<-XAAdaptationGst_CreateVideoPP"); - return vpp; -} /** * GstElement* XAAdaptationGst_CreateFixedSizeRecordVideoPP( ) * @return GstElement* - return newly created gst pipeline element - * Description: Create video processing pipeline with fixed output size to TEST_VIDEO_WIDTH x TEST_VIDEO_HEIGHT + * Description: Create video processing pipeline with fixed output size + * to TEST_VIDEO_WIDTH x TEST_VIDEO_HEIGHT * experimental implementation for changing recorder output size */ -GstElement* XAAdaptationGst_CreateFixedSizeVideoPP( ) -{ +GstElement* XAAdaptationGst_CreateFixedSizeVideoPP() + { GstElement *vpp; DEBUG_API("->XAAdaptationGst_CreateFixedSizeVideoPP"); vpp = gst_pipeline_new("videopp"); - if( vpp ) - { + if (vpp) + { GstPad *ghostsink, *ghostsrc; - GstElement *col1, - *col2, - *rotate, - *mirror, - *box, - *crop, - *gamma, - *balance, - *scale, - *scale2, - *filter, - *queue; - + GstElement *col1, *col2, *rotate, *mirror, *box, *crop, *gamma, + *balance, *scale, *scale2, *filter, *queue; /* Crete ffmpegcolorspace to convert stream to correct format */ - col1 = gst_element_factory_make( "ffmpegcolorspace", "pp_colsp1"); - if(col1) - { + col1 = gst_element_factory_make("ffmpegcolorspace", "pp_colsp1"); + if (col1) + { DEBUG_INFO("Created ffmpegcolorspace element"); gst_bin_add(GST_BIN(vpp), col1); - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(col1,"sink"); - if(ghostsink) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink",ghostsink)); + /* make this bin link point*/ + ghostsink = gst_element_get_static_pad(col1, "sink"); + if (ghostsink) + { + gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink", + ghostsink)); gst_object_unref(GST_OBJECT(ghostsink)); + } } - } /* create video crop, this will be sink for videoPP pipeline */ - crop = gst_element_factory_make( "videocrop", "pp_crop"); - if(crop) - { + crop = gst_element_factory_make("videocrop", "pp_crop"); + if (crop) + { DEBUG_INFO("Created crop element"); gst_bin_add(GST_BIN(vpp), crop); - } + } /* create video rotate */ - rotate = gst_element_factory_make( "videoflip", "pp_rotate"); - if(rotate) - { + rotate = gst_element_factory_make("videoflip", "pp_rotate"); + if (rotate) + { DEBUG_INFO("Created rotate element"); g_object_set(G_OBJECT(rotate), "method", FLIP_NONE, NULL); gst_bin_add(GST_BIN(vpp), rotate); - } + } /* create video mirror */ - mirror = gst_element_factory_make( "videoflip", "pp_mirror"); - if(mirror) - { + mirror = gst_element_factory_make("videoflip", "pp_mirror"); + if (mirror) + { DEBUG_INFO("Created mirror element"); g_object_set(G_OBJECT(mirror), "method", FLIP_NONE, NULL); gst_bin_add(GST_BIN(vpp), mirror); - } + } /* create video box */ - box = gst_element_factory_make( "videobox", "pp_box"); - if(box) - { + box = gst_element_factory_make("videobox", "pp_box"); + if (box) + { DEBUG_INFO("Created videobox element"); gst_bin_add(GST_BIN(vpp), box); - } + } /* create video balance */ - balance = gst_element_factory_make( "videobalance", "pp_balance"); - if(balance) - { + balance = gst_element_factory_make("videobalance", "pp_balance"); + if (balance) + { DEBUG_INFO("Created balance element"); gst_bin_add(GST_BIN(vpp), balance); - } + } /* create video gamma */ - gamma = gst_element_factory_make( "gamma", "pp_gamma"); - if(gamma) - { + gamma = gst_element_factory_make("gamma", "pp_gamma"); + if (gamma) + { DEBUG_INFO("Created gamma element"); gst_bin_add(GST_BIN(vpp), gamma); - } + } /* Create videoscale element to scale postprocessed output to correct size */ scale = gst_element_factory_make("videoscale", "pp_scale"); - if ( scale ) - { + if (scale) + { DEBUG_INFO("Created videoscale element"); gst_bin_add(GST_BIN(vpp), scale); - } + } scale2 = gst_element_factory_make("videoscale", "pp_scale2"); - if ( scale2 ) - { + if (scale2) + { GstPad *pad = NULL; GstCaps *caps = NULL; DEBUG_INFO("Created videoscale element"); - pad = gst_element_get_static_pad(scale2,"src"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); + pad = gst_element_get_static_pad(scale2, "src"); + caps = gst_caps_new_simple("video/x-raw-yuv", "width", + G_TYPE_INT, 0, "height", G_TYPE_INT, 0, NULL); gst_pad_set_caps(pad, caps); gst_bin_add(GST_BIN(vpp), scale2); - } + } /* create capsfilter for fixed video size */ filter = gst_element_factory_make("capsfilter", "pp_filter"); - if ( filter ) - { + if (filter) + { - g_object_set( G_OBJECT(filter), "caps", - gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT, TEST_VIDEO_WIDTH, - "height", G_TYPE_INT, TEST_VIDEO_HEIGHT, NULL) - ,NULL ); + g_object_set(G_OBJECT(filter), "caps", gst_caps_new_simple( + "video/x-raw-yuv", "width", G_TYPE_INT, TEST_VIDEO_WIDTH, + "height", G_TYPE_INT, TEST_VIDEO_HEIGHT, NULL), NULL); gst_bin_add(GST_BIN(vpp), filter); - } + } /* create video queue */ - queue = gst_element_factory_make( "queue", "vpp_queue"); - if(queue) - { + queue = gst_element_factory_make("queue", "vpp_queue"); + if (queue) + { gst_bin_add(GST_BIN(vpp), queue); - } - + } /* Crete ffmpegcolorspace to convert stream to correct format */ - col2 = gst_element_factory_make( "ffmpegcolorspace", "pp_colsp2"); - if(col2) - { + col2 = gst_element_factory_make("ffmpegcolorspace", "pp_colsp2"); + if (col2) + { DEBUG_INFO("Created ffmpegcolorspace element"); gst_bin_add(GST_BIN(vpp), col2); /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(col2,"src"); - if(ghostsrc) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src",ghostsrc)); + ghostsrc = gst_element_get_static_pad(col2, "src"); + if (ghostsrc) + { + gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src", + ghostsrc)); gst_object_unref(GST_OBJECT(ghostsrc)); + } } - } - if( !(gst_element_link_many(col1, - scale, - crop, - rotate, - mirror, - box, - balance, - gamma, - queue, - scale2, - filter, - col2, - NULL) - ) ) - { + if (!(gst_element_link_many(col1, scale, crop, rotate, mirror, box, + balance, gamma, queue, scale2, filter, col2, NULL))) + { DEBUG_ERR("Could not link videopp elements!!"); gst_object_unref(vpp); vpp = NULL; - } - } - DEBUG_API("<-XAAdaptationGst_CreateFixedSizeVideoPP"); + } + }DEBUG_API("<-XAAdaptationGst_CreateFixedSizeVideoPP"); return vpp; -} - - + } /** * GstElement* XAAdaptationGst_CreateVideoPPBlackScr( ) * @return GstElement* - return newly created gst pipeline element * Description: Create video processing pipeline for black screen */ -GstElement* XAAdaptationGst_CreateVideoPPBlackScr( ) -{ +GstElement* XAAdaptationGst_CreateVideoPPBlackScr() + { GstElement *vppBScr; DEBUG_API("->XAAdaptationGst_CreateVideoPPBlackScr"); vppBScr = gst_pipeline_new("videoppBScr"); - if( vppBScr ) - { - GstPad *ghostsrc=NULL; - GstElement *testVideo=NULL, *scale=NULL; - GstElement *ffmpegcolorspace=NULL; + if (vppBScr) + { + GstPad *ghostsrc = NULL; + GstElement *testVideo = NULL, *scale = NULL; + GstElement *ffmpegcolorspace = NULL; - testVideo = gst_element_factory_make( "videotestsrc", "videotest"); - if(testVideo) - { + testVideo = gst_element_factory_make("videotestsrc", "videotest"); + if (testVideo) + { DEBUG_INFO("Created videotestsrc element"); - g_object_set(G_OBJECT(testVideo), "pattern", (gint)2, "num-buffers", (gint)1, NULL); + g_object_set(G_OBJECT(testVideo), "pattern", (gint) 2, + "num-buffers", (gint) 1, NULL); gst_bin_add(GST_BIN(vppBScr), testVideo); - } + } scale = gst_element_factory_make("videoscale", "BSrc_scale"); - if(scale) - { + if (scale) + { DEBUG_INFO("Created videoscale element"); gst_bin_add(GST_BIN(vppBScr), scale); /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(scale,"src"); - if(ghostsrc) - { - gst_element_add_pad(vppBScr, gst_ghost_pad_new("videoppBSrc_src",ghostsrc)); + ghostsrc = gst_element_get_static_pad(scale, "src"); + if (ghostsrc) + { + gst_element_add_pad(vppBScr, gst_ghost_pad_new( + "videoppBSrc_src", ghostsrc)); gst_object_unref(GST_OBJECT(ghostsrc)); + } } - } - ffmpegcolorspace = gst_element_factory_make("ffmpegcolorspace", "BlackScrFfmpeg"); + ffmpegcolorspace = gst_element_factory_make("ffmpegcolorspace", + "BlackScrFfmpeg"); gst_bin_add(GST_BIN(vppBScr), ffmpegcolorspace); - if( !(gst_element_link_many(testVideo, ffmpegcolorspace, scale, NULL)) ) - { + if (!(gst_element_link_many(testVideo, ffmpegcolorspace, scale, NULL))) + { DEBUG_ERR("Could not link videoppBSrc elements!!"); gst_object_unref(vppBScr); vppBScr = NULL; - } + } + }DEBUG_API("<-XAAdaptationGst_CreateVideoPPBlackScr"); + return vppBScr; } - DEBUG_API("<-XAAdaptationGst_CreateVideoPPBlackScr"); - return vppBScr; -} /** * GstElement* XAAdaptationGst_CreateInputSelector( ) * @return GstElement* - return newly created input selector * Description: Create input selector to processing between black screen and video screen */ -GstElement* XAAdaptationGst_CreateInputSelector( ) -{ +GstElement* XAAdaptationGst_CreateInputSelector() + { GstElement *inputSelector; DEBUG_API("->XAAdaptationGst_CreateInputSelector"); - inputSelector = gst_element_factory_make("input-selector", "input-selector"); - if( inputSelector ) - { + inputSelector = gst_element_factory_make("input-selector", + "input-selector"); + if (inputSelector) + { g_object_set(G_OBJECT(inputSelector), "select-all", TRUE, NULL); + }DEBUG_API("<-XAAdaptationGst_CreateInputSelector"); + return inputSelector; } - DEBUG_API("<-XAAdaptationGst_CreateInputSelector"); - return inputSelector; -} /** * GstElement* XAAdaptationGst_CreateAudioPP( ) * @return GstElement* - return newly created gst pipeline element * Description: Create video processing pipeline */ -GstElement* XAAdaptationGst_CreateAudioPP( ) -{ +GstElement* XAAdaptationGst_CreateAudioPP() + { GstElement *app; gboolean ok = TRUE; DEBUG_API("->XAAdaptationGst_CreateAudioPP"); app = gst_pipeline_new("audiopp"); - if( app ) - { + if (app) + { GstPad *ghostsink, *ghostsrc; - GstElement *ac,*vol,*eq,*queue,*pan, *ac2; + GstElement *ac, *vol, *eq, *queue, *pan, *ac2; - /* first and last elements should be audioconverts to match sink and encoder formats */ - ac = gst_element_factory_make( "audioconvert", "pp_ac"); + /* first and last elements should be audioconverts to + * match sink and encoder formats */ + ac = gst_element_factory_make("audioconvert", "pp_ac"); if (ac) - { + { ok = gst_bin_add(GST_BIN(app), ac); /* make this bin link point*/ if (ok) - { - ghostsink = gst_element_get_static_pad(ac,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); + { + ghostsink = gst_element_get_static_pad(ac, "sink"); + ok = gst_element_add_pad(app, gst_ghost_pad_new("sink", + ghostsink)); gst_object_unref(GST_OBJECT(ghostsink)); + } } - } - ac2 = gst_element_factory_make( "audioconvert", "pp_ac2"); + ac2 = gst_element_factory_make("audioconvert", "pp_ac2"); if (ac2 && ok) - { + { ok = gst_bin_add(GST_BIN(app), ac2); /* make this bin link point*/ if (ok) + { + ghostsrc = gst_element_get_static_pad(ac2, "src"); + ok = gst_element_add_pad(app, gst_ghost_pad_new("src", + ghostsrc)); + gst_object_unref(GST_OBJECT(ghostsrc)); + } + } + + vol = gst_element_factory_make("volume", "pp_vol"); + /* create volume controller */ + if (vol && ok) { - ghostsrc = gst_element_get_static_pad(ac2,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); + ok = gst_bin_add(GST_BIN(app), vol); + g_object_set(G_OBJECT(vol), "volume", (gdouble) 1, NULL); + } + /* create 10-band equalizer */ + eq = gst_element_factory_make("equalizer-10bands", "pp_equ"); + if (eq && ok) + { + ok = gst_bin_add(GST_BIN(app), eq); + } + /* create audio queue */ + queue = gst_element_factory_make("queue", "app_queue"); + if (queue && ok) + { + ok = gst_bin_add(GST_BIN(app), queue); + g_object_set(G_OBJECT (queue), "max-size-buffers", 2, NULL); + } + /* create audio pan effect */ + pan = gst_element_factory_make("audiopanorama", "pp_pan"); + if (pan && ok) + { + ok = gst_bin_add(GST_BIN(app), pan); + } + + if (ac && ok) + { + if (queue) + { + ok = gst_element_link(ac, queue); + } + else if (vol) + { + ok = gst_element_link(ac, vol); + } + else if (pan) + { + ok = gst_element_link(ac, pan); + } + else if (eq) + { + ok = gst_element_link(ac, eq); + } + else if (ac2) + { + ok = gst_element_link(ac, ac2); + } + } + if (queue && ok) + { + if (vol) + { + ok = gst_element_link(queue, vol); + } + else if (pan) + { + ok = gst_element_link(queue, pan); + } + else if (eq) + { + ok = gst_element_link(queue, eq); + } + else if (ac2) + { + ok = gst_element_link(queue, ac2); + } + } + if (vol && ok) + { + if (pan) + { + ok = gst_element_link(vol, pan); + } + else if (eq) + { + ok = gst_element_link(vol, eq); + } + else if (ac2) + { + ok = gst_element_link(vol, ac2); + } + } + if (pan && ok) + { + if (eq) + { + ok = gst_element_link(pan, eq); + } + else if (ac2) + { + ok = gst_element_link(pan, ac2); + } + } + if (eq && ok) + { + if (ac2) + { + ok = gst_element_link(eq, ac2); + } + } + + if (ac) + { + // ghost sink above + } + else if (queue && ok) + { + /* make this bin link point*/ + ghostsink = gst_element_get_static_pad(queue, "sink"); + ok = gst_element_add_pad(app, + gst_ghost_pad_new("sink", ghostsink)); + gst_object_unref(GST_OBJECT(ghostsink)); + } + else if (vol && ok) + { + /* make this bin link point*/ + ghostsink = gst_element_get_static_pad(vol, "sink"); + ok = gst_element_add_pad(app, + gst_ghost_pad_new("sink", ghostsink)); + gst_object_unref(GST_OBJECT(ghostsink)); + } + else if (pan && ok) + { + /* make this bin link point*/ + ghostsink = gst_element_get_static_pad(pan, "sink"); + ok = gst_element_add_pad(app, + gst_ghost_pad_new("sink", ghostsink)); + gst_object_unref(GST_OBJECT(ghostsink)); + } + else if (eq && ok) + { + /* make this bin link point*/ + ghostsink = gst_element_get_static_pad(eq, "sink"); + ok = gst_element_add_pad(app, + gst_ghost_pad_new("sink", ghostsink)); + gst_object_unref(GST_OBJECT(ghostsink)); + } + else if (ac2 && ok) + { + /* make this bin link point*/ + ghostsink = gst_element_get_static_pad(ac2, "sink"); + ok = gst_element_add_pad(app, + gst_ghost_pad_new("sink", ghostsink)); + gst_object_unref(GST_OBJECT(ghostsink)); + } + + if (ac2) + { + // ghost src above + } + else if (eq && ok) + { + /* make this bin link point*/ + ghostsrc = gst_element_get_static_pad(eq, "src"); + ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); + gst_object_unref(GST_OBJECT(ghostsrc)); + } + else if (pan && ok) + { + /* make this bin link point*/ + ghostsrc = gst_element_get_static_pad(pan, "src"); + ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); + gst_object_unref(GST_OBJECT(ghostsrc)); + } + else if (vol && ok) + { + /* make this bin link point*/ + ghostsrc = gst_element_get_static_pad(vol, "src"); + ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); + gst_object_unref(GST_OBJECT(ghostsrc)); + } + else if (queue && ok) + { + /* make this bin link point*/ + ghostsrc = gst_element_get_static_pad(queue, "src"); + ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); + gst_object_unref(GST_OBJECT(ghostsrc)); + } + else if (ac && ok) + { + /* make this bin link point*/ + ghostsrc = gst_element_get_static_pad(ac, "src"); + ok = gst_element_add_pad(app, gst_ghost_pad_new("src", ghostsrc)); + gst_object_unref(GST_OBJECT(ghostsrc)); + } + + // if( !(gst_element_link_many(ac, queue, vol, ac2, NULL)) ) + // if( !(gst_element_link_many(ac, queue, vol, pan, eq, ac2, NULL)) ) + if (!ok) + { + DEBUG_ERR("Could not link audiopp elements!!"); + gst_object_unref(app); + app = NULL; } } - vol = gst_element_factory_make( "volume", "pp_vol"); - /* create volume controller */ - if (vol && ok) - { - ok = gst_bin_add(GST_BIN(app), vol); - g_object_set( G_OBJECT(vol), "volume", (gdouble)1, NULL ); - } - /* create 10-band equalizer */ - eq = gst_element_factory_make( "equalizer-10bands", "pp_equ"); - if (eq && ok) - { - ok = gst_bin_add(GST_BIN(app), eq); - } - /* create audio queue */ - queue = gst_element_factory_make( "queue", "app_queue"); - if(queue && ok) - { - ok = gst_bin_add(GST_BIN(app), queue); - g_object_set (G_OBJECT (queue), "max-size-buffers", 2, NULL); - } - /* create audio pan effect */ - pan = gst_element_factory_make( "audiopanorama", "pp_pan"); - if (pan && ok) - { - ok = gst_bin_add(GST_BIN(app), pan); - } - - if (ac && ok) - { - if (queue) - { - ok = gst_element_link(ac, queue); - } - else if (vol) - { - ok = gst_element_link(ac, vol); - } - else if (pan) - { - ok = gst_element_link(ac, pan); - } - else if (eq) - { - ok = gst_element_link(ac, eq); - } - else if (ac2) - { - ok = gst_element_link(ac, ac2); - } - } - if (queue && ok) - { - if (vol) - { - ok = gst_element_link(queue, vol); - } - else if (pan) - { - ok = gst_element_link(queue, pan); - } - else if (eq) - { - ok = gst_element_link(queue, eq); - } - else if (ac2) - { - ok = gst_element_link(queue, ac2); - } - } - if (vol && ok) - { - if (pan) - { - ok = gst_element_link(vol, pan); - } - else if (eq) - { - ok = gst_element_link(vol, eq); - } - else if (ac2) - { - ok = gst_element_link(vol, ac2); - } - } - if (pan && ok) - { - if (eq) - { - ok = gst_element_link(pan, eq); - } - else if (ac2) - { - ok = gst_element_link(pan, ac2); - } - } - if (eq && ok) - { - if (ac2) - { - ok = gst_element_link(eq, ac2); - } - } - - if (ac) - { - // ghost sink above - } - else if (queue && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(queue,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - else if (vol && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(vol,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - else if (pan && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(pan,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - else if (eq && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(eq,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - else if (ac2 && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(ac2,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - - if (ac2) - { - // ghost src above - } - else if (eq && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(eq,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - else if (pan && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(pan,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - else if (vol && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(vol,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - else if (queue && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(queue,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - else if (ac && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(ac,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - -// if( !(gst_element_link_many(ac, queue, vol, ac2, NULL)) ) -// if( !(gst_element_link_many(ac, queue, vol, pan, eq, ac2, NULL)) ) - if (!ok) - { - DEBUG_ERR("Could not link audiopp elements!!"); - gst_object_unref(app); - app = NULL; - } + DEBUG_API("<-XAAdaptationGst_CreateAudioPP"); + return app; } - DEBUG_API("<-XAAdaptationGst_CreateAudioPP"); - return app; -} - /* called when pad is actually blocking/ gets unblocked*/ -void XAAdaptationGst_PadBlockCb(GstPad *pad, gboolean blocked, gpointer user_data) -{ +void XAAdaptationGst_PadBlockCb(GstPad *pad, gboolean blocked, + gpointer user_data) + { DEBUG_API_A2("->XAAdaptationGst_PadBlockCb pad \"%s\" of \"%s\" ", - GST_OBJECT_NAME(pad), - GST_OBJECT_NAME(gst_pad_get_parent_element(pad)) ); + GST_OBJECT_NAME(pad), + GST_OBJECT_NAME(gst_pad_get_parent_element(pad)) ); DEBUG_API_A1("<-XAAdaptationGst_PadBlockCb blocked:%d",blocked); -} + } /* utility to set same fields for all media types in caps */ -void XAAdaptationGst_SetAllCaps (GstCaps * caps, char *field, ...) -{ +void XAAdaptationGst_SetAllCaps(GstCaps * caps, char *field, ...) + { GstStructure *structure; va_list var_args; int i; - for (i = 0; i < gst_caps_get_size (caps); i++) - { - structure = gst_caps_get_structure (caps, i); + for (i = 0; i < gst_caps_get_size(caps); i++) + { + structure = gst_caps_get_structure(caps, i); va_start (var_args, field); - gst_structure_set_valist (structure, field, var_args); + gst_structure_set_valist(structure, field, var_args); va_end (var_args); + } } -} - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Base Gstreamer Adaptation Source + * + */ #ifndef XAADAPTATIONGST_H_ #define XAADAPTATIONGST_H_ @@ -22,12 +22,12 @@ #include #include #include -#include "openmaxalwrapper.h" -#include "xaglobals.h" #include #include #include #include +#include "openmaxalwrapper.h" +#include "xaglobals.h" #include "xaplatform.h" #include "xaadptbasectx.h" #include @@ -45,48 +45,47 @@ #define FLIP_VERTICAL 5 /* Flip image vertically */ /* TYPEDEFS */ -typedef gboolean (*GstBusCb)( GstBus *bus, GstMessage *message, gpointer data ); +typedef gboolean (*GstBusCb)(GstBus *bus, GstMessage *message, gpointer data); #define CONTENT_PIPE_BUFFER_SIZE 1000 #define TEST_VIDEO_WIDTH 640 #define TEST_VIDEO_HEIGHT 480 /*typedef enum -{ - XA_AUDIO_WAVENC = 0, - XA_AUDIO_VORBISENC, - XA_AUDIO_PCM, - XA_NUM_OF_AUDIOENCODERS Do not move this line -} XAAudioEnc;*/ + { + XA_AUDIO_WAVENC = 0, + XA_AUDIO_VORBISENC, + XA_AUDIO_PCM, + XA_NUM_OF_AUDIOENCODERS Do not move this line + } XAAudioEnc;*/ /*typedef enum -{ - XA_VIDEO_JPEGENC = 0, - XA_VIDEO_THEORAENC, - XA_NUM_OF_VIDEOENCODERS Do not move this line -} XAVideoEnc;*/ + { + XA_VIDEO_JPEGENC = 0, + XA_VIDEO_THEORAENC, + XA_NUM_OF_VIDEOENCODERS Do not move this line + } XAVideoEnc;*/ /*typedef enum CP_STATE -{ - CPStateNull =0, - CPStateInitialized, - CPStatePrerolling, - CPStateStarted, - CPStateRunning, - CPStatePaused, - CPStateStopped, - CPStateWaitForData, - CPStateEOS, - CPStateError -}CP_STATE;*/ + { + CPStateNull =0, + CPStateInitialized, + CPStatePrerolling, + CPStateStarted, + CPStateRunning, + CPStatePaused, + CPStateStopped, + CPStateWaitForData, + CPStateEOS, + CPStateError + }CP_STATE;*/ /*typedef enum -{ - XA_IMAGE_JPEGENC = 0, - XA_IMAGE_RAW, - XA_NUM_OF_IMAGEENCODERS Do not move this line -} XAImageEnc;*/ - + { + XA_IMAGE_JPEGENC = 0, + XA_IMAGE_RAW, + XA_NUM_OF_IMAGEENCODERS Do not move this line + } XAImageEnc;*/ /* STRUCTURES */ @@ -98,26 +97,26 @@ * Gst-Adaptation context structures. */ typedef struct XAAdaptationGstCtx_ -{ + { /* Common Variables for all adaptation elements */ XAAdaptationBaseCtx baseObj; - GstState binWantedState; /** requested gst-bin target state **/ - GstElement *bin; /** Container for all gst elements **/ + GstState binWantedState; /** requested gst-bin target state **/ + GstElement *bin; /** Container for all gst elements **/ - GstBus *bus; /** Gst-bus where gst sends messages **/ - GMainLoop *busloop; /** Gst-bus listener loop **/ - pthread_t busloopThr; - GstBusCb busCb; /** Gst-Bus callback funtion*/ + GstBus *bus; /** Gst-bus where gst sends messages **/ + GMainLoop *busloop; /** Gst-bus listener loop **/ + pthread_t busloopThr; + GstBusCb busCb; /** Gst-Bus callback funtion*/ - XAboolean waitingasyncop; - sem_t semAsyncWait; - guint asynctimer; + XAboolean waitingasyncop; + sem_t semAsyncWait; + guint asynctimer; #ifdef XA_IMPL_MEASURE_GST_DELAY - clock_t startTime; - clock_t endTime; - double diff; + clock_t startTime; + clock_t endTime; + double diff; #endif /*XA_IMPL_MEASURE_GST_DELAY*/ XAboolean thread_launched; @@ -126,7 +125,7 @@ XAboolean cond_mutx_inited; /* FUNCTIONS*/ -} XAAdaptationGstCtx_; + } XAAdaptationGstCtx_; /* FUNCTIONS */ /* @@ -134,13 +133,13 @@ * Default CallBack handler for gst-bus messages. This will be called if object specific callback is * not implemented. */ - -XAresult XAAdaptationGst_Init( XAAdaptationGstCtx* pSelf, XAuint32 ctxId ); -XAresult XAAdaptationGst_PostInit( XAAdaptationGstCtx* ctx ); -void XAAdaptationGst_Free( XAAdaptationGstCtx* ctx ); - -gboolean XAAdaptationGst_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ); +XAresult XAAdaptationGst_Init(XAAdaptationGstCtx* pSelf, XAuint32 ctxId); +XAresult XAAdaptationGst_PostInit(XAAdaptationGstCtx* ctx); +void XAAdaptationGst_Free(XAAdaptationGstCtx* ctx); + +gboolean XAAdaptationGst_GstBusCb(GstBus *bus, GstMessage *message, + gpointer data); XAresult XAAdaptationGst_InitGstListener(XAAdaptationGstCtx* ctx); void* XAAdaptationGst_LaunchGstListener(void* args); @@ -151,17 +150,19 @@ gboolean XAAdaptationGst_CancelAsyncWait(gpointer ctx); void XAAdaptationGst_CompleteAsyncWait(XAAdaptationGstCtx* ctx); -GstElement* XAAdaptationGst_CreateGstSource( XADataSource* xaSrc, const char *name, XAboolean *isobj, XAboolean *isPCM, XAboolean *isRawImage ); -GstElement* XAAdaptationGst_CreateGstSink( XADataSink* xaSrc, const char *name, XAboolean *isobj ); +GstElement* XAAdaptationGst_CreateGstSource(XADataSource* xaSrc, + const char *name, XAboolean *isobj, XAboolean *isPCM, + XAboolean *isRawImage); +GstElement* XAAdaptationGst_CreateGstSink(XADataSink* xaSrc, + const char *name, XAboolean *isobj); GstElement* XAAdaptationGst_CreateVideoPP(void); GstElement* XAAdaptationGst_CreateVideoPPBlackScr(void); GstElement* XAAdaptationGst_CreateInputSelector(void); GstElement* XAAdaptationGst_CreateAudioPP(void); -void XAAdaptationGst_PadBlockCb(GstPad *pad, gboolean blocked, gpointer user_data); -void XAAdaptationGst_SetAllCaps (GstCaps * caps, char *field, ...); - - +void XAAdaptationGst_PadBlockCb(GstPad *pad, gboolean blocked, + gpointer user_data); +void XAAdaptationGst_SetAllCaps(GstCaps * caps, char *field, ...); /*XAresult XAMetadataAdapt_TryWriteTags(XAAdaptationGstCtx* mCtx, GstBin* binToWriteTo);*/ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: AudioEnc Intfc Adaptation for GStreamer + * + */ #include #include "xamediarecorderadaptctx.h" @@ -29,46 +29,48 @@ * @return XAresult ret - return success value * Description: Sets preferred encoder settings for pipeline. */ -XAresult XAAudioEncoderItfAdapt_SetEncoderSettings( XAAdaptationBaseCtx *ctx, - XAAudioEncoderSettings *pSettings ) -{ +XAresult XAAudioEncoderItfAdapt_SetEncoderSettings(XAAdaptationBaseCtx *ctx, + XAAudioEncoderSettings *pSettings) + { XAresult ret = XA_RESULT_SUCCESS; XAMediaRecorderAdaptationCtx* mCtx = NULL; DEBUG_API("->XAAudioEncoderItfAdapt_SetEncoderSettings"); - if( !ctx || (ctx->ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { + if (!ctx || (ctx->ctxId != XAMediaRecorderAdaptation) || !pSettings) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAAudioEncoderItfImpl_SetEncoderSettings"); return XA_RESULT_PARAMETER_INVALID; - } + } mCtx = (XAMediaRecorderAdaptationCtx*) ctx; - ret = XAMediaRecorderAdapt_CheckCodec(mCtx,XACAP_AUDIO,pSettings->encoderId); - if(ret==XA_RESULT_SUCCESS) - { + ret = XAMediaRecorderAdapt_CheckCodec(mCtx, XACAP_AUDIO, + pSettings->encoderId); + if (ret == XA_RESULT_SUCCESS) + { /*change of settings - pipeline must be regenerated**/ mCtx->encodingchanged = XA_BOOLEAN_TRUE; - memcpy(&mCtx->audioEncSettings, pSettings, sizeof(XAAudioEncoderSettings)); - } - DEBUG_API("<-XAAudioEncoderItfAdapt_SetEncoderSettings"); + memcpy(&mCtx->audioEncSettings, pSettings, + sizeof(XAAudioEncoderSettings)); + }DEBUG_API("<-XAAudioEncoderItfAdapt_SetEncoderSettings"); return ret; -} + } -XAresult XAAudioEncoderItfAdapt_GetEncoderSettings( XAAdaptationBaseCtx *bCtx, - XAAudioEncoderSettings *pSettings ) -{ +XAresult XAAudioEncoderItfAdapt_GetEncoderSettings(XAAdaptationBaseCtx *bCtx, + XAAudioEncoderSettings *pSettings) + { XAMediaRecorderAdaptationCtx* mCtx = NULL; XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAAudioEncoderItfAdapt_GetEncoderSettings"); - if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { + if (!bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); return XA_RESULT_PARAMETER_INVALID; - } + } mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - memcpy(pSettings, &(mCtx->audioEncSettings), sizeof(XAAudioEncoderSettings)); + memcpy(pSettings, &(mCtx->audioEncSettings), + sizeof(XAAudioEncoderSettings)); DEBUG_API("<-XAAudioEncoderItfAdapt_GetEncoderSettings"); return ret; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.h Fri Jun 11 19:59:23 2010 -0500 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: AudioEnc Itf GST Adaptation * */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.c --- a/khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,35 +1,40 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "xagstcapabilitiesmgr.h" + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: GST Capabilities Mgr. Here you can query the capabilities + * of various GST components and store it in a list. + * + */ + #include #include +#include "xagstcapabilitiesmgr.h" +#include "xaframeworkmgr.h" -static XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(XACapabilities **ppNode); -static XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(XACapabilities **ppNode); -static XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(XACapabilities **ppNode); +static XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities( + XACapabilities **ppNode); +static XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities( + XACapabilities **ppNode); +static XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities( + XACapabilities **ppNode); /* XAresult XAGSTCapabilitiesMgr_UpdateCapabilitieList * Description: Update the capabilities list supported by GStreamer framework. */ XAresult XAGSTCapabilitiesMgr_UpdateCapabilitieList( - FrameworkMap *frameworkMap, - XACapabilities **ppListHead) + FrameworkMap *frameworkMap, XACapabilities **ppListHead) -{ + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *newNode = NULL; FWMgrFwType fwtype = FWMgrFWUknown; @@ -39,166 +44,156 @@ DEBUG_API("->XAGSTCapabilitiesMgr_UpdateCapabilitieList"); - if(!frameworkMap || !ppListHead) - { + if (!frameworkMap || !ppListHead) + { res = XA_RESULT_PARAMETER_INVALID; return res; - } - + } + lastNode = firstNode = *ppListHead; - + /* traverse and point to the last node in the list */ - while(lastNode && lastNode->next) - { + while (lastNode && lastNode->next) + { lastNode = lastNode->next; - } - + } uri = "file:///c:/test.mp4"; - fwtype = XAFrameworkMgr_GetFramework( - frameworkMap, - uri, - FWMgrMORecorder); - - if(fwtype == FWMgrFWGST) - { - /* Add codec capabilities */ - newNode = NULL; - res = XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(&newNode); - if (res != XA_RESULT_SUCCESS) - { - return res; - } - if (lastNode) - { - lastNode->next = newNode; - } - if (newNode) - { /* if a new node is created move lastNode to the new item */ - if (!firstNode) - firstNode = newNode; - lastNode = newNode; - } - } - + fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder); + + if (fwtype == FWMgrFWGST) + { + /* Add codec capabilities */ + newNode = NULL; + res = XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(&newNode); + if (res != XA_RESULT_SUCCESS) + { + return res; + } + if (lastNode) + { + lastNode->next = newNode; + } + if (newNode) + { /* if a new node is created move lastNode to the new item */ + if (!firstNode) + firstNode = newNode; + lastNode = newNode; + } + } uri = "file:///c:/test.amr"; - fwtype = XAFrameworkMgr_GetFramework( - frameworkMap, - uri, - FWMgrMORecorder); - - if(fwtype == FWMgrFWGST) - { - newNode = NULL; - res = XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(&newNode); - if (res != XA_RESULT_SUCCESS) - { - return res; - } - if (lastNode) - { - lastNode->next = newNode; - } - if (newNode) - { /* if a new node is created move lastNode to the new item */ - if (!firstNode) - firstNode = newNode; - lastNode = newNode; - } - } + fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder); + + if (fwtype == FWMgrFWGST) + { + newNode = NULL; + res = XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(&newNode); + if (res != XA_RESULT_SUCCESS) + { + return res; + } + if (lastNode) + { + lastNode->next = newNode; + } + if (newNode) + { /* if a new node is created move lastNode to the new item */ + if (!firstNode) + firstNode = newNode; + lastNode = newNode; + } + } uri = "file:///c:/test.wav"; - fwtype = XAFrameworkMgr_GetFramework( - frameworkMap, - uri, - FWMgrMORecorder); - - if(fwtype == FWMgrFWGST) - { - newNode = NULL; - res = XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(&newNode); - if (res != XA_RESULT_SUCCESS) - { - return res; - } - if (lastNode) - { - lastNode->next = newNode; - } - if (newNode) - { /* if a new node is created move lastNode to the new item */ - if (!firstNode) - firstNode = newNode; - lastNode = newNode; - } - } + fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder); + + if (fwtype == FWMgrFWGST) + { + newNode = NULL; + res = XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(&newNode); + if (res != XA_RESULT_SUCCESS) + { + return res; + } + if (lastNode) + { + lastNode->next = newNode; + } + if (newNode) + { /* if a new node is created move lastNode to the new item */ + if (!firstNode) + firstNode = newNode; + lastNode = newNode; + } + } /* if empty list, then append first node as the head */ if (!(*ppListHead)) { *ppListHead = firstNode; - } - DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList"); + }DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList"); return res; -} + } -XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities(XACapabilities **ppNode) -{ +XAresult XAGSTCapabilitiesMgr_GetAudioAACEncoderCapabilities( + XACapabilities **ppNode) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *newNode = NULL; XAAudioCodecDescriptor *entries = NULL; XAchar aacencelement[] = "nokiaaacenc"; int strLen = 0; - - newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities)); + + newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities)); if (!newNode) - { + { res = XA_RESULT_MEMORY_FAILURE; return res; - } + } newNode->capsType = AUD_E; newNode->xaid = XA_AUDIOCODEC_AAC; newNode->noOfEntries = 1; - - - strLen = strlen((char*)aacencelement); - newNode->adaptId = (XAchar *)calloc(strLen + 1, sizeof(XAchar)); + + strLen = strlen((char*) aacencelement); + newNode->adaptId = (XAchar *) calloc(strLen + 1, sizeof(XAchar)); if (!newNode->adaptId) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } - strncpy((char*)newNode->adaptId, (char*)aacencelement, strLen); + strncpy((char*) newNode->adaptId, (char*) aacencelement, strLen); newNode->adaptId[strLen] = '\0'; /*Null terminate it*/ - + /* Allocate array */ - entries = (XAAudioCodecDescriptor*)calloc(1, sizeof(XAAudioCodecDescriptor)); + entries = (XAAudioCodecDescriptor*) calloc(1, + sizeof(XAAudioCodecDescriptor)); if (!entries) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } - newNode->pEntry = (void*)entries; - + newNode->pEntry = (void*) entries; + entries->maxChannels = 2; entries->minBitsPerSample = 16; entries->maxBitsPerSample = 16; - entries->minSampleRate = 8000000; /*milliHz*/ + entries->minSampleRate = 8000000; /*milliHz*/ entries->maxSampleRate = 48000000; - entries->isFreqRangeContinuous=XA_BOOLEAN_FALSE; + entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE; entries->numSampleRatesSupported = 7; - entries->pSampleRatesSupported = (XAmilliHertz*)calloc(entries->numSampleRatesSupported, sizeof(XAmilliHertz)); + entries->pSampleRatesSupported = (XAmilliHertz*) calloc( + entries->numSampleRatesSupported, sizeof(XAmilliHertz)); if (!entries->pSampleRatesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } /* entries in milliHz */ entries->pSampleRatesSupported[0] = 8000000; entries->pSampleRatesSupported[1] = 11025000; @@ -212,13 +207,14 @@ entries->maxBitRate = 256000; entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; entries->numBitratesSupported = 8; - entries->pBitratesSupported = (XAuint32*)calloc(entries->numBitratesSupported, sizeof(XAuint32)); + entries->pBitratesSupported = (XAuint32*) calloc( + entries->numBitratesSupported, sizeof(XAuint32)); if (!entries->pBitratesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } (entries->pBitratesSupported)[0] = 32000; (entries->pBitratesSupported)[1] = 64000; (entries->pBitratesSupported)[2] = 96000; @@ -231,58 +227,61 @@ entries->profileSetting = XA_AUDIOPROFILE_AAC_AAC; entries->modeSetting = XA_AUDIOMODE_AAC_LC; - newNode->pEntry = (void*)entries; + newNode->pEntry = (void*) entries; *ppNode = newNode; return res; -} + } -XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities(XACapabilities **ppNode) -{ +XAresult XAGSTCapabilitiesMgr_GetAudioAMREncoderCapabilities( + XACapabilities **ppNode) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *newNode = NULL; XAAudioCodecDescriptor *entries = NULL; - - newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities)); + + newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities)); if (!newNode) - { + { res = XA_RESULT_MEMORY_FAILURE; return res; - } + } newNode->capsType = AUD_E; newNode->xaid = XA_AUDIOCODEC_AMR; newNode->noOfEntries = 1; /* Allocate array */ - entries = (XAAudioCodecDescriptor*)calloc(1, sizeof(XAAudioCodecDescriptor)); + entries = (XAAudioCodecDescriptor*) calloc(1, + sizeof(XAAudioCodecDescriptor)); if (!entries) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } - newNode->pEntry = (void*)entries; - + newNode->pEntry = (void*) entries; + entries->maxChannels = 1; entries->minBitsPerSample = 8; entries->maxBitsPerSample = 8; - entries->minSampleRate = 8000000; /*milliHz*/ + entries->minSampleRate = 8000000; /*milliHz*/ entries->maxSampleRate = 8000000; - entries->isFreqRangeContinuous=XA_BOOLEAN_TRUE; + entries->isFreqRangeContinuous = XA_BOOLEAN_TRUE; entries->numSampleRatesSupported = 1; - entries->minBitRate=4750; - entries->maxBitRate=12200; - entries->isBitrateRangeContinuous=XA_BOOLEAN_FALSE; + entries->minBitRate = 4750; + entries->maxBitRate = 12200; + entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; entries->numBitratesSupported = 8; - entries->pBitratesSupported = (XAuint32*)calloc(entries->numBitratesSupported, sizeof(XAuint32)); + entries->pBitratesSupported = (XAuint32*) calloc( + entries->numBitratesSupported, sizeof(XAuint32)); if (!entries->pBitratesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } (entries->pBitratesSupported)[0] = 4750; (entries->pBitratesSupported)[1] = 5150; (entries->pBitratesSupported)[2] = 5900; @@ -295,54 +294,57 @@ entries->profileSetting = XA_AUDIOPROFILE_AMR; entries->modeSetting = 0; - newNode->pEntry = (void*)entries; + newNode->pEntry = (void*) entries; *ppNode = newNode; return res; -} + } -XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities(XACapabilities **ppNode) -{ +XAresult XAGSTCapabilitiesMgr_GetAudioPCMEncoderCapabilities( + XACapabilities **ppNode) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *newNode = NULL; XAAudioCodecDescriptor *entries = NULL; - newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities)); + newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities)); if (!newNode) - { + { res = XA_RESULT_MEMORY_FAILURE; return res; - } + } newNode->capsType = AUD_E; newNode->xaid = XA_AUDIOCODEC_PCM; newNode->noOfEntries = 1; /* Allocate array */ - entries = (XAAudioCodecDescriptor*)calloc(1, sizeof(XAAudioCodecDescriptor)); + entries = (XAAudioCodecDescriptor*) calloc(1, + sizeof(XAAudioCodecDescriptor)); if (!entries) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } - newNode->pEntry = (void*)entries; + newNode->pEntry = (void*) entries; entries->maxChannels = 2; entries->minBitsPerSample = 16; entries->maxBitsPerSample = 16; - entries->minSampleRate = 8000000; /*milliHz*/ + entries->minSampleRate = 8000000; /*milliHz*/ entries->maxSampleRate = 96000000; - entries->isFreqRangeContinuous=XA_BOOLEAN_FALSE; + entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE; entries->numSampleRatesSupported = 10; - entries->pSampleRatesSupported = (XAmilliHertz*)calloc(entries->numSampleRatesSupported, sizeof(XAmilliHertz)); + entries->pSampleRatesSupported = (XAmilliHertz*) calloc( + entries->numSampleRatesSupported, sizeof(XAmilliHertz)); if (!entries->pSampleRatesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } /* entries in milliHz */ entries->pSampleRatesSupported[0] = 12000000; entries->pSampleRatesSupported[1] = 16000000; @@ -363,8 +365,8 @@ entries->profileSetting = XA_AUDIOPROFILE_PCM; entries->modeSetting = 0; - newNode->pEntry = (void*)entries; + newNode->pEntry = (void*) entries; *ppNode = newNode; return res; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.h --- a/khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: GST Capability Mgr header + * + */ #ifndef XAGSTCAPABILITIESMGR_H #define XAGSTCAPABILITIESMGR_H @@ -23,7 +23,6 @@ #include "xacapabilitiesmgr.h" XAresult XAGSTCapabilitiesMgr_UpdateCapabilitieList( - FrameworkMap *frameworkMap, - XACapabilities** ppListHead); + FrameworkMap *frameworkMap, XACapabilities** ppListHead); #endif /* XAGSTCAPABILITIESMGR_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.c --- a/khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.c Fri Jun 11 19:59:23 2010 -0500 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Media Recorder Adaptation for GST * */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.h --- a/khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Media Recoder Adaptation for GST Header + * + */ #ifndef XAMEDIARECORDERADAPTCTX_H_ #define XAMEDIARECORDERADAPTCTX_H_ @@ -24,111 +24,114 @@ /* TYPEDEFS */ typedef struct XASnapshotItfVars_ -{ + { /*User variables*/ - XAuint32 numpics; - XAuint32 fps; - XAboolean freeze; - gchar* fnametemplate; - XADataSink* xaSink; + XAuint32 numpics; + XAuint32 fps; + XAboolean freeze; + gchar* fnametemplate; + XADataSink* xaSink; /* internal variables */ - gboolean waitforbuffer; - gboolean parsenegotiated; - XAuint32 numpicstaken; + gboolean waitforbuffer; + gboolean parsenegotiated; + XAuint32 numpicstaken; - GstBus* ssbus; - GstElement* sspipeline; - GstElement* ssbuffersrc; - GstElement* ssparser; - GstElement* ssscaler; - GstElement* ssfilter; - GstElement* ssencoder; - GstElement* sstagger; - GstElement* sssink; - gulong sighandler; + GstBus* ssbus; + GstElement* sspipeline; + GstElement* ssbuffersrc; + GstElement* ssparser; + GstElement* ssscaler; + GstElement* ssfilter; + GstElement* ssencoder; + GstElement* sstagger; + GstElement* sssink; + gulong sighandler; - GstBuffer* snapshotbuffer; + GstBuffer* snapshotbuffer; -} XASnapshotItfVars; + } XASnapshotItfVars; /* context to track buffer insufficient event */ -typedef struct recordItfCtx_{ +typedef struct recordItfCtx_ + { XAImplSemHandle bufInsufficientSem; XAboolean buffer_insufficient; -}recodtItfCtx; + } recodtItfCtx; typedef struct XAMediaRecorderAdaptationCtx_ XAMediaRecorderAdaptationCtx; typedef struct XAMediaRecorderAdaptationCtx_ -{ + { /* Parent*/ XAAdaptationGstCtx_ baseObj; /* OMX-AL Variables */ - XADataSource *xaAudioSource, *xaVideoSource; - XADataSink *xaSink; - XAuint8 recModes; + XADataSource *xaAudioSource, *xaVideoSource; + XADataSink *xaSink; + XAuint8 recModes; /* GST elements */ - GstElement *datasink; - XAboolean isobjsink; /*is sink another XA object?*/ - GstElement *codecbin; - GstElement *audioppbin; - GstElement *audiofilter; - GstElement *videoppbin; - GstElement *videofilter; - GstElement *videoextract; - GstElement *audiosource; - GstElement *audioqueue; - XAboolean isobjasrc; /*is audio source another XA object?*/ - GstElement *videosource; - GstState vsrcOrigState; - GstElement *videoqueue; - XAboolean isobjvsrc; /*is video source another XA object?*/ - XAboolean encodingchanged; + GstElement *datasink; + XAboolean isobjsink; /*is sink another XA object?*/ + GstElement *codecbin; + GstElement *audioppbin; + GstElement *audiofilter; + GstElement *videoppbin; + GstElement *videofilter; + GstElement *videoextract; + GstElement *audiosource; + GstElement *audioqueue; + XAboolean isobjasrc; /*is audio source another XA object?*/ + GstElement *videosource; + GstState vsrcOrigState; + GstElement *videoqueue; + XAboolean isobjvsrc; /*is video source another XA object?*/ + XAboolean encodingchanged; - XAboolean mute; - XAuint32 imageEffectID; - XAboolean isStereoPosition; - XAuint32 xaRecordState; - XAmillidegree curRotation; - XAuint32 curMirror; - XAboolean isRecord; + XAboolean mute; + XAuint32 imageEffectID; + XAboolean isStereoPosition; + XAuint32 xaRecordState; + XAmillidegree curRotation; + XAuint32 curMirror; + XAboolean isRecord; /* internals */ - XAboolean trackpositionenabled; - gboolean runpositiontimer; - GSourceFunc positionCb; + XAboolean trackpositionenabled; + gboolean runpositiontimer; + GSourceFunc positionCb; - XAImplThreadHandle recordingEventThr; - recodtItfCtx recThrCtx; - + XAImplThreadHandle recordingEventThr; + recodtItfCtx recThrCtx; /* Variables for snapshot */ - XASnapshotItfVars snapshotVars; + XASnapshotItfVars snapshotVars; - XAMetadataAdaptVars *metadatavars; + XAMetadataAdaptVars *metadatavars; /* Variables for encoders */ - XAAudioEncoderSettings audioEncSettings; - XAVideoSettings videoEncSettings; - XAImageSettings imageEncSettings; + XAAudioEncoderSettings audioEncSettings; + XAVideoSettings videoEncSettings; + XAImageSettings imageEncSettings; /*buffersink variable*/ - guint64 writepos; + guint64 writepos; -} XAMediaRecorderAdaptationCtx_; + } XAMediaRecorderAdaptationCtx_; /* FUNCTIONS */ -XAAdaptationBaseCtx* XAMediaRecorderAdapt_Create( XADataSource* pAudioSrc, XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes ); -XAresult XAMediaRecorderAdapt_PostInit( XAAdaptationGstCtx* bCtx ); -void XAMediaRecorderAdapt_Destroy( XAAdaptationGstCtx* bCtx ); +XAAdaptationBaseCtx* XAMediaRecorderAdapt_Create(XADataSource* pAudioSrc, + XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes); +XAresult XAMediaRecorderAdapt_PostInit(XAAdaptationGstCtx* bCtx); +void XAMediaRecorderAdapt_Destroy(XAAdaptationGstCtx* bCtx); /*XAresult XAMediaRecorderAdapt_InitContentPipeSink(XAMediaRecorderAdaptationCtx* ctx);*/ -XAresult XAMediaRecorderAdapt_ChangeEncoders( XAMediaRecorderAdaptationCtx_* mCtx ); -XAresult XAMediaRecorderAdapt_CheckCodec( XAMediaRecorderAdaptationCtx_* mCtx, XACapsType encType, XAuint32 encoderId ); +XAresult XAMediaRecorderAdapt_ChangeEncoders( + XAMediaRecorderAdaptationCtx_* mCtx); +XAresult XAMediaRecorderAdapt_CheckCodec(XAMediaRecorderAdaptationCtx_* mCtx, + XACapsType encType, XAuint32 encoderId); -void* XAMediaRecorderAdapt_RecordEventThr(void* ctx); +void* XAMediaRecorderAdapt_RecordEventThr(void* ctx); #endif /* XAMEDIARECORDERADAPTCTX_H_ */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Record Itf GST adaptation + * + */ #include #include @@ -35,8 +35,9 @@ * XAuint32 state - Record state to be set * @return XAresult ret - Success value */ -XAresult XARecordItfAdapt_SetRecordState(XAAdaptationGstCtx *bCtx, XAuint32 state) -{ +XAresult XARecordItfAdapt_SetRecordState(XAAdaptationGstCtx *bCtx, + XAuint32 state) + { XAresult ret = XA_RESULT_SUCCESS; XAboolean closeSink = XA_BOOLEAN_FALSE; XAboolean requestStateChange = XA_BOOLEAN_FALSE; @@ -44,167 +45,187 @@ XAMediaRecorderAdaptationCtx* mCtx = NULL; XAboolean recording = XA_BOOLEAN_FALSE; DEBUG_API_A1("->XARecordItfAdapt_SetRecordState %s",RECORDSTATENAME(state)); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) - { + if (!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfAdapt_SetRecordState"); return XA_RESULT_PARAMETER_INVALID; - } + } mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; mCtx->isRecord = XA_BOOLEAN_TRUE; - switch ( state ) - { + switch (state) + { case XA_RECORDSTATE_STOPPED: - { - // Audio sourse should be stopped - if ( mCtx->audiosource ) + { + // Audio sourse should be stopped + if (mCtx->audiosource) { - if ( gst_element_send_event (mCtx->audiosource, gst_event_new_eos ()) == TRUE ) - { - DEBUG_INFO ("posted eos"); - } - else - { - DEBUG_ERR("FAIL : post eos"); - } + if (gst_element_send_event(mCtx->audiosource, + gst_event_new_eos()) == TRUE) + { + DEBUG_INFO ("posted eos"); + } + else + { + DEBUG_ERR("FAIL : post eos"); + } } - - if ( cameraCtx && cameraRealized && mCtx->isobjvsrc && mCtx->videosource ) - { - cameraCtx->recording = XA_BOOLEAN_FALSE; + + if (cameraCtx && cameraRealized && mCtx->isobjvsrc + && mCtx->videosource) + { + cameraCtx->recording = XA_BOOLEAN_FALSE; - if(!cameraCtx->playing && !cameraCtx->snapshotting) - { - /* Neither view finder or recorder is running -> pause camera */ - if ( GST_STATE( GST_ELEMENT(mCtx->videosource)) == GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->videosource), GST_STATE_PAUSED ); - if(gret == GST_STATE_CHANGE_SUCCESS) - gret = gst_element_get_state( GST_ELEMENT(mCtx->videosource), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - } + if (!cameraCtx->playing && !cameraCtx->snapshotting) + { + /* Neither view finder or recorder is running -> pause camera */ + if (GST_STATE( GST_ELEMENT(mCtx->videosource)) + == GST_STATE_PLAYING) + { + GstStateChangeReturn gret; + DEBUG_INFO("Stop camera source"); + gret = gst_element_set_state( + GST_ELEMENT(mCtx->videosource), + GST_STATE_PAUSED); + if (gret == GST_STATE_CHANGE_SUCCESS) + gret = gst_element_get_state( + GST_ELEMENT(mCtx->videosource), NULL, + NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); + } + } + } bCtx->binWantedState = GST_STATE_PAUSED; closeSink = XA_BOOLEAN_TRUE; - if(mCtx->runpositiontimer > 0) - { + if (mCtx->runpositiontimer > 0) + { g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } + mCtx->runpositiontimer = 0; + } - if ( mCtx->recThrCtx.bufInsufficientSem ) - { + if (mCtx->recThrCtx.bufInsufficientSem) + { DEBUG_INFO("No buffer-insufficient received, posting record thr semaphore."); - if ( XAImpl_PostSemaphore( mCtx->recThrCtx.bufInsufficientSem ) != XA_RESULT_SUCCESS) - { + if (XAImpl_PostSemaphore(mCtx->recThrCtx.bufInsufficientSem) + != XA_RESULT_SUCCESS) + { DEBUG_ERR("Posting buffer-insufficient semaphore FAILED!"); + } } - } break; - } + } case XA_RECORDSTATE_PAUSED: - { - if ( cameraCtx && cameraRealized && mCtx->isobjvsrc && mCtx->videosource ) - { - cameraCtx->recording = XA_BOOLEAN_FALSE; - if(!cameraCtx->playing && !cameraCtx->snapshotting) - { - /* Neither view finder or recorder is running -> pause camera */ - if ( GST_STATE( GST_ELEMENT(mCtx->videosource)) == GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->videosource), GST_STATE_PAUSED ); - if(gret == GST_STATE_CHANGE_SUCCESS) - gret = gst_element_get_state( GST_ELEMENT(mCtx->videosource), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - } - - if(mCtx->xaRecordState==XA_RECORDSTATE_STOPPED && mCtx->encodingchanged) - { - XAMediaRecorderAdapt_ChangeEncoders( mCtx ); - mCtx->encodingchanged = XA_BOOLEAN_FALSE; - } - bCtx->binWantedState = GST_STATE_PAUSED; - if(mCtx->runpositiontimer > 0) { + if (cameraCtx && cameraRealized && mCtx->isobjvsrc + && mCtx->videosource) + { + cameraCtx->recording = XA_BOOLEAN_FALSE; + if (!cameraCtx->playing && !cameraCtx->snapshotting) + { + /* Neither view finder or recorder is running -> pause camera */ + if (GST_STATE( GST_ELEMENT(mCtx->videosource)) + == GST_STATE_PLAYING) + { + GstStateChangeReturn gret; + DEBUG_INFO("Stop camera source"); + gret = gst_element_set_state( + GST_ELEMENT(mCtx->videosource), + GST_STATE_PAUSED); + if (gret == GST_STATE_CHANGE_SUCCESS) + gret = gst_element_get_state( + GST_ELEMENT(mCtx->videosource), NULL, + NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); + } + } + } + + if (mCtx->xaRecordState == XA_RECORDSTATE_STOPPED + && mCtx->encodingchanged) + { + XAMediaRecorderAdapt_ChangeEncoders(mCtx); + mCtx->encodingchanged = XA_BOOLEAN_FALSE; + } + bCtx->binWantedState = GST_STATE_PAUSED; + if (mCtx->runpositiontimer > 0) + { g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; + mCtx->runpositiontimer = 0; + } + break; } - break; - } case XA_RECORDSTATE_RECORDING: - { - if ( cameraCtx && mCtx->isobjvsrc ) - { - cameraCtx->recording = XA_BOOLEAN_TRUE; - } - - if(mCtx->xaRecordState==XA_RECORDSTATE_STOPPED && (mCtx->encodingchanged)) { - XAMediaRecorderAdapt_ChangeEncoders( mCtx ); + if (cameraCtx && mCtx->isobjvsrc) + { + cameraCtx->recording = XA_BOOLEAN_TRUE; + } + + if (mCtx->xaRecordState == XA_RECORDSTATE_STOPPED + && (mCtx->encodingchanged)) + { + XAMediaRecorderAdapt_ChangeEncoders(mCtx); mCtx->encodingchanged = XA_BOOLEAN_FALSE; - } + } - if ( mCtx->recThrCtx.bufInsufficientSem ) - { + if (mCtx->recThrCtx.bufInsufficientSem) + { /* Recording to address and recording thread semaphora is created */ - if(! XAImpl_StartThread(&(mCtx->recordingEventThr),NULL, &XAMediaRecorderAdapt_RecordEventThr, (void*)mCtx )) + if (!XAImpl_StartThread(&(mCtx->recordingEventThr), NULL, + &XAMediaRecorderAdapt_RecordEventThr, (void*) mCtx)) { - DEBUG_ERR("Start thread Failed"); - return XA_RESULT_INTERNAL_ERROR; + DEBUG_ERR("Start thread Failed"); + return XA_RESULT_INTERNAL_ERROR; } - } + } bCtx->binWantedState = GST_STATE_PLAYING; recording = XA_BOOLEAN_TRUE; break; - } + } default: - DEBUG_ERR("Unhandled state"); + DEBUG_ERR("Unhandled state") + ; ret = XA_RESULT_PARAMETER_INVALID; break; - } + } - if( ret == XA_RESULT_SUCCESS ) - { + if (ret == XA_RESULT_SUCCESS) + { mCtx->xaRecordState = state; - } + } /* launch Gstreamer state change only if necessary */ - if( GST_STATE_TARGET(bCtx->bin) == bCtx->binWantedState ) - { + if (GST_STATE_TARGET(bCtx->bin) == bCtx->binWantedState) + { DEBUG_INFO("Gst already transitioning to wanted state!!"); requestStateChange = XA_BOOLEAN_FALSE; - } + } else - { - if( (GST_STATE(bCtx->bin) == bCtx->binWantedState) && - (GST_STATE_PENDING(bCtx->bin) == GST_STATE_VOID_PENDING) ) { + if ((GST_STATE(bCtx->bin) == bCtx->binWantedState) + && (GST_STATE_PENDING(bCtx->bin) == GST_STATE_VOID_PENDING)) + { DEBUG_ERR_A3("WARNING : gststate %d == wanted %d != gsttarget %d and no statechange pending", - GST_STATE(bCtx->bin), bCtx->binWantedState, GST_STATE_TARGET(bCtx->bin)); - } + GST_STATE(bCtx->bin), bCtx->binWantedState, GST_STATE_TARGET(bCtx->bin)); + } requestStateChange = XA_BOOLEAN_TRUE; - } + } - if( requestStateChange ) - { + if (requestStateChange) + { XAAdaptationGst_PrepareAsyncWait(bCtx); DEBUG_INFO_A1("Sending change state request to state %d", bCtx->binWantedState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - switch ( gstRet ) - { + gstRet = gst_element_set_state(GST_ELEMENT(bCtx->bin), + bCtx->binWantedState); + switch (gstRet) + { case GST_STATE_CHANGE_FAILURE: - DEBUG_ERR_A1("FAILED to change state (target %d)",bCtx->binWantedState); + DEBUG_ERR_A1("FAILED to change state (target %d)",bCtx->binWantedState) + ; bCtx->binWantedState = GST_STATE(bCtx->bin); ret = XA_RESULT_INTERNAL_ERROR; break; @@ -214,64 +235,71 @@ ret = XA_RESULT_SUCCESS; break; case GST_STATE_CHANGE_NO_PREROLL: - DEBUG_INFO("GST_STATE_CHANGE_NO_PREROLL"); + DEBUG_INFO("GST_STATE_CHANGE_NO_PREROLL") + ; /* deliberate fall-through */ case GST_STATE_CHANGE_SUCCESS: - DEBUG_INFO_A1("Successfully changed state (target %d)",bCtx->binWantedState); + DEBUG_INFO_A1("Successfully changed state (target %d)",bCtx->binWantedState) + ; ret = XA_RESULT_SUCCESS; break; default: - DEBUG_ERR_A1("Unhandled error (%d)",gstRet); + DEBUG_ERR_A1("Unhandled error (%d)",gstRet) + ; ret = XA_RESULT_UNKNOWN_ERROR; break; - } + } bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - } - if( (GST_STATE(bCtx->bin) > GST_STATE_READY) && closeSink ) - { /* close the sink*/ - gst_element_send_event(bCtx->bin,gst_event_new_flush_start()); - gst_element_send_event(bCtx->bin,gst_event_new_flush_stop()); - } + } + if ((GST_STATE(bCtx->bin) > GST_STATE_READY) && closeSink) + { /* close the sink*/ + gst_element_send_event(bCtx->bin, gst_event_new_flush_start()); + gst_element_send_event(bCtx->bin, gst_event_new_flush_stop()); + } - if ( recording && mCtx->isobjvsrc && mCtx->videosource ) - { - GstPad *pad = gst_element_get_static_pad( GST_ELEMENT(mCtx->videosource), "MRObjSrc"); - if( pad && gst_pad_is_linked(pad) ) - { - DEBUG_INFO_A2("unblock element:%s pad:%s", - gst_element_get_name(mCtx->videosource), - gst_pad_get_name(pad)); - gst_pad_set_blocked_async(pad, FALSE, XAAdaptationGst_PadBlockCb, NULL); - } + if (recording && mCtx->isobjvsrc && mCtx->videosource) + { + GstPad *pad = gst_element_get_static_pad( + GST_ELEMENT(mCtx->videosource), "MRObjSrc"); + if (pad && gst_pad_is_linked(pad)) + { + DEBUG_INFO_A2("unblock element:%s pad:%s", + gst_element_get_name(mCtx->videosource), + gst_pad_get_name(pad)); + gst_pad_set_blocked_async(pad, FALSE, XAAdaptationGst_PadBlockCb, + NULL); + } - if ( GST_STATE( GST_ELEMENT(mCtx->videosource)) != GST_STATE_PLAYING ) - { - GstStateChangeReturn gret = GST_STATE_CHANGE_SUCCESS; - DEBUG_INFO("Start camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->videosource), GST_STATE_PLAYING ); - if(gret == GST_STATE_CHANGE_SUCCESS) - gret = gst_element_get_state( GST_ELEMENT(mCtx->videosource), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } + if (GST_STATE( GST_ELEMENT(mCtx->videosource)) != GST_STATE_PLAYING) + { + GstStateChangeReturn gret = GST_STATE_CHANGE_SUCCESS; + DEBUG_INFO("Start camera source"); + gret = gst_element_set_state(GST_ELEMENT(mCtx->videosource), + GST_STATE_PLAYING); + if (gret == GST_STATE_CHANGE_SUCCESS) + gret = gst_element_get_state(GST_ELEMENT(mCtx->videosource), + NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); + } + }DEBUG_API("<-XARecordItfAdapt_SetRecordState"); + return ret; } - DEBUG_API("<-XARecordItfAdapt_SetRecordState"); - return ret; -} /* * XAresult XARecordItfAdapt_GetRecordState(XAAdaptationGstCtx *bCtx, XAuint32 *state) * Description: Return record state */ -XAresult XARecordItfAdapt_GetRecordState(XAAdaptationGstCtx *bCtx, XAuint32 *state) -{ +XAresult XARecordItfAdapt_GetRecordState(XAAdaptationGstCtx *bCtx, + XAuint32 *state) + { XAMediaRecorderAdaptationCtx* mCtx = NULL; DEBUG_API("->XARecordItfAdapt_GetRecordState"); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) - { + if (!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfAdapt_GetRecordState"); return XA_RESULT_PARAMETER_INVALID; - } + } mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; @@ -279,7 +307,7 @@ DEBUG_API("<-XARecordItfAdapt_GetRecordState"); return XA_RESULT_SUCCESS; -} + } /* * XAresult XARecordItfAdapt_GetPosition(XAAdaptationGstCtx *ctx, AdaptationContextIDS ctxIDs, XAmillisecond *pMsec) @@ -287,39 +315,39 @@ * XAmillisecond *pMsec - Pointer where to store current position in stream. * @return XAresult ret - Success value */ -XAresult XARecordItfAdapt_GetPosition(XAAdaptationGstCtx *bCtx, XAmillisecond *pMsec) -{ +XAresult XARecordItfAdapt_GetPosition(XAAdaptationGstCtx *bCtx, + XAmillisecond *pMsec) + { XAresult ret = XA_RESULT_SUCCESS; - - gint64 position=0; + + gint64 position = 0; GstFormat format = GST_FORMAT_TIME; DEBUG_API("->XARecordItfAdapt_GetPosition"); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) - { + if (!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfAdapt_GetPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } - if ( gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &position ) ) - { + } + if (gst_element_query_position(GST_ELEMENT(bCtx->bin), &format, &position)) + { ret = XA_RESULT_SUCCESS; *pMsec = GST_TIME_AS_MSECONDS(position); /*Warning ok due to used API specification*/ DEBUG_INFO_A1("Gst: Position in microseconds : %u", *pMsec ); - } + } else - { + { DEBUG_ERR("WARNING: Gst: could not get position"); /* probably not fully prerolled - safe assumption for position = 0 */ *pMsec = 0; ret = XA_RESULT_SUCCESS; - } + } DEBUG_API("<-XARecordItfAdapt_GetPosition"); return ret; -} - + } /* * gboolean XARecordItfAdapt_PositionUpdate(gpointer ctx) @@ -328,75 +356,81 @@ * @return false to stop periodic calls */ gboolean XARecordItfAdapt_PositionUpdate(gpointer ctx) -{ + { XAAdaptationGstCtx *bCtx = (XAAdaptationGstCtx*) ctx; XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) ctx; DEBUG_API("->XARecordItfAdapt_PositionUpdate"); - if( mCtx && mCtx->trackpositionenabled ) - { + if (mCtx && mCtx->trackpositionenabled) + { GstFormat format = GST_FORMAT_TIME; gint64 position = 0; - if ( gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &position ) ) - { - XAuint32 posMsec = GST_TIME_AS_MSECONDS(position);/*Warning ok due to used API specification*/ - XAAdaptEvent event = {XA_RECORDITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL}; + if (gst_element_query_position(GST_ELEMENT(bCtx->bin), &format, + &position)) + { + XAuint32 posMsec = GST_TIME_AS_MSECONDS(position); + /*Warning ok due to used API specification*/ + XAAdaptEvent event = + { + XA_RECORDITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL + }; event.data = &posMsec; DEBUG_API_A1("XARecordItfAdapt_PositionUpdate: pos %lu ms", posMsec); /* send needed events */ - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } + XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event); + } else - { + { DEBUG_ERR("Gst: Failed to get position"); + } + DEBUG_API_A1("<-XARecordItfAdapt_PositionUpdate: %d", mCtx->runpositiontimer); + /* return false to stop timer */ + return (mCtx->runpositiontimer); } - DEBUG_API_A1("<-XARecordItfAdapt_PositionUpdate: %d", mCtx->runpositiontimer); - /* return false to stop timer */ - return( mCtx->runpositiontimer ); + return FALSE; } - return FALSE; -} /* * XAresult XARecordItfAdapt_EnablePositionTracking * Enable/disable periodic position tracking callbacks */ -XAresult XARecordItfAdapt_EnablePositionTracking(XAAdaptationGstCtx *bCtx, XAboolean enable) -{ +XAresult XARecordItfAdapt_EnablePositionTracking(XAAdaptationGstCtx *bCtx, + XAboolean enable) + { XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; DEBUG_API_A1("->XARecordItfAdapt_EnablePositionTracking (enable: %lu)", enable); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) - { + if (!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } - + } /* create a timer to track position of playback */ - if(enable && !(mCtx->trackpositionenabled)) - { + if (enable && !(mCtx->trackpositionenabled)) + { mCtx->trackpositionenabled = XA_BOOLEAN_TRUE; mCtx->positionCb = &XARecordItfAdapt_PositionUpdate; /* if recording is already on, create a timer to track position of recording */ - if( GST_STATE(bCtx->bin) == GST_STATE_PLAYING ) - { - mCtx->runpositiontimer = g_timeout_add(XA_ADAPT_PU_INTERVAL, mCtx->positionCb, mCtx); + if (GST_STATE(bCtx->bin) == GST_STATE_PLAYING) + { + mCtx->runpositiontimer = g_timeout_add(XA_ADAPT_PU_INTERVAL, + mCtx->positionCb, mCtx); + } } - } else if (!enable && (mCtx->trackpositionenabled)) - { + { mCtx->trackpositionenabled = XA_BOOLEAN_FALSE; - if(mCtx->runpositiontimer > 0) - { + if (mCtx->runpositiontimer > 0) + { g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; + mCtx->runpositiontimer = 0; + } } - } DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); return XA_RESULT_SUCCESS; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,43 +1,47 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Record Itf GST adapt header + * + */ #ifndef XARECORDITFADAPTATION_H #define XARECORDITFADAPTATION_H #include "xaadaptationgst.h" - #ifdef _DEBUG /*parse state names for debug prints*/ static const char* recordstatenames[3] = -{ - "XA_RECORDSTATE_STOPPED", - "XA_RECORDSTATE_PAUSED", - "XA_RECORDSTATE_RECORDING", -}; + { + "XA_RECORDSTATE_STOPPED", + "XA_RECORDSTATE_PAUSED", + "XA_RECORDSTATE_RECORDING", + }; #define RECORDSTATENAME(i) ((i>0&&i<4)?recordstatenames[i-1]:"INVALID") #endif /*_DEBUG*/ /* FUNCTIONS */ -XAresult XARecordItfAdapt_SetRecordState(XAAdaptationGstCtx *ctx, XAuint32 state ); -XAresult XARecordItfAdapt_SetDurationLimit( XAAdaptationGstCtx *ctx, XAmillisecond msec ); -XAresult XARecordItfAdapt_GetPosition( XAAdaptationGstCtx *ctx, XAmillisecond *pMsec ); -XAresult XARecordItfAdapt_EnablePositionTracking(XAAdaptationGstCtx *ctx, XAboolean enable); -XAresult XARecordItfAdapt_GetRecordState(XAAdaptationGstCtx *bCtx, XAuint32 *state); +XAresult XARecordItfAdapt_SetRecordState(XAAdaptationGstCtx *ctx, + XAuint32 state); +XAresult XARecordItfAdapt_SetDurationLimit(XAAdaptationGstCtx *ctx, + XAmillisecond msec); +XAresult XARecordItfAdapt_GetPosition(XAAdaptationGstCtx *ctx, + XAmillisecond *pMsec); +XAresult XARecordItfAdapt_EnablePositionTracking(XAAdaptationGstCtx *ctx, + XAboolean enable); +XAresult XARecordItfAdapt_GetRecordState(XAAdaptationGstCtx *bCtx, + XAuint32 *state); #endif /* XARECORDITFADAPTATION_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xastreaminformationitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xastreaminformationitfadaptation.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xastreaminformationitfadaptation.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,10 +1,19 @@ -/** - * src\adaptation\XAStreamInformationItfAdaptation.c - * Part of OpenMAX AL Implementation - * Copyright (c) 2009 Nokia Inc. +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * - * This file contains implementation of XAStreamInformationItfAdaptation - **/ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: StreamInformation Itf Adaptation Source + * + */ #include "xadebug.h" #include "xathreadsafety.h" diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/gst_adaptation/xastreaminformationitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xastreaminformationitfadaptation.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xastreaminformationitfadaptation.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,10 +1,20 @@ -/** - * src\adaptation\XAStreamInformationItfAdaptation.h - * Part of OpenMAX AL Implementation - * Copyright (c) 2009 Nokia Inc. +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * - * This file contains implementation of XAStreamInformationItfAdaptation - **/ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: StreamInformation Itf Adaptation header + * + */ + #ifndef XASTREAMINFORMATIONITFADAPTATION_H #define XASTREAMINFORMATIONITFADAPTATION_H diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediaplayer/xamediaplayer.c --- a/khronosfws/openmax_al/src/mediaplayer/xamediaplayer.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xamediaplayer.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Media Player Object Implementation + * + */ #include #include @@ -45,26 +45,26 @@ /* Static mapping of enumeration XAMediaPlayerInterfaces to interface iids */ static const XAInterfaceID* xaMediaPlayerItfIIDs[MP_ITFCOUNT] = -{ - &XA_IID_OBJECT, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, - &XA_IID_PLAY, - &XA_IID_SEEK, - &XA_IID_VOLUME, - &XA_IID_PREFETCHSTATUS, - &XA_IID_CONFIGEXTENSION, - &XA_IID_DYNAMICSOURCE, - &XA_IID_EQUALIZER, - &XA_IID_IMAGECONTROLS, - &XA_IID_IMAGEEFFECTS, - &XA_IID_METADATAEXTRACTION, - &XA_IID_METADATATRAVERSAL, - &XA_IID_PLAYBACKRATE, - &XA_IID_VIDEOPOSTPROCESSING, - &XA_IID_NOKIAVOLUMEEXT, - &XA_IID_NOKIALINEARVOLUME, - &XA_IID_STREAMINFORMATION -}; + { + &XA_IID_OBJECT, + &XA_IID_DYNAMICINTERFACEMANAGEMENT, + &XA_IID_PLAY, + &XA_IID_SEEK, + &XA_IID_VOLUME, + &XA_IID_PREFETCHSTATUS, + &XA_IID_CONFIGEXTENSION, + &XA_IID_DYNAMICSOURCE, + &XA_IID_EQUALIZER, + &XA_IID_IMAGECONTROLS, + &XA_IID_IMAGEEFFECTS, + &XA_IID_METADATAEXTRACTION, + &XA_IID_METADATATRAVERSAL, + &XA_IID_PLAYBACKRATE, + &XA_IID_VIDEOPOSTPROCESSING, + &XA_IID_NOKIAVOLUMEEXT, + &XA_IID_NOKIALINEARVOLUME, + &XA_IID_STREAMINFORMATION + }; /* Global methods */ @@ -72,18 +72,13 @@ * Create object */ XAresult XAMediaPlayerImpl_CreateMediaPlayer(FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf *pPlayer, - XADataSource *pDataSrc, - XADataSource *pBankSrc, - XADataSink *pAudioSnk, - XADataSink *pImageVideoSnk, - XADataSink *pVibra, - XADataSink *pLEDArray, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ + XACapabilities* capabilities, XAObjectItf *pPlayer, + XADataSource *pDataSrc, XADataSource *pBankSrc, + XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, + XADataSink *pVibra, XADataSink *pLEDArray, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { XAuint8 itfIdx = 0; XAMediaType mediaType = XA_MEDIATYPE_UNKNOWN; XAMediaPlayerImpl* pPlayerImpl = NULL; @@ -91,53 +86,53 @@ XAObjectItfImpl* pBaseObj = NULL; const char *uri = NULL; XAresult ret = XA_RESULT_SUCCESS; - XADataLocator_IODevice* tmpIODevice; - XADataLocator_IODevice locatorIODevice; + XADataLocator_IODevice* tmpIODevice; + XADataLocator_IODevice locatorIODevice; DEBUG_API("->XAMediaPlayerImpl_CreateMediaPlayer"); XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); - if(!pPlayer || !pDataSrc) - { + if (!pPlayer || !pDataSrc) + { XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAMediaPlayerImpl_CreateMediaPlayer"); return XA_RESULT_PARAMETER_INVALID; - } + } /* check sink&source parameters */ - ret = XACommon_ValidateDataLocator(6, pAudioSnk, pImageVideoSnk, pDataSrc, - pBankSrc, pVibra, pLEDArray); - if(ret!=XA_RESULT_SUCCESS) - { + ret = XACommon_ValidateDataLocator(6, pAudioSnk, pImageVideoSnk, + pDataSrc, pBankSrc, pVibra, pLEDArray); + if (ret != XA_RESULT_SUCCESS) + { XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_API("<-XAMediaPlayerImpl_CreateMediaPlayer"); return ret; - } + } /* also, check source availability */ - ret = XACommon_CheckDataSource(pDataSrc,&mediaType); - if(ret!=XA_RESULT_SUCCESS) - { + ret = XACommon_CheckDataSource(pDataSrc, &mediaType); + if (ret != XA_RESULT_SUCCESS) + { XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_API("<-XAMediaPlayerImpl_CreateMediaPlayer"); return ret; - } + } /* instantiate object */ - pPlayerImpl = (XAMediaPlayerImpl*)calloc(1,sizeof(XAMediaPlayerImpl)); - if(!pPlayerImpl) - { + pPlayerImpl = (XAMediaPlayerImpl*) calloc(1, sizeof(XAMediaPlayerImpl)); + if (!pPlayerImpl) + { /* memory allocation failed */ XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_API("<-XAMediaPlayerImpl_CreateMediaPlayer"); return XA_RESULT_MEMORY_FAILURE; - } + } pBaseObj = &pPlayerImpl->baseObj; /* Initialize base object default implementation */ XAObjectItfImpl_Init(pBaseObj, MP_ITFCOUNT, xaMediaPlayerItfIIDs, - XAMediaPlayerImpl_DoRealize, XAMediaPlayerImpl_DoResume, - XAMediaPlayerImpl_FreeResources); + XAMediaPlayerImpl_DoRealize, XAMediaPlayerImpl_DoResume, + XAMediaPlayerImpl_FreeResources); /* Mark interfaces that need to be exposed */ /* Implicit and mandated interfaces */ @@ -145,73 +140,72 @@ pBaseObj->interfaceMap[MP_DIMITF].required = XA_BOOLEAN_TRUE; /* Explicit interfaces */ - if((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) - { + if ((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) + { /* Check required interfaces */ - for(itfIdx = 0; itfIdx < numInterfaces; itfIdx++) - { + for (itfIdx = 0; itfIdx < numInterfaces; itfIdx++) + { /* If mapEntry is null then required interface is not supported.*/ - XAObjItfMapEntry *entry = - XAObjectItfImpl_GetItfEntry((XAObjectItf)&(pBaseObj), pInterfaceIds[itfIdx]); - if( !entry ) - { - if( pInterfaceRequired[itfIdx] ) + XAObjItfMapEntry *entry = XAObjectItfImpl_GetItfEntry( + (XAObjectItf) &(pBaseObj), pInterfaceIds[itfIdx]); + if (!entry) { + if (pInterfaceRequired[itfIdx]) + { /* required interface cannot be accommodated - fail creation */ DEBUG_ERR("Required interface not found - abort creation!"); ret = XA_RESULT_FEATURE_UNSUPPORTED; break; - } + } else - { + { DEBUG_INFO("Requested (not required) interface not found - continue creation"); + } } - } else - { /* weed out unsupported content-aware itf's */ - if( (mediaType==XA_MEDIATYPE_IMAGE && - (entry->mapIdx==MP_SEEKITF || - entry->mapIdx==MP_EQUALIZERITF || - entry->mapIdx==MP_VOLUMEITF)) - || - (mediaType==XA_MEDIATYPE_AUDIO && - (entry->mapIdx==MP_IMAGECONTROLSITF || - entry->mapIdx==MP_IMAGEEFFECTSITF || - entry->mapIdx==MP_VIDEOPOSTPROCESSINGITF)) ) - { + { /* weed out unsupported content-aware itf's */ + if ((mediaType == XA_MEDIATYPE_IMAGE && (entry->mapIdx + == MP_SEEKITF || entry->mapIdx == MP_EQUALIZERITF + || entry->mapIdx == MP_VOLUMEITF)) || (mediaType + == XA_MEDIATYPE_AUDIO && (entry->mapIdx + == MP_IMAGECONTROLSITF || entry->mapIdx + == MP_IMAGEEFFECTSITF || entry->mapIdx + == MP_VIDEOPOSTPROCESSINGITF))) + { entry->required = XA_BOOLEAN_FALSE; - if( pInterfaceRequired[itfIdx] ) - { + if (pInterfaceRequired[itfIdx]) + { DEBUG_ERR("Required interface not supported for given media - abort creation!"); ret = XA_RESULT_FEATURE_UNSUPPORTED; break; + } } - } else - { + { entry->required = XA_BOOLEAN_TRUE; + } } } } - } - if(ret!=XA_RESULT_SUCCESS) - { /* creation fails */ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); + if (ret != XA_RESULT_SUCCESS) + { /* creation fails */ + XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); return ret; - } + } /* Mark interfaces that can be handled dynamically */ /* Mandated dynamic itfs */ pBaseObj->interfaceMap[MP_EQUALIZERITF].isDynamic = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MP_IMAGEEFFECTSITF].isDynamic = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MP_METADATAEXTRACTIONITF].isDynamic = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MP_METADATATRAVERSALITF].isDynamic = XA_BOOLEAN_TRUE; + pBaseObj->interfaceMap[MP_METADATAEXTRACTIONITF].isDynamic + = XA_BOOLEAN_TRUE; + pBaseObj->interfaceMap[MP_METADATATRAVERSALITF].isDynamic + = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MP_PLAYBACKRATEITF].isDynamic = XA_BOOLEAN_TRUE; - - /*Set ObjectItf to point to newly created object*/ - *pPlayer = (XAObjectItf)&(pBaseObj->self); + /*Set ObjectItf to point to newly created object*/ + *pPlayer = (XAObjectItf) &(pBaseObj->self); /*initialize XAPlayerImpl variables */ @@ -221,127 +215,121 @@ pPlayerImpl->imageVideoSnk = pImageVideoSnk; pPlayerImpl->vibra = pVibra; pPlayerImpl->LEDArray = pLEDArray; - + // Handle possible radio: - tmpIODevice = (XADataLocator_IODevice*)(pPlayerImpl->dataSrc->pLocator); - locatorIODevice = *tmpIODevice; - if (locatorIODevice.deviceType == XA_IODEVICE_RADIO) - { - fwType = (FWMgrFwType)FWMgrFWMMF; - } - else - { - /* Determine framework type that can handle recording */ - fwType = (FWMgrFwType)FWMgrMOUnknown; - /**/ - if (pDataSrc->pLocator) - { - XADataLocator_URI* dataLoc = (XADataLocator_URI*)pDataSrc->pLocator; - if (dataLoc->locatorType == XA_DATALOCATOR_URI) - { - uri = (char*)dataLoc->URI; - } - } - fwType = XAFrameworkMgr_GetFramework( - mapper, - uri, - FWMgrMOPlayer); - - if (fwType == FWMgrMOUnknown) + tmpIODevice = (XADataLocator_IODevice*) (pPlayerImpl->dataSrc->pLocator); + locatorIODevice = *tmpIODevice; + if (locatorIODevice.deviceType == XA_IODEVICE_RADIO) + { + fwType = (FWMgrFwType) FWMgrFWMMF; + } + else { - ret = XA_RESULT_CONTENT_UNSUPPORTED; - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - DEBUG_API("<-XAMediaPlayerImpl_CreateMediaPlayer"); - return ret; + /* Determine framework type that can handle recording */ + fwType = (FWMgrFwType) FWMgrMOUnknown; + /**/ + if (pDataSrc->pLocator) + { + XADataLocator_URI* dataLoc = + (XADataLocator_URI*) pDataSrc->pLocator; + if (dataLoc->locatorType == XA_DATALOCATOR_URI) + { + uri = (char*) dataLoc->URI; + } + } + fwType = XAFrameworkMgr_GetFramework(mapper, uri, FWMgrMOPlayer); + + if (fwType == FWMgrMOUnknown) + { + ret = XA_RESULT_CONTENT_UNSUPPORTED; + XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); + XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); + DEBUG_API("<-XAMediaPlayerImpl_CreateMediaPlayer"); + return ret; + } + } // end else + + if (fwType == FWMgrFWMMF) + { + pPlayerImpl->adaptationCtxMMF = XAMediaPlayerAdaptMMF_Create( + pPlayerImpl->dataSrc, pPlayerImpl->bankSrc, + pPlayerImpl->audioSnk, pPlayerImpl->imageVideoSnk, + pPlayerImpl->vibra, pPlayerImpl->LEDArray); + + pPlayerImpl->curAdaptCtx = pPlayerImpl->adaptationCtxMMF; } - } // end else - - if(fwType == FWMgrFWMMF) - { - pPlayerImpl->adaptationCtxMMF = XAMediaPlayerAdaptMMF_Create(pPlayerImpl->dataSrc, - pPlayerImpl->bankSrc, - pPlayerImpl->audioSnk, - pPlayerImpl->imageVideoSnk, - pPlayerImpl->vibra, - pPlayerImpl->LEDArray); - - pPlayerImpl->curAdaptCtx = pPlayerImpl->adaptationCtxMMF; - } else - { - pPlayerImpl->adaptationCtxGst = XAMediaPlayerAdapt_Create(pPlayerImpl->dataSrc, - pPlayerImpl->bankSrc, - pPlayerImpl->audioSnk, - pPlayerImpl->imageVideoSnk, - pPlayerImpl->vibra, - pPlayerImpl->LEDArray); - - pPlayerImpl->curAdaptCtx = pPlayerImpl->adaptationCtxGst; - } - + { + pPlayerImpl->adaptationCtxGst = XAMediaPlayerAdapt_Create( + pPlayerImpl->dataSrc, pPlayerImpl->bankSrc, + pPlayerImpl->audioSnk, pPlayerImpl->imageVideoSnk, + pPlayerImpl->vibra, pPlayerImpl->LEDArray); + + pPlayerImpl->curAdaptCtx = pPlayerImpl->adaptationCtxGst; + } + pPlayerImpl->curAdaptCtx->capslist = capabilities; pPlayerImpl->curAdaptCtx->fwtype = fwType; - + XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAMediaPlayerImpl_CreateMediaPlayer"); return XA_RESULT_SUCCESS; -} + } /* XAResult XAMediaPlayerImpl_QueryNumSupportedInterfaces * Statically query supported interfaces */ -XAresult XAMediaPlayerImpl_QueryNumSupportedInterfaces(XAuint32 * pNumSupportedInterfaces) -{ +XAresult XAMediaPlayerImpl_QueryNumSupportedInterfaces( + XAuint32 * pNumSupportedInterfaces) + { DEBUG_API("->XAMediaPlayerImpl_QueryNumSupportedInterfaces"); - if(pNumSupportedInterfaces) - { + if (pNumSupportedInterfaces) + { *pNumSupportedInterfaces = MP_ITFCOUNT; DEBUG_API("<-XAMediaPlayerImpl_QueryNumSupportedInterfaces"); return XA_RESULT_SUCCESS; - } + } else - { + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAMediaPlayerImpl_QueryNumSupportedInterfaces"); return XA_RESULT_PARAMETER_INVALID; + } } -} /* XAResult XAMediaPlayerImpl_QuerySupportedInterfaces * Statically query supported interfaces */ XAresult XAMediaPlayerImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID * pInterfaceId) -{ + XAInterfaceID * pInterfaceId) + { DEBUG_API("->XAMediaPlayerImpl_QuerySupportedInterfaces"); - if (index >= MP_ITFCOUNT || !pInterfaceId ) - { - if(pInterfaceId) + if (index >= MP_ITFCOUNT || !pInterfaceId) { + if (pInterfaceId) + { *pInterfaceId = XA_IID_NULL; + }DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMediaPlayerImpl_QuerySupportedInterfaces"); + return XA_RESULT_PARAMETER_INVALID; } - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMediaPlayerImpl_QuerySupportedInterfaces"); - return XA_RESULT_PARAMETER_INVALID; - } else - { + { *pInterfaceId = *(xaMediaPlayerItfIIDs[index]); DEBUG_API("<-XAMediaPlayerImpl_QuerySupportedInterfaces"); return XA_RESULT_SUCCESS; + } } -} /* * Realize the object */ XAresult XAMediaPlayerImpl_DoRealize(XAObjectItf self) -{ - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAMediaPlayerImpl* pImpl = (XAMediaPlayerImpl*)(pObj); + { + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAMediaPlayerImpl* pImpl = (XAMediaPlayerImpl*) (pObj); XAuint8 itfIdx = 0; void *pItf = NULL; XAresult ret = XA_RESULT_SUCCESS; @@ -350,51 +338,55 @@ XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); /* check casting from correct pointer type */ - if(!pImpl || pObj != pImpl->baseObj.self) - { + if (!pImpl || pObj != pImpl->baseObj.self) + { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAMediaPlayerImpl_DoRealize"); return XA_RESULT_PARAMETER_INVALID; - } + } /* Realize all implicit and explicitly wanted interfaces */ - for(itfIdx = 0; itfIdx < MP_ITFCOUNT; itfIdx++) - { - if(!(pObj->interfaceMap[itfIdx].pItf) && pObj->interfaceMap[itfIdx].required) + for (itfIdx = 0; itfIdx < MP_ITFCOUNT; itfIdx++) { - switch(itfIdx) + if (!(pObj->interfaceMap[itfIdx].pItf) + && pObj->interfaceMap[itfIdx].required) { + switch (itfIdx) + { case MP_DIMITF: pItf = XADIMItfImpl_Create(); - if(pItf) - { + if (pItf) + { XADIMItfImpl_Init(pItf, self, - XAMediaPlayerImpl_DoAddItf, - XAMediaPlayerImpl_DoResumeItf, - XAMediaPlayerImpl_DoRemoveItf); - } + XAMediaPlayerImpl_DoAddItf, + XAMediaPlayerImpl_DoResumeItf, + XAMediaPlayerImpl_DoRemoveItf); + } break; case MP_PLAYITF: pItf = XAPlayItfImpl_Create(pImpl); - if ( pImpl->dataSrc ) - { - XAuint32 locType = *((XAuint32*)(pImpl->dataSrc->pLocator)); - if ( locType == XA_DATALOCATOR_IODEVICE ) - { - XADataLocator_IODevice *ioDevice = (XADataLocator_IODevice*)(pImpl->dataSrc->pLocator); - if ( ioDevice->deviceType == XA_IODEVICE_CAMERA) - { - vfHandle = (void*) pItf; - DEBUG_INFO_A1("Stored view finder pointer to global address %x", vfHandle); - } - } - else - { - - } - } + if (pImpl->dataSrc) + { + XAuint32 locType = + *((XAuint32*) (pImpl->dataSrc->pLocator)); + if (locType == XA_DATALOCATOR_IODEVICE) + { + XADataLocator_IODevice + *ioDevice = + (XADataLocator_IODevice*) (pImpl->dataSrc->pLocator); + if (ioDevice->deviceType == XA_IODEVICE_CAMERA) + { + vfHandle = (void*) pItf; + DEBUG_INFO_A1("Stored view finder pointer to global address %x", vfHandle); + } + } + else + { + + } + } break; case MP_VOLUMEITF: pItf = XAVolumeItfImpl_Create(pImpl->curAdaptCtx); @@ -403,20 +395,23 @@ pItf = XASeekItfImpl_Create(pImpl); break; case MP_PREFETCHSTATUSITF: - pItf = XAPrefetchStatusItfImpl_Create( pImpl ); + pItf = XAPrefetchStatusItfImpl_Create(pImpl); break; case MP_METADATAEXTRACTIONITF: - pItf = XAMetadataExtractionItfImpl_Create( pImpl->curAdaptCtx ); + pItf = XAMetadataExtractionItfImpl_Create( + pImpl->curAdaptCtx); break; case MP_METADATATRAVERSALITF: - pItf = XAMetadataTraversalItfImpl_Create( pImpl->curAdaptCtx ); + pItf = XAMetadataTraversalItfImpl_Create( + pImpl->curAdaptCtx); break; case MP_PLAYBACKRATEITF: pItf = XAPlaybackRateItfImpl_Create(pImpl); break; case MP_CONFIGEXTENSIONITF: pItf = XAConfigExtensionsItfImpl_Create(); - XAConfigExtensionsItfImpl_SetContext( pItf, pImpl->curAdaptCtx); + XAConfigExtensionsItfImpl_SetContext(pItf, + pImpl->curAdaptCtx); break; case MP_DYNAMICSOURCEITF: pItf = XADynamicSourceItfImpl_Create(pImpl->curAdaptCtx); @@ -425,97 +420,101 @@ pItf = XAEqualizerItfImpl_Create(pImpl->curAdaptCtx); break; #ifdef OMAX_CAMERABIN - case MP_IMAGECONTROLSITF: + case MP_IMAGECONTROLSITF: pItf = XAImageControlsItfImpl_Create(pImpl->curAdaptCtx); break; - case MP_IMAGEEFFECTSITF: + case MP_IMAGEEFFECTSITF: pItf = XAImageEffectsItfImpl_Create(pImpl->curAdaptCtx); break; - case MP_VIDEOPOSTPROCESSINGITF: + case MP_VIDEOPOSTPROCESSINGITF: pItf = XAVideoPostProcessingItfImpl_Create(pImpl->curAdaptCtx); break; #endif - case MP_NOKIAVOLUMEEXT: + case MP_NOKIAVOLUMEEXT: pItf = XANokiaVolumeExtItfImpl_Create(pImpl->curAdaptCtx); break; - case MP_NOKIALINEARVOLUME: - pItf = XANokiaLinearVolumeItfImpl_Create(pImpl->curAdaptCtx); - break; + case MP_NOKIALINEARVOLUME: + pItf = XANokiaLinearVolumeItfImpl_Create( + pImpl->curAdaptCtx); + break; case MP_STREAMINFORMATIONITF: - pItf = XAStreamInformationItfImpl_Create(pImpl->curAdaptCtx); - break; + pItf = XAStreamInformationItfImpl_Create( + pImpl->curAdaptCtx); + break; default: break; - } - if(!pItf) - { + } + if (!pItf) + { /* Memory allocation failed */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); DEBUG_API("<-XAMediaPlayerImpl_DoRealize"); return XA_RESULT_MEMORY_FAILURE; - } + } else - { + { pObj->interfaceMap[itfIdx].pItf = pItf; + } } } - } /* init adaptation */ - if(pImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAMediaPlayerAdaptMMF_PostInit( (XAAdaptationMMFCtx*)pImpl->adaptationCtxMMF ); - } + if (pImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAMediaPlayerAdaptMMF_PostInit( + (XAAdaptationMMFCtx*) pImpl->adaptationCtxMMF); + } else - { - ret = XAMediaPlayerAdapt_PostInit( (XAAdaptationGstCtx*)pImpl->adaptationCtxGst ); - } - if ( ret != XA_RESULT_SUCCESS ) - { + { + ret = XAMediaPlayerAdapt_PostInit( + (XAAdaptationGstCtx*) pImpl->adaptationCtxGst); + } + if (ret != XA_RESULT_SUCCESS) + { XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_ERR("Adaptation init failed!"); DEBUG_API("<-XAMediaPlayerImpl_DoRealize"); return ret; - } + } pObj->state = XA_OBJECT_STATE_REALIZED; XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAMediaPlayerImpl_DoRealize"); return XA_RESULT_SUCCESS; -} + } /* * Resume object */ XAresult XAMediaPlayerImpl_DoResume(XAObjectItf self) -{ + { DEBUG_API("->XAMediaPlayerImpl_DoResume"); DEBUG_API("<-XAMediaPlayerImpl_DoResume"); /* suspended state not supported by this implementation */ return XA_RESULT_PRECONDITIONS_VIOLATED; -} + } /** * void XAMediaPlayerImpl_FreeResources(XAObjectItf self) * Description: Free all resources reserved at XAMediaPlayerImpl_DoRealize() **/ void XAMediaPlayerImpl_FreeResources(XAObjectItf self) -{ - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); + { + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); XAuint8 itfIdx = 0; - XAMediaPlayerImpl* pImpl = (XAMediaPlayerImpl*)pObj; + XAMediaPlayerImpl* pImpl = (XAMediaPlayerImpl*) pObj; DEBUG_API("->XAMediaPlayerImpl_FreeResources"); XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS( XATSMediaPlayer ); assert(pObj && pImpl && pObj == pObj->self); - for(itfIdx = 0; itfIdx < MP_ITFCOUNT; itfIdx++) - { + for (itfIdx = 0; itfIdx < MP_ITFCOUNT; itfIdx++) + { void *pItf = pObj->interfaceMap[itfIdx].pItf; - if(pItf) - { - switch(itfIdx) + if (pItf) { + switch (itfIdx) + { case MP_DIMITF: XADIMItfImpl_Free(pItf); break; @@ -550,13 +549,13 @@ XAEqualizerItfImpl_Free(pItf); break; #ifdef OMAX_CAMERABIN - case MP_IMAGECONTROLSITF: + case MP_IMAGECONTROLSITF: XAImageControlsItfImpl_Free(pItf); break; - case MP_IMAGEEFFECTSITF: + case MP_IMAGEEFFECTSITF: XAImageEffectsItfImpl_Free(pItf); break; - case MP_VIDEOPOSTPROCESSINGITF: + case MP_VIDEOPOSTPROCESSINGITF: XAVideoPostProcessingItfImpl_Free(pItf); break; #endif @@ -565,113 +564,122 @@ break; case MP_NOKIALINEARVOLUME: XANokiaLinearVolumeItfImpl_Free(pItf); - break; + break; case MP_STREAMINFORMATIONITF: XAStreamInformationItfImpl_Free(pItf); break; - + + } + pObj->interfaceMap[itfIdx].pItf = NULL; } - pObj->interfaceMap[itfIdx].pItf = NULL; } - } - - if(pImpl->curAdaptCtx) + + if (pImpl->curAdaptCtx) { - if(pImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + if (pImpl->curAdaptCtx->fwtype == FWMgrFWMMF) { - XAMediaPlayerAdaptMMF_Destroy( (XAAdaptationMMFCtx*)pImpl->adaptationCtxMMF ); + XAMediaPlayerAdaptMMF_Destroy( + (XAAdaptationMMFCtx*) pImpl->adaptationCtxMMF); } else { - XAMediaPlayerAdapt_Destroy( (XAAdaptationGstCtx*)pImpl->adaptationCtxGst ); + XAMediaPlayerAdapt_Destroy( + (XAAdaptationGstCtx*) pImpl->adaptationCtxGst); } } XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaPlayer ); DEBUG_API("<-XAMediaPlayerImpl_FreeResources"); return; -} + } /* XAMediaPlayerImpl_DoAddItf * Dynamically add an interface, object specific parts */ -XAresult XAMediaPlayerImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ - - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAMediaPlayerImpl* pImpl = (XAMediaPlayerImpl*)(pObj); +XAresult XAMediaPlayerImpl_DoAddItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry) + { + + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAMediaPlayerImpl* pImpl = (XAMediaPlayerImpl*) (pObj); XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMediaPlayerImpl_DoAddItf"); - if(mapEntry) - { - switch( mapEntry->mapIdx ) + if (mapEntry) + { + switch (mapEntry->mapIdx) { - + case MP_METADATAEXTRACTIONITF: - mapEntry->pItf = XAMetadataExtractionItfImpl_Create( pImpl->curAdaptCtx ); + mapEntry->pItf = XAMetadataExtractionItfImpl_Create( + pImpl->curAdaptCtx); break; case MP_METADATATRAVERSALITF: - mapEntry->pItf = XAMetadataTraversalItfImpl_Create( pImpl->curAdaptCtx ); + mapEntry->pItf = XAMetadataTraversalItfImpl_Create( + pImpl->curAdaptCtx); break; case MP_PLAYBACKRATEITF: mapEntry->pItf = XAPlaybackRateItfImpl_Create(pImpl); break; case MP_EQUALIZERITF: - mapEntry->pItf = XAEqualizerItfImpl_Create( pImpl->curAdaptCtx ); + mapEntry->pItf + = XAEqualizerItfImpl_Create(pImpl->curAdaptCtx); break; #ifdef OMAX_CAMERABIN - case MP_IMAGEEFFECTSITF: + case MP_IMAGEEFFECTSITF: mapEntry->pItf = XAImageEffectsItfImpl_Create( pImpl->curAdaptCtx ); break; #endif default: - DEBUG_ERR("XAMediaPlayerImpl_DoAddItf unknown id"); + DEBUG_ERR("XAMediaPlayerImpl_DoAddItf unknown id") + ; ret = XA_RESULT_FEATURE_UNSUPPORTED; break; } - - if( !mapEntry->pItf && ret == XA_RESULT_SUCCESS) + + if (!mapEntry->pItf && ret == XA_RESULT_SUCCESS) { DEBUG_ERR("XAMediaPlayerImpl_DoAddItf itf creation failed"); ret = XA_RESULT_MEMORY_FAILURE; } - } + } else - { + { ret = XA_RESULT_PARAMETER_INVALID; - } + } DEBUG_API("<-XAMediaPlayerImpl_DoAddItf"); return ret; -} + } /* XAMediaPlayerImpl_DoResumeItf * Try to resume lost interface, object specific parts */ -XAresult XAMediaPlayerImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ +XAresult XAMediaPlayerImpl_DoResumeItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry) + { /* For now, no difference between suspended and unrealised itfs */ XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMediaPlayerImpl_DoResumeItf"); - ret = XAMediaPlayerImpl_DoAddItf(self,mapEntry); + ret = XAMediaPlayerImpl_DoAddItf(self, mapEntry); DEBUG_API("<-XAMediaPlayerImpl_DoResumeItf"); return ret; -} + } /* XAMediaPlayerImpl_DoRemoveItf * Dynamically remove an interface, object specific parts */ -XAresult XAMediaPlayerImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ +XAresult XAMediaPlayerImpl_DoRemoveItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry) + { XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMediaPlayerImpl_DoRemoveItf"); - if(mapEntry) - { - switch( mapEntry->mapIdx ) + if (mapEntry) { + switch (mapEntry->mapIdx) + { case MP_METADATAEXTRACTIONITF: XAMetadataExtractionItfImpl_Free(mapEntry->pItf); break; @@ -685,23 +693,24 @@ XAEqualizerItfImpl_Free(mapEntry->pItf); break; #ifdef OMAX_CAMERABIN - case MP_IMAGEEFFECTSITF: + case MP_IMAGEEFFECTSITF: XAImageEffectsItfImpl_Free(mapEntry->pItf); break; #endif default: - DEBUG_ERR("XAMediaPlayerImpl_DoRemoveItf unknown id"); + DEBUG_ERR("XAMediaPlayerImpl_DoRemoveItf unknown id") + ; ret = XA_RESULT_FEATURE_UNSUPPORTED; break; - } + } mapEntry->pItf = NULL; - } + } else - { + { ret = XA_RESULT_PARAMETER_INVALID; - } + } DEBUG_API("<-XAMediaPlayerImpl_DoRemoveItf"); return ret; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediaplayer/xamediaplayer.h --- a/khronosfws/openmax_al/src/mediaplayer/xamediaplayer.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xamediaplayer.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MediaPlayer Object Implementation Header + * + */ #ifndef XAMEDIAPLAYER_H #define XAMEDIAPLAYER_H @@ -26,14 +26,12 @@ #include "xacapabilitiesmgr.h" /** MACROS **/ - /** TYPES **/ - /** ENUMERATIONS **/ /* Enumeration for interfaces that MediaPlayer supports. */ typedef enum -{ + { MP_OBJECTITF, MP_DIMITF, MP_PLAYITF, @@ -53,12 +51,12 @@ MP_NOKIALINEARVOLUME, MP_STREAMINFORMATIONITF, MP_ITFCOUNT -} MPInterfaces; + } MPInterfaces; /** STRUCTURES **/ /* Specification for XAMediaPlayerImpl.*/ typedef struct XAMediaPlayerImpl_ -{ + { /* Parent for XAMediaPlayerImpl */ XAObjectItfImpl baseObj; @@ -76,8 +74,7 @@ XAAdaptationBaseCtx* adaptationCtxGst; XAAdaptationBaseCtx* adaptationCtxMMF; -} XAMediaPlayerImpl; - + } XAMediaPlayerImpl; /** METHODS **/ @@ -87,8 +84,11 @@ void XAMediaPlayerImpl_FreeResources(XAObjectItf self); /* DynamicInterfaceManagement object-specific methods */ -XAresult XAMediaPlayerImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XAMediaPlayerImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XAMediaPlayerImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); +XAresult XAMediaPlayerImpl_DoAddItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry); +XAresult XAMediaPlayerImpl_DoResumeItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry); +XAresult XAMediaPlayerImpl_DoRemoveItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry); #endif /* XAMEDIAPLAYER_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediaplayer/xaplayitf.c --- a/khronosfws/openmax_al/src/mediaplayer/xaplayitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xaplayitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Play Itf Implementation + * + */ #include #include @@ -33,17 +33,17 @@ * Description: Validate interface pointer and cast it to implementation pointer. */ static XAPlayItfImpl* GetImpl(XAPlayItf self) -{ - if(self) { - XAPlayItfImpl* impl = (XAPlayItfImpl*)(*self); - if(impl && impl == impl->self) + if (self) { + XAPlayItfImpl* impl = (XAPlayItfImpl*) (*self); + if (impl && impl == impl->self) + { return impl; + } } + return NULL; } - return NULL; -} /** * Base interface XAPlayItf implementation @@ -54,124 +54,130 @@ * Description: Requests a transition of the player into the given play state. **/ XAresult XAPlayItfImpl_SetPlayState(XAPlayItf self, XAuint32 state) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API_A1("->XAPlayItfImpl_SetPlayState %s",PLAYSTATENAME(state)); - if( !impl || state < XA_PLAYSTATE_STOPPED || state > XA_PLAYSTATE_PLAYING ) - { + if (!impl || state < XA_PLAYSTATE_STOPPED || state > XA_PLAYSTATE_PLAYING) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_SetPlayState"); return XA_RESULT_PARAMETER_INVALID; - } + } XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAPlayItfAdaptMMF_SetPlayState(impl->pObjImpl->curAdaptCtx, state); + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAPlayItfAdaptMMF_SetPlayState(impl->pObjImpl->curAdaptCtx, + state); XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_SetPlayState"); - return ret; - } + return ret; + } - /* check is play state changed, if not do nothing */ - if(state != impl->playbackState) - { - if(state == XA_PLAYSTATE_PLAYING) - { - XAPlayItfAdaptGST_GetPosition((XAAdaptationGstCtx*)impl->adapCtx, &(impl->lastPosition)); - } - ret = XAPlayItfAdaptGST_SetPlayState(impl->adapCtx, state); + /* check is play state changed, if not do nothing */ + if (state != impl->playbackState) + { + if (state == XA_PLAYSTATE_PLAYING) + { + XAPlayItfAdaptGST_GetPosition( + (XAAdaptationGstCtx*) impl->adapCtx, + &(impl->lastPosition)); + } + ret = XAPlayItfAdaptGST_SetPlayState(impl->adapCtx, state); - if(ret == XA_RESULT_SUCCESS) - { - impl->playbackState = state; - if(state == XA_PLAYSTATE_STOPPED || state == XA_PLAYSTATE_PAUSED) - { - impl->isMarkerPosCbSend = XA_BOOLEAN_FALSE; - impl->lastPosition = 0; - } - } - } + if (ret == XA_RESULT_SUCCESS) + { + impl->playbackState = state; + if (state == XA_PLAYSTATE_STOPPED || state == XA_PLAYSTATE_PAUSED) + { + impl->isMarkerPosCbSend = XA_BOOLEAN_FALSE; + impl->lastPosition = 0; + } + } + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_SetPlayState"); return ret; -} + } /** * XAresult XAPlayItfImpl_GetPlayState(XAPlayItf self, XAuint32 *pState) * Description: Gets the player's current play state. **/ XAresult XAPlayItfImpl_GetPlayState(XAPlayItf self, XAuint32 *pState) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API("->XAPlayItfImpl_GetPlayState"); - if(!impl || !pState) - { + if (!impl || !pState) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_GetPlayState"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAPlayItfAdaptMMF_GetPlayState(impl->pObjImpl->curAdaptCtx, pState); - } + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAPlayItfAdaptMMF_GetPlayState(impl->pObjImpl->curAdaptCtx, + pState); + } else - { + { *pState = impl->playbackState; - } + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API_A1("<-XAPlayItfImpl_GetPlayState: %s",PLAYSTATENAME(impl->playbackState)); return ret; -} + } /** * XAresult XAPlayItfImpl_GetDuration(XAPlayItf self, XAmillisecond *pMsec) * Description: Gets the duration of the current content, in milliseconds. **/ XAresult XAPlayItfImpl_GetDuration(XAPlayItf self, XAmillisecond *pMsec) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API("->XAPlayItfImpl_GetDuration"); - if(!impl || !pMsec) - { + if (!impl || !pMsec) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_GetDuration"); return XA_RESULT_PARAMETER_INVALID; - } + } XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAPlayItfAdaptMMF_GetDuration(impl->pObjImpl->curAdaptCtx, pMsec); - } + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAPlayItfAdaptMMF_GetDuration(impl->pObjImpl->curAdaptCtx, + pMsec); + } else - { - ret = XAPlayItfAdaptGST_GetDuration((XAAdaptationGstCtx*)impl->adapCtx, pMsec); - } - + { + ret = XAPlayItfAdaptGST_GetDuration( + (XAAdaptationGstCtx*) impl->adapCtx, pMsec); + } + XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_GetDuration"); return ret; -} + } /** * XAresult XAPlayItfImpl_GetPosition(XAPlayItf self, XAmillisecond *pMsec) @@ -179,177 +185,187 @@ * to the beginning of the content. **/ XAresult XAPlayItfImpl_GetPosition(XAPlayItf self, XAmillisecond *pMsec) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); - + DEBUG_API("->XAPlayItfImpl_GetPosition"); - if(!impl || !pMsec) - { + if (!impl || !pMsec) + { /* invalid parameter */ DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_GetPosition"); return XA_RESULT_PARAMETER_INVALID; - } + } XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAPlayItfAdaptMMF_GetPosition(impl->pObjImpl->curAdaptCtx, pMsec); - } + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAPlayItfAdaptMMF_GetPosition(impl->pObjImpl->curAdaptCtx, + pMsec); + } else - { + { - if ( impl->playbackState == XA_PLAYSTATE_STOPPED ) - { - *pMsec = 0; - DEBUG_API("<-XAPlayItfImpl_GetPosition"); - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - return XA_RESULT_SUCCESS; + if (impl->playbackState == XA_PLAYSTATE_STOPPED) + { + *pMsec = 0; + DEBUG_API("<-XAPlayItfImpl_GetPosition"); + XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); + return XA_RESULT_SUCCESS; + } + ret = XAPlayItfAdaptGST_GetPosition( + (XAAdaptationGstCtx*) impl->adapCtx, pMsec); } - ret = XAPlayItfAdaptGST_GetPosition((XAAdaptationGstCtx*)impl->adapCtx, pMsec); - } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_GetPosition"); return ret; -} + } /** * XAresult XAPlayItfImpl_RegisterCallback(XAPlayItf self, xaPlayCallback callback, * void *pContext) * Description: Sets the playback callback function. **/ -XAresult XAPlayItfImpl_RegisterCallback(XAPlayItf self, xaPlayCallback callback, - void *pContext) -{ +XAresult XAPlayItfImpl_RegisterCallback(XAPlayItf self, + xaPlayCallback callback, void *pContext) + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API("->XAPlayItfImpl_RegisterCallback"); - if(!impl) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_RegisterCallback"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } /* callback may be NULL (to remove callback) */ impl->callback = callback; impl->cbcontext = pContext; impl->cbPtrToSelf = self; - + // No need to do anything else if radio: - if ( ((XAMediaPlayerAdaptationMMFCtx*)impl->pObjImpl->curAdaptCtx)->isForRadio == XA_BOOLEAN_TRUE) - { - DEBUG_API("<-XAPlayItfImpl_RegisterCallback"); - return ret; - } + if (((XAMediaPlayerAdaptationMMFCtx*) impl->pObjImpl->curAdaptCtx)->isForRadio + == XA_BOOLEAN_TRUE) + { + DEBUG_API("<-XAPlayItfImpl_RegisterCallback"); + return ret; + } XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAPlayItfAdaptMMF_RegisterCallback(impl->pObjImpl->curAdaptCtx, callback); - } + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAPlayItfAdaptMMF_RegisterCallback(impl->pObjImpl->curAdaptCtx, + callback); + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_RegisterCallback"); return ret; -} + } /** * XAresult XAPlayItfImpl_SetCallbackEventsMask(XAPlayItf self, XAuint32 eventFlags) * Description: Enables/disables notification of playback events. **/ -XAresult XAPlayItfImpl_SetCallbackEventsMask(XAPlayItf self, XAuint32 eventFlags) -{ +XAresult XAPlayItfImpl_SetCallbackEventsMask(XAPlayItf self, + XAuint32 eventFlags) + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API("->XAPlayItfImpl_SetCallbackEventsMask"); - if(!impl || ( eventFlags > (XA_PLAYEVENT_HEADATEND | XA_PLAYEVENT_HEADATMARKER | - XA_PLAYEVENT_HEADATNEWPOS | XA_PLAYEVENT_HEADMOVING | XA_PLAYEVENT_HEADSTALLED) ) ) - { + if (!impl || (eventFlags > (XA_PLAYEVENT_HEADATEND + | XA_PLAYEVENT_HEADATMARKER | XA_PLAYEVENT_HEADATNEWPOS + | XA_PLAYEVENT_HEADMOVING | XA_PLAYEVENT_HEADSTALLED))) + { /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAPlayItfImpl_SetCallbackEventsMask"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAPlayItfImpl_SetCallbackEventsMask"); return XA_RESULT_PARAMETER_INVALID; - } + } XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); impl->eventFlags = eventFlags; - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAPlayItfAdaptMMF_SetCallbackEventsMask(impl->pObjImpl->curAdaptCtx, eventFlags); + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAPlayItfAdaptMMF_SetCallbackEventsMask( + impl->pObjImpl->curAdaptCtx, eventFlags); - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - DEBUG_API("<-XAPlayItfImpl_SetCallbackEventsMask"); - return ret; - } + XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); + DEBUG_API("<-XAPlayItfImpl_SetCallbackEventsMask"); + return ret; + } /* enable position tracking if client wants so */ - if( (eventFlags & (XA_PLAYEVENT_HEADATMARKER | XA_PLAYEVENT_HEADATNEWPOS)) - && impl->adapCtx && !impl->positionupdateOn) + if ((eventFlags & (XA_PLAYEVENT_HEADATMARKER | XA_PLAYEVENT_HEADATNEWPOS)) + && impl->adapCtx && !impl->positionupdateOn) { - ret = XAPlayItfAdapt_EnablePositionTracking((XAAdaptationGstCtx*)impl->adapCtx, XA_BOOLEAN_TRUE); - if( ret == XA_RESULT_SUCCESS ) - { + ret = XAPlayItfAdapt_EnablePositionTracking( + (XAAdaptationGstCtx*) impl->adapCtx, XA_BOOLEAN_TRUE); + if (ret == XA_RESULT_SUCCESS) + { impl->positionupdateOn = XA_BOOLEAN_TRUE; + } } - } - else if( !(eventFlags & (XA_PLAYEVENT_HEADATMARKER | XA_PLAYEVENT_HEADATNEWPOS)) - && impl->adapCtx && impl->positionupdateOn) - { - ret = XAPlayItfAdapt_EnablePositionTracking((XAAdaptationGstCtx*)impl->adapCtx, XA_BOOLEAN_FALSE); - if( ret == XA_RESULT_SUCCESS ) + else if (!(eventFlags & (XA_PLAYEVENT_HEADATMARKER + | XA_PLAYEVENT_HEADATNEWPOS)) && impl->adapCtx + && impl->positionupdateOn) { + ret = XAPlayItfAdapt_EnablePositionTracking( + (XAAdaptationGstCtx*) impl->adapCtx, XA_BOOLEAN_FALSE); + if (ret == XA_RESULT_SUCCESS) + { impl->positionupdateOn = XA_BOOLEAN_FALSE; + } } - } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_SetCallbackEventsMask"); return ret; -} + } /** * XAresult XAPlayItfImpl_GetCallbackEventsMask(XAPlayItf self, XAuint32 *pEventFlags) * Description: Queries for the notification state (enabled/disabled) of playback events. **/ -XAresult XAPlayItfImpl_GetCallbackEventsMask(XAPlayItf self, XAuint32 *pEventFlags) -{ +XAresult XAPlayItfImpl_GetCallbackEventsMask(XAPlayItf self, + XAuint32 *pEventFlags) + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API("->XAPlayItfImpl_GetCallbackEventsMask"); - if(!impl || !pEventFlags) - { + if (!impl || !pEventFlags) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_GetCallbackEventsMask"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pEventFlags = impl->eventFlags; DEBUG_API("<-XAPlayItfImpl_GetCallbackEventsMask"); return ret; -} + } /** * XAresult XAPlayItfImpl_SetMarkerPosition(XAPlayItf self, XAmillisecond mSec) * Description: Sets the position of the playback marker. **/ XAresult XAPlayItfImpl_SetMarkerPosition(XAPlayItf self, XAmillisecond mSec) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAmillisecond duration = 0; XAPlayItfImpl* impl = GetImpl(self); @@ -357,161 +373,164 @@ DEBUG_API_A1("->XAPlayItfImpl_SetMarkerPosition: %lu ms", mSec); /* Get duration of the content */ - if(XAPlayItfImpl_GetDuration(self, &duration) != XA_RESULT_SUCCESS) - { + if (XAPlayItfImpl_GetDuration(self, &duration) != XA_RESULT_SUCCESS) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_SetMarkerPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } - + } - if(!impl || mSec > duration) - { + if (!impl || mSec > duration) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_SetMarkerPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } impl->markerPosition = mSec; impl->isMarkerPosCbSend = XA_BOOLEAN_FALSE; XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAPlayItfAdaptMMF_SetMarkerPosition(impl->pObjImpl->curAdaptCtx, mSec); - } + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAPlayItfAdaptMMF_SetMarkerPosition( + impl->pObjImpl->curAdaptCtx, mSec); + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_SetMarkerPosition"); return ret; -} + } /** * XAresult XAPlayItfImpl_ClearMarkerPosition(XAPlayItf self) * Description: Clears marker. **/ XAresult XAPlayItfImpl_ClearMarkerPosition(XAPlayItf self) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API("->XAPlayItfImpl_ClearMarkerPosition"); - if(!impl) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_ClearMarkerPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } impl->isMarkerPosCbSend = XA_BOOLEAN_FALSE; impl->markerPosition = NO_POSITION; XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAPlayItfAdaptMMF_ClearMarkerPosition(impl->pObjImpl->curAdaptCtx); - } + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAPlayItfAdaptMMF_ClearMarkerPosition( + impl->pObjImpl->curAdaptCtx); + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_ClearMarkerPosition"); return ret; -} + } /** * XAresult XAPlayItfImpl_GetMarkerPosition(XAPlayItf self, XAmillisecond *pMsec) * Description: Queries the position of playback marker. **/ XAresult XAPlayItfImpl_GetMarkerPosition(XAPlayItf self, XAmillisecond *pMsec) -{ + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API("->XAPlayItfImpl_GetMarkerPosition"); - if(!impl || !pMsec) - { + if (!impl || !pMsec) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_GetMarkerPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - if(impl->markerPosition == NO_POSITION) - { + if (impl->markerPosition == NO_POSITION) + { DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); DEBUG_API("<-XAPlayItfImpl_GetMarkerPosition"); /*marker is not set */ return XA_RESULT_PRECONDITIONS_VIOLATED; - } + } *pMsec = impl->markerPosition; DEBUG_API("<-XAPlayItfImpl_GetMarkerPosition"); return ret; -} + } /** * XAresult XAPlayItfImpl_SetPositionUpdatePeriod(XAPlayItf self, XAmillisecond mSec) * Description: Sets the interval between periodic position notifications. **/ -XAresult XAPlayItfImpl_SetPositionUpdatePeriod(XAPlayItf self, XAmillisecond mSec) -{ +XAresult XAPlayItfImpl_SetPositionUpdatePeriod(XAPlayItf self, + XAmillisecond mSec) + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API_A1("->XAPlayItfImpl_SetPositionUpdatePeriod, %lu mSec", mSec); - if(!impl ) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_SetPositionUpdatePeriod"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } impl->positionUpdatePeriod = mSec; XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAPlayItfAdaptMMF_SetPositionUpdatePeriod(impl->pObjImpl->curAdaptCtx, mSec); - } + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAPlayItfAdaptMMF_SetPositionUpdatePeriod( + impl->pObjImpl->curAdaptCtx, mSec); + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_SetPositionUpdatePeriod"); return ret; -} + } /** * XAresult XAPlayItfImpl_GetPositionUpdatePeriod(XAPlayItf self, XAmillisecond *pMsec) * Description: Queries the interval between periodic position notifications. **/ -XAresult XAPlayItfImpl_GetPositionUpdatePeriod(XAPlayItf self, XAmillisecond *pMsec) -{ +XAresult XAPlayItfImpl_GetPositionUpdatePeriod(XAPlayItf self, + XAmillisecond *pMsec) + { XAresult ret = XA_RESULT_SUCCESS; XAPlayItfImpl* impl = GetImpl(self); DEBUG_API("->XAPlayItfImpl_GetPositionUpdatePeriod"); - if(!impl || !pMsec) - { + if (!impl || !pMsec) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlayItfImpl_GetPositionUpdatePeriod"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pMsec = impl->positionUpdatePeriod; DEBUG_API("<-XAPlayItfImpl_GetPositionUpdatePeriod"); return ret; -} - + } /** * XAPlayItfImpl -specific methods @@ -521,14 +540,14 @@ * XAPlayItfImpl* XAPlayItfImpl_Create() * Description: Allocate and initialize PlayItfImpl **/ -XAPlayItfImpl* XAPlayItfImpl_Create( XAMediaPlayerImpl *impl ) -{ +XAPlayItfImpl* XAPlayItfImpl_Create(XAMediaPlayerImpl *impl) + { XAPlayItfImpl *self; DEBUG_API("->XAPlayItfImpl_Create"); - self = (XAPlayItfImpl*)calloc(1,sizeof(XAPlayItfImpl)); - if(self) - { + self = (XAPlayItfImpl*) calloc(1, sizeof(XAPlayItfImpl)); + if (self) + { /* init itf default implementation */ self->itf.ClearMarkerPosition = XAPlayItfImpl_ClearMarkerPosition; self->itf.GetCallbackEventsMask = XAPlayItfImpl_GetCallbackEventsMask; @@ -536,12 +555,14 @@ self->itf.GetMarkerPosition = XAPlayItfImpl_GetMarkerPosition; self->itf.GetPlayState = XAPlayItfImpl_GetPlayState; self->itf.GetPosition = XAPlayItfImpl_GetPosition; - self->itf.GetPositionUpdatePeriod = XAPlayItfImpl_GetPositionUpdatePeriod; + self->itf.GetPositionUpdatePeriod + = XAPlayItfImpl_GetPositionUpdatePeriod; self->itf.RegisterCallback = XAPlayItfImpl_RegisterCallback; self->itf.SetCallbackEventsMask = XAPlayItfImpl_SetCallbackEventsMask; self->itf.SetMarkerPosition = XAPlayItfImpl_SetMarkerPosition; self->itf.SetPlayState = XAPlayItfImpl_SetPlayState; - self->itf.SetPositionUpdatePeriod = XAPlayItfImpl_SetPositionUpdatePeriod; + self->itf.SetPositionUpdatePeriod + = XAPlayItfImpl_SetPositionUpdatePeriod; /* init variables */ self->callback = NULL; @@ -555,150 +576,155 @@ self->pObjImpl = impl; self->cbPtrToSelf = NULL; self->isMarkerPosCbSend = XA_BOOLEAN_FALSE; - -/* XAAdaptationBase_AddEventHandler( self->adapCtx, &XAPlayItfImpl_AdaptCb, XA_PLAYITFEVENTS, self );*/ - XAAdaptationBase_AddEventHandler( self->pObjImpl->curAdaptCtx, &XAPlayItfImpl_AdaptCb, XA_PLAYITFEVENTS, self ); + + /* XAAdaptationBase_AddEventHandler( self->adapCtx, &XAPlayItfImpl_AdaptCb, XA_PLAYITFEVENTS, self );*/ + XAAdaptationBase_AddEventHandler(self->pObjImpl->curAdaptCtx, + &XAPlayItfImpl_AdaptCb, XA_PLAYITFEVENTS, self); self->self = self; - } + } DEBUG_API("<-XAPlayItfImpl_Create"); return self; -} + } /* void XAPlayItfImpl_Free(XAPlayItfImpl* self) * Description: Free all resources reserved at XAPlayItfImpl_Create */ void XAPlayItfImpl_Free(XAPlayItfImpl* self) -{ + { DEBUG_API("->XAPlayItfImpl_Free"); assert(self==self->self); -/* XAAdaptationBase_RemoveEventHandler( self->adapCtx, &XAPlayItfImpl_AdaptCb );*/ - XAAdaptationBase_RemoveEventHandler( self->pObjImpl->curAdaptCtx, &XAPlayItfImpl_AdaptCb ); + /* XAAdaptationBase_RemoveEventHandler( self->adapCtx, &XAPlayItfImpl_AdaptCb );*/ + XAAdaptationBase_RemoveEventHandler(self->pObjImpl->curAdaptCtx, + &XAPlayItfImpl_AdaptCb); free(self); DEBUG_API("<-XAPlayItfImpl_Free"); -} + } /* void XAPlayItfImpl_AdaptCb * Description: Listen changes in adaptation */ -void XAPlayItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ - XAPlayItfImpl* impl = (XAPlayItfImpl*)pHandlerCtx; +void XAPlayItfImpl_AdaptCb(void *pHandlerCtx, XAAdaptEvent *event) + { + XAPlayItfImpl* impl = (XAPlayItfImpl*) pHandlerCtx; XAuint32 newpos = 0; DEBUG_API("->XAPlayItfImpl_AdaptCb"); XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS( XATSMediaPlayer ); - if(!impl) - { + if (!impl) + { DEBUG_ERR("XAPlayItfImpl_AdaptCb, invalid context pointer!"); DEBUG_API("<-XAPlayItfImpl_AdaptCb"); XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaPlayer ); return; - } + } assert(event); - if(impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { + if (impl->pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { impl->callback(impl->cbPtrToSelf, impl->cbcontext, event->eventid); DEBUG_API("<-XAPlayItfImpl_AdaptCb"); XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaPlayer ); return; - } + } /* check position update events */ - if( event->eventid == XA_ADAPT_POSITION_UPDATE_EVT ) - { + if (event->eventid == XA_ADAPT_POSITION_UPDATE_EVT) + { assert(event->data); - newpos = *((XAuint32*)(event->data)); + newpos = *((XAuint32*) (event->data)); DEBUG_API_A1("Position update from adaptation: new position %lu ms",newpos); /* Check is looping start file playing before marker position */ - if(newpos < impl->markerPosition || impl->lastPosition > newpos) - { - DEBUG_INFO("Restart looping, clear marker position callback flag."); + if (newpos < impl->markerPosition || impl->lastPosition > newpos) + { + DEBUG_INFO("Restart looping, clear marker position callback flag."); impl->isMarkerPosCbSend = XA_BOOLEAN_FALSE; - } + } /* check if marker passed and callback needed */ - if( (impl->markerPosition != NO_POSITION) && - (impl->eventFlags & XA_PLAYEVENT_HEADATMARKER) ) + if ((impl->markerPosition != NO_POSITION) && (impl->eventFlags + & XA_PLAYEVENT_HEADATMARKER)) + { + if (impl->callback && (((impl->lastPosition + < impl->markerPosition) + && (newpos > impl->markerPosition)) || (newpos + == impl->markerPosition))) + { + /* Check is callback already send */ + if (impl->isMarkerPosCbSend != XA_BOOLEAN_TRUE) + { + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_PLAYEVENT_HEADATMARKER); + impl->isMarkerPosCbSend = XA_BOOLEAN_TRUE; + } + } + } + /* check if update period passed and callback needed */ + if ((impl->positionUpdatePeriod > 0) && (impl->eventFlags + & XA_PLAYEVENT_HEADATNEWPOS) && impl->callback) + { + if ((XAuint32) ((impl->lastPosition) + / (impl->positionUpdatePeriod)) < (XAuint32) (newpos + / (impl->positionUpdatePeriod))) + { + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_PLAYEVENT_HEADATNEWPOS); + } + } + /* store position */ + impl->lastPosition = newpos; + } + + /* check other events */ + else if (event->eventid == XA_PLAYEVENT_HEADATEND) { - if( impl->callback && - ( - ((impl->lastPosition < impl->markerPosition) && - (newpos > impl->markerPosition)) - || - (newpos == impl->markerPosition) - ) - ) + impl->playbackState = XA_PLAYSTATE_STOPPED; + impl->lastPosition = 0; + /* send callback if needed */ + if ((XA_PLAYEVENT_HEADATEND & impl->eventFlags) && impl->callback) { - /* Check is callback already send */ - if( impl->isMarkerPosCbSend != XA_BOOLEAN_TRUE ) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_PLAYEVENT_HEADATMARKER); - impl->isMarkerPosCbSend = XA_BOOLEAN_TRUE; - } + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_PLAYEVENT_HEADATEND); } } - /* check if update period passed and callback needed */ - if( (impl->positionUpdatePeriod > 0) && - (impl->eventFlags & XA_PLAYEVENT_HEADATNEWPOS) && - impl->callback ) + else if (event->eventid == XA_PLAYEVENT_HEADSTALLED) { - if( (XAuint32)((impl->lastPosition)/(impl->positionUpdatePeriod )) < - (XAuint32)(newpos/(impl->positionUpdatePeriod )) ) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_PLAYEVENT_HEADATNEWPOS); - } - } - /* store position */ - impl->lastPosition = newpos; - } - - /* check other events */ - else if( event->eventid == XA_PLAYEVENT_HEADATEND ) - { - impl->playbackState = XA_PLAYSTATE_STOPPED; - impl->lastPosition=0; - /* send callback if needed */ - if( (XA_PLAYEVENT_HEADATEND & impl->eventFlags) && impl->callback ) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_PLAYEVENT_HEADATEND); - } - } - else if( event->eventid == XA_PLAYEVENT_HEADSTALLED ) - { impl->playbackState = XA_PLAYSTATE_PAUSED; - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (impl->adapCtx->fwtype == FWMgrFWMMF) { //XAPlayItfAdaptMMF_GetPosition((XAAdaptationGstCtx*)impl->adapCtx, &(impl->lastPosition)); } else { - XAPlayItfAdaptGST_GetPosition((XAAdaptationGstCtx*)impl->adapCtx, &(impl->lastPosition)); - } + XAPlayItfAdaptGST_GetPosition( + (XAAdaptationGstCtx*) impl->adapCtx, + &(impl->lastPosition)); + } /* send callback if needed */ - if( (XA_PLAYEVENT_HEADSTALLED & impl->eventFlags) && impl->callback ) + if ((XA_PLAYEVENT_HEADSTALLED & impl->eventFlags) && impl->callback) + { + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_PLAYEVENT_HEADSTALLED); + } + } + else if (event->eventid == XA_PLAYEVENT_HEADMOVING) { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_PLAYEVENT_HEADSTALLED); - } - } - else if( event->eventid == XA_PLAYEVENT_HEADMOVING ) - { impl->playbackState = XA_PLAYSTATE_PLAYING; /* send callback if needed */ - if( (XA_PLAYEVENT_HEADMOVING & impl->eventFlags) && impl->callback ) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_PLAYEVENT_HEADMOVING); + if ((XA_PLAYEVENT_HEADMOVING & impl->eventFlags) && impl->callback) + { + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_PLAYEVENT_HEADMOVING); + } } - } else - { + { /* do nothing */ - } + } DEBUG_API("<-XAPlayItfImpl_AdaptCb"); XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaPlayer ); -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediaplayer/xaplayitf.h --- a/khronosfws/openmax_al/src/mediaplayer/xaplayitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xaplayitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Play Itf Header + * + */ #ifndef XAPLAYITF_H #define XAPLAYITF_H @@ -21,7 +21,6 @@ #include "xaadptbasectx.h" #include "xamediaplayer.h" - /** MACROS **/ #define NO_POSITION XA_TIME_UNKNOWN #define PLAYITF_DEFAULT_UPDATE_PERIOD 1000 @@ -34,7 +33,7 @@ /** STRUCTURES **/ /* Definition of XAPlayItf implementation */ typedef struct XAPlayItfImpl_ -{ + { /* parent interface */ struct XAPlayItf_ itf; /* pointer to self */ @@ -51,7 +50,7 @@ XAuint32 eventFlags; XAmillisecond markerPosition; XAmillisecond positionUpdatePeriod; - XAboolean positionupdateOn; + XAboolean positionupdateOn; XAmillisecond lastPosition; XAboolean isMarkerPosCbSend; @@ -59,10 +58,10 @@ /* TODO : This is no longer needed since we have access to XAMediaPlayerImpl * Delete this.*/ XAAdaptationBaseCtx *adapCtx; - + XAMediaPlayerImpl* pObjImpl; -} XAPlayItfImpl; + } XAPlayItfImpl; /** METHODS **/ @@ -75,30 +74,33 @@ XAresult XAPlayItfImpl_GetPosition(XAPlayItf self, XAmillisecond *pMsec); -XAresult XAPlayItfImpl_RegisterCallback(XAPlayItf self, xaPlayCallback callback, - void *pContext); +XAresult XAPlayItfImpl_RegisterCallback(XAPlayItf self, + xaPlayCallback callback, void *pContext); -XAresult XAPlayItfImpl_SetCallbackEventsMask(XAPlayItf self, XAuint32 eventFlags); +XAresult XAPlayItfImpl_SetCallbackEventsMask(XAPlayItf self, + XAuint32 eventFlags); -XAresult XAPlayItfImpl_GetCallbackEventsMask(XAPlayItf self, XAuint32 *pEventFlags); +XAresult XAPlayItfImpl_GetCallbackEventsMask(XAPlayItf self, + XAuint32 *pEventFlags); XAresult XAPlayItfImpl_SetMarkerPosition(XAPlayItf self, XAmillisecond mSec); XAresult XAPlayItfImpl_ClearMarkerPosition(XAPlayItf self); -XAresult XAPlayItfImpl_GetMarkerPosition(XAPlayItf self, XAmillisecond *pMsec); +XAresult + XAPlayItfImpl_GetMarkerPosition(XAPlayItf self, XAmillisecond *pMsec); -XAresult XAPlayItfImpl_SetPositionUpdatePeriod(XAPlayItf self, XAmillisecond mSec); +XAresult XAPlayItfImpl_SetPositionUpdatePeriod(XAPlayItf self, + XAmillisecond mSec); -XAresult XAPlayItfImpl_GetPositionUpdatePeriod(XAPlayItf self, XAmillisecond *pMsec); - +XAresult XAPlayItfImpl_GetPositionUpdatePeriod(XAPlayItf self, + XAmillisecond *pMsec); /* * implementation-specific methods */ -XAPlayItfImpl* XAPlayItfImpl_Create( XAMediaPlayerImpl *impl ); -void XAPlayItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); +XAPlayItfImpl* XAPlayItfImpl_Create(XAMediaPlayerImpl *impl); +void XAPlayItfImpl_AdaptCb(void *pHandlerCtx, XAAdaptEvent *event); void XAPlayItfImpl_Free(XAPlayItfImpl* self); - #endif /* XAPLAYITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediaplayer/xaseekitf.c --- a/khronosfws/openmax_al/src/mediaplayer/xaseekitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xaseekitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Seek Itf Implementation + * + */ #include #include @@ -31,17 +31,17 @@ * Description: Validate interface pointer and cast it to implementation pointer. */ static XASeekItfImpl* GetImpl(XASeekItf self) -{ - if(self) { - XASeekItfImpl* impl = (XASeekItfImpl*)(*self); - if(impl && impl == impl->self) + if (self) { + XASeekItfImpl* impl = (XASeekItfImpl*) (*self); + if (impl && impl == impl->self) + { return impl; + } } + return NULL; } - return NULL; -} /** * Base interface XASeekItf implementation @@ -53,28 +53,29 @@ * Description: Sets the position of the playback head. **/ XAresult XASeekItfImpl_SetPosition(XASeekItf self, XAmillisecond pos, - XAuint32 seekMode) -{ + XAuint32 seekMode) + { XAresult ret = XA_RESULT_SUCCESS; XAmillisecond duration = 0; XASeekItfImpl* impl = GetImpl(self); DEBUG_API("->XASeekItfImpl_SetPosition"); XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(!impl) - { + if (!impl) + { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XASeekItfImpl_SetPosition"); return XA_RESULT_PARAMETER_INVALID; - } + } - - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (impl->adapCtx->fwtype == FWMgrFWMMF) { /* Get duration of the content */ - if(XAPlayItfAdaptMMF_GetDuration((XAAdaptationBaseCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS) + if (XAPlayItfAdaptMMF_GetDuration( + (XAAdaptationBaseCtx*) impl->adapCtx, &duration) + != XA_RESULT_SUCCESS) { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -82,7 +83,7 @@ DEBUG_API("<-XASeekItfImpl_SetPosition"); return XA_RESULT_PARAMETER_INVALID; } - if(pos > duration) + if (pos > duration) { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -90,8 +91,8 @@ DEBUG_API("<-XASeekItfImpl_SetPosition"); return XA_RESULT_PARAMETER_INVALID; } - - if(seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) + + if (seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) { /* seek mode unsupported */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -99,9 +100,9 @@ DEBUG_API("<-XASeekItfImpl_SetPosition"); return XA_RESULT_FEATURE_UNSUPPORTED; } - + ret = XASeekItfAdaptMMF_SetPosition(impl->adapCtx, pos, seekMode); - if(ret == XA_RESULT_SUCCESS) + if (ret == XA_RESULT_SUCCESS) { impl->playbackPosition = pos; impl->seekMode = seekMode; @@ -110,7 +111,9 @@ else { /* Get duration of the content */ - if(XAPlayItfAdaptGST_GetDuration((XAAdaptationGstCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS) + if (XAPlayItfAdaptGST_GetDuration( + (XAAdaptationGstCtx*) impl->adapCtx, &duration) + != XA_RESULT_SUCCESS) { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -118,7 +121,7 @@ DEBUG_API("<-XASeekItfImpl_SetPosition"); return XA_RESULT_PARAMETER_INVALID; } - if(pos > duration) + if (pos > duration) { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -126,8 +129,8 @@ DEBUG_API("<-XASeekItfImpl_SetPosition"); return XA_RESULT_PARAMETER_INVALID; } - - if(seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) + + if (seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) { /* seek mode unsupported */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -135,20 +138,21 @@ DEBUG_API("<-XASeekItfImpl_SetPosition"); return XA_RESULT_FEATURE_UNSUPPORTED; } - - ret = XASeekItfAdapt_SetPosition((XAAdaptationGstCtx*)impl->adapCtx, pos, seekMode); - if(ret == XA_RESULT_SUCCESS) + + ret = XASeekItfAdapt_SetPosition((XAAdaptationGstCtx*) impl->adapCtx, + pos, seekMode); + if (ret == XA_RESULT_SUCCESS) { impl->playbackPosition = pos; impl->seekMode = seekMode; } - + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XASeekItfImpl_SetPosition"); return ret; -} + } /** * XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable, @@ -156,27 +160,29 @@ * Description: Enables or disables looping and sets the start and end points of looping. **/ XAresult XASeekItfImpl_SetLoop(XASeekItf self, XAboolean loopEnable, - XAmillisecond startPos, XAmillisecond endPos) -{ + XAmillisecond startPos, XAmillisecond endPos) + { XAresult ret = XA_RESULT_SUCCESS; XAmillisecond duration = 0; XASeekItfImpl* impl = GetImpl(self); DEBUG_API_A2("->XASeekItfImpl_SetLoop, startPos:%lu, endPos:%lu", startPos, endPos); XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); - if(!impl || (startPos > endPos)) - { + if (!impl || (startPos > endPos)) + { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XASeekItfImpl_SetLoop"); return XA_RESULT_PARAMETER_INVALID; - } + } - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (impl->adapCtx->fwtype == FWMgrFWMMF) { /* Get duration of the content */ - if(XAPlayItfAdaptMMF_GetDuration((XAAdaptationBaseCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS) + if (XAPlayItfAdaptMMF_GetDuration( + (XAAdaptationBaseCtx*) impl->adapCtx, &duration) + != XA_RESULT_SUCCESS) { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -184,7 +190,7 @@ DEBUG_API("<-XASeekItfImpl_SetLoop"); return XA_RESULT_PARAMETER_INVALID; } - if(endPos > duration && endPos != XA_TIME_UNKNOWN) + if (endPos > duration && endPos != XA_TIME_UNKNOWN) { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -192,19 +198,22 @@ DEBUG_API("<-XASeekItfImpl_SetLoop"); return XA_RESULT_PARAMETER_INVALID; } - - ret = XASeekItfAdaptMMF_SetLoop(impl->adapCtx, loopEnable, startPos, endPos); - if(ret == XA_RESULT_SUCCESS) + + ret = XASeekItfAdaptMMF_SetLoop(impl->adapCtx, loopEnable, startPos, + endPos); + if (ret == XA_RESULT_SUCCESS) { impl->loopEnable = loopEnable; impl->startPos = startPos; impl->endPos = endPos; - } + } } else { /* Get duration of the content */ - if(XAPlayItfAdaptGST_GetDuration((XAAdaptationGstCtx*)impl->adapCtx, &duration) != XA_RESULT_SUCCESS) + if (XAPlayItfAdaptGST_GetDuration( + (XAAdaptationGstCtx*) impl->adapCtx, &duration) + != XA_RESULT_SUCCESS) { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -212,7 +221,7 @@ DEBUG_API("<-XASeekItfImpl_SetLoop"); return XA_RESULT_PARAMETER_INVALID; } - if(endPos > duration && endPos != XA_TIME_UNKNOWN) + if (endPos > duration && endPos != XA_TIME_UNKNOWN) { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -220,21 +229,22 @@ DEBUG_API("<-XASeekItfImpl_SetLoop"); return XA_RESULT_PARAMETER_INVALID; } - - ret = XASeekItfAdapt_SetLoop((XAAdaptationGstCtx*)impl->adapCtx, loopEnable, startPos, endPos); - if(ret == XA_RESULT_SUCCESS) + + ret = XASeekItfAdapt_SetLoop((XAAdaptationGstCtx*) impl->adapCtx, + loopEnable, startPos, endPos); + if (ret == XA_RESULT_SUCCESS) { impl->loopEnable = loopEnable; impl->startPos = startPos; impl->endPos = endPos; } - + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XASeekItfImpl_SetLoop"); return ret; -} + } /** * XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled, @@ -243,21 +253,20 @@ * Description: Queries whether looping is enabled or disabled, and retrieves loop points. **/ XAresult XASeekItfImpl_GetLoop(XASeekItf self, XAboolean *pLoopEnabled, - XAmillisecond *pStartPos, - XAmillisecond *pEndPos) -{ + XAmillisecond *pStartPos, XAmillisecond *pEndPos) + { XAresult ret = XA_RESULT_SUCCESS; XASeekItfImpl* impl = GetImpl(self); DEBUG_API("->XASeekItfImpl_GetLoop"); - if(!impl || !pLoopEnabled || !pStartPos || !pEndPos) - { + if (!impl || !pLoopEnabled || !pStartPos || !pEndPos) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XASeekItfImpl_GetLoop"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pLoopEnabled = impl->loopEnable; *pStartPos = impl->startPos; @@ -265,7 +274,7 @@ DEBUG_API("<-XASeekItfImpl_GetLoop"); return ret; -} + } /** * XASeekItfImpl -specific methods @@ -275,13 +284,12 @@ * XASeekItfImpl* XASeekItfImpl_Create() * Description: Allocate and initialize SeekItfImpl. **/ -XASeekItfImpl* XASeekItfImpl_Create( XAMediaPlayerImpl* impl ) -{ - XASeekItfImpl *self = (XASeekItfImpl*) - calloc(1,sizeof(XASeekItfImpl)); +XASeekItfImpl* XASeekItfImpl_Create(XAMediaPlayerImpl* impl) + { + XASeekItfImpl *self = (XASeekItfImpl*) calloc(1, sizeof(XASeekItfImpl)); DEBUG_API("->XASeekItfImpl_Create"); - if(self) - { + if (self) + { /* init itf default implementation */ self->itf.GetLoop = XASeekItfImpl_GetLoop; self->itf.SetLoop = XASeekItfImpl_SetLoop; @@ -297,19 +305,21 @@ self->adapCtx = impl->curAdaptCtx; self->self = self; + }DEBUG_API("<-XASeekItfImpl_Create"); + return self; } - DEBUG_API("<-XASeekItfImpl_Create"); - return self; -} /** * void XASeekItfImpl_Free(XASeekItfImpl* self) * Description: Free all resources reserved at XASeekItfImpl_Create. **/ void XASeekItfImpl_Free(XASeekItfImpl* self) -{ + { DEBUG_API("->XASeekItfImpl_Free"); assert(self==self->self); - free(self); + if(self) + { + free(self); + } DEBUG_API("<-XASeekItfImpl_Free"); -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediaplayer/xaseekitf.h --- a/khronosfws/openmax_al/src/mediaplayer/xaseekitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xaseekitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Seek Interface Header * */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediarecorder/xaaudioencoderitf.c --- a/khronosfws/openmax_al/src/mediarecorder/xaaudioencoderitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xaaudioencoderitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #include #include "xamediarecorderadaptctxmmf.h" @@ -28,17 +28,17 @@ * Description: Validate interface pointer and cast it to implementation pointer. **/ static XAAudioEncoderItfImpl* GetImpl(XAAudioEncoderItf self) -{ - if( self ) { - XAAudioEncoderItfImpl* impl = (XAAudioEncoderItfImpl*)(*self); - if( impl && (impl == impl->self) ) + if (self) { + XAAudioEncoderItfImpl* impl = (XAAudioEncoderItfImpl*) (*self); + if (impl && (impl == impl->self)) + { return impl; + } } + return NULL; } - return NULL; -} /***************************************************************************** * Base interface XAAudioEncoderItf implementation @@ -50,8 +50,8 @@ * Description: Set audio encoder settings. **/ XAresult XAAudioEncoderItfImpl_SetEncoderSettings(XAAudioEncoderItf self, - XAAudioEncoderSettings *pSettings) -{ + XAAudioEncoderSettings *pSettings) + { XAMediaRecorderAdaptationMMFCtx* mCtx; XAresult ret = XA_RESULT_SUCCESS; XAuint32 recState = XA_RECORDSTATE_STOPPED; @@ -61,7 +61,7 @@ DEBUG_API("->XAAudioEncoderItfImpl_SetEncoderSettings"); XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); - if( !impl || !pSettings ) + if (!impl || !pSettings) { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); @@ -70,11 +70,12 @@ return XA_RESULT_PARAMETER_INVALID; } - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (impl->adapCtx->fwtype == FWMgrFWMMF) { - mCtx = (XAMediaRecorderAdaptationMMFCtx*) impl->pObjImpl->adaptationCtx; - - if(mCtx->xaRecordState != recState) + mCtx + = (XAMediaRecorderAdaptationMMFCtx*) impl->pObjImpl->adaptationCtx; + + if (mCtx->xaRecordState != recState) { XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); @@ -83,56 +84,60 @@ } XAAudioEncoderItfImpl_GetEncoderSettings(self, ¤tSettings); - if(pSettings->encoderId == currentSettings.encoderId) + if (pSettings->encoderId == currentSettings.encoderId) { - if(pSettings->channelsIn != currentSettings.channelsIn) + if (pSettings->channelsIn != currentSettings.channelsIn) { - ret = mmf_set_destination_channels(mCtx->mmfContext, &(pSettings->channelsIn)); + ret = mmf_set_destination_channels(mCtx->mmfContext, + &(pSettings->channelsIn)); } - - if(pSettings->channelsOut != currentSettings.channelsOut) + + if (pSettings->channelsOut != currentSettings.channelsOut) { - ret = mmf_set_destination_channels(mCtx->mmfContext, &(pSettings->channelsOut)); - } - - if(pSettings->sampleRate != currentSettings.sampleRate) - { - ret = mmf_set_destination_samplerate(mCtx->mmfContext, &(pSettings->sampleRate)); + ret = mmf_set_destination_channels(mCtx->mmfContext, + &(pSettings->channelsOut)); } - if(pSettings->bitRate != currentSettings.bitRate) + if (pSettings->sampleRate != currentSettings.sampleRate) { - ret = mmf_set_destination_bitrate(mCtx->mmfContext, &(pSettings->bitRate)); + ret = mmf_set_destination_samplerate(mCtx->mmfContext, + &(pSettings->sampleRate)); } - - if(pSettings->rateControl != currentSettings.rateControl) + + if (pSettings->bitRate != currentSettings.bitRate) + { + ret = mmf_set_destination_bitrate(mCtx->mmfContext, + &(pSettings->bitRate)); + } + + if (pSettings->rateControl != currentSettings.rateControl) { ret = XA_RESULT_PARAMETER_INVALID; } - if(pSettings->channelMode != currentSettings.channelMode) + if (pSettings->channelMode != currentSettings.channelMode) { ret = XA_RESULT_PARAMETER_INVALID; } - if(pSettings->encodeOptions != currentSettings.encodeOptions) + if (pSettings->encodeOptions != currentSettings.encodeOptions) + { + ret = XA_RESULT_PARAMETER_INVALID; + } + if (pSettings->blockAlignment != currentSettings.blockAlignment) { ret = XA_RESULT_PARAMETER_INVALID; } - if(pSettings->blockAlignment != currentSettings.blockAlignment) - { - ret = XA_RESULT_PARAMETER_INVALID; - } - if(pSettings->bitsPerSample != currentSettings.bitsPerSample) + if (pSettings->bitsPerSample != currentSettings.bitsPerSample) { ret = XA_RESULT_PARAMETER_INVALID; - } - if(pSettings->profileSetting != currentSettings.profileSetting) + } + if (pSettings->profileSetting != currentSettings.profileSetting) { ret = XA_RESULT_PARAMETER_INVALID; - } - if(pSettings->levelSetting != currentSettings.levelSetting) + } + if (pSettings->levelSetting != currentSettings.levelSetting) { ret = XA_RESULT_PARAMETER_INVALID; - } + } } else { @@ -142,16 +147,21 @@ else { XACapabilities temp; - - ret = XACapabilitiesMgr_GetCapsById(impl->pObjImpl->adaptationCtx->capslist, (XACapsType)(XACAP_ENCODER|XACAP_AUDIO), pSettings->encoderId, &temp); - if( ret == XA_RESULT_SUCCESS ) + + ret = XACapabilitiesMgr_GetCapsById( + impl->pObjImpl->adaptationCtx->capslist, + (XACapsType) (XACAP_ENCODER | XACAP_AUDIO), + pSettings->encoderId, &temp); + if (ret == XA_RESULT_SUCCESS) { - ret = XARecordItfAdapt_GetRecordState( (XAAdaptationGstCtx*)impl->adapCtx, &recState ); - if( ret == XA_RESULT_SUCCESS ) + ret = XARecordItfAdapt_GetRecordState( + (XAAdaptationGstCtx*) impl->adapCtx, &recState); + if (ret == XA_RESULT_SUCCESS) { - if( XA_RECORDSTATE_STOPPED == recState ) + if (XA_RECORDSTATE_STOPPED == recState) { - ret = XAAudioEncoderItfAdapt_SetEncoderSettings( impl->adapCtx, pSettings); + ret = XAAudioEncoderItfAdapt_SetEncoderSettings( + impl->adapCtx, pSettings); } else { @@ -167,12 +177,12 @@ DEBUG_API("<-XAAudioEncoderItfImpl_SetEncoderSettings"); return XA_RESULT_FEATURE_UNSUPPORTED; } - } - + } + XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_API("<-XAAudioEncoderItfImpl_SetEncoderSettings"); return ret; -} + } /** * XAresult XAAudioEncoderItfImpl_GetEncoderSettings(XAAudioEncoderItf self, @@ -180,8 +190,8 @@ * Description: Get audio encoder settings. **/ XAresult XAAudioEncoderItfImpl_GetEncoderSettings(XAAudioEncoderItf self, - XAAudioEncoderSettings *pSettings) -{ + XAAudioEncoderSettings *pSettings) + { XAresult ret = XA_RESULT_SUCCESS; XAuint32 encoderId; XAuint32 channelsIn; @@ -189,26 +199,24 @@ XAmilliHertz sampleRate; XAuint32 bitRate; XAMediaRecorderAdaptationMMFCtx* mCtx; - + XAAudioEncoderItfImpl *impl = GetImpl(self); - + DEBUG_API("->XAAudioEncoderItfImpl_GetEncoderSettings"); - if(!impl || !pSettings ) - { + if (!impl || !pSettings) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } mCtx = (XAMediaRecorderAdaptationMMFCtx*) (impl->pObjImpl->adaptationCtx); - - - if(impl->adapCtx->fwtype == FWMgrFWMMF) + if (impl->adapCtx->fwtype == FWMgrFWMMF) { mmf_get_codec_id(mCtx->mmfContext, &encoderId); - - switch(encoderId) + + switch (encoderId) { case 0x36315020: pSettings->encoderId = XA_AUDIOCODEC_PCM; @@ -232,9 +240,9 @@ pSettings->streamFormat = XA_AUDIOSTREAMFORMAT_RAW; break; } - + mmf_get_channels(mCtx->mmfContext, &channelsIn); - pSettings->channelsIn = channelsIn; + pSettings->channelsIn = channelsIn; mmf_get_channels(mCtx->mmfContext, &channelsOut); pSettings->channelsOut = channelsOut; mmf_get_samplerate(mCtx->mmfContext, &sampleRate); @@ -248,11 +256,11 @@ } else { - ret = XAAudioEncoderItfAdapt_GetEncoderSettings(impl->adapCtx, pSettings); - } - DEBUG_API("<-XAAudioEncoderItfImpl_GetEncoderSettings"); + ret = XAAudioEncoderItfAdapt_GetEncoderSettings(impl->adapCtx, + pSettings); + }DEBUG_API("<-XAAudioEncoderItfImpl_GetEncoderSettings"); return ret; -} + } /***************************************************************************** * XAAudioEncoderItfImpl -specific methods @@ -261,39 +269,43 @@ /* XAAudioEncoderItfImpl* XAAudioEncoderItfImpl_Create() * Description: Allocate and initialize XAAudioEncoderItfImpl */ -XAAudioEncoderItfImpl* XAAudioEncoderItfImpl_Create( XAMediaRecorderImpl* impl ) -{ - XAAudioEncoderItfImpl* self = (XAAudioEncoderItfImpl*) - calloc(1,sizeof(XAAudioEncoderItfImpl)); +XAAudioEncoderItfImpl* XAAudioEncoderItfImpl_Create(XAMediaRecorderImpl* impl) + { + XAAudioEncoderItfImpl* self = (XAAudioEncoderItfImpl*) calloc(1, + sizeof(XAAudioEncoderItfImpl)); //XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)(impl->adaptationCtx); - + DEBUG_API("->XAAudioEncoderItfImpl_Create"); - if( self ) - { + if (self) + { //if(mCtx->fwtype == FWMgrFWMMF) { /* init itf default implementation */ - self->itf.GetEncoderSettings = XAAudioEncoderItfImpl_GetEncoderSettings; - self->itf.SetEncoderSettings = XAAudioEncoderItfImpl_SetEncoderSettings; + self->itf.GetEncoderSettings + = XAAudioEncoderItfImpl_GetEncoderSettings; + self->itf.SetEncoderSettings + = XAAudioEncoderItfImpl_SetEncoderSettings; } - + self->pObjImpl = impl; /* init variables */ self->adapCtx = impl->adaptationCtx; self->self = self; + }DEBUG_API("<-XAAudioEncoderItfImpl_Create"); + return self; } - DEBUG_API("<-XAAudioEncoderItfImpl_Create"); - return self; -} /* void XAAudioEncoderItfImpl_Free(XAAudioEncoderItfImpl* self) * Description: Free all resources reserved at XAAudioEncoderItfImpl_Create */ void XAAudioEncoderItfImpl_Free(XAAudioEncoderItfImpl* self) -{ + { DEBUG_API("->XAAudioEncoderItfImpl_Free"); assert( self==self->self ); - free( self ); + if(self) + { + free(self); + } DEBUG_API("<-XAAudioEncoderItfImpl_Free"); -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediarecorder/xaaudioencoderitf.h --- a/khronosfws/openmax_al/src/mediarecorder/xaaudioencoderitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xaaudioencoderitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: AudioEncoder Itf Header + * + */ #ifndef XAAUDIOENCODERITF_H #define XAAUDIOENCODERITF_H @@ -29,32 +29,33 @@ /** STRUCTURES **/ /* Definition of XAAudioEncoderItf implementation */ typedef struct XAAudioEncoderItfImpl_ -{ + { /* parent interface */ struct XAAudioEncoderItf_ itf; /* pointer to self */ struct XAAudioEncoderItfImpl_* self; - + XAMediaRecorderImpl* pObjImpl; - + /* variables */ - XAAdaptationBaseCtx *adapCtx; + XAAdaptationBaseCtx *adapCtx; -} XAAudioEncoderItfImpl; + } XAAudioEncoderItfImpl; /** METHODS **/ /* Base interface XAAudioEncoderItf implementation * See API Specification for method documentation */ -XAresult XAAudioEncoderItfImpl_SetEncoderSettings( XAAudioEncoderItf self, - XAAudioEncoderSettings *pSettings ); +XAresult XAAudioEncoderItfImpl_SetEncoderSettings(XAAudioEncoderItf self, + XAAudioEncoderSettings *pSettings); -XAresult XAAudioEncoderItfImpl_GetEncoderSettings( XAAudioEncoderItf self, - XAAudioEncoderSettings *pSettings ); +XAresult XAAudioEncoderItfImpl_GetEncoderSettings(XAAudioEncoderItf self, + XAAudioEncoderSettings *pSettings); /* XAAudioEncoderItfImpl -specific methods */ -XAAudioEncoderItfImpl* XAAudioEncoderItfImpl_Create( XAMediaRecorderImpl* impl ); -void XAAudioEncoderItfImpl_Free( XAAudioEncoderItfImpl* self ); +XAAudioEncoderItfImpl + * XAAudioEncoderItfImpl_Create(XAMediaRecorderImpl* impl); +void XAAudioEncoderItfImpl_Free(XAAudioEncoderItfImpl* self); #endif /* XAAUDIOENCODERITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediarecorder/xamediarecorder.c --- a/khronosfws/openmax_al/src/mediarecorder/xamediarecorder.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xamediarecorder.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MediaRecoder Object Impl + * + */ #include #include @@ -40,25 +40,25 @@ #include "xamediarecorderadaptctxmmf.h" #include "xamediarecorderadaptctx.h" /* Static mapping of enumeration XAMediaRecorderInterfaces to interface iids */ -static const XAInterfaceID* xaMediaRecorderItfIIDs[MR_ITFCOUNT]= -{ - &XA_IID_OBJECT, - &XA_IID_AUDIOENCODER, - &XA_IID_CONFIGEXTENSION, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, - &XA_IID_EQUALIZER, - &XA_IID_IMAGECONTROLS, - &XA_IID_IMAGEEFFECTS, - &XA_IID_IMAGEENCODER, - &XA_IID_METADATAINSERTION, - &XA_IID_RECORD, - &XA_IID_SNAPSHOT, - &XA_IID_VIDEOENCODER, - &XA_IID_VIDEOPOSTPROCESSING, - &XA_IID_VOLUME, - &XA_IID_METADATAEXTRACTION, - &XA_IID_METADATATRAVERSAL -}; +static const XAInterfaceID* xaMediaRecorderItfIIDs[MR_ITFCOUNT] = + { + &XA_IID_OBJECT, + &XA_IID_AUDIOENCODER, + &XA_IID_CONFIGEXTENSION, + &XA_IID_DYNAMICINTERFACEMANAGEMENT, + &XA_IID_EQUALIZER, + &XA_IID_IMAGECONTROLS, + &XA_IID_IMAGEEFFECTS, + &XA_IID_IMAGEENCODER, + &XA_IID_METADATAINSERTION, + &XA_IID_RECORD, + &XA_IID_SNAPSHOT, + &XA_IID_VIDEOENCODER, + &XA_IID_VIDEOPOSTPROCESSING, + &XA_IID_VOLUME, + &XA_IID_METADATAEXTRACTION, + &XA_IID_METADATATRAVERSAL + }; /* Global methods */ @@ -66,230 +66,222 @@ * Create object */ XAresult XAMediaRecorderImpl_CreateMediaRecorder(FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf* pRecorder, - XADataSource* pAudioSrc, - XADataSource* pImageVideoSrc, - XADataSink* pDataSnk, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ + XACapabilities* capabilities, XAObjectItf* pRecorder, + XADataSource* pAudioSrc, XADataSource* pImageVideoSrc, + XADataSink* pDataSnk, XAuint32 numInterfaces, + const XAInterfaceID *pInterfaceIds, + const XAboolean *pInterfaceRequired) + { XAMediaRecorderImpl* pImpl = NULL; XAObjectItfImpl* pBaseObj = NULL; FWMgrFwType fwType; XAuint8 itfIdx; XAMediaType mediaType = XA_MEDIATYPE_UNKNOWN; - XAresult ret=XA_RESULT_SUCCESS; + XAresult ret = XA_RESULT_SUCCESS; const char *uri = NULL; - + DEBUG_API("->XAMediaRecorderImpl_CreateMediaRecorder"); XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); - if( !pRecorder ) - { + if (!pRecorder) + { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); return XA_RESULT_PARAMETER_INVALID; - } + } /* check sink&source parameters */ - ret = XACommon_ValidateDataLocator(3, pAudioSrc, pImageVideoSrc, pDataSnk); - if(ret!=XA_RESULT_SUCCESS) - { + ret + = XACommon_ValidateDataLocator(3, pAudioSrc, pImageVideoSrc, + pDataSnk); + if (ret != XA_RESULT_SUCCESS) + { XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); return ret; - } + } /* instantiate object implementation */ - pImpl = (XAMediaRecorderImpl*)calloc(1,sizeof(XAMediaRecorderImpl)); - if( !pImpl ) - { + pImpl = (XAMediaRecorderImpl*) calloc(1, sizeof(XAMediaRecorderImpl)); + if (!pImpl) + { /* memory allocation failed */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); return XA_RESULT_MEMORY_FAILURE; - } + } pBaseObj = &pImpl->baseObj; /* Initialize base object default implementation */ - XAObjectItfImpl_Init(pBaseObj, - MR_ITFCOUNT, - xaMediaRecorderItfIIDs, - XAMediaRecorderImpl_DoRealize, - XAMediaRecorderImpl_DoResume, - XAMediaRecorderImpl_FreeResources); + XAObjectItfImpl_Init(pBaseObj, MR_ITFCOUNT, xaMediaRecorderItfIIDs, + XAMediaRecorderImpl_DoRealize, XAMediaRecorderImpl_DoResume, + XAMediaRecorderImpl_FreeResources); /* Mark interfaces that need to be exposed */ /* Implicit and mandated interfaces */ pBaseObj->interfaceMap[MR_RECORDITF].required = XA_BOOLEAN_TRUE; - if(pAudioSrc && mediaType!=XA_MEDIATYPE_IMAGE) - { + if (pAudioSrc && mediaType != XA_MEDIATYPE_IMAGE) + { pBaseObj->interfaceMap[MR_AUDIOENCODERITF].required = XA_BOOLEAN_TRUE; - } - if(pImageVideoSrc && mediaType!=XA_MEDIATYPE_AUDIO) - { + } + if (pImageVideoSrc && mediaType != XA_MEDIATYPE_AUDIO) + { pBaseObj->interfaceMap[MR_VIDEOENCODER].required = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MR_IMAGEENCODERITF].required = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MR_SNAPSHOTITF].required = XA_BOOLEAN_TRUE; - } + } pBaseObj->interfaceMap[MR_DIMITF].required = XA_BOOLEAN_TRUE; /* Explicit interfaces */ - if((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) - { - /* check only sink media type, do not care about return value (availability) */ - XACommon_CheckDataSource((XADataSource*)pDataSnk,&mediaType); - /* Check required interfaces */ - for( itfIdx = 0; itfIdx < numInterfaces; itfIdx++) + if ((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) { + /* check only sink media type, do not care about return value (availability) */ + XACommon_CheckDataSource((XADataSource*) pDataSnk, &mediaType); + /* Check required interfaces */ + for (itfIdx = 0; itfIdx < numInterfaces; itfIdx++) + { /* If mapEntry is null then required interface is not supported.*/ - XAObjItfMapEntry *entry = - XAObjectItfImpl_GetItfEntry((XAObjectItf)&(pBaseObj), pInterfaceIds[itfIdx]); - if( !entry ) - { - if( pInterfaceRequired[itfIdx] ) + XAObjItfMapEntry *entry = XAObjectItfImpl_GetItfEntry( + (XAObjectItf) &(pBaseObj), pInterfaceIds[itfIdx]); + if (!entry) { + if (pInterfaceRequired[itfIdx]) + { /* required interface cannot be accommodated - fail creation */ DEBUG_ERR("Required interface not found - abort creation!"); ret = XA_RESULT_FEATURE_UNSUPPORTED; break; - } + } else - { + { DEBUG_INFO("Requested (not required) interface not found - continue creation"); + } } - } else - { /* weed out unsupported content-aware itf's */ - if( ( (mediaType==XA_MEDIATYPE_IMAGE || !pAudioSrc) && - (entry->mapIdx==MR_EQUALIZERITF || - entry->mapIdx==MR_VOLUMEITF || - entry->mapIdx==MR_AUDIOENCODERITF)) - || - ( (mediaType==XA_MEDIATYPE_AUDIO || !pImageVideoSrc) && - (entry->mapIdx==MR_IMAGECONTROLSITF || - entry->mapIdx==MR_IMAGEEFFECTSITF || - entry->mapIdx==MR_VIDEOPOSTPROCESSINGITF || - entry->mapIdx==MR_VIDEOENCODER || - entry->mapIdx==MR_IMAGEENCODERITF || - entry->mapIdx==MR_SNAPSHOTITF)) ) - { + { /* weed out unsupported content-aware itf's */ + if (((mediaType == XA_MEDIATYPE_IMAGE || !pAudioSrc) + && (entry->mapIdx == MR_EQUALIZERITF || entry->mapIdx + == MR_VOLUMEITF || entry->mapIdx + == MR_AUDIOENCODERITF)) || ((mediaType + == XA_MEDIATYPE_AUDIO || !pImageVideoSrc) + && (entry->mapIdx == MR_IMAGECONTROLSITF + || entry->mapIdx == MR_IMAGEEFFECTSITF + || entry->mapIdx == MR_VIDEOPOSTPROCESSINGITF + || entry->mapIdx == MR_VIDEOENCODER + || entry->mapIdx == MR_IMAGEENCODERITF + || entry->mapIdx == MR_SNAPSHOTITF))) + { entry->required = XA_BOOLEAN_FALSE; - if( pInterfaceRequired[itfIdx] ) - { + if (pInterfaceRequired[itfIdx]) + { DEBUG_ERR("Required interface not supported for given media - abort creation!"); ret = XA_RESULT_FEATURE_UNSUPPORTED; break; + } } - } else - { + { entry->required = XA_BOOLEAN_TRUE; - } + } - if(entry->mapIdx==MR_SNAPSHOTITF) - { + if (entry->mapIdx == MR_SNAPSHOTITF) + { DEBUG_ERR("SnapshotItf requested - support still mode"); pImpl->recModes |= XA_RECMODE_STILL; - } - if(entry->mapIdx==MR_RECORDITF) - { + } + if (entry->mapIdx == MR_RECORDITF) + { DEBUG_ERR("RecordItf requested - support stream mode"); pImpl->recModes |= XA_RECMODE_STREAM; + } } } } - } - if( pImpl->recModes ==0 ) - { + if (pImpl->recModes == 0) + { DEBUG_ERR("Warning!!! No recording interfaces requested - unable to record!!"); - } + } /*check sink and src parameters*/ - if(ret==XA_RESULT_SUCCESS) - { - ret = XACommon_ValidateDataLocator(3, pDataSnk, pAudioSrc, pImageVideoSrc); + if (ret == XA_RESULT_SUCCESS) + { + ret = XACommon_ValidateDataLocator(3, pDataSnk, pAudioSrc, + pImageVideoSrc); /*datasink ignored if only snapshotitf is used*/ - if(!pDataSnk && (pImpl->recModes & XA_RECMODE_STREAM)) - { + if (!pDataSnk && (pImpl->recModes & XA_RECMODE_STREAM)) + { DEBUG_ERR("No datasink to record to!"); ret = XA_RESULT_PARAMETER_INVALID; - } - if(!pAudioSrc && !pImageVideoSrc) - { + } + if (!pAudioSrc && !pImageVideoSrc) + { DEBUG_ERR("No data sources set!"); ret = XA_RESULT_PARAMETER_INVALID; + } } - } - if(ret!=XA_RESULT_SUCCESS) - { /* creation fails */ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); + if (ret != XA_RESULT_SUCCESS) + { /* creation fails */ + XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); return ret; - } + } /* Mark interfaces that can be handled dynamically */ /* Mandated dynamic itfs */ - pBaseObj->interfaceMap[MR_METADATAINSERTIONITF].isDynamic = XA_BOOLEAN_TRUE; + pBaseObj->interfaceMap[MR_METADATAINSERTIONITF].isDynamic + = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MR_EQUALIZERITF].isDynamic = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MR_IMAGEEFFECTSITF].isDynamic = XA_BOOLEAN_TRUE; - /* Initialize XAMediaRecorderImpl variables */ pImpl->audioSrc = pAudioSrc; pImpl->dataSnk = pDataSnk; pImpl->imageVideoSrc = pImageVideoSrc; /* Determine framework type that can handle recording */ - fwType = (FWMgrFwType)FWMgrMOUnknown; + fwType = (FWMgrFwType) FWMgrMOUnknown; /**/ if (pDataSnk->pLocator) - { - XADataLocator_URI* dataLoc = (XADataLocator_URI*)pDataSnk->pLocator; + { + XADataLocator_URI* dataLoc = (XADataLocator_URI*) pDataSnk->pLocator; if (dataLoc->locatorType == XA_DATALOCATOR_URI) { - uri = (char*)dataLoc->URI; + uri = (char*) dataLoc->URI; } - } - fwType = XAFrameworkMgr_GetFramework( - mapper, - uri, - FWMgrMORecorder); + } + fwType = XAFrameworkMgr_GetFramework(mapper, uri, FWMgrMORecorder); if (fwType == FWMgrMOUnknown) { ret = XA_RESULT_CONTENT_UNSUPPORTED; - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); + XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); return ret; } - + /* Set ObjectItf to point to newly created object */ - *pRecorder = (XAObjectItf)&(pBaseObj->self); - - if(fwType == FWMgrFWMMF) - { - - pImpl->adaptationCtx = XAMediaRecorderAdaptMMF_Create(pImpl->audioSrc, - pImpl->imageVideoSrc, pImpl->dataSnk, pImpl->recModes); - } + *pRecorder = (XAObjectItf) &(pBaseObj->self); + + if (fwType == FWMgrFWMMF) + { + + pImpl->adaptationCtx = XAMediaRecorderAdaptMMF_Create( + pImpl->audioSrc, pImpl->imageVideoSrc, pImpl->dataSnk, + pImpl->recModes); + } else - { + { pImpl->adaptationCtx = XAMediaRecorderAdapt_Create(pImpl->audioSrc, - pImpl->imageVideoSrc, - pImpl->dataSnk, - pImpl->recModes); - } + pImpl->imageVideoSrc, pImpl->dataSnk, pImpl->recModes); + } - if(pImpl->adaptationCtx) + if (pImpl->adaptationCtx) { pImpl->adaptationCtx->capslist = capabilities; pImpl->adaptationCtx->fwtype = fwType; @@ -297,56 +289,57 @@ else { ret = XA_RESULT_MEMORY_FAILURE; - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); + XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); return ret; } - + XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_API("<-XAMediaRecorderImpl_CreateMediaRecorder"); return XA_RESULT_SUCCESS; -} + } /* XAResult XAMediaRecorderImpl_QueryNumSupportedInterfaces * Statically query supported interfaces */ -XAresult XAMediaRecorderImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces) -{ +XAresult XAMediaRecorderImpl_QueryNumSupportedInterfaces( + XAuint32 *pNumSupportedInterfaces) + { DEBUG_API("->XAMediaRecorderImpl_QueryNumSupportedInterfaces"); - if( pNumSupportedInterfaces ) - { + if (pNumSupportedInterfaces) + { *pNumSupportedInterfaces = MR_ITFCOUNT; DEBUG_API("<-XAMediaRecorderImpl_QueryNumSupportedInterfaces"); return XA_RESULT_SUCCESS; - } + } else - { + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); return XA_RESULT_PARAMETER_INVALID; + } } -} /* XAResult XAMediaRecorderImpl_QuerySupportedInterfaces * Statically query supported interfaces */ XAresult XAMediaRecorderImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId) -{ + XAInterfaceID *pInterfaceId) + { DEBUG_API("->XAMediaRecorderImpl_QuerySupportedInterfaces"); - if( index >= MR_ITFCOUNT || !pInterfaceId ) - { + if (index >= MR_ITFCOUNT || !pInterfaceId) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); return XA_RESULT_PARAMETER_INVALID; - } + } else - { + { *pInterfaceId = *(xaMediaRecorderItfIIDs[index]); DEBUG_API("<-XAMediaRecorderImpl_QuerySupportedInterfaces"); return XA_RESULT_SUCCESS; + } } -} /***************************************************************************** * base object XAObjectItfImpl methods @@ -357,165 +350,169 @@ * Create and initialize implementation-specific variables. * Called from base object XAObjectItfImpl */ -XAresult XAMediaRecorderImpl_DoRealize( XAObjectItf self ) -{ +XAresult XAMediaRecorderImpl_DoRealize(XAObjectItf self) + { XAuint8 itfIdx; - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAMediaRecorderImpl* pObjImpl = (XAMediaRecorderImpl*)(pObj); + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAMediaRecorderImpl* pObjImpl = (XAMediaRecorderImpl*) (pObj); XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAMediaRecorderImpl_DoRealize"); XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); /* check casting from correct pointer type */ - if( !pObjImpl || pObj != pObjImpl->baseObj.self ) - { + if (!pObjImpl || pObj != pObjImpl->baseObj.self) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); return XA_RESULT_PARAMETER_INVALID; - } + } /* init adaptation */ - if(pObjImpl->adaptationCtx->fwtype == FWMgrFWMMF) - { - ret = XAMediaRecorderAdaptMMF_PostInit( (XAAdaptationMMFCtx*)pObjImpl->adaptationCtx ); - } + if (pObjImpl->adaptationCtx->fwtype == FWMgrFWMMF) + { + ret = XAMediaRecorderAdaptMMF_PostInit( + (XAAdaptationMMFCtx*) pObjImpl->adaptationCtx); + } else - { - ret = XAMediaRecorderAdapt_PostInit( (XAAdaptationGstCtx*)pObjImpl->adaptationCtx ); - } + { + ret = XAMediaRecorderAdapt_PostInit( + (XAAdaptationGstCtx*) pObjImpl->adaptationCtx); + } - if( ret != XA_RESULT_SUCCESS ) - { + if (ret != XA_RESULT_SUCCESS) + { XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); return ret; - } + } /* Realize all implicit and explicitly wanted interfaces */ - for( itfIdx = 0; itfIdx < MR_ITFCOUNT; itfIdx++ ) - { - if( !(pObj->interfaceMap[itfIdx].pItf) && - pObj->interfaceMap[itfIdx].required ) + for (itfIdx = 0; itfIdx < MR_ITFCOUNT; itfIdx++) { + if (!(pObj->interfaceMap[itfIdx].pItf) + && pObj->interfaceMap[itfIdx].required) + { void *pItf = NULL; - switch( itfIdx ) - { + switch (itfIdx) + { case MR_DIMITF: pItf = XADIMItfImpl_Create(); - if(pItf) - { + if (pItf) + { XADIMItfImpl_Init(pItf, self, XAMediaRecorderImpl_DoAddItf, XAMediaRecorderImpl_DoResumeItf, XAMediaRecorderImpl_DoRemoveItf); - } + } break; case MR_RECORDITF: - pItf = XARecordItfImpl_Create( pObjImpl ); + pItf = XARecordItfImpl_Create(pObjImpl); break; case MR_AUDIOENCODERITF: pItf = XAAudioEncoderItfImpl_Create(pObjImpl); break; #ifdef OMAX_CAMERABIN - case MR_SNAPSHOTITF: + case MR_SNAPSHOTITF: pItf = XASnapshotItfImpl_Create(pObjImpl); break; - case MR_VIDEOENCODER: + case MR_VIDEOENCODER: pItf = XAVideoEncoderItfImpl_Create(pObjImpl); - break; - case MR_IMAGEENCODERITF: + break; + case MR_IMAGEENCODERITF: pItf = XAImageEncoderItfImpl_Create(pObjImpl); - break; + break; #endif case MR_METADATAINSERTIONITF: pItf = XAMetadataInsertionItfImpl_Create(pObjImpl); - break; + break; - case MR_CONFIGEXTENSIONITF: + case MR_CONFIGEXTENSIONITF: pItf = XAConfigExtensionsItfImpl_Create(); - XAConfigExtensionsItfImpl_SetContext( pItf, pObjImpl->adaptationCtx); + XAConfigExtensionsItfImpl_SetContext(pItf, + pObjImpl->adaptationCtx); break; case MR_EQUALIZERITF: - pItf = XAEqualizerItfImpl_Create( pObjImpl->adaptationCtx ); + pItf = XAEqualizerItfImpl_Create(pObjImpl->adaptationCtx); break; #ifdef OMAX_CAMERABIN - case MR_IMAGECONTROLSITF: + case MR_IMAGECONTROLSITF: pItf = XAImageControlsItfImpl_Create( pObjImpl->adaptationCtx ); break; - case MR_IMAGEEFFECTSITF: + case MR_IMAGEEFFECTSITF: pItf = XAImageEffectsItfImpl_Create( pObjImpl->adaptationCtx ); break; - case MR_VIDEOPOSTPROCESSINGITF: + case MR_VIDEOPOSTPROCESSINGITF: pItf = XAVideoPostProcessingItfImpl_Create( pObjImpl->adaptationCtx ); break; #endif case MR_VOLUMEITF: - pItf = XAVolumeItfImpl_Create( pObjImpl->adaptationCtx ); + pItf = XAVolumeItfImpl_Create(pObjImpl->adaptationCtx); break; case MR_METADATAEXTRACTIONITF: - pItf = XAMetadataExtractionItfImpl_Create( pObjImpl->adaptationCtx ); + pItf = XAMetadataExtractionItfImpl_Create( + pObjImpl->adaptationCtx); break; case MR_METADATATRAVERSALITF: - pItf = XAMetadataTraversalItfImpl_Create( pObjImpl->adaptationCtx ); + pItf = XAMetadataTraversalItfImpl_Create( + pObjImpl->adaptationCtx); break; - + default: break; - } - if( !pItf ) - { + } + if (!pItf) + { DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); /* memory allocation failed */ XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); return XA_RESULT_MEMORY_FAILURE; - } + } else - { + { pObj->interfaceMap[itfIdx].pItf = pItf; + } } } - } pObj->state = XA_OBJECT_STATE_REALIZED; DEBUG_API("<-XAMediaRecorderImpl_DoRealize"); XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); return XA_RESULT_SUCCESS; -} + } /* XAresult XAMediaRecorderImpl_DoResume * Description: Resume object from suspended state */ XAresult XAMediaRecorderImpl_DoResume(XAObjectItf self) -{ + { DEBUG_API("->XAMediaRecorderImpl_DoResume"); DEBUG_API("<-XAMediaRecorderImpl_DoResume"); /* This implementation does not support suspended state */ return XA_RESULT_PRECONDITIONS_VIOLATED; -} + } /* void XAMediaRecorderImpl_FreeResources * Description: Free all resources reserved at XAMediaRecorderImpl_DoRealize() */ void XAMediaRecorderImpl_FreeResources(XAObjectItf self) -{ - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAMediaRecorderImpl* pObjImpl = (XAMediaRecorderImpl*)(pObj); + { + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAMediaRecorderImpl* pObjImpl = (XAMediaRecorderImpl*) (pObj); XAuint8 itfIdx; - XAMediaRecorderImpl* pImpl = (XAMediaRecorderImpl*)(*self); + XAMediaRecorderImpl* pImpl = (XAMediaRecorderImpl*) (*self); DEBUG_API("->XAMediaRecorderImpl_FreeResources"); XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS( XATSMediaRecorder ); assert( pObj && pImpl && pObj == pObj->self ); /* free all allocated interfaces */ - for(itfIdx = 0; itfIdx < MR_ITFCOUNT; itfIdx++) - { + for (itfIdx = 0; itfIdx < MR_ITFCOUNT; itfIdx++) + { void *pItf = pObj->interfaceMap[itfIdx].pItf; - if(pItf) - { - switch(itfIdx) + if (pItf) { + switch (itfIdx) + { case MR_AUDIOENCODERITF: XAAudioEncoderItfImpl_Free(pItf); break; @@ -529,13 +526,13 @@ XAEqualizerItfImpl_Free(pItf); break; #ifdef OMAX_CAMERABIN - case MR_IMAGECONTROLSITF: + case MR_IMAGECONTROLSITF: XAImageControlsItfImpl_Free(pItf); break; - case MR_IMAGEEFFECTSITF: + case MR_IMAGEEFFECTSITF: XAImageEffectsItfImpl_Free(pItf); break; - case MR_IMAGEENCODERITF: + case MR_IMAGEENCODERITF: XAImageEncoderItfImpl_Free(pItf); break; #endif @@ -546,13 +543,13 @@ XARecordItfImpl_Free(pItf); break; #ifdef OMAX_CAMERABIN - case MR_SNAPSHOTITF: + case MR_SNAPSHOTITF: XASnapshotItfImpl_Free(pItf); break; - case MR_VIDEOENCODER: + case MR_VIDEOENCODER: XAVideoEncoderItfImpl_Free(pItf); break; - case MR_VIDEOPOSTPROCESSINGITF: + case MR_VIDEOPOSTPROCESSINGITF: XAVideoPostProcessingItfImpl_Free(pItf); break; #endif @@ -567,30 +564,32 @@ break; default: break; - } + } pObj->interfaceMap[itfIdx].pItf = NULL; + } } - } - if ( pImpl->adaptationCtx != NULL ) - { - if(pImpl->adaptationCtx->fwtype == FWMgrFWMMF) + if (pImpl->adaptationCtx != NULL) + { + if (pImpl->adaptationCtx->fwtype == FWMgrFWMMF) { - XAMediaRecorderAdaptMMF_Destroy( (XAAdaptationMMFCtx*)pObjImpl->adaptationCtx ); + XAMediaRecorderAdaptMMF_Destroy( + (XAAdaptationMMFCtx*) pObjImpl->adaptationCtx); } else { - XAMediaRecorderAdapt_Destroy( (XAAdaptationGstCtx*)pImpl->adaptationCtx ); + XAMediaRecorderAdapt_Destroy( + (XAAdaptationGstCtx*) pImpl->adaptationCtx); } pImpl->adaptationCtx = NULL; - } + } /* free all other allocated resources*/ DEBUG_API("<-XAMediaRecorderImpl_FreeResources"); XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaRecorder ); return; -} + } /***************************************************************************** * MediaRecorderImpl -specific methods @@ -599,109 +598,114 @@ /* XAMediaRecorderImpl_DoAddItf * Dynamically add an interface, object specific parts */ -XAresult XAMediaRecorderImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ +XAresult XAMediaRecorderImpl_DoAddItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry) + { - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAMediaRecorderImpl* pImpl = (XAMediaRecorderImpl*)(pObj); + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAMediaRecorderImpl* pImpl = (XAMediaRecorderImpl*) (pObj); XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMediaRecorderImpl_DoAddItf"); XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); - if(mapEntry) - { - switch( mapEntry->mapIdx ) + if (mapEntry) { + switch (mapEntry->mapIdx) + { - case MR_METADATAINSERTIONITF: - mapEntry->pItf = XAMetadataInsertionItfImpl_Create(pImpl); - break; - case MR_EQUALIZERITF: - mapEntry->pItf = XAEqualizerItfImpl_Create( pImpl->adaptationCtx ); - break; + case MR_METADATAINSERTIONITF: + mapEntry->pItf = XAMetadataInsertionItfImpl_Create(pImpl); + break; + case MR_EQUALIZERITF: + mapEntry->pItf = XAEqualizerItfImpl_Create( + pImpl->adaptationCtx); + break; #ifdef OMAX_CAMERABIN - case MR_IMAGEEFFECTSITF: - mapEntry->pItf = XAImageEffectsItfImpl_Create( pImpl->adaptationCtx ); - break; + case MR_IMAGEEFFECTSITF: + mapEntry->pItf = XAImageEffectsItfImpl_Create( pImpl->adaptationCtx ); + break; #endif - default: - DEBUG_ERR("XAMediaRecorderImpl_DoAddItf unknown id"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - - if( !mapEntry->pItf && ret == XA_RESULT_SUCCESS) - { + default: + DEBUG_ERR("XAMediaRecorderImpl_DoAddItf unknown id") + ; + ret = XA_RESULT_FEATURE_UNSUPPORTED; + break; + } + + if (!mapEntry->pItf && ret == XA_RESULT_SUCCESS) + { DEBUG_ERR("XAMediaRecorderImpl_DoAddItf itf creation failed"); ret = XA_RESULT_MEMORY_FAILURE; + } } - } else - { + { ret = XA_RESULT_PARAMETER_INVALID; - } + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_API("<-XAMediaRecorderImpl_DoAddItf"); return ret; -} + } /* XAMediaRecorderImpl_DoResumeItf * Try to resume lost interface, object specific parts */ -XAresult XAMediaRecorderImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ +XAresult XAMediaRecorderImpl_DoResumeItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry) + { XAresult ret; /* For now, no difference between suspended and unrealised itfs */ DEBUG_API("->XAMediaRecorderImpl_DoResumeItf"); XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); - ret = XAMediaRecorderImpl_DoAddItf(self,mapEntry); + ret = XAMediaRecorderImpl_DoAddItf(self, mapEntry); XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_API("<-XAMediaRecorderImpl_DoResumeItf"); return ret; -} + } /* XAMediaRecorderImpl_DoRemoveItf * Dynamically remove an interface, object specific parts */ -XAresult XAMediaRecorderImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ +XAresult XAMediaRecorderImpl_DoRemoveItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry) + { XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMediaRecorderImpl_DoRemoveItf"); XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); - if(mapEntry) - { - switch( mapEntry->mapIdx ) + if (mapEntry) { - case MR_METADATAINSERTIONITF: - XAMetadataInsertionItfImpl_Free( mapEntry->pItf ); - break; - case MR_EQUALIZERITF: - XAEqualizerItfImpl_Free( mapEntry->pItf ); - break; + switch (mapEntry->mapIdx) + { + case MR_METADATAINSERTIONITF: + XAMetadataInsertionItfImpl_Free(mapEntry->pItf); + break; + case MR_EQUALIZERITF: + XAEqualizerItfImpl_Free(mapEntry->pItf); + break; #ifdef OMAX_CAMERABIN - case MR_IMAGEEFFECTSITF: - XAImageEffectsItfImpl_Free( mapEntry->pItf ); - break; + case MR_IMAGEEFFECTSITF: + XAImageEffectsItfImpl_Free( mapEntry->pItf ); + break; #endif - default: - DEBUG_ERR("XAMediaRecorderImpl_DoRemoveItf unknown id"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } + default: + DEBUG_ERR("XAMediaRecorderImpl_DoRemoveItf unknown id") + ; + ret = XA_RESULT_FEATURE_UNSUPPORTED; + break; + } mapEntry->pItf = NULL; - } + } else - { + { ret = XA_RESULT_PARAMETER_INVALID; - } + } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); DEBUG_API("<-XAMediaRecorderImpl_DoRemoveItf"); return ret; -} - + } /* END OF FILE */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediarecorder/xamediarecorder.h --- a/khronosfws/openmax_al/src/mediarecorder/xamediarecorder.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xamediarecorder.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MediaRecorder Object Header + * + */ #ifndef XAMEDIARECORDER_H #define XAMEDIARECORDER_H @@ -26,14 +26,12 @@ /** MACROS **/ - /** TYPES **/ - /** ENUMERATIONS **/ /* Enumeration for interfaces that MediaRecorder supports. */ typedef enum -{ + { MR_OBJECTITF, MR_AUDIOENCODERITF, MR_CONFIGEXTENSIONITF, @@ -51,12 +49,12 @@ MR_METADATAEXTRACTIONITF, MR_METADATATRAVERSALITF, MR_ITFCOUNT -} MRInterfaces; + } MRInterfaces; /** STRUCTURES **/ /* Specification for MediaRecorderImpl. */ typedef struct XAMediaRecorderImpl_ -{ + { /* Parent for XAMediaRecorder */ XAObjectItfImpl baseObj; @@ -67,20 +65,21 @@ XAuint8 recModes; XAAdaptationBaseCtx* adaptationCtx; -} XAMediaRecorderImpl; - + } XAMediaRecorderImpl; /** METHODS **/ /* base object XAObjectItfImpl methods */ -XAresult XAMediaRecorderImpl_DoRealize(XAObjectItf self); -XAresult XAMediaRecorderImpl_DoResume(XAObjectItf self); -void XAMediaRecorderImpl_FreeResources(XAObjectItf self); - +XAresult XAMediaRecorderImpl_DoRealize(XAObjectItf self); +XAresult XAMediaRecorderImpl_DoResume(XAObjectItf self); +void XAMediaRecorderImpl_FreeResources(XAObjectItf self); /* MediaRecorderImpl -specific methods*/ -XAresult XAMediaRecorderImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XAMediaRecorderImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XAMediaRecorderImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); +XAresult XAMediaRecorderImpl_DoAddItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry); +XAresult XAMediaRecorderImpl_DoResumeItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry); +XAresult XAMediaRecorderImpl_DoRemoveItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry); #endif /* XAMEDIARECORDER_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediarecorder/xametadatainsertionitf.c --- a/khronosfws/openmax_al/src/mediarecorder/xametadatainsertionitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xametadatainsertionitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata Insertion Itf Impl + * + */ #include #include @@ -27,17 +27,18 @@ * Description: Validate interface pointer and cast it to implementation pointer. */ static XAMetadataInsertionItfImpl* GetImpl(XAMetadataInsertionItf self) -{ - if( self ) { - XAMetadataInsertionItfImpl* impl = (XAMetadataInsertionItfImpl*)(*self); - if( impl && (impl == impl->self) ) + if (self) { + XAMetadataInsertionItfImpl* impl = + (XAMetadataInsertionItfImpl*) (*self); + if (impl && (impl == impl->self)) + { return impl; + } } + return NULL; } - return NULL; -} /***************************************************************************** * Base interface XAMetadataInsertionItf implementation @@ -46,424 +47,421 @@ /* XAMetadataInsertionItfImpl_CreateChildNode * Description: Creates a new child node for the given parent. */ -XAresult XAMetadataInsertionItfImpl_CreateChildNode(XAMetadataInsertionItf self, - XAint32 parentNodeID, - XAuint32 type, - XAchar *mimeType, - XAint32 *pChildNodeID) -{ +XAresult XAMetadataInsertionItfImpl_CreateChildNode( + XAMetadataInsertionItf self, XAint32 parentNodeID, XAuint32 type, + XAchar *mimeType, XAint32 *pChildNodeID) + { XAMetadataInsertionItfImpl *impl = NULL; XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataInsertionItfImpl_CreateChildNode"); impl = GetImpl(self); - if(!impl || !mimeType || !pChildNodeID ) - { + if (!impl || !mimeType || !pChildNodeID) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ ret = XA_RESULT_PARAMETER_INVALID; - } - else - { - - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) - { - if(impl->adaptCtx) - { - ret = XAMetadataInsertionItfAdapt_CreateChildNode( - (XAAdaptationGstCtx*)impl->adaptCtx,parentNodeID,type,mimeType,pChildNodeID); - } - else - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } else { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAMetadataInsertionItfImpl_CreateChildNode"); - return XA_RESULT_FEATURE_UNSUPPORTED; - } + + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) + { + if (impl->adaptCtx) + { + ret = XAMetadataInsertionItfAdapt_CreateChildNode( + (XAAdaptationGstCtx*) impl->adaptCtx, parentNodeID, + type, mimeType, pChildNodeID); + } + else + { + ret = XA_RESULT_INTERNAL_ERROR; + } + + } + else + { + DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); + DEBUG_API("<-XAMetadataInsertionItfImpl_CreateChildNode"); + return XA_RESULT_FEATURE_UNSUPPORTED; + } + }DEBUG_API("<-XAMetadataInsertionItfImpl_CreateChildNode"); + return ret; } - DEBUG_API("<-XAMetadataInsertionItfImpl_CreateChildNode"); - return ret; -} /* XAresult XAMetadataInsertionItfImpl_GetSupportedKeysCount * Description: A query method to tell if the metadata keys (for writing metadata) * can be freely chosen by the application or if they are fixed (for the given node). */ -XAresult XAMetadataInsertionItfImpl_GetSupportedKeysCount(XAMetadataInsertionItf self, - XAint32 nodeID, - XAboolean *pFreeKeys, - XAuint32 *pKeyCount, - XAuint32 *pEncodingCount) -{ +XAresult XAMetadataInsertionItfImpl_GetSupportedKeysCount( + XAMetadataInsertionItf self, XAint32 nodeID, XAboolean *pFreeKeys, + XAuint32 *pKeyCount, XAuint32 *pEncodingCount) + { XAMetadataInsertionItfImpl *impl = NULL; XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataInsertionItfImpl_GetSupportedKeysCount"); impl = GetImpl(self); - if(!impl || !pFreeKeys || !pKeyCount || !pEncodingCount ) - { + if (!impl || !pFreeKeys || !pKeyCount || !pEncodingCount) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ ret = XA_RESULT_PARAMETER_INVALID; - } + } else - { - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { - if( impl->adaptCtx ) + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { - ret = XAMetadataInsertionItfAdapt_GetSupportedKeysCount( - (XAAdaptationGstCtx*)impl->adaptCtx,nodeID,pFreeKeys,pKeyCount,pEncodingCount); + if (impl->adaptCtx) + { + ret = XAMetadataInsertionItfAdapt_GetSupportedKeysCount( + (XAAdaptationGstCtx*) impl->adaptCtx, nodeID, + pFreeKeys, pKeyCount, pEncodingCount); + } + else + { + ret = XA_RESULT_INTERNAL_ERROR; + } } else { - ret = XA_RESULT_INTERNAL_ERROR; + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataInsertionItfImpl_GetSupportedKeysCount"); + return XA_RESULT_PARAMETER_INVALID; } - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataInsertionItfImpl_GetSupportedKeysCount"); - return XA_RESULT_PARAMETER_INVALID; - } + }DEBUG_API("<-XAMetadataInsertionItfImpl_GetSupportedKeysCount"); + return ret; } - DEBUG_API("<-XAMetadataInsertionItfImpl_GetSupportedKeysCount"); - return ret; -} /* XAresult XAMetadataInsertionItfImpl_GetKeySize * Description: Returns the byte size required for a supported metadata * key pointed by the given index */ XAresult XAMetadataInsertionItfImpl_GetKeySize(XAMetadataInsertionItf self, - XAint32 nodeID, - XAuint32 keyIndex, - XAuint32 *pKeySize) -{ + XAint32 nodeID, XAuint32 keyIndex, XAuint32 *pKeySize) + { XAMetadataInsertionItfImpl *impl = NULL; XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataInsertionItfImpl_GetKeySize"); impl = GetImpl(self); - if(!impl || !pKeySize ) - { + if (!impl || !pKeySize) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ ret = XA_RESULT_PARAMETER_INVALID; - } + } else - { - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { - - if( impl->adaptCtx ) + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { - ret = XAMetadataInsertionItfAdapt_GetKeySize( - (XAAdaptationGstCtx*)impl->adaptCtx, nodeID, keyIndex, pKeySize); + + if (impl->adaptCtx) + { + ret = XAMetadataInsertionItfAdapt_GetKeySize( + (XAAdaptationGstCtx*) impl->adaptCtx, nodeID, + keyIndex, pKeySize); + } + else + { + ret = XA_RESULT_INTERNAL_ERROR; + } } else { - ret = XA_RESULT_INTERNAL_ERROR; + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataInsertionItfImpl_GetKeySize"); + return XA_RESULT_PARAMETER_INVALID; } - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataInsertionItfImpl_GetKeySize"); - return XA_RESULT_PARAMETER_INVALID; - } + }DEBUG_API("<-XAMetadataInsertionItfImpl_GetKeySize"); + return ret; } - DEBUG_API("<-XAMetadataInsertionItfImpl_GetKeySize"); - return ret; -} /* XAresult XAMetadataInsertionItfImpl_GetKey * Description; Returns a XAMetadataInfo structure and associated data * referenced by the structure for a supported key */ XAresult XAMetadataInsertionItfImpl_GetKey(XAMetadataInsertionItf self, - XAint32 nodeID, - XAuint32 keyIndex, - XAuint32 keySize, - XAMetadataInfo *pKey) -{ + XAint32 nodeID, XAuint32 keyIndex, XAuint32 keySize, + XAMetadataInfo *pKey) + { XAMetadataInsertionItfImpl *impl = NULL; XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataInsertionItfImpl_GetKey"); impl = GetImpl(self); - if(!impl || !pKey ) - { + if (!impl || !pKey) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ ret = XA_RESULT_PARAMETER_INVALID; - } + } else - { - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { - - if( impl->adaptCtx ) + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { - ret = XAMetadataInsertionItfAdapt_GetKey( - (XAAdaptationGstCtx*)impl->adaptCtx,nodeID,keyIndex,keySize,pKey); + + if (impl->adaptCtx) + { + ret = XAMetadataInsertionItfAdapt_GetKey( + (XAAdaptationGstCtx*) impl->adaptCtx, nodeID, + keyIndex, keySize, pKey); + } + else + { + ret = XA_RESULT_INTERNAL_ERROR; + } } else { - ret = XA_RESULT_INTERNAL_ERROR; + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataInsertionItfImpl_GetKey"); + return XA_RESULT_PARAMETER_INVALID; } - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataInsertionItfImpl_GetKey"); - return XA_RESULT_PARAMETER_INVALID; - } + }DEBUG_API("<-XAMetadataInsertionItfImpl_GetKey"); + return ret; } - DEBUG_API("<-XAMetadataInsertionItfImpl_GetKey"); - return ret; -} /* XAresult XAMetadataInsertionItfImpl_GetFreeKeysEncoding * Description: A method to be used in case implementation supports * free keys for metadata insertion. */ -XAresult XAMetadataInsertionItfImpl_GetFreeKeysEncoding(XAMetadataInsertionItf self, - XAint32 nodeID, - XAuint32 encodingIndex, - XAuint32 *pEncoding) -{ +XAresult XAMetadataInsertionItfImpl_GetFreeKeysEncoding( + XAMetadataInsertionItf self, XAint32 nodeID, XAuint32 encodingIndex, + XAuint32 *pEncoding) + { XAMetadataInsertionItfImpl *impl = NULL; XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); impl = GetImpl(self); - if( !impl || !pEncoding ) - { + if (!impl || !pEncoding) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ - ret =XA_RESULT_PARAMETER_INVALID; - } + ret = XA_RESULT_PARAMETER_INVALID; + } else - { - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { - - if( impl->adaptCtx ) + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { - ret = XAMetadataInsertionItfAdapt_GetFreeKeysEncoding( - (XAAdaptationGstCtx*)impl->adaptCtx,nodeID,encodingIndex,pEncoding); + + if (impl->adaptCtx) + { + ret = XAMetadataInsertionItfAdapt_GetFreeKeysEncoding( + (XAAdaptationGstCtx*) impl->adaptCtx, nodeID, + encodingIndex, pEncoding); + } + else + { + ret = XA_RESULT_INTERNAL_ERROR; + } } else { - ret = XA_RESULT_INTERNAL_ERROR; + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); + return XA_RESULT_PARAMETER_INVALID; } - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); - return XA_RESULT_PARAMETER_INVALID; - } + }DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); + return ret; } - DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); - return ret; -} /* XAresult XAMetadataInsertionItfImpl_InsertMetadataItem * Description: Inserts the key/value pair to the specified node of the metadata tree. */ -XAresult XAMetadataInsertionItfImpl_InsertMetadataItem(XAMetadataInsertionItf self, - XAint32 nodeID, - XAMetadataInfo *pKey, - XAMetadataInfo *pValue, - XAboolean overwrite) -{ +XAresult XAMetadataInsertionItfImpl_InsertMetadataItem( + XAMetadataInsertionItf self, XAint32 nodeID, XAMetadataInfo *pKey, + XAMetadataInfo *pValue, XAboolean overwrite) + { XAMetadataInsertionItfImpl *impl = NULL; XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataInsertionItfImpl_InsertMetadataItem"); impl = GetImpl(self); - if( !impl || !pKey || !pValue ) - { + if (!impl || !pKey || !pValue) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ ret = XA_RESULT_PARAMETER_INVALID; - } + } else - { - if(impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { + if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) + { - if( impl->adaptCtx ) - { - ret = XAMetadataInsertionItfAdapt_InsertMetadataItem( - (XAAdaptationGstCtx*)impl->adaptCtx,nodeID,pKey,pValue,overwrite); - impl->currentTags.mdeKeys[impl->currentTags.itemcount] = pKey; - impl->currentTags.mdeValues[impl->currentTags.itemcount] = pValue; - impl->currentTags.itemcount++; + if (impl->adaptCtx) + { + ret = XAMetadataInsertionItfAdapt_InsertMetadataItem( + (XAAdaptationGstCtx*) impl->adaptCtx, nodeID, pKey, + pValue, overwrite); + impl->currentTags.mdeKeys[impl->currentTags.itemcount] = pKey; + impl->currentTags.mdeValues[impl->currentTags.itemcount] + = pValue; + impl->currentTags.itemcount++; + } + else + { + ret = XA_RESULT_INTERNAL_ERROR; + } } else { - ret = XA_RESULT_INTERNAL_ERROR; + DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); + DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); + return XA_RESULT_FEATURE_UNSUPPORTED; } - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); - return XA_RESULT_FEATURE_UNSUPPORTED; - } + }DEBUG_API("<-XAMetadataInsertionItfImpl_InsertMetadataItem"); + return ret; } - DEBUG_API("<-XAMetadataInsertionItfImpl_InsertMetadataItem"); - return ret; -} /* XAresult XAMetadataInsertionItfImpl_RegisterCallback * Description: Registers a callback on the object that executes after each of * the actual writings of metadata key/value pairs takes place. */ -XAresult XAMetadataInsertionItfImpl_RegisterCallback(XAMetadataInsertionItf self, - xaMetadataInsertionCallback callback, - void *pContext) -{ +XAresult XAMetadataInsertionItfImpl_RegisterCallback( + XAMetadataInsertionItf self, xaMetadataInsertionCallback callback, + void *pContext) + { XAMetadataInsertionItfImpl *impl = NULL; DEBUG_API("->XAMetadataInsertionItfImpl_RegisterCallback"); impl = GetImpl(self); - if( !impl ) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAMetadataInsertionItfImpl_RegisterCallback"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - if(callback) - { - XAAdaptationBase_AddEventHandler( impl->adaptCtx, &XAMetadataInsertionItfImpl_AdaptCb, - XA_METADATAEVENTS, impl ); + if (callback) + { + XAAdaptationBase_AddEventHandler(impl->adaptCtx, + &XAMetadataInsertionItfImpl_AdaptCb, XA_METADATAEVENTS, impl); impl->callback = callback; - impl->cbcontext = pContext; + impl->cbcontext = pContext; impl->cbPtrToSelf = self; - } + } else - { - XAAdaptationBase_RemoveEventHandler(impl->adaptCtx, &XAMetadataInsertionItfImpl_AdaptCb ); - } + { + XAAdaptationBase_RemoveEventHandler(impl->adaptCtx, + &XAMetadataInsertionItfImpl_AdaptCb); + } DEBUG_API("<-XAMetadataInsertionItfImpl_RegisterCallback"); return XA_RESULT_SUCCESS; -} + } /***************************************************************************** * XAMetadataTraversalImpl -specific methods *****************************************************************************/ - /* XAMetadataInsertionItfImpl* XAMetadataInsertionItfImpl_Create() * Description: Allocate and initialize MetadataInsertionItfImpl */ -XAMetadataInsertionItfImpl* XAMetadataInsertionItfImpl_Create(XAMediaRecorderImpl* impl) -{ - XAMetadataInsertionItfImpl* self = (XAMetadataInsertionItfImpl*) - calloc(1,sizeof(XAMetadataInsertionItfImpl)); +XAMetadataInsertionItfImpl* XAMetadataInsertionItfImpl_Create( + XAMediaRecorderImpl* impl) + { + XAMetadataInsertionItfImpl* self = (XAMetadataInsertionItfImpl*) calloc( + 1, sizeof(XAMetadataInsertionItfImpl)); //XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)(impl->adaptationCtx); - + DEBUG_API("->XAMetadataInsertionItfImpl_Create"); - if( self ) - { + if (self) + { //if(mCtx->fwtype == FWMgrFWGST) { /* init itf default implementation */ - self->itf.CreateChildNode = XAMetadataInsertionItfImpl_CreateChildNode; - self->itf.GetFreeKeysEncoding = XAMetadataInsertionItfImpl_GetFreeKeysEncoding; + self->itf.CreateChildNode + = XAMetadataInsertionItfImpl_CreateChildNode; + self->itf.GetFreeKeysEncoding + = XAMetadataInsertionItfImpl_GetFreeKeysEncoding; self->itf.GetKey = XAMetadataInsertionItfImpl_GetKey; self->itf.GetKeySize = XAMetadataInsertionItfImpl_GetKeySize; - self->itf.GetSupportedKeysCount = XAMetadataInsertionItfImpl_GetSupportedKeysCount; - self->itf.InsertMetadataItem = XAMetadataInsertionItfImpl_InsertMetadataItem; - self->itf.RegisterCallback = XAMetadataInsertionItfImpl_RegisterCallback; + self->itf.GetSupportedKeysCount + = XAMetadataInsertionItfImpl_GetSupportedKeysCount; + self->itf.InsertMetadataItem + = XAMetadataInsertionItfImpl_InsertMetadataItem; + self->itf.RegisterCallback + = XAMetadataInsertionItfImpl_RegisterCallback; } /* init variables*/ - + self->callback = NULL; self->cbcontext = NULL; self->cbPtrToSelf = NULL; self->adaptCtx = impl->adaptationCtx; - self->currentTags.mdeKeys = calloc(MAX_TAGS,sizeof(XAMetadataInfo*)); - self->currentTags.mdeValues = calloc(MAX_TAGS,sizeof(XAMetadataInfo*)); + self->currentTags.mdeKeys = calloc(MAX_TAGS, sizeof(XAMetadataInfo*)); + self->currentTags.mdeValues = calloc(MAX_TAGS, + sizeof(XAMetadataInfo*)); self->self = self; + }DEBUG_API("<-XAMetadataInsertionItfImpl_Create"); + return self; } - DEBUG_API("<-XAMetadataInsertionItfImpl_Create"); - return self; -} /* void XAMetadataInsertionItfImpl_Free(XAMetadataInsertionItfImpl* self) * Description: Free all resources reserved at XAMetadataInsertionItfImpl_Create() */ void XAMetadataInsertionItfImpl_Free(XAMetadataInsertionItfImpl* self) -{ + { DEBUG_API("->XAMetadataInsertionItfImpl_Free"); assert( self==self->self ); - if(self->callback) - { - XAAdaptationBase_RemoveEventHandler(self->adaptCtx, &XAMetadataInsertionItfImpl_AdaptCb ); + if (self->callback) + { + XAAdaptationBase_RemoveEventHandler(self->adaptCtx, + &XAMetadataInsertionItfImpl_AdaptCb); + } + XAMetadataAdapt_FreeImplTagList(&(self->currentTags), XA_BOOLEAN_FALSE); + free(self); + DEBUG_API("<-XAMetadataInsertionItfImpl_Free"); } - XAMetadataAdapt_FreeImplTagList(&(self->currentTags), XA_BOOLEAN_FALSE); - free( self ); - DEBUG_API("<-XAMetadataInsertionItfImpl_Free"); -} /* With this method, adaptation infroms that tags are written to stream */ -void XAMetadataInsertionItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ +void XAMetadataInsertionItfImpl_AdaptCb(void *pHandlerCtx, + XAAdaptEvent *event) + { XAMetadataInsertionItfImpl* impl = NULL; XAuint32 idx = 0, nodeID = XA_ROOT_NODE_ID; XAboolean result = XA_BOOLEAN_TRUE; DEBUG_API("->XAMetadataInsertionItfImpl_AdaptCb"); - impl = (XAMetadataInsertionItfImpl*)pHandlerCtx; - if(!impl) - { + impl = (XAMetadataInsertionItfImpl*) pHandlerCtx; + if (!impl) + { DEBUG_ERR("XAMetadataInsertionItfImpl_AdaptCb, invalid context pointer!"); DEBUG_API("<-XAMetadataInsertionItfImpl_AdaptCb"); return; - } - if( event && event->eventid == XA_ADAPT_MDE_TAGS_WRITTEN ) - { + } + if (event && event->eventid == XA_ADAPT_MDE_TAGS_WRITTEN) + { /*here datasize field is used for return value*/ - if(event->datasize != XA_RESULT_SUCCESS) - { + if (event->datasize != XA_RESULT_SUCCESS) + { DEBUG_ERR_A1("Adaptation failed to write metadata (code %x)!",(int)event->datasize); - result=XA_BOOLEAN_FALSE; - } + result = XA_BOOLEAN_FALSE; + } /*all tags written, send cb for client to free the memory*/ - for(idx=0;idxcurrentTags.itemcount;idx++) - { - if(impl->callback) + for (idx = 0; idx < impl->currentTags.itemcount; idx++) { + if (impl->callback) + { impl->callback(impl->cbPtrToSelf, impl->cbcontext, - impl->currentTags.mdeKeys[idx], - impl->currentTags.mdeValues[idx], - nodeID, result); + impl->currentTags.mdeKeys[idx], + impl->currentTags.mdeValues[idx], nodeID, result); + } + impl->currentTags.mdeKeys[idx] = NULL; + impl->currentTags.mdeValues[idx] = NULL; } - impl->currentTags.mdeKeys[idx]=NULL; - impl->currentTags.mdeValues[idx]=NULL; + impl->currentTags.itemcount = 0; } - impl->currentTags.itemcount=0; - } else - { + { DEBUG_INFO("unhandled"); - } + } DEBUG_API("<-XAMetadataInsertionItfImpl_AdaptCb"); -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediarecorder/xametadatainsertionitf.h --- a/khronosfws/openmax_al/src/mediarecorder/xametadatainsertionitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xametadatainsertionitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,24 +1,23 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata Insertion Itf Impl + * + */ #ifndef XAMETADATAINSERTIONITF_H #define XAMETADATAINSERTIONITF_H - #include "xametadataadaptation.h" #include "xamediarecorder.h" /** MACROS **/ @@ -30,7 +29,7 @@ /** STRUCTURES **/ /* Definition of XAMetadataInsertionItf implementation */ typedef struct XAMetadataInsertionItfImpl_ -{ + { /* parent interface */ struct XAMetadataInsertionItf_ itf; /* pointer to self */ @@ -38,59 +37,50 @@ /* variables */ XAAdaptationBaseCtx *adaptCtx; - XAMetadataImplTagList currentTags; + XAMetadataImplTagList currentTags; /*Callback*/ xaMetadataInsertionCallback callback; - void *cbcontext; + void *cbcontext; XAMetadataInsertionItf cbPtrToSelf; -} XAMetadataInsertionItfImpl; + } XAMetadataInsertionItfImpl; /** METHODS **/ /* Base interface XAMetadataInsertionItf implementation */ -XAresult XAMetadataInsertionItfImpl_CreateChildNode(XAMetadataInsertionItf self, - XAint32 parentNodeID, - XAuint32 type, - XAchar *mimeType, - XAint32 *pChildNodeID); +XAresult XAMetadataInsertionItfImpl_CreateChildNode( + XAMetadataInsertionItf self, XAint32 parentNodeID, XAuint32 type, + XAchar *mimeType, XAint32 *pChildNodeID); -XAresult XAMetadataInsertionItfImpl_GetSupportedKeysCount(XAMetadataInsertionItf self, - XAint32 nodeID, - XAboolean *pFreeKeys, - XAuint32 *pKeyCount, - XAuint32 *pEncodingCount); +XAresult XAMetadataInsertionItfImpl_GetSupportedKeysCount( + XAMetadataInsertionItf self, XAint32 nodeID, XAboolean *pFreeKeys, + XAuint32 *pKeyCount, XAuint32 *pEncodingCount); XAresult XAMetadataInsertionItfImpl_GetKeySize(XAMetadataInsertionItf self, - XAint32 nodeID, - XAuint32 keyIndex, - XAuint32 *pKeySize); + XAint32 nodeID, XAuint32 keyIndex, XAuint32 *pKeySize); XAresult XAMetadataInsertionItfImpl_GetKey(XAMetadataInsertionItf self, - XAint32 nodeID, - XAuint32 keyIndex, - XAuint32 keySize, - XAMetadataInfo *pKey); + XAint32 nodeID, XAuint32 keyIndex, XAuint32 keySize, + XAMetadataInfo *pKey); -XAresult XAMetadataInsertionItfImpl_GetFreeKeysEncoding(XAMetadataInsertionItf self, - XAint32 nodeID, - XAuint32 encodingIndex, - XAuint32 *pEncoding); +XAresult XAMetadataInsertionItfImpl_GetFreeKeysEncoding( + XAMetadataInsertionItf self, XAint32 nodeID, XAuint32 encodingIndex, + XAuint32 *pEncoding); -XAresult XAMetadataInsertionItfImpl_InsertMetadataItem(XAMetadataInsertionItf self, - XAint32 nodeID, - XAMetadataInfo *pKey, - XAMetadataInfo *pValue, - XAboolean overwrite); +XAresult XAMetadataInsertionItfImpl_InsertMetadataItem( + XAMetadataInsertionItf self, XAint32 nodeID, XAMetadataInfo *pKey, + XAMetadataInfo *pValue, XAboolean overwrite); -XAresult XAMetadataInsertionItfImpl_RegisterCallback(XAMetadataInsertionItf self, - xaMetadataInsertionCallback callback, - void *pContext); +XAresult XAMetadataInsertionItfImpl_RegisterCallback( + XAMetadataInsertionItf self, xaMetadataInsertionCallback callback, + void *pContext); /* XAMetadataInsertionItfImpl -specific methods */ -XAMetadataInsertionItfImpl* XAMetadataInsertionItfImpl_Create(XAMediaRecorderImpl* impl); -void XAMetadataInsertionItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); +XAMetadataInsertionItfImpl* XAMetadataInsertionItfImpl_Create( + XAMediaRecorderImpl* impl); +void XAMetadataInsertionItfImpl_AdaptCb(void *pHandlerCtx, + XAAdaptEvent *event); void XAMetadataInsertionItfImpl_Free(XAMetadataInsertionItfImpl* self); #endif /* XAMETADATAINSERTIONITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediarecorder/xarecorditf.c --- a/khronosfws/openmax_al/src/mediarecorder/xarecorditf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xarecorditf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Record Itf Impl + * + */ #include #include @@ -30,17 +30,17 @@ * Description: Validate interface pointer and cast it to implementation pointer. **/ static XARecordItfImpl* GetImpl(XARecordItf self) -{ - if( self ) { - XARecordItfImpl* impl = (XARecordItfImpl*)(*self); - if( impl && (impl == impl->self) ) + if (self) { + XARecordItfImpl* impl = (XARecordItfImpl*) (*self); + if (impl && (impl == impl->self)) + { return impl; + } } + return NULL; } - return NULL; -} /***************************************************************************** * Base interface XARecordItf implementation @@ -51,68 +51,69 @@ * XAuint32 state) * Description: Transitions recorder into the given record state. **/ -XAresult XARecordItfImpl_SetRecordState(XARecordItf self, - XAuint32 state) -{ +XAresult XARecordItfImpl_SetRecordState(XARecordItf self, XAuint32 state) + { XAresult ret = XA_RESULT_SUCCESS; XARecordItfImpl *impl = GetImpl(self); DEBUG_API("->XARecordItfImpl_SetRecordState"); - if( !impl || state < XA_RECORDSTATE_STOPPED || state > XA_RECORDSTATE_RECORDING ) - { + if (!impl || state < XA_RECORDSTATE_STOPPED || state + > XA_RECORDSTATE_RECORDING) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_SetRecordState"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } /* check is play state changed, if not do nothing */ - if(state != impl->recordState) - { - if(impl->adapCtx->fwtype == FWMgrFWMMF) - { - ret = XARecordItfAdaptMMF_SetRecordState((XAAdaptationMMFCtx*)impl->adapCtx, state); - } - else + if (state != impl->recordState) { - ret = XARecordItfAdapt_SetRecordState((XAAdaptationGstCtx*)impl->adapCtx, state); - } + if (impl->adapCtx->fwtype == FWMgrFWMMF) + { + ret = XARecordItfAdaptMMF_SetRecordState( + (XAAdaptationMMFCtx*) impl->adapCtx, state); + } + else + { + ret = XARecordItfAdapt_SetRecordState( + (XAAdaptationGstCtx*) impl->adapCtx, state); + } - if(ret == XA_RESULT_SUCCESS) - { + if (ret == XA_RESULT_SUCCESS) + { impl->recordState = state; + } } - } DEBUG_API("<-XARecordItfImpl_SetRecordState"); return ret; -} + } /** * XAresult XARecordItfImpl_GetRecordState(XARecordItf self, * XAuint32 *pState) * Description: Gets the recorder’s current record state. **/ -XAresult XARecordItfImpl_GetRecordState(XARecordItf self, - XAuint32 *pState) -{ +XAresult XARecordItfImpl_GetRecordState(XARecordItf self, XAuint32 *pState) + { XARecordItfImpl *impl = GetImpl(self); DEBUG_API("->XARecordItfImpl_GetRecordState"); - if( !impl || !pState ) - { + if (!impl || !pState) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_GetRecordState"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pState = impl->recordState; DEBUG_API("<-XARecordItfImpl_GetRecordState"); return XA_RESULT_SUCCESS; -} + } /** * XAresult XARecordItfImpl_SetDurationLimit(XARecordItf self, @@ -120,37 +121,38 @@ * Description: Sets the duration of current content in milliseconds. **/ XAresult XARecordItfImpl_SetDurationLimit(XARecordItf self, - XAmillisecond msec) -{ + XAmillisecond msec) + { XAresult ret = XA_RESULT_SUCCESS; XARecordItfImpl *impl = GetImpl(self); DEBUG_API("->XARecordItfImpl_SetDurationLimit"); XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - if( !impl || msec <= 0 ) - { + if (!impl || msec <= 0) + { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_SetDurationLimit"); return XA_RESULT_PARAMETER_INVALID; - } + } impl->durationLimitSetted = 1; impl->durationLimit = msec; - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XARecordItfAdapt_EnablePositionTracking( (XAAdaptationGstCtx*)impl->adapCtx, 1 ); - } + if (impl->adapCtx->fwtype == FWMgrFWGST) + { + ret = XARecordItfAdapt_EnablePositionTracking( + (XAAdaptationGstCtx*) impl->adapCtx, 1); + } else - { - ret = XARecordItfAdaptMMF_EnablePositionTracking( (XAAdaptationMMFCtx*)impl->adapCtx, 1 ); - } - + { + ret = XARecordItfAdaptMMF_EnablePositionTracking( + (XAAdaptationMMFCtx*) impl->adapCtx, 1); + } XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); DEBUG_API("<-XARecordItfImpl_SetDurationLimit"); return ret; -} + } /** * XAresult XARecordItfImpl_GetPosition(XARecordItf self, @@ -158,36 +160,36 @@ * Description: Returns the current position of the recording head relative * to the beginning of content. **/ -XAresult XARecordItfImpl_GetPosition(XARecordItf self, - XAmillisecond *pMsec) -{ +XAresult XARecordItfImpl_GetPosition(XARecordItf self, XAmillisecond *pMsec) + { XAresult ret = XA_RESULT_SUCCESS; XARecordItfImpl *impl = GetImpl(self); DEBUG_API("->XARecordItfImpl_GetPosition"); XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - if( !impl || !pMsec ) - { + if (!impl || !pMsec) + { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_GetPosition"); return XA_RESULT_PARAMETER_INVALID; - } + } - - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XARecordItfAdapt_GetPosition((XAAdaptationGstCtx*)impl->adapCtx, pMsec); - } + if (impl->adapCtx->fwtype == FWMgrFWGST) + { + ret = XARecordItfAdapt_GetPosition( + (XAAdaptationGstCtx*) impl->adapCtx, pMsec); + } else - { - ret = XARecordItfAdaptMMF_GetPosition((XAAdaptationMMFCtx*)impl->adapCtx, pMsec); - } + { + ret = XARecordItfAdaptMMF_GetPosition( + (XAAdaptationMMFCtx*) impl->adapCtx, pMsec); + } XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); DEBUG_API("<-XARecordItfImpl_GetPosition"); return ret; -} + } /** * XAresult XARecordItfImpl_RegisterCallback(XARecordItf self, @@ -196,35 +198,34 @@ * Description: Registers the record callback function. **/ XAresult XARecordItfImpl_RegisterCallback(XARecordItf self, - xaRecordCallback callback, - void *pContext) -{ + xaRecordCallback callback, void *pContext) + { XAresult ret = XA_RESULT_SUCCESS; XARecordItfImpl *impl = GetImpl(self); DEBUG_API("->XARecordItfImpl_RegisterCallback"); - if( !impl ) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_RegisterCallback"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - if( callback ) - { + if (callback) + { impl->callback = callback; - impl->cbcontext = pContext; + impl->cbcontext = pContext; impl->cbPtrToSelf = self; - } + } else - { + { /* There is no callback */ - } + } DEBUG_API("<-XARecordItfImpl_RegisterCallback"); return ret; -} + } /** * XAresult XARecordItfImpl_SetCallbackEventsMask(XARecordItf self, @@ -232,74 +233,83 @@ * Description: Sets the notification state of record events. **/ XAresult XARecordItfImpl_SetCallbackEventsMask(XARecordItf self, - XAuint32 eventFlags) -{ + XAuint32 eventFlags) + { XAresult ret = XA_RESULT_SUCCESS; XARecordItfImpl* impl = GetImpl(self); DEBUG_API_A1("->XARecordItfImpl_SetCallbackEventsMask- %lu", eventFlags); XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - if(!impl || (eventFlags > (XA_RECORDEVENT_HEADATLIMIT | XA_RECORDEVENT_HEADATMARKER | - XA_RECORDEVENT_HEADATNEWPOS | XA_RECORDEVENT_HEADMOVING | - XA_RECORDEVENT_HEADSTALLED | XA_RECORDEVENT_BUFFER_FULL)) ) - { + if (!impl || (eventFlags > (XA_RECORDEVENT_HEADATLIMIT + | XA_RECORDEVENT_HEADATMARKER | XA_RECORDEVENT_HEADATNEWPOS + | XA_RECORDEVENT_HEADMOVING | XA_RECORDEVENT_HEADSTALLED + | XA_RECORDEVENT_BUFFER_FULL))) + { /* invalid parameter */ XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_SetCallbackEventsMask"); return XA_RESULT_PARAMETER_INVALID; - } + } impl->eventFlags = eventFlags; - - if(impl->adapCtx->fwtype == FWMgrFWGST) + + if (impl->adapCtx->fwtype == FWMgrFWGST) { - /* enable position tracking if client wants so */ - if( (eventFlags & (XA_RECORDEVENT_HEADATMARKER | XA_RECORDEVENT_HEADATNEWPOS)) - && impl->adapCtx && !impl->positionupdateOn) + /* enable position tracking if client wants so */ + if ((eventFlags & (XA_RECORDEVENT_HEADATMARKER + | XA_RECORDEVENT_HEADATNEWPOS)) && impl->adapCtx + && !impl->positionupdateOn) { - ret = XARecordItfAdapt_EnablePositionTracking((XAAdaptationGstCtx*)impl->adapCtx, XA_BOOLEAN_TRUE); - if( ret == XA_RESULT_SUCCESS ) + ret = XARecordItfAdapt_EnablePositionTracking( + (XAAdaptationGstCtx*) impl->adapCtx, XA_BOOLEAN_TRUE); + if (ret == XA_RESULT_SUCCESS) { - impl->positionupdateOn = XA_BOOLEAN_TRUE; + impl->positionupdateOn = XA_BOOLEAN_TRUE; } } - else if( !(eventFlags & (XA_RECORDEVENT_HEADATMARKER | XA_RECORDEVENT_HEADATNEWPOS)) - && impl->adapCtx && impl->positionupdateOn) + else if (!(eventFlags & (XA_RECORDEVENT_HEADATMARKER + | XA_RECORDEVENT_HEADATNEWPOS)) && impl->adapCtx + && impl->positionupdateOn) { - ret = XARecordItfAdapt_EnablePositionTracking((XAAdaptationGstCtx*)impl->adapCtx, XA_BOOLEAN_FALSE); - if( ret == XA_RESULT_SUCCESS ) + ret = XARecordItfAdapt_EnablePositionTracking( + (XAAdaptationGstCtx*) impl->adapCtx, XA_BOOLEAN_FALSE); + if (ret == XA_RESULT_SUCCESS) { - impl->positionupdateOn = XA_BOOLEAN_FALSE; + impl->positionupdateOn = XA_BOOLEAN_FALSE; } } } else { - /* enable position tracking if client wants so */ - if( (eventFlags & (XA_RECORDEVENT_HEADATMARKER | XA_RECORDEVENT_HEADATNEWPOS)) - && impl->adapCtx && !impl->positionupdateOn) + /* enable position tracking if client wants so */ + if ((eventFlags & (XA_RECORDEVENT_HEADATMARKER + | XA_RECORDEVENT_HEADATNEWPOS)) && impl->adapCtx + && !impl->positionupdateOn) { - ret = XARecordItfAdaptMMF_EnablePositionTracking((XAAdaptationMMFCtx*)impl->adapCtx, XA_BOOLEAN_TRUE); - if( ret == XA_RESULT_SUCCESS ) + ret = XARecordItfAdaptMMF_EnablePositionTracking( + (XAAdaptationMMFCtx*) impl->adapCtx, XA_BOOLEAN_TRUE); + if (ret == XA_RESULT_SUCCESS) { - impl->positionupdateOn = XA_BOOLEAN_TRUE; + impl->positionupdateOn = XA_BOOLEAN_TRUE; } } - else if( !(eventFlags & (XA_RECORDEVENT_HEADATMARKER | XA_RECORDEVENT_HEADATNEWPOS)) - && impl->adapCtx && impl->positionupdateOn) + else if (!(eventFlags & (XA_RECORDEVENT_HEADATMARKER + | XA_RECORDEVENT_HEADATNEWPOS)) && impl->adapCtx + && impl->positionupdateOn) { - ret = XARecordItfAdaptMMF_EnablePositionTracking((XAAdaptationMMFCtx*)impl->adapCtx, XA_BOOLEAN_FALSE); - if( ret == XA_RESULT_SUCCESS ) + ret = XARecordItfAdaptMMF_EnablePositionTracking( + (XAAdaptationMMFCtx*) impl->adapCtx, XA_BOOLEAN_FALSE); + if (ret == XA_RESULT_SUCCESS) { - impl->positionupdateOn = XA_BOOLEAN_FALSE; + impl->positionupdateOn = XA_BOOLEAN_FALSE; } - } + } } XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); DEBUG_API("<-XARecordItfImpl_SetCallbackEventsMask"); return ret; -} + } /** * XAresult XARecordItfImpl_GetCallbackEventsMask(XARecordItf self, @@ -307,27 +317,26 @@ * Description: Queries the notification state of record events. **/ XAresult XARecordItfImpl_GetCallbackEventsMask(XARecordItf self, - XAuint32 *pEventFlags) -{ + XAuint32 *pEventFlags) + { XAresult ret = XA_RESULT_SUCCESS; XARecordItfImpl *impl = GetImpl(self); DEBUG_API("->XARecordItfImpl_GetCallbackEventsMask"); DEBUG_INFO_A1("pEventFlags - %u", pEventFlags); - - if( !impl || !pEventFlags ) - { + if (!impl || !pEventFlags) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_GetCallbackEventsMask"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pEventFlags = impl->eventFlags; DEBUG_API("<-XARecordItfImpl_GetCallbackEventsMask"); return ret; -} + } /** * XAresult XARecordItfImpl_SetMarkerPosition(XARecordItf self, @@ -335,49 +344,50 @@ * Description: Sets the position of the recording marker. **/ XAresult XARecordItfImpl_SetMarkerPosition(XARecordItf self, - XAmillisecond mSec) -{ + XAmillisecond mSec) + { XAresult ret = XA_RESULT_SUCCESS; XARecordItfImpl *impl = GetImpl(self); DEBUG_API_A1("->XARecordItfImpl_SetMarkerPosition, mSec-%lu",mSec); - if( !impl || (( impl->durationLimitSetted) && (mSec > impl->durationLimit) ) ) - { + if (!impl + || ((impl->durationLimitSetted) && (mSec > impl->durationLimit))) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_SetMarkerPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } impl->markerPosition = mSec; DEBUG_API("<-XARecordItfImpl_SetMarkerPosition"); return ret; -} + } /** * XAresult XARecordItfImpl_ClearMarkerPosition(XARecordItf self) * Description: Clears marker. **/ XAresult XARecordItfImpl_ClearMarkerPosition(XARecordItf self) -{ + { XAresult ret = XA_RESULT_SUCCESS; XARecordItfImpl *impl = GetImpl(self); DEBUG_API("->XARecordItfImpl_ClearMarkerPosition"); - if( !impl ) - { + if (!impl) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_ClearMarkerPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } impl->markerPosition = NO_POSITION; DEBUG_API("<-XARecordItfImpl_ClearMarkerPosition"); return ret; -} + } /** * XAresult XARecordItfImpl_GetMarkerPosition(XARecordItf self, @@ -385,29 +395,29 @@ * Description: Queries the position of the recording marker. **/ XAresult XARecordItfImpl_GetMarkerPosition(XARecordItf self, - XAmillisecond *pMsec) -{ + XAmillisecond *pMsec) + { XARecordItfImpl *impl = GetImpl(self); DEBUG_API("->XARecordItfImpl_GetMarkerPosition"); - if( !impl || !pMsec ) - { + if (!impl || !pMsec) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_GetMarkerPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } - if ( impl->markerPosition == NO_POSITION ) - { + } + if (impl->markerPosition == NO_POSITION) + { DEBUG_ERR("No marker position set."); return XA_RESULT_PRECONDITIONS_VIOLATED; - } + } *pMsec = impl->markerPosition; DEBUG_API("<-XARecordItfImpl_GetMarkerPosition"); return XA_RESULT_SUCCESS; -} + } /** * XAresult XARecordItfImpl_SetPositionUpdatePeriod(XARecordItf self, @@ -415,25 +425,26 @@ * Description: Sets the interval between periodic position notifications. **/ XAresult XARecordItfImpl_SetPositionUpdatePeriod(XARecordItf self, - XAmillisecond mSec) -{ + XAmillisecond mSec) + { XAresult ret = XA_RESULT_SUCCESS; XARecordItfImpl *impl = GetImpl(self); DEBUG_API_A1("->XARecordItfImpl_SetPositionUpdatePeriod, mSec-%lu",mSec); - if( !impl || (( impl->durationLimitSetted) && (mSec > impl->durationLimit) ) ) - { + if (!impl + || ((impl->durationLimitSetted) && (mSec > impl->durationLimit))) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_SetPositionUpdatePeriod"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } impl->positionUpdatePeriod = mSec; DEBUG_API("<-XARecordItfImpl_SetPositionUpdatePeriod"); return ret; -} + } /** * XAresult XARecordItfImpl_GetPositionUpdatePeriod(XARecordItf self, @@ -441,55 +452,57 @@ * Description: Queries the interval between periodic position notifications. **/ XAresult XARecordItfImpl_GetPositionUpdatePeriod(XARecordItf self, - XAmillisecond *pMsec) -{ + XAmillisecond *pMsec) + { XARecordItfImpl *impl = GetImpl(self); DEBUG_API("->XARecordItfImpl_GetPositionUpdatePeriod"); - if( !impl || !pMsec ) - { + if (!impl || !pMsec) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XARecordItfImpl_GetPositionUpdatePeriod"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } *pMsec = impl->positionUpdatePeriod; DEBUG_API("<-XARecordItfImpl_GetPositionUpdatePeriod"); return XA_RESULT_SUCCESS; -} + } /***************************************************************************** * XARecordItfImpl -specific methods *****************************************************************************/ - /** * XARecordItfImpl* XARecordItfImpl_Create() * Description: Allocate and initialize XARecordItfImpl **/ -XARecordItfImpl* XARecordItfImpl_Create( XAMediaRecorderImpl* impl ) -{ - XARecordItfImpl* self = (XARecordItfImpl*) - calloc(1,sizeof(XARecordItfImpl)); - - +XARecordItfImpl* XARecordItfImpl_Create(XAMediaRecorderImpl* impl) + { + XARecordItfImpl* self = (XARecordItfImpl*) calloc(1, + sizeof(XARecordItfImpl)); + DEBUG_API("->XARecordItfImpl_Create"); - if( self ) - { + if (self) + { /* init itf default implementation */ self->itf.ClearMarkerPosition = XARecordItfImpl_ClearMarkerPosition; - self->itf.GetCallbackEventsMask = XARecordItfImpl_GetCallbackEventsMask; + self->itf.GetCallbackEventsMask + = XARecordItfImpl_GetCallbackEventsMask; self->itf.GetMarkerPosition = XARecordItfImpl_GetMarkerPosition; self->itf.GetPosition = XARecordItfImpl_GetPosition; - self->itf.GetPositionUpdatePeriod = XARecordItfImpl_GetPositionUpdatePeriod; + self->itf.GetPositionUpdatePeriod + = XARecordItfImpl_GetPositionUpdatePeriod; self->itf.GetRecordState = XARecordItfImpl_GetRecordState; self->itf.RegisterCallback = XARecordItfImpl_RegisterCallback; - self->itf.SetCallbackEventsMask = XARecordItfImpl_SetCallbackEventsMask; + self->itf.SetCallbackEventsMask + = XARecordItfImpl_SetCallbackEventsMask; self->itf.SetDurationLimit = XARecordItfImpl_SetDurationLimit; self->itf.SetMarkerPosition = XARecordItfImpl_SetMarkerPosition; - self->itf.SetPositionUpdatePeriod = XARecordItfImpl_SetPositionUpdatePeriod; + self->itf.SetPositionUpdatePeriod + = XARecordItfImpl_SetPositionUpdatePeriod; self->itf.SetRecordState = XARecordItfImpl_SetRecordState; /* init variables */ @@ -505,115 +518,122 @@ self->cbPtrToSelf = NULL; self->pObjImpl = impl; self->adapCtx = impl->adaptationCtx; - XAAdaptationBase_AddEventHandler( impl->adaptationCtx, &XARecordItfImpl_AdaptCb, XA_RECORDITFEVENTS, self ); + XAAdaptationBase_AddEventHandler(impl->adaptationCtx, + &XARecordItfImpl_AdaptCb, XA_RECORDITFEVENTS, self); self->self = self; + }DEBUG_API("<-XARecordItfImpl_Create"); + return self; } - DEBUG_API("<-XARecordItfImpl_Create"); - return self; -} /** * void XARecordItfImpl_Free(XARecordItfImpl* self) * Description: Free all resources reserved at XARecordItfImpl_Create **/ void XARecordItfImpl_Free(XARecordItfImpl* self) -{ + { DEBUG_API("->XARecordItfImpl_Free"); assert( self==self->self ); - XAAdaptationBase_RemoveEventHandler( self->adapCtx, &XARecordItfImpl_AdaptCb ); - free( self ); + XAAdaptationBase_RemoveEventHandler(self->adapCtx, + &XARecordItfImpl_AdaptCb); + free(self); DEBUG_API("<-XARecordItfImpl_Free"); -} + } /* void XARecordItfImpl_AdaptCb * Description: Listen changes in adaptation */ -void XARecordItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ - XARecordItfImpl* impl = (XARecordItfImpl*)pHandlerCtx; +void XARecordItfImpl_AdaptCb(void *pHandlerCtx, XAAdaptEvent *event) + { + XARecordItfImpl* impl = (XARecordItfImpl*) pHandlerCtx; DEBUG_API("->XARecordItfImpl_AdaptCb"); - if(!impl) - { + if (!impl) + { DEBUG_ERR("XARecordItfImpl_AdaptCb, invalid context pointer!"); DEBUG_API("<-XARecordItfImpl_AdaptCb"); return; - } + } assert(event); /* check position update events */ - if( event->eventid == XA_ADAPT_POSITION_UPDATE_EVT ) - { + if (event->eventid == XA_ADAPT_POSITION_UPDATE_EVT) + { XAuint32 newpos = 0; assert(event->data); - newpos = *((XAuint32*)(event->data)); + newpos = *((XAuint32*) (event->data)); DEBUG_INFO_A1("new position %u",newpos); /* check if marker passed and callback needed */ - if( (impl->markerPosition != NO_POSITION) && - (impl->eventFlags & XA_RECORDEVENT_HEADATMARKER) ) - { - if( (impl->lastPosition < impl->markerPosition) && - (newpos >= impl->markerPosition) && - impl->callback ) + if ((impl->markerPosition != NO_POSITION) && (impl->eventFlags + & XA_RECORDEVENT_HEADATMARKER)) { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_RECORDEVENT_HEADATMARKER); + if ((impl->lastPosition < impl->markerPosition) && (newpos + >= impl->markerPosition) && impl->callback) + { + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_RECORDEVENT_HEADATMARKER); + } } - } /* check if update period passed and callback needed */ - if( (impl->positionUpdatePeriod > 0) && - (impl->eventFlags & XA_RECORDEVENT_HEADATNEWPOS) && - impl->callback ) - { - if( (XAuint32)((impl->lastPosition)/(impl->positionUpdatePeriod )) < - (XAuint32)(newpos/(impl->positionUpdatePeriod )) ) + if ((impl->positionUpdatePeriod > 0) && (impl->eventFlags + & XA_RECORDEVENT_HEADATNEWPOS) && impl->callback) { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_RECORDEVENT_HEADATNEWPOS); + if ((XAuint32) ((impl->lastPosition) + / (impl->positionUpdatePeriod)) < (XAuint32) (newpos + / (impl->positionUpdatePeriod))) + { + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_RECORDEVENT_HEADATNEWPOS); + } } - } /* store position */ impl->lastPosition = newpos; /* Check have we reached record duration limit */ - if ( impl->durationLimitSetted) - { - if ( impl->callback && (impl->lastPosition >= impl->durationLimit )) + if (impl->durationLimitSetted) { - impl->itf.SetRecordState(impl->cbPtrToSelf,XA_RECORDSTATE_STOPPED); - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_RECORDEVENT_HEADATLIMIT); + if (impl->callback && (impl->lastPosition >= impl->durationLimit)) + { + impl->itf.SetRecordState(impl->cbPtrToSelf, + XA_RECORDSTATE_STOPPED); + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_RECORDEVENT_HEADATLIMIT); + } } } - } - else if( event->eventid == XA_RECORDEVENT_HEADSTALLED ) - { + else if (event->eventid == XA_RECORDEVENT_HEADSTALLED) + { impl->recordState = XA_RECORDSTATE_PAUSED; /* send callback if needed */ - if( (XA_RECORDEVENT_HEADSTALLED & impl->eventFlags) && impl->callback ) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_RECORDEVENT_HEADSTALLED); + if ((XA_RECORDEVENT_HEADSTALLED & impl->eventFlags) && impl->callback) + { + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_RECORDEVENT_HEADSTALLED); + } } - } - else if( event->eventid == XA_RECORDEVENT_BUFFER_FULL ) - { + else if (event->eventid == XA_RECORDEVENT_BUFFER_FULL) + { /* Adaptation is set to pause, need to sync state with AL-layer*/ impl->recordState = XA_RECORDSTATE_STOPPED; /* send callback if needed */ - if( (XA_RECORDEVENT_BUFFER_FULL & impl->eventFlags) && impl->callback ) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_RECORDEVENT_BUFFER_FULL); + if ((XA_RECORDEVENT_BUFFER_FULL & impl->eventFlags) && impl->callback) + { + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_RECORDEVENT_BUFFER_FULL); + } } - } - else if( event->eventid == XA_RECORDEVENT_HEADMOVING ) - { + else if (event->eventid == XA_RECORDEVENT_HEADMOVING) + { /* send callback if needed */ - if( (XA_RECORDEVENT_HEADMOVING & impl->eventFlags) && impl->callback ) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, XA_RECORDEVENT_HEADMOVING); + if ((XA_RECORDEVENT_HEADMOVING & impl->eventFlags) && impl->callback) + { + impl->callback(impl->cbPtrToSelf, impl->cbcontext, + XA_RECORDEVENT_HEADMOVING); + } } - } else - { + { /* do nothing */ + } + + DEBUG_API("<-XARecordItfImpl_AdaptCb"); } - DEBUG_API("<-XARecordItfImpl_AdaptCb"); -} - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mediarecorder/xarecorditf.h --- a/khronosfws/openmax_al/src/mediarecorder/xarecorditf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xarecorditf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Record Itf Impl + * + */ #ifndef XARECORDITF_H #define XARECORDITF_H @@ -35,7 +35,7 @@ /** STRUCTURES **/ /* Definition of XARecordItf implementation */ typedef struct XARecordItfImpl_ -{ + { /* parent interface */ struct XARecordItf_ itf; /* pointer to self */ @@ -43,70 +43,66 @@ XAMediaRecorderImpl* pObjImpl; /* variables */ - XAuint32 recordState; - XAboolean durationLimitSetted; - XAmillisecond durationLimit; - XAmillisecond markerPosition; - XAmillisecond positionUpdatePeriod; - void *cbcontext; - XAuint32 eventFlags; - XAboolean positionupdateOn; - XAmillisecond lastPosition; + XAuint32 recordState; + XAboolean durationLimitSetted; + XAmillisecond durationLimit; + XAmillisecond markerPosition; + XAmillisecond positionUpdatePeriod; + void *cbcontext; + XAuint32 eventFlags; + XAboolean positionupdateOn; + XAmillisecond lastPosition; xaRecordCallback callback; - void* context; - XARecordItf cbPtrToSelf; + void* context; + XARecordItf cbPtrToSelf; /*Adaptation variables*/ XAAdaptationBaseCtx *adapCtx; -} XARecordItfImpl; + } XARecordItfImpl; /** METHODS **/ /* Base interface XARecordItf implementation * See API Specification for method documentation */ -XAresult XARecordItfImpl_SetRecordState( XARecordItf self, - XAuint32 state ); +XAresult XARecordItfImpl_SetRecordState(XARecordItf self, XAuint32 state); -XAresult XARecordItfImpl_GetRecordState( XARecordItf self, - XAuint32 *pState ); +XAresult XARecordItfImpl_GetRecordState(XARecordItf self, XAuint32 *pState); + +XAresult XARecordItfImpl_SetDurationLimit(XARecordItf self, + XAmillisecond msec); -XAresult XARecordItfImpl_SetDurationLimit( XARecordItf self, - XAmillisecond msec ); +XAresult XARecordItfImpl_GetPosition(XARecordItf self, XAmillisecond *pMsec); -XAresult XARecordItfImpl_GetPosition( XARecordItf self, - XAmillisecond *pMsec ); +XAresult XARecordItfImpl_RegisterCallback(XARecordItf self, + xaRecordCallback callback, void *pContext); -XAresult XARecordItfImpl_RegisterCallback( XARecordItf self, - xaRecordCallback callback, - void *pContext ); +XAresult XARecordItfImpl_SetCallbackEventsMask(XARecordItf self, + XAuint32 eventFlags); -XAresult XARecordItfImpl_SetCallbackEventsMask( XARecordItf self, - XAuint32 eventFlags ); +XAresult XARecordItfImpl_GetCallbackEventsMask(XARecordItf self, + XAuint32 *pEventFlags); -XAresult XARecordItfImpl_GetCallbackEventsMask( XARecordItf self, - XAuint32 *pEventFlags ); +XAresult XARecordItfImpl_SetMarkerPosition(XARecordItf self, + XAmillisecond mSec); -XAresult XARecordItfImpl_SetMarkerPosition( XARecordItf self, - XAmillisecond mSec ); +XAresult XARecordItfImpl_ClearMarkerPosition(XARecordItf self); -XAresult XARecordItfImpl_ClearMarkerPosition( XARecordItf self ); - -XAresult XARecordItfImpl_GetMarkerPosition( XARecordItf self, - XAmillisecond *pMsec ); +XAresult XARecordItfImpl_GetMarkerPosition(XARecordItf self, + XAmillisecond *pMsec); -XAresult XARecordItfImpl_SetPositionUpdatePeriod( XARecordItf self, - XAmillisecond mSec ); +XAresult XARecordItfImpl_SetPositionUpdatePeriod(XARecordItf self, + XAmillisecond mSec); -XAresult XARecordItfImpl_GetPositionUpdatePeriod( XARecordItf self, - XAmillisecond *pMsec ); +XAresult XARecordItfImpl_GetPositionUpdatePeriod(XARecordItf self, + XAmillisecond *pMsec); /* XARecordItfImpl -specific methods */ -XARecordItfImpl* XARecordItfImpl_Create( XAMediaRecorderImpl* impl ); -void XARecordItfImpl_Free( XARecordItfImpl* self ); -void XARecordItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); +XARecordItfImpl* XARecordItfImpl_Create(XAMediaRecorderImpl* impl); +void XARecordItfImpl_Free(XARecordItfImpl* self); +void XARecordItfImpl_AdaptCb(void *pHandlerCtx, XAAdaptEvent *event); #endif - /* XARECORDITF_H */ +/* XARECORDITF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/metadataextractor/xametadataextractor.c --- a/khronosfws/openmax_al/src/metadataextractor/xametadataextractor.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/metadataextractor/xametadataextractor.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata Extractor Object Impl + * + */ #include #include @@ -32,18 +32,16 @@ #include "xaadaptationmmf.h" #include "xametadataadaptctxmmf.h" - /* Static mapping of enumeration XAMetadataInterfaces to interface iids */ -static const XAInterfaceID* xaMetadataExtractorItfIIDs[MDE_ITFCOUNT]= -{ - &XA_IID_OBJECT, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, - &XA_IID_METADATAEXTRACTION, - &XA_IID_METADATATRAVERSAL, - &XA_IID_CONFIGEXTENSION, - &XA_IID_DYNAMICSOURCE -}; - +static const XAInterfaceID* xaMetadataExtractorItfIIDs[MDE_ITFCOUNT] = + { + &XA_IID_OBJECT, + &XA_IID_DYNAMICINTERFACEMANAGEMENT, + &XA_IID_METADATAEXTRACTION, + &XA_IID_METADATATRAVERSAL, + &XA_IID_CONFIGEXTENSION, + &XA_IID_DYNAMICSOURCE + }; /***************************************************************************** * Global methods @@ -54,195 +52,191 @@ * Add this method to XAGlobals.h */ XAresult XAMetadataExtractorImpl_Create(FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf *pMetadataExtractor, - XADataSource *pDataSource, - XAuint32 numInterfaces, - const XAInterfaceID * pInterfaceIds, - const XAboolean * pInterfaceRequired) -{ + XACapabilities* capabilities, XAObjectItf *pMetadataExtractor, + XADataSource *pDataSource, XAuint32 numInterfaces, + const XAInterfaceID * pInterfaceIds, + const XAboolean * pInterfaceRequired) + { XAMetadataExtractorImpl* pImpl = NULL; XAObjectItfImpl* pBaseObj = NULL; XAuint8 itfIndex = 0; FWMgrFwType fwType; - const char *uri = NULL; + const char *uri = NULL; XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataExtractorImpl_Create"); XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); - if( !pMetadataExtractor ) - { + if (!pMetadataExtractor) + { XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ DEBUG_API("<-XAMetadataExtractorImpl_Create"); return XA_RESULT_PARAMETER_INVALID; - } + } - res = XACommon_CheckDataSource(pDataSource,NULL); - if(res!=XA_RESULT_SUCCESS) - { + res = XACommon_CheckDataSource(pDataSource, NULL); + if (res != XA_RESULT_SUCCESS) + { XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_API("<-XAMetadataExtractorImpl_Create"); return res; - } + } /* instantiate object implementation */ - pImpl = (XAMetadataExtractorImpl*)calloc(1,sizeof(XAMetadataExtractorImpl)); - if(!pImpl) - { + pImpl = (XAMetadataExtractorImpl*) calloc(1, + sizeof(XAMetadataExtractorImpl)); + if (!pImpl) + { XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); /* memory allocation failed */ DEBUG_API("<-XAMetadataExtractorImpl_Create"); return XA_RESULT_MEMORY_FAILURE; - } + } pBaseObj = &pImpl->baseObj; /* Initialize base object default implementation */ - XAObjectItfImpl_Init(pBaseObj, - MDE_ITFCOUNT, - xaMetadataExtractorItfIIDs, - XAMetadataExtractorImpl_DoRealize, - XAMetadataExtractorImpl_DoResume, - XAMetadataExtractorImpl_FreeResources); + XAObjectItfImpl_Init(pBaseObj, MDE_ITFCOUNT, xaMetadataExtractorItfIIDs, + XAMetadataExtractorImpl_DoRealize, + XAMetadataExtractorImpl_DoResume, + XAMetadataExtractorImpl_FreeResources); /* Mark interfaces that need to be exposed */ /* Implicit and mandated interfaces */ - pBaseObj->interfaceMap[MDE_METADATAEXTRACTIONITF].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MDE_METADATATRAVERSALITF].required = XA_BOOLEAN_TRUE; + pBaseObj->interfaceMap[MDE_METADATAEXTRACTIONITF].required + = XA_BOOLEAN_TRUE; + pBaseObj->interfaceMap[MDE_METADATATRAVERSALITF].required + = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MDE_DYNAMICSOURCEITF].required = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MDE_DIMITF].required = XA_BOOLEAN_TRUE; /* Explicit interfaces */ - if ((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired ) - { + if ((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) + { /* Check required interfaces */ - for(itfIndex = 0; itfIndex < numInterfaces; itfIndex++) - { + for (itfIndex = 0; itfIndex < numInterfaces; itfIndex++) + { /* If mapEntry is null then required interface is not supported.*/ - XAObjItfMapEntry *entry = - XAObjectItfImpl_GetItfEntry((XAObjectItf)&(pBaseObj), pInterfaceIds[itfIndex]); - if( !entry ) - { - if( pInterfaceRequired[itfIndex] ) + XAObjItfMapEntry *entry = XAObjectItfImpl_GetItfEntry( + (XAObjectItf) &(pBaseObj), pInterfaceIds[itfIndex]); + if (!entry) { + if (pInterfaceRequired[itfIndex]) + { /* required interface cannot be accommodated - fail creation */ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); + XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_ERR("Required interface not found - abort creation!"); DEBUG_API("<-XAMetadataExtractorImpl_Create"); return XA_RESULT_FEATURE_UNSUPPORTED; - } + } else - { + { DEBUG_INFO("Requested (not required) interface not found - continue creation"); + } } - } else - { + { entry->required = XA_BOOLEAN_TRUE; + } } } - } - // Mark interfaces that can be handled dynamically - pBaseObj->interfaceMap[MDE_CONFIGEXTENSIONITF].isDynamic = XA_BOOLEAN_TRUE; + pBaseObj->interfaceMap[MDE_CONFIGEXTENSIONITF].isDynamic + = XA_BOOLEAN_TRUE; - //Set ObjectItf to point to newly created object - *pMetadataExtractor = (XAObjectItf)&(pBaseObj->self); + //Set ObjectItf to point to newly created object + *pMetadataExtractor = (XAObjectItf) &(pBaseObj->self); - //store member variables - pImpl->dataSrc = pDataSource; + //store member variables + pImpl->dataSrc = pDataSource; - /* Determine framework type that can handle recording */ - fwType = (FWMgrFwType)FWMgrMOUnknown; + /* Determine framework type that can handle recording */ + fwType = (FWMgrFwType) FWMgrMOUnknown; /**/ if (pDataSource->pLocator) - { - XADataLocator_URI* dataLoc = (XADataLocator_URI*)pDataSource->pLocator; + { + XADataLocator_URI* dataLoc = + (XADataLocator_URI*) pDataSource->pLocator; if (dataLoc->locatorType == XA_DATALOCATOR_URI) - { - uri = (char*)dataLoc->URI; + { + uri = (char*) dataLoc->URI; + } } - } - + fwType = XAFrameworkMgr_GetFramework(mapper, uri, FWMgrMOPlayer); if (fwType == FWMgrMOUnknown) - { - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); + { + XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAMetadataExtractorImpl_Create"); return XA_RESULT_CONTENT_UNSUPPORTED; - } - - if(fwType == FWMgrFWMMF) - { + } + + if (fwType == FWMgrFWMMF) + { pImpl->adaptationCtxMMF = XAMetadataAdaptCtxMMF_Create(pDataSource); - - pImpl->curAdaptCtx = pImpl->adaptationCtxMMF; - } + + pImpl->curAdaptCtx = pImpl->adaptationCtxMMF; + } else - { - // Create metadata adaptation context - pImpl->adaptationCtxGst = XAMetadataAdaptCtx_Create(pDataSource); - - pImpl->curAdaptCtx = pImpl->adaptationCtxGst; - } + { + // Create metadata adaptation context + pImpl->adaptationCtxGst = XAMetadataAdaptCtx_Create(pDataSource); + + pImpl->curAdaptCtx = pImpl->adaptationCtxGst; + } XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_API("<-XAMetadataExtractorImpl_Create"); return XA_RESULT_SUCCESS; -} + } /* XAResult XAMetadataExtractorImpl_QueryNumSupportedInterfaces * Description: Statically query number of supported interfaces */ XAresult XAMetadataExtractorImpl_QueryNumSupportedInterfaces( - XAuint32 *pNumSupportedInterfaces) -{ + XAuint32 *pNumSupportedInterfaces) + { XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataExtractorImpl_QueryNumSupportedInterfaces"); - if(pNumSupportedInterfaces) - { + if (pNumSupportedInterfaces) + { *pNumSupportedInterfaces = MDE_ITFCOUNT; res = XA_RESULT_SUCCESS; - } + } else - { + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; + }DEBUG_API_A1("<-XAMetadataExtractorImpl_QueryNumSupportedInterfaces (%d)", (int)res); + return res; } - DEBUG_API_A1("<-XAMetadataExtractorImpl_QueryNumSupportedInterfaces (%d)", (int)res); - return res; -} /* XAResult XAMetadataExtractorImpl_QuerySupportedInterfaces * Description: Statically query supported interfaces */ -XAresult XAMetadataExtractorImpl_QuerySupportedInterfaces( - XAuint32 index, - XAInterfaceID * pInterfaceId) -{ +XAresult XAMetadataExtractorImpl_QuerySupportedInterfaces(XAuint32 index, + XAInterfaceID * pInterfaceId) + { XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataExtractorImpl_QuerySupportedInterfaces"); - if (index >= MDE_ITFCOUNT || !pInterfaceId ) - { + if (index >= MDE_ITFCOUNT || !pInterfaceId) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; - } + } else - { + { *pInterfaceId = *(xaMetadataExtractorItfIIDs[index]); res = XA_RESULT_SUCCESS; - } - DEBUG_API_A1("<-XAMetadataExtractorImpl_QuerySupportedInterfaces (%d)", (int)res); + }DEBUG_API_A1("<-XAMetadataExtractorImpl_QuerySupportedInterfaces (%d)", (int)res); return res; -} - + } /***************************************************************************** * base object XAObjectItfImpl methods @@ -253,11 +247,11 @@ * Create and initialize implementation-specific variables. * Called from base object XAObjectItfImpl */ -XAresult XAMetadataExtractorImpl_DoRealize( XAObjectItf self ) -{ +XAresult XAMetadataExtractorImpl_DoRealize(XAObjectItf self) + { XAuint8 itfIdx = 0; - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAMetadataExtractorImpl* pObjImpl = (XAMetadataExtractorImpl*)(pObj); + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAMetadataExtractorImpl* pObjImpl = (XAMetadataExtractorImpl*) (pObj); void *pItf = NULL; XAresult ret = XA_RESULT_SUCCESS; @@ -265,124 +259,129 @@ XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); /* check casting from correct pointer type */ - if( !pObjImpl || pObj != pObjImpl->baseObj.self ) - { + if (!pObjImpl || pObj != pObjImpl->baseObj.self) + { XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ DEBUG_API("<-XAMetadataExtractorImpl_DoRealize"); return XA_RESULT_PARAMETER_INVALID; - } + } /* Realize all implicit and explicitly wanted interfaces */ - for(itfIdx=0; itfIdxinterfaceMap[itfIdx].pItf) && - pObj->interfaceMap[itfIdx].required ) + for (itfIdx = 0; itfIdx < MDE_ITFCOUNT; itfIdx++) { - switch(itfIdx) + if (!(pObj->interfaceMap[itfIdx].pItf) + && pObj->interfaceMap[itfIdx].required) { + switch (itfIdx) + { case MDE_DIMITF: pItf = XADIMItfImpl_Create(); - if(pItf) - { + if (pItf) + { XADIMItfImpl_Init(pItf, self, - XAMetadataExtractorImpl_DoAddItf, - XAMetadataExtractorImpl_DoResumeItf, - XAMetadataExtractorImpl_DoRemoveItf); - } + XAMetadataExtractorImpl_DoAddItf, + XAMetadataExtractorImpl_DoResumeItf, + XAMetadataExtractorImpl_DoRemoveItf); + } break; case MDE_METADATAEXTRACTIONITF: - pItf = XAMetadataExtractionItfImpl_Create( pObjImpl->curAdaptCtx ); + pItf = XAMetadataExtractionItfImpl_Create( + pObjImpl->curAdaptCtx); break; case MDE_METADATATRAVERSALITF: - pItf = XAMetadataTraversalItfImpl_Create( pObjImpl->curAdaptCtx ); + pItf = XAMetadataTraversalItfImpl_Create( + pObjImpl->curAdaptCtx); break; case MDE_CONFIGEXTENSIONITF: pItf = XAConfigExtensionsItfImpl_Create(); - XAConfigExtensionsItfImpl_SetContext( pItf, pObjImpl->curAdaptCtx ); + XAConfigExtensionsItfImpl_SetContext(pItf, + pObjImpl->curAdaptCtx); break; case MDE_DYNAMICSOURCEITF: - pItf = XADynamicSourceItfImpl_Create( pObjImpl->curAdaptCtx ); + pItf = XADynamicSourceItfImpl_Create( + pObjImpl->curAdaptCtx); break; default: break; - } - if(!pItf) - { + } + if (!pItf) + { XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); /* memory allocation failed */ DEBUG_API("<-XAMetadataExtractorImpl_DoRealize"); return XA_RESULT_MEMORY_FAILURE; - } + } else - { + { pObj->interfaceMap[itfIdx].pItf = pItf; + } } } - } /*Initialize adaptation context*/ /* init adaptation */ - if(pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - ret = XAMetadataAdaptCtxMMF_PostInit( (XAAdaptationMMFCtx*)pObjImpl->adaptationCtxMMF ); - } + if (pObjImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + ret = XAMetadataAdaptCtxMMF_PostInit( + (XAAdaptationMMFCtx*) pObjImpl->adaptationCtxMMF); + } else - { - ret = XAMetadataAdaptCtx_PostInit( (XAAdaptationGstCtx*)pObjImpl->adaptationCtxGst ); - } + { + ret = XAMetadataAdaptCtx_PostInit( + (XAAdaptationGstCtx*) pObjImpl->adaptationCtxGst); + } - if ( ret != XA_RESULT_SUCCESS ) - { + if (ret != XA_RESULT_SUCCESS) + { XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_ERR("Adaptation init failed!"); DEBUG_API("<-XAMetadataExtractorImpl_DoRealize"); return ret; - } + } pObj->state = XA_OBJECT_STATE_REALIZED; XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_API("<-XAMetadataExtractorImpl_DoRealize"); return XA_RESULT_SUCCESS; -} + } /* XAresult XAMetadataExtractorImpl_DoResume * Description: Resume object from suspended state */ XAresult XAMetadataExtractorImpl_DoResume(XAObjectItf self) -{ + { DEBUG_API("->XAMetadataExtractorImpl_DoResume"); DEBUG_API("<-XAMetadataExtractorImpl_DoResume"); /* "suspended" state not supported by this implementation */ return XA_RESULT_PRECONDITIONS_VIOLATED; -} + } /* void XAMetadataExtractorImpl_FreeResources * Description: Free all resources reserved at XAMetadataExtractorImpl_DoRealize() */ void XAMetadataExtractorImpl_FreeResources(XAObjectItf self) -{ - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - + { + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAuint8 itfIdx = 0; void *pItf = NULL; - XAMetadataExtractorImpl* pImpl = (XAMetadataExtractorImpl*)(*self); + XAMetadataExtractorImpl* pImpl = (XAMetadataExtractorImpl*) (*self); DEBUG_API("->XAMetadataExtractorImpl_FreeResources"); XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS(XATSMediaPlayer); - assert( pObj && pImpl && pObj == pObj->self ); - for(itfIdx = 0; itfIdx < MDE_ITFCOUNT; itfIdx++) - { + for (itfIdx = 0; itfIdx < MDE_ITFCOUNT; itfIdx++) + { pItf = pObj->interfaceMap[itfIdx].pItf; - if(pItf) - { - switch(itfIdx) + if (pItf) { + switch (itfIdx) + { case MDE_METADATAEXTRACTIONITF: XAMetadataExtractionItfImpl_Free(pItf); break; @@ -398,31 +397,33 @@ case MDE_CONFIGEXTENSIONITF: XAConfigExtensionsItfImpl_Free(pItf); break; + } + pObj->interfaceMap[itfIdx].pItf = NULL; } - pObj->interfaceMap[itfIdx].pItf = NULL; } - } - - if(pImpl->curAdaptCtx) - { - if(pImpl->curAdaptCtx->fwtype == FWMgrFWMMF) - { - XAMetadataAdaptCtxMMF_Destroy( (XAAdaptationMMFCtx*)pImpl->adaptationCtxMMF ); - pImpl->adaptationCtxMMF = NULL; - } - else - { - XAMetadataAdaptCtx_Destroy( (XAAdaptationGstCtx*)pImpl->adaptationCtxGst ); - pImpl->adaptationCtxGst = NULL; - } - } - - pImpl->curAdaptCtx = NULL; + + if (pImpl->curAdaptCtx) + { + if (pImpl->curAdaptCtx->fwtype == FWMgrFWMMF) + { + XAMetadataAdaptCtxMMF_Destroy( + (XAAdaptationMMFCtx*) pImpl->adaptationCtxMMF); + pImpl->adaptationCtxMMF = NULL; + } + else + { + XAMetadataAdaptCtx_Destroy( + (XAAdaptationGstCtx*) pImpl->adaptationCtxGst); + pImpl->adaptationCtxGst = NULL; + } + } + + pImpl->curAdaptCtx = NULL; XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS(XATSMediaPlayer); DEBUG_API("<-XAMetadataExtractorImpl_FreeResources"); return; -} + } /***************************************************************************** * MetadataExtractorImpl -specific methods @@ -431,85 +432,91 @@ /* XAMetadataExtractorImpl_DoAddItf * Dynamically add an interface, object specific parts */ -XAresult XAMetadataExtractorImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ +XAresult XAMetadataExtractorImpl_DoAddItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry) + { - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAMetadataExtractorImpl* pImpl = (XAMetadataExtractorImpl*)(pObj); + XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); + XAMetadataExtractorImpl* pImpl = (XAMetadataExtractorImpl*) (pObj); XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataExtractorImpl_DoAddItf"); - if(mapEntry) - { - switch( mapEntry->mapIdx ) + if (mapEntry) { + switch (mapEntry->mapIdx) + { case MDE_CONFIGEXTENSIONITF: mapEntry->pItf = XAConfigExtensionsItfImpl_Create(); - XAConfigExtensionsItfImpl_SetContext( mapEntry->pItf, pImpl->adaptationCtxGst); + XAConfigExtensionsItfImpl_SetContext(mapEntry->pItf, + pImpl->adaptationCtxGst); break; default: - DEBUG_ERR("XAMetadataExtractorImpl_DoAddItf unknown id"); + DEBUG_ERR("XAMetadataExtractorImpl_DoAddItf unknown id") + ; ret = XA_RESULT_FEATURE_UNSUPPORTED; break; - } - if( !mapEntry->pItf && ret == XA_RESULT_SUCCESS) - { + } + if (!mapEntry->pItf && ret == XA_RESULT_SUCCESS) + { DEBUG_ERR("XAMetadataExtractorImpl_DoAddItf itf creation failed"); ret = XA_RESULT_MEMORY_FAILURE; + } } - } else - { + { ret = XA_RESULT_PARAMETER_INVALID; - } + } DEBUG_API("<-XAMetadataExtractorImpl_DoAddItf"); return ret; -} + } /* XAMetadataExtractorImpl_DoResumeItf * Try to resume lost interface, object specific parts */ -XAresult XAMetadataExtractorImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ +XAresult XAMetadataExtractorImpl_DoResumeItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry) + { XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataExtractorImpl_DoResumeItf"); /* For now, no difference between suspended and unrealised itfs */ - ret = XAMetadataExtractorImpl_DoAddItf(self,mapEntry); + ret = XAMetadataExtractorImpl_DoAddItf(self, mapEntry); DEBUG_API("<-XAMetadataExtractorImpl_DoResumeItf"); return ret; -} + } /* XAMetadataExtractorImpl_DoRemoveItf * Dynamically remove an interface, object specific parts */ -XAresult XAMetadataExtractorImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ +XAresult XAMetadataExtractorImpl_DoRemoveItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry) + { XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAMetadataExtractorImpl_DoRemoveItf"); ret = XA_RESULT_SUCCESS; - if(mapEntry) - { - switch( mapEntry->mapIdx ) + if (mapEntry) { + switch (mapEntry->mapIdx) + { case MDE_CONFIGEXTENSIONITF: XAConfigExtensionsItfImpl_Free(mapEntry->pItf); break; default: - DEBUG_ERR("XAMetadataExtractorImpl_DoRemoveItf unknown id"); + DEBUG_ERR("XAMetadataExtractorImpl_DoRemoveItf unknown id") + ; ret = XA_RESULT_FEATURE_UNSUPPORTED; break; - } + } mapEntry->pItf = NULL; - } + } else - { + { ret = XA_RESULT_PARAMETER_INVALID; - } + } DEBUG_API("<-XAMetadataExtractorImpl_DoRemoveItf"); return ret; -} + } /* END OF FILE */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/metadataextractor/xametadataextractor.h --- a/khronosfws/openmax_al/src/metadataextractor/xametadataextractor.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/metadataextractor/xametadataextractor.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata Extractor Header + * + */ #ifndef XAMETADATAEXTRACTOR_H #define XAMETADATAEXTRACTOR_H @@ -23,17 +23,14 @@ #include "xaglobals.h" #include "xaadptbasectx.h" - /** MACROS **/ - /** TYPES **/ - /** ENUMERATIONS **/ /* Enumeration for interfaces that MetadataExtractor supports. */ typedef enum -{ + { MDE_OBJECTITF, /* <-keep this first */ MDE_DIMITF, MDE_METADATAEXTRACTIONITF, @@ -41,37 +38,38 @@ MDE_CONFIGEXTENSIONITF, MDE_DYNAMICSOURCEITF, MDE_ITFCOUNT -} XAMetadataExtractorInterfaces; + } XAMetadataExtractorInterfaces; /** STRUCTURES **/ /* Specification for XAMetadataExtractorImpl */ typedef struct XAMetadataExtractorImpl_ -{ + { /* Parent for XAMetadataExtractorImpl */ XAObjectItfImpl baseObj; /* <-keep this first */ /* variables */ XADataSource *dataSrc; - + XAAdaptationBaseCtx* curAdaptCtx; XAAdaptationBaseCtx* adaptationCtxGst; XAAdaptationBaseCtx* adaptationCtxMMF; -} XAMetadataExtractorImpl; - + } XAMetadataExtractorImpl; /** METHODS **/ /* base object XAObjectItfImpl methods */ -XAresult XAMetadataExtractorImpl_DoRealize(XAObjectItf self); -XAresult XAMetadataExtractorImpl_DoResume(XAObjectItf self); -void XAMetadataExtractorImpl_FreeResources(XAObjectItf self); +XAresult XAMetadataExtractorImpl_DoRealize(XAObjectItf self); +XAresult XAMetadataExtractorImpl_DoResume(XAObjectItf self); +void XAMetadataExtractorImpl_FreeResources(XAObjectItf self); /* MetadataExtractorImpl -specific methods */ -XAresult XAMetadataExtractorImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XAMetadataExtractorImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XAMetadataExtractorImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); - +XAresult XAMetadataExtractorImpl_DoAddItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry); +XAresult XAMetadataExtractorImpl_DoResumeItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry); +XAresult XAMetadataExtractorImpl_DoRemoveItf(XAObjectItf self, + XAObjItfMapEntry *mapEntry); #endif /* XAMETADATAEXTRACTOR_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp --- a/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -1,1001 +1,1030 @@ -#include "cmetadatautilityitf.h" +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata backend engine + * + */ + #include #include #include #include +#include "cmetadatautilityitf.h" #include "profileutilmacro.h" -CMetadataUtilityItf::CMetadataUtilityItf():m_pS60Util(NULL), m_pHXUtil(NULL) -{ -} +CMetadataUtilityItf::CMetadataUtilityItf() : + m_pS60Util(NULL), m_pHXUtil(NULL) + { + } CMetadataUtilityItf::~CMetadataUtilityItf() -{ - if(m_pS60Util) - { - delete m_pS60Util; - } + { + if (m_pS60Util) + { + delete m_pS60Util; + } - if(m_pHXUtil) - { - delete m_pHXUtil; - } -} - + if (m_pHXUtil) + { + delete m_pHXUtil; + } + } CMetadataUtilityItf* CMetadataUtilityItf::New(char* uri) -{ - CMetadataUtilityItf* p_mdutilitf = new CMetadataUtilityItf; - - p_mdutilitf->ParseSource(uri); //ignore error + { + CMetadataUtilityItf* p_mdutilitf = new CMetadataUtilityItf; - return p_mdutilitf; -} + p_mdutilitf->ParseSource(uri); //ignore error + + return p_mdutilitf; + } TInt CMetadataUtilityItf::OpenSource(char* pOrigUri) -{ + { //Make a local copy for uri - if ( !pOrigUri ) + if (!pOrigUri) return XA_RESULT_PARAMETER_INVALID; - + int uriLen = strlen(pOrigUri); - char* uri = new char[uriLen+1]; - if (! uri ) + char* uri = new char[uriLen + 1]; + if (!uri) { return XA_RESULT_MEMORY_FAILURE; } strncpy(uri, pOrigUri, uriLen); uri[uriLen] = '\0'; //////////////////////////////////////////// - _LIT8(KFileSlash,"file:///"); TInt fileslashlen = KFileSlash().Length(); - TPtr8 fileuri((TUint8*)uri, strlen(uri),strlen(uri)); - TPtr8 filepath = fileuri.RightTPtr(strlen(uri)-fileslashlen); - + TPtr8 fileuri((TUint8*) uri, strlen(uri), strlen(uri)); + TPtr8 filepath = fileuri.RightTPtr(strlen(uri) - fileslashlen); + TInt pos = filepath.LocateReverse(':'); - if(pos != KErrNotFound) - { - fileuri.Delete(fileslashlen+pos,1); - } + if (pos != KErrNotFound) + { + fileuri.Delete(fileslashlen + pos, 1); + } TUriParser8 localfileUri; TInt ret = localfileUri.Parse(fileuri); - if(ret == KErrNone) - { - HBufC* file = NULL; - TRAP(ret,file = localfileUri.GetFileNameL()); - if(ret == KErrNone) + if (ret == KErrNone) { - if(m_pS60Util) - { - ret = m_pS60Util->ParseSource(*file); - } - else if(m_pHXUtil) - { - ret = m_pHXUtil->ParseSource(*file); - } - else - { - ret = KErrNotFound; - } + HBufC* file = NULL; + TRAP(ret,file = localfileUri.GetFileNameL()); + if (ret == KErrNone) + { + if (m_pS60Util) + { + ret = m_pS60Util->ParseSource(*file); + } + else if (m_pHXUtil) + { + ret = m_pHXUtil->ParseSource(*file); + } + else + { + ret = KErrNotFound; + } + } + + delete file; } - - delete file; - } - - if(uri) - { - delete []uri; + + if (uri) + { + delete[] uri; + } + + if (ret != KErrNone) + { + //delete the utilities + if (m_pS60Util) + { + delete m_pS60Util; + m_pS60Util = NULL; + } + + if (m_pHXUtil) + { + delete m_pHXUtil; + m_pHXUtil = NULL; + } + + } + return ret; } - if(ret != KErrNone) - { - //delete the utilities - if(m_pS60Util) - { - delete m_pS60Util; - m_pS60Util = NULL; - } - - if(m_pHXUtil) - { - delete m_pHXUtil; - m_pHXUtil = NULL; - } +TInt CMetadataUtilityItf::ExtractUCS2(TDesC& inDes, char* outPtr, TInt maxLen) + { + TPtrC tempPtr = inDes.Left((maxLen / 2) - 1); //save last one for null terminator + TInt outLen = tempPtr.Length() + 1; - - } - return ret; -} + TPtr16 outDes((unsigned short*) outPtr, outLen); + outDes.Copy(tempPtr); + outDes.ZeroTerminate(); -TInt CMetadataUtilityItf::ExtractUCS2(TDesC& inDes, char* outPtr,TInt maxLen) -{ - TPtrC tempPtr = inDes.Left((maxLen/2)-1); //save last one for null terminator - TInt outLen = tempPtr.Length() + 1; - - TPtr16 outDes((unsigned short*)outPtr, outLen); - outDes.Copy(tempPtr); - outDes.ZeroTerminate(); - - return outLen * 2; //return size -} + return outLen * 2; //return size + } TInt CMetadataUtilityItf::CalculateNumMetadataItems(TUint*numItems) -{ - *numItems = 0; - - if(m_pS60Util) - { - return m_pS60Util->CalculateNumMetadataItems(numItems); - } - else if(m_pHXUtil) - { - return m_pHXUtil->CalculateNumMetadataItems(numItems); - } + { + *numItems = 0; - return KErrNone; -} + if (m_pS60Util) + { + return m_pS60Util->CalculateNumMetadataItems(numItems); + } + else if (m_pHXUtil) + { + return m_pHXUtil->CalculateNumMetadataItems(numItems); + } + + return KErrNone; + } char* CMetadataUtilityItf::GetKey(TInt index) -{ - if(m_pS60Util) - { - return m_pS60Util->GetKey(index); - } - else if(m_pHXUtil) - { - return m_pHXUtil->GetKey(index); - } + { + if (m_pS60Util) + { + return m_pS60Util->GetKey(index); + } + else if (m_pHXUtil) + { + return m_pHXUtil->GetKey(index); + } - return NULL; -} + return NULL; + } TInt CMetadataUtilityItf::GetValueSize(TInt index) -{ - if(m_pS60Util) - { - return m_pS60Util->GetValueSize(index); - } - else if(m_pHXUtil) - { - return m_pHXUtil->GetValueSize(index); - } + { + if (m_pS60Util) + { + return m_pS60Util->GetValueSize(index); + } + else if (m_pHXUtil) + { + return m_pHXUtil->GetValueSize(index); + } - return 0; -} + return 0; + } -TInt CMetadataUtilityItf::GetValue(TInt index, char* data, TInt maxLength, TInt* outSize, TInt* encodingType) -{ - if(m_pS60Util) - { - return m_pS60Util->GetValue(index, data, maxLength, outSize, encodingType); - } - else if(m_pHXUtil) - { - return m_pHXUtil->GetValue(index, data, maxLength, outSize, encodingType); - } +TInt CMetadataUtilityItf::GetValue(TInt index, char* data, TInt maxLength, + TInt* outSize, TInt* encodingType) + { + if (m_pS60Util) + { + return m_pS60Util->GetValue(index, data, maxLength, outSize, + encodingType); + } + else if (m_pHXUtil) + { + return m_pHXUtil->GetValue(index, data, maxLength, outSize, + encodingType); + } - return 0; -} + return 0; + } TInt CMetadataUtilityItf::ParseSource(char* uri) -{ - char* tempPtr = NULL; - char extension[MAX_EXTENSION_SIZE] = { 0 }; - - tempPtr = strchr(uri, (int)'.'); - strncpy(extension,tempPtr,sizeof(tempPtr)); - - for(unsigned int i=0;iReset(); - if(!CS60MetadataUtilityItf::IsSupportedExtension(extension)) - { - delete m_pS60Util; - m_pS60Util = NULL; - } - } + for (unsigned int i = 0; i < sizeof(extension); i++) + { + extension[i] = tolower(extension[i]); + } + + //if s60 util in use + if (m_pS60Util) + { + //reset existing instace + TInt ret = m_pS60Util->Reset(); + if (!CS60MetadataUtilityItf::IsSupportedExtension(extension)) + { + delete m_pS60Util; + m_pS60Util = NULL; + } + } - if(m_pHXUtil) - { - //reset existing instace - TInt ret = m_pHXUtil->Reset(); - if(CS60MetadataUtilityItf::IsSupportedExtension(extension)) - { - delete m_pHXUtil; - m_pHXUtil = NULL; - } - } + if (m_pHXUtil) + { + //reset existing instace + TInt ret = m_pHXUtil->Reset(); + if (CS60MetadataUtilityItf::IsSupportedExtension(extension)) + { + delete m_pHXUtil; + m_pHXUtil = NULL; + } + } - if(!m_pS60Util && !m_pHXUtil) - { - - if(CS60MetadataUtilityItf::IsSupportedExtension(extension)) - { - m_pS60Util = CS60MetadataUtilityItf::New(); - } - else - { - m_pHXUtil = CHXMetadataUtilityItf::New(); - } - } + if (!m_pS60Util && !m_pHXUtil) + { - return OpenSource(uri); -} + if (CS60MetadataUtilityItf::IsSupportedExtension(extension)) + { + m_pS60Util = CS60MetadataUtilityItf::New(); + } + else + { + m_pHXUtil = CHXMetadataUtilityItf::New(); + } + } + return OpenSource(uri); + } bool CS60MetadataUtilityItf::IsSupportedExtension(char *extn) -{ - if( (!strcasecmp(extn, ".mp3")) || - (!strcasecmp(extn, ".wma")) || - (!strcasecmp(extn, ".aac")) || - (!strcasecmp(extn, ".wav")) || - (!strcasecmp(extn, ".m4a"))) - { - return true; - } + { + if ((!strcasecmp(extn, ".mp3")) || (!strcasecmp(extn, ".wma")) + || (!strcasecmp(extn, ".aac")) || (!strcasecmp(extn, ".wav")) + || (!strcasecmp(extn, ".m4a"))) + { + return true; + } - return false; -} + return false; + } CS60MetadataUtilityItf* CS60MetadataUtilityItf::New() -{ - CS60MetadataUtilityItf* self = new CS60MetadataUtilityItf(); - - TInt err = KErrGeneral; - TRAP(err, self->ConstructL()); + { + CS60MetadataUtilityItf* self = new CS60MetadataUtilityItf(); + + TInt err = KErrGeneral; + TRAP(err, self->ConstructL()); - if(err == KErrNone) - { - return self; - } + if (err == KErrNone) + { + return self; + } - delete self; - return NULL; -} + delete self; + return NULL; + } -CS60MetadataUtilityItf::CS60MetadataUtilityItf():pMetaDataUtility(NULL) -{ -} +CS60MetadataUtilityItf::CS60MetadataUtilityItf() : + pMetaDataUtility(NULL) + { + } void CS60MetadataUtilityItf::ConstructL() -{ - TAG_TIME_PROFILING_BEGIN; - pMetaDataUtility = CMetaDataUtility::NewL(); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; -} - + { + TAG_TIME_PROFILING_BEGIN; + pMetaDataUtility = CMetaDataUtility::NewL(); + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; + } + CS60MetadataUtilityItf::~CS60MetadataUtilityItf() -{ - if(pMetaDataUtility) - { - TInt err = KErrGeneral; - - TAG_TIME_PROFILING_BEGIN; - TRAP(err, pMetaDataUtility->ResetL()); - delete pMetaDataUtility; - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; - } + { + if (pMetaDataUtility) + { + TInt err = KErrGeneral; - pMetaDataUtility = NULL; -} + TAG_TIME_PROFILING_BEGIN; + TRAP(err, pMetaDataUtility->ResetL()); + delete pMetaDataUtility; + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; + } + + pMetaDataUtility = NULL; + } TInt CS60MetadataUtilityItf::ParseSource(TDesC& fileName) -{ - TInt err = KErrGeneral; + { + TInt err = KErrGeneral; + + if (pMetaDataUtility) + { - if(pMetaDataUtility) - { - - TAG_TIME_PROFILING_BEGIN; - //open with the file handle - TRAP(err, pMetaDataUtility->OpenFileL(fileName)); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; + TAG_TIME_PROFILING_BEGIN; + //open with the file handle + TRAP(err, pMetaDataUtility->OpenFileL(fileName)); + TAG_TIME_PROFILING_END; + PRINT_TO_CONSOLE_TIME_DIFF; - if(err == KErrNone) - { - uNumMetadataItems = pMetaDataUtility->MetaDataCount(); - } - } + if (err == KErrNone) + { + uNumMetadataItems = pMetaDataUtility->MetaDataCount(); + } + } - return err; -} + return err; + } TInt CS60MetadataUtilityItf::CalculateNumMetadataItems(TUint* numItems) -{ - TInt err = KErrGeneral; + { + TInt err = KErrGeneral; - if(pMetaDataUtility && numItems) - { - *numItems = uNumMetadataItems; - err = KErrNone; - } + if (pMetaDataUtility && numItems) + { + *numItems = uNumMetadataItems; + err = KErrNone; + } - return err; -} + return err; + } char* CS60MetadataUtilityItf::KeyMapping(TMetaDataFieldId fldID) -{ - switch(fldID) - { - - case EMetaDataSongTitle: - { - return "KhronosTitle"; - } - case EMetaDataArtist: - { - return "KhronosArtist"; - } - case EMetaDataAlbum: - { - return "KhronosAlbum"; - } - case EMetaDataYear: - { - return "KhronosYear"; - } - case EMetaDataComment: - { - return "KhronosComment"; - } - case EMetaDataAlbumTrack: - { - return "KhronosTrackNumber"; - } - case EMetaDataGenre: - { - return "KhronosGenre"; - } - case EMetaDataComposer: - { - return "Composer"; //Non Standard - } - case EMetaDataCopyright: - { - return "KhronosCopyright"; - } - case EMetaDataOriginalArtist: - { - return "Original Artist"; //Non Standard - } - case EMetaDataUserUrl: - case EMetaDataUrl: - { - return "KhronosContentURL"; - } - case EMetaDataJpeg: - { - return "attachedpicture";//"KhronosAlbumArtJPEG"; - } - case EMetaDataVendor: - { - return "Vendor"; //Non Standard - } - case EMetaDataRating: - { - return "KhronosRating"; - } - case EMetaDataDuration: - { - return "Duration"; //Non Standard - } - default: - { - } - } + { + switch (fldID) + { - return "UnSupported"; -} + case EMetaDataSongTitle: + { + return "KhronosTitle"; + } + case EMetaDataArtist: + { + return "KhronosArtist"; + } + case EMetaDataAlbum: + { + return "KhronosAlbum"; + } + case EMetaDataYear: + { + return "KhronosYear"; + } + case EMetaDataComment: + { + return "KhronosComment"; + } + case EMetaDataAlbumTrack: + { + return "KhronosTrackNumber"; + } + case EMetaDataGenre: + { + return "KhronosGenre"; + } + case EMetaDataComposer: + { + return "Composer"; //Non Standard + } + case EMetaDataCopyright: + { + return "KhronosCopyright"; + } + case EMetaDataOriginalArtist: + { + return "Original Artist"; //Non Standard + } + case EMetaDataUserUrl: + case EMetaDataUrl: + { + return "KhronosContentURL"; + } + case EMetaDataJpeg: + { + return "attachedpicture";//"KhronosAlbumArtJPEG"; + } + case EMetaDataVendor: + { + return "Vendor"; //Non Standard + } + case EMetaDataRating: + { + return "KhronosRating"; + } + case EMetaDataDuration: + { + return "Duration"; //Non Standard + } + default: + { + } + } + + return "UnSupported"; + } TInt CS60MetadataUtilityItf::ValueEncoding(TMetaDataFieldId fldID) -{ - switch(fldID) - { - case EMetaDataJpeg: - { - return CMetadataUtilityItf::EBinaryEncoding; - } - - case EMetaDataSongTitle: - case EMetaDataArtist: - case EMetaDataAlbum: - case EMetaDataYear: - case EMetaDataComment: - case EMetaDataAlbumTrack: - case EMetaDataGenre: - case EMetaDataComposer: - case EMetaDataCopyright: - case EMetaDataOriginalArtist: - case EMetaDataUserUrl: - case EMetaDataUrl: - case EMetaDataVendor: - case EMetaDataRating: - case EMetaDataDuration: - default: - { - return CMetadataUtilityItf::EUnicodeEncoding; - } - } - -} + { + switch (fldID) + { + case EMetaDataJpeg: + { + return CMetadataUtilityItf::EBinaryEncoding; + } + + case EMetaDataSongTitle: + case EMetaDataArtist: + case EMetaDataAlbum: + case EMetaDataYear: + case EMetaDataComment: + case EMetaDataAlbumTrack: + case EMetaDataGenre: + case EMetaDataComposer: + case EMetaDataCopyright: + case EMetaDataOriginalArtist: + case EMetaDataUserUrl: + case EMetaDataUrl: + case EMetaDataVendor: + case EMetaDataRating: + case EMetaDataDuration: + default: + { + return CMetadataUtilityItf::EUnicodeEncoding; + } + } + + } char* CS60MetadataUtilityItf::GetKey(TInt index) -{ + { + + if (pMetaDataUtility && index < uNumMetadataItems) + { + + TMetaDataFieldId fieldId; - if(pMetaDataUtility && index < uNumMetadataItems) - { - - TMetaDataFieldId fieldId; - - TAG_TIME_PROFILING_BEGIN; - TInt err = KErrGeneral; - TRAP(err, pMetaDataUtility->MetaDataFieldsL().FieldIdAt( index, fieldId )); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; - - if((err == KErrNone) && (fieldId != EUnknownMetaDataField)) - { - return KeyMapping(fieldId); - } - } - return NULL; -} + TAG_TIME_PROFILING_BEGIN; + TInt err = KErrGeneral; + TRAP(err, pMetaDataUtility->MetaDataFieldsL().FieldIdAt( index, fieldId )); + TAG_TIME_PROFILING_END; + PRINT_TO_CONSOLE_TIME_DIFF; + + if ((err == KErrNone) && (fieldId != EUnknownMetaDataField)) + { + return KeyMapping(fieldId); + } + } + return NULL; + } TInt CS60MetadataUtilityItf::GetValueSize(TInt index) -{ - if(pMetaDataUtility && index < uNumMetadataItems) - { - - TMetaDataFieldId fieldId; - TInt err = KErrGeneral; - TRAP(err, pMetaDataUtility->MetaDataFieldsL().FieldIdAt( index, fieldId )); + { + if (pMetaDataUtility && index < uNumMetadataItems) + { + + TMetaDataFieldId fieldId; + TInt err = KErrGeneral; + TRAP(err, pMetaDataUtility->MetaDataFieldsL().FieldIdAt( index, fieldId )); - if((err == KErrNone) && (fieldId != EUnknownMetaDataField)) - { - const CMetaDataFieldContainer* iContainer = NULL; - TRAP(err, iContainer = &pMetaDataUtility->MetaDataFieldsL()); - if(err == KErrNone) - { - if(ValueEncoding(fieldId) == CMetadataUtilityItf::EUnicodeEncoding) - { - TPtrC field = iContainer->Field( fieldId ); - if(field != KNullDesC) - { - return field.Size() + 2; //additional character (two bytes) for null terminator - } - } - else //Binary - { - TPtrC8 field8 = iContainer->Field8( fieldId ); - if(field8 != KNullDesC8) - { - return field8.Size(); - } - } - } - } - } + if ((err == KErrNone) && (fieldId != EUnknownMetaDataField)) + { + const CMetaDataFieldContainer* iContainer = NULL; + TRAP(err, iContainer = &pMetaDataUtility->MetaDataFieldsL()); + if (err == KErrNone) + { + if (ValueEncoding(fieldId) + == CMetadataUtilityItf::EUnicodeEncoding) + { + TPtrC field = iContainer->Field(fieldId); + if (field != KNullDesC) + { + return field.Size() + 2; //additional character (two bytes) for null terminator + } + } + else //Binary + { + TPtrC8 field8 = iContainer->Field8(fieldId); + if (field8 != KNullDesC8) + { + return field8.Size(); + } + } + } + } + } - return 0; -} - -TInt CS60MetadataUtilityItf::GetValue(TInt index, char* data, TInt maxLength, //in params - TInt* outSize, TInt* encodingType) //out params -{ + return 0; + } - TInt retValueSize = 0; - *encodingType= CMetadataUtilityItf::EUnknownEncoding; +TInt CS60MetadataUtilityItf::GetValue(TInt index, char* data, TInt maxLength, //in params + TInt* outSize, TInt* encodingType) //out params + { + + TInt retValueSize = 0; + *encodingType = CMetadataUtilityItf::EUnknownEncoding; + + if (pMetaDataUtility && index < uNumMetadataItems) + { - if(pMetaDataUtility && index < uNumMetadataItems) - { - - TMetaDataFieldId fieldId; - TInt err = KErrGeneral; - TRAP(err, pMetaDataUtility->MetaDataFieldsL().FieldIdAt( index, fieldId )); - - - if((err==KErrNone) && (fieldId != EUnknownMetaDataField)) - { - - const CMetaDataFieldContainer* iContainer = NULL; - TRAP(err, iContainer = &pMetaDataUtility->MetaDataFieldsL()); - if(err == KErrNone) - { - *encodingType = ValueEncoding(fieldId); - if(*encodingType == CMetadataUtilityItf::EUnicodeEncoding) - { - - - TAG_TIME_PROFILING_BEGIN; - TPtrC field = iContainer->Field( fieldId ); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; - if(field != KNullDesC) - { - *outSize = CMetadataUtilityItf::ExtractUCS2(field, data, maxLength); - retValueSize = field.Size() + 2; //actual size - } - } - else //Binary - { - - TAG_TIME_PROFILING_BEGIN; - TPtrC8 field8 = iContainer->Field8( fieldId ); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; - if(field8 != KNullDesC8) - { - *outSize = (maxLength > field8.Size())?field8.Size():maxLength; - memcpy(data, field8.Ptr(), *outSize); - retValueSize = field8.Size(); - } - } - } - } - } + TMetaDataFieldId fieldId; + TInt err = KErrGeneral; + TRAP(err, pMetaDataUtility->MetaDataFieldsL().FieldIdAt( index, fieldId )); + + if ((err == KErrNone) && (fieldId != EUnknownMetaDataField)) + { + + const CMetaDataFieldContainer* iContainer = NULL; + TRAP(err, iContainer = &pMetaDataUtility->MetaDataFieldsL()); + if (err == KErrNone) + { + *encodingType = ValueEncoding(fieldId); + if (*encodingType == CMetadataUtilityItf::EUnicodeEncoding) + { - return retValueSize; -} + TAG_TIME_PROFILING_BEGIN; + TPtrC field = iContainer->Field(fieldId); + TAG_TIME_PROFILING_END; + PRINT_TO_CONSOLE_TIME_DIFF; + if (field != KNullDesC) + { + *outSize = CMetadataUtilityItf::ExtractUCS2(field, + data, maxLength); + retValueSize = field.Size() + 2; //actual size + } + } + else //Binary + { + + TAG_TIME_PROFILING_BEGIN; + TPtrC8 field8 = iContainer->Field8(fieldId); + TAG_TIME_PROFILING_END; + PRINT_TO_CONSOLE_TIME_DIFF; + if (field8 != KNullDesC8) + { + *outSize + = (maxLength > field8.Size()) + ? field8.Size() + : maxLength; + memcpy(data, field8.Ptr(), *outSize); + retValueSize = field8.Size(); + } + } + } + } + } + + return retValueSize; + } TInt CS60MetadataUtilityItf::Reset() -{ - TInt err = KErrNone; - if(pMetaDataUtility) - { - TRAP(err, pMetaDataUtility->ResetL()); - } + { + TInt err = KErrNone; + if (pMetaDataUtility) + { + TRAP(err, pMetaDataUtility->ResetL()); + } - return err; -} - + return err; + } -CHXMetadataUtilityItf::CHXMetadataUtilityItf():pHXMetaDataUtility(NULL) -{ -} +CHXMetadataUtilityItf::CHXMetadataUtilityItf() : + pHXMetaDataUtility(NULL) + { + } void CHXMetadataUtilityItf::ConstructL() -{ - TAG_TIME_PROFILING_BEGIN; - pHXMetaDataUtility = CHXMetaDataUtility::NewL(); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; -} + { + TAG_TIME_PROFILING_BEGIN; + pHXMetaDataUtility = CHXMetaDataUtility::NewL(); + TAG_TIME_PROFILING_END; + PRINT_TO_CONSOLE_TIME_DIFF; + } - CHXMetadataUtilityItf* CHXMetadataUtilityItf::New() -{ - CHXMetadataUtilityItf* self = new CHXMetadataUtilityItf(); + { + CHXMetadataUtilityItf* self = new CHXMetadataUtilityItf(); + + if (self) + { + TInt err = KErrGeneral; + TRAP(err, self->ConstructL()); - if(self) - { - TInt err = KErrGeneral; - TRAP(err, self->ConstructL()); - - if(err != KErrNone) - { - delete self; - self = NULL; - } - } - - return self; -} - + if (err != KErrNone) + { + delete self; + self = NULL; + } + } + + return self; + } + CHXMetadataUtilityItf::~CHXMetadataUtilityItf() -{ - if(pHXMetaDataUtility) - { - TInt err = KErrGeneral; - - TAG_TIME_PROFILING_BEGIN; - TRAP(err, pHXMetaDataUtility->ResetL()); - delete pHXMetaDataUtility; - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; - } + { + if (pHXMetaDataUtility) + { + TInt err = KErrGeneral; - pHXMetaDataUtility = NULL; -} + TAG_TIME_PROFILING_BEGIN; + TRAP(err, pHXMetaDataUtility->ResetL()); + delete pHXMetaDataUtility; + TAG_TIME_PROFILING_END; + PRINT_TO_CONSOLE_TIME_DIFF; + } + + pHXMetaDataUtility = NULL; + } TInt CHXMetadataUtilityItf::Reset() -{ - TInt err = KErrNone; - if(pHXMetaDataUtility) - { - TRAP(err, pHXMetaDataUtility->ResetL()); - } + { + TInt err = KErrNone; + if (pHXMetaDataUtility) + { + TRAP(err, pHXMetaDataUtility->ResetL()); + } - return err; -} - - + return err; + } TInt CHXMetadataUtilityItf::ParseSource(TDesC& fileName) -{ - TInt err = KErrGeneral; + { + TInt err = KErrGeneral; - if(pHXMetaDataUtility) - { - //open with the file handle - TAG_TIME_PROFILING_BEGIN; - TRAP(err, pHXMetaDataUtility->OpenFileL(fileName)); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; + if (pHXMetaDataUtility) + { + //open with the file handle + TAG_TIME_PROFILING_BEGIN; + TRAP(err, pHXMetaDataUtility->OpenFileL(fileName)); + TAG_TIME_PROFILING_END; + PRINT_TO_CONSOLE_TIME_DIFF; - if(err == KErrNone) - { - return pHXMetaDataUtility->GetMetaDataCount(uNumMetadataItems); - } - } + if (err == KErrNone) + { + return pHXMetaDataUtility->GetMetaDataCount(uNumMetadataItems); + } + } - return err; -} + return err; + } TInt CHXMetadataUtilityItf::CalculateNumMetadataItems(TUint* numItems) -{ - TInt err = KErrGeneral; + { + TInt err = KErrGeneral; - if(pHXMetaDataUtility && numItems) - { - *numItems = uNumMetadataItems; - err = KErrNone; - } + if (pHXMetaDataUtility && numItems) + { + *numItems = uNumMetadataItems; + err = KErrNone; + } - return err; -} + return err; + } char* CHXMetadataUtilityItf::KeyMapping(HXMetaDataKeys::EHXMetaDataId fldID) -{ - - switch(fldID) - { - - case HXMetaDataKeys::EHXTitle: - { - return "KhronosTitle"; - } - case HXMetaDataKeys::EHXPerformer: - { - return "KhronosArtist"; - } - case HXMetaDataKeys::EHXDescription: - { - return "KhronosComment"; - } - case HXMetaDataKeys::EHXGenre: - { - return "KhronosGenre"; - } - case HXMetaDataKeys::EHXAuthor: - { - return "Composer"; //Non Standard - } - case HXMetaDataKeys::EHXCopyright: - { - return "KhronosCopyright"; - } - case HXMetaDataKeys::EHXContentURI: - { - return "KhronosContentURL"; - } - case HXMetaDataKeys::EHXDuration: - { - return "Duration"; //Non Standard - } - case HXMetaDataKeys::EHXClipBitRate: - { - return "ClipBitRate"; //non-standard - } - case HXMetaDataKeys::EHXVideoBitRate: - { - return "VideoBitRate"; // non-standard - } - case HXMetaDataKeys::EHXAudioBitRate: - { - return "AudioBitRate"; - } - case HXMetaDataKeys::EHXCodec: - { - return "Codec"; - } - case HXMetaDataKeys::EHXFrameSize: - { - return "Resolution"; - } - case HXMetaDataKeys::EHXFramesPerSecond: - { - return "FrameRate"; - } - case HXMetaDataKeys::EHXStreamCount: - { - return "Stream Count"; - } - case HXMetaDataKeys::EHXLiveStream: - { - return "Live Stream"; - } + { + + switch (fldID) + { + + case HXMetaDataKeys::EHXTitle: + { + return "KhronosTitle"; + } + case HXMetaDataKeys::EHXPerformer: + { + return "KhronosArtist"; + } + case HXMetaDataKeys::EHXDescription: + { + return "KhronosComment"; + } + case HXMetaDataKeys::EHXGenre: + { + return "KhronosGenre"; + } + case HXMetaDataKeys::EHXAuthor: + { + return "Composer"; //Non Standard + } + case HXMetaDataKeys::EHXCopyright: + { + return "KhronosCopyright"; + } + case HXMetaDataKeys::EHXContentURI: + { + return "KhronosContentURL"; + } + case HXMetaDataKeys::EHXDuration: + { + return "Duration"; //Non Standard + } + case HXMetaDataKeys::EHXClipBitRate: + { + return "ClipBitRate"; //non-standard + } + case HXMetaDataKeys::EHXVideoBitRate: + { + return "VideoBitRate"; // non-standard + } + case HXMetaDataKeys::EHXAudioBitRate: + { + return "AudioBitRate"; + } + case HXMetaDataKeys::EHXCodec: + { + return "Codec"; + } + case HXMetaDataKeys::EHXFrameSize: + { + return "Resolution"; + } + case HXMetaDataKeys::EHXFramesPerSecond: + { + return "FrameRate"; + } + case HXMetaDataKeys::EHXStreamCount: + { + return "Stream Count"; + } + case HXMetaDataKeys::EHXLiveStream: + { + return "Live Stream"; + } case HXMetaDataKeys::EHXSeekable: - { - return "Seekable"; - } + { + return "Seekable"; + } case HXMetaDataKeys::EHXContentType: - { - return "Content Type"; - } - case HXMetaDataKeys::EHXFormat: - { - return "Format"; - } + { + return "Content Type"; + } + case HXMetaDataKeys::EHXFormat: + { + return "Format"; + } case HXMetaDataKeys::EHXQuality: - { - return "Quality"; - } + { + return "Quality"; + } case HXMetaDataKeys::EHXAbstract: - { - return "Abstract"; - } - case HXMetaDataKeys::EHXMimeType: - { - return "MimeType"; - } - case HXMetaDataKeys::EHXIconURI: - { - return "Icon URI"; - } + { + return "Abstract"; + } + case HXMetaDataKeys::EHXMimeType: + { + return "MimeType"; + } + case HXMetaDataKeys::EHXIconURI: + { + return "Icon URI"; + } case HXMetaDataKeys::EHXEPreviewURI: - { - return "Preview URI"; - } + { + return "Preview URI"; + } case HXMetaDataKeys::EHXContentID: - { - return "Content ID"; - } + { + return "Content ID"; + } case HXMetaDataKeys::EHXInfoURL: - { - return "Info URL"; - } - default: - { - } - } + { + return "Info URL"; + } + default: + { + } + } - return "UnSupported"; -} + return "UnSupported"; + } TInt CHXMetadataUtilityItf::ValueEncoding(HXMetaDataKeys::EHXMetaDataId fldID) -{ - switch(fldID) - { - default: - { - return CMetadataUtilityItf::EUnicodeEncoding; - } - } - -} + { + switch (fldID) + { + default: + { + return CMetadataUtilityItf::EUnicodeEncoding; + } + } + + } char* CHXMetadataUtilityItf::GetKey(TInt index) -{ + { - if(pHXMetaDataUtility && index < uNumMetadataItems) - { - HXMetaDataKeys::EHXMetaDataId id; - HBufC* pDes; - - TAG_TIME_PROFILING_BEGIN; - TInt err = pHXMetaDataUtility->GetMetaDataAt(index, id, pDes); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; - - if(err == KErrNone) - { - return KeyMapping(id); - } - } - return NULL; -} + if (pHXMetaDataUtility && index < uNumMetadataItems) + { + HXMetaDataKeys::EHXMetaDataId id; + HBufC* pDes; + + TAG_TIME_PROFILING_BEGIN; + TInt err = pHXMetaDataUtility->GetMetaDataAt(index, id, pDes); + TAG_TIME_PROFILING_END; + PRINT_TO_CONSOLE_TIME_DIFF; + + if (err == KErrNone) + { + return KeyMapping(id); + } + } + return NULL; + } TInt CHXMetadataUtilityItf::GetValueSize(TInt index) -{ - if(pHXMetaDataUtility && index < uNumMetadataItems) - { - HXMetaDataKeys::EHXMetaDataId id; - HBufC* pDes; - - TInt err = pHXMetaDataUtility->GetMetaDataAt(index, id, pDes); - - if(err == KErrNone) - { - if(ValueEncoding(id) == CMetadataUtilityItf::EUnicodeEncoding) - { - return pDes->Size() + 2; //additional character (two bytes) for null terminator - } - else //Binary - { - //no support - } - } - } + { + if (pHXMetaDataUtility && index < uNumMetadataItems) + { + HXMetaDataKeys::EHXMetaDataId id; + HBufC* pDes; + + TInt err = pHXMetaDataUtility->GetMetaDataAt(index, id, pDes); - return 0; -} - -TInt CHXMetadataUtilityItf::GetValue(TInt index, char* data, TInt maxLength, //in params - TInt* outSize, TInt* encodingType) //out params -{ + if (err == KErrNone) + { + if (ValueEncoding(id) == CMetadataUtilityItf::EUnicodeEncoding) + { + return pDes->Size() + 2; //additional character (two bytes) for null terminator + } + else //Binary + { + //no support + } + } + } - TInt retValueSize = 0; - *encodingType= CMetadataUtilityItf::EUnknownEncoding; + return 0; + } + +TInt CHXMetadataUtilityItf::GetValue(TInt index, char* data, TInt maxLength, //in params + TInt* outSize, TInt* encodingType) //out params + { + + TInt retValueSize = 0; + *encodingType = CMetadataUtilityItf::EUnknownEncoding; - if(pHXMetaDataUtility && index < uNumMetadataItems) - { - HXMetaDataKeys::EHXMetaDataId id; - HBufC* pDes; + if (pHXMetaDataUtility && index < uNumMetadataItems) + { + HXMetaDataKeys::EHXMetaDataId id; + HBufC* pDes; + + TAG_TIME_PROFILING_BEGIN; + TInt err = pHXMetaDataUtility->GetMetaDataAt(index, id, pDes); + TAG_TIME_PROFILING_END; + PRINT_TO_CONSOLE_TIME_DIFF; + + *encodingType = ValueEncoding(id); - - TAG_TIME_PROFILING_BEGIN; - TInt err = pHXMetaDataUtility->GetMetaDataAt(index, id, pDes); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; - - *encodingType = ValueEncoding(id); - - if(err == KErrNone) - { - if(*encodingType == CMetadataUtilityItf::EUnicodeEncoding) - { - *outSize = CMetadataUtilityItf::ExtractUCS2(*pDes, data, maxLength); - retValueSize = pDes->Size() + 2; //actual Size - } - else //Binary - { - //no support - } - } - } + if (err == KErrNone) + { + if (*encodingType == CMetadataUtilityItf::EUnicodeEncoding) + { + *outSize = CMetadataUtilityItf::ExtractUCS2(*pDes, data, + maxLength); + retValueSize = pDes->Size() + 2; //actual Size + } + else //Binary + { + //no support + } + } + } - return retValueSize; -} + return retValueSize; + } - -extern "C" { +extern "C" + { void* mmf_metadata_utility_init(char* uri) - { - return CMetadataUtilityItf::New(uri); - } + { + return CMetadataUtilityItf::New(uri); + } void mmf_metadata_utility_destroy(void* context) - { - delete ((CMetadataUtilityItf*)context); - } + { + delete ((CMetadataUtilityItf*) context); + } + + XAresult mmf_metadata_utility_parse_source(void* context, char* uri) + { + TInt err = ((CMetadataUtilityItf*) context)->ParseSource(uri); + + if (err == KErrNone) + { + return XA_RESULT_SUCCESS; + } - XAresult mmf_metadata_utility_parse_source(void* context, char* uri) - { - TInt err = ((CMetadataUtilityItf*)context)->ParseSource(uri); - - if(err == KErrNone) - { - return XA_RESULT_SUCCESS; - } - - return XA_RESULT_PARAMETER_INVALID; - } + return XA_RESULT_PARAMETER_INVALID; + } + XAresult mmf_get_item_count(void* context, XAuint32* itemCount) + { + if (itemCount) + { + TInt err =((CMetadataUtilityItf*) (context))->CalculateNumMetadataItems( + (TUint *) itemCount); + if (err == KErrNone) + { + return XA_RESULT_SUCCESS; + } + } + + return XA_RESULT_PARAMETER_INVALID; + } - XAresult mmf_get_item_count(void* context, XAuint32* itemCount) - { - if(itemCount) - { - TInt err = ((CMetadataUtilityItf*)(context))->CalculateNumMetadataItems((TUint *)itemCount); - if(err == KErrNone) - { - return XA_RESULT_SUCCESS; - } - } + XAresult mmf_get_key_size(void* context, XAuint32 keyIndex, + XAuint32* keySize) + { + char* key = ((CMetadataUtilityItf*) (context))->GetKey(keyIndex); + if (key && keySize) + { + *keySize = (strlen(key) + sizeof(XAMetadataInfo)); + + return XA_RESULT_SUCCESS; + } + + return XA_RESULT_PARAMETER_INVALID; + } - return XA_RESULT_PARAMETER_INVALID; - } - - XAresult mmf_get_key_size(void* context, XAuint32 keyIndex, XAuint32* keySize) - { - char* key = ((CMetadataUtilityItf*)(context))->GetKey(keyIndex); - if(key && keySize) - { - *keySize = (strlen(key) + sizeof(XAMetadataInfo)); - - return XA_RESULT_SUCCESS; - } - - return XA_RESULT_PARAMETER_INVALID; - } - + XAresult mmf_get_key(void* context, XAuint32 index, XAuint32 keySize, + XAMetadataInfo *pKey) + { + XAresult ret = XA_RESULT_PARAMETER_INVALID; + + TInt keyDataSize = keySize - sizeof(XAMetadataInfo) + 1; + char* ascKey = ((CMetadataUtilityItf*) (context))->GetKey(index); - XAresult mmf_get_key(void* context, XAuint32 index,XAuint32 keySize, XAMetadataInfo *pKey) - { - XAresult ret = XA_RESULT_PARAMETER_INVALID; - - TInt keyDataSize = keySize - sizeof(XAMetadataInfo) + 1; - char* ascKey = ((CMetadataUtilityItf*)(context))->GetKey(index); + if (ascKey && keyDataSize) + { + TInt ascKeySize = strlen(ascKey); + TInt outSize = (ascKeySize >= keyDataSize) + ? (keyDataSize - 1) + : ascKeySize; + + pKey->size = outSize + 1; + pKey->encoding = XA_CHARACTERENCODING_ASCII; + strcpy((char *) (pKey->langCountry), "en-us"); + strncpy((char *) (pKey->data), ascKey, outSize); + pKey->data[outSize] = '\0'; - if(ascKey && keyDataSize) - { - TInt ascKeySize = strlen(ascKey); - TInt outSize = (ascKeySize >= keyDataSize) ? (keyDataSize - 1) : ascKeySize; - - pKey->size = outSize + 1; - pKey->encoding = XA_CHARACTERENCODING_ASCII; - strcpy((char *)(pKey->langCountry), "en-us"); - strncpy((char *)(pKey->data), ascKey, outSize); - pKey->data[outSize] = '\0'; + if (ascKeySize >= keyDataSize) + { + ret = XA_RESULT_BUFFER_INSUFFICIENT; + } + else + { + ret = XA_RESULT_SUCCESS; + } + } + + ret = XA_RESULT_SUCCESS; + return ret; + } - if(ascKeySize >= keyDataSize) - { - ret = XA_RESULT_BUFFER_INSUFFICIENT; - } - else - { - ret = XA_RESULT_SUCCESS; - } - } + XAresult mmf_get_value_size(void* context, XAuint32 index, + XAuint32 *pValueSize) + { + if (pValueSize) + { + *pValueSize = ((CMetadataUtilityItf*) (context))->GetValueSize( + index) + sizeof(XAMetadataInfo) - 1; + //XAMetadataInfo already includes one byte for Data - ret = XA_RESULT_SUCCESS; - return ret; - } + return XA_RESULT_SUCCESS; + } - XAresult mmf_get_value_size(void* context, XAuint32 index, XAuint32 *pValueSize) - { - if(pValueSize) - { - *pValueSize = ((CMetadataUtilityItf*)(context))->GetValueSize(index) + sizeof(XAMetadataInfo) - 1; //XAMetadataInfo already includes one byte for Data - - return XA_RESULT_SUCCESS; - } + return XA_RESULT_PARAMETER_INVALID; + } - return XA_RESULT_PARAMETER_INVALID; - } - - XAresult mmf_get_value(void* context, XAuint32 index, XAuint32 valueSize, XAMetadataInfo *pValue) - { - XAresult ret = XA_RESULT_PARAMETER_INVALID; - TInt dataSize = valueSize - sizeof(XAMetadataInfo) + 1; - TInt outLen = 0, encodingType = CMetadataUtilityItf::EUnknownEncoding; + XAresult mmf_get_value(void* context, XAuint32 index, XAuint32 valueSize, + XAMetadataInfo *pValue) + { + XAresult ret = XA_RESULT_PARAMETER_INVALID; + TInt dataSize = valueSize - sizeof(XAMetadataInfo) + 1; + TInt outLen = 0, encodingType = CMetadataUtilityItf::EUnknownEncoding; - if(dataSize > 0) - { - - TInt actualDataSize = ((CMetadataUtilityItf*)(context))->GetValue(index, (char*)pValue->data, dataSize, &outLen, &encodingType); + if (dataSize > 0) + { - pValue->size = outLen; - pValue->encoding = (encodingType == CMetadataUtilityItf::EUnicodeEncoding) ? XA_CHARACTERENCODING_UTF16LE : XA_CHARACTERENCODING_BINARY; - strcpy((char *)(pValue->langCountry), "en-us"); + TInt actualDataSize = + ((CMetadataUtilityItf*) (context))->GetValue(index, + (char*) pValue->data, dataSize, &outLen, + &encodingType); - if(!actualDataSize) - { - return XA_RESULT_INTERNAL_ERROR; - } - if(actualDataSize > dataSize) - { - ret = XA_RESULT_BUFFER_INSUFFICIENT; - } - else - { - ret = XA_RESULT_SUCCESS; - } - } - - return ret; - } -} + pValue->size = outLen; + pValue->encoding + = (encodingType == CMetadataUtilityItf::EUnicodeEncoding) + ? XA_CHARACTERENCODING_UTF16LE : XA_CHARACTERENCODING_BINARY; + strcpy((char *) (pValue->langCountry), "en-us"); + if (!actualDataSize) + { + return XA_RESULT_INTERNAL_ERROR; + } + if (actualDataSize > dataSize) + { + ret = XA_RESULT_BUFFER_INSUFFICIENT; + } + else + { + ret = XA_RESULT_SUCCESS; + } + } + + return ret; + } + } + diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,7 +1,23 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata backend engine + * + */ + #ifndef CMETADATA_UTILITY_ITF_H #define CMETADATA_UTILITY_ITF_H - #ifdef __cplusplus #include @@ -14,7 +30,6 @@ #include #include - #define MAX_EXTENSION_SIZE 10 #define uint32 unsigned int @@ -22,112 +37,109 @@ class CHXMetadataUtilityItf; NONSHARABLE_CLASS(CMetadataUtilityItf) -{ + { public: - enum TValueEncodingType - { - EUnknownEncoding, - EAsciiEncoding, - EUnicodeEncoding, - EBinaryEncoding, - }; - - static CMetadataUtilityItf* New(char* uri); + enum TValueEncodingType + { + EUnknownEncoding, EAsciiEncoding, EUnicodeEncoding, EBinaryEncoding, + }; + + static CMetadataUtilityItf* New(char* uri); - CMetadataUtilityItf(); - virtual ~CMetadataUtilityItf(); - TInt ParseSource(char* uri); - TInt OpenSource(char* uri); - TInt CalculateNumMetadataItems(TUint*); - char* GetKey(TInt index); - TInt GetValueSize(TInt index); - TInt GetValue(TInt index, char* data, TInt maxLength, TInt* outSize, TInt* encodingType); + CMetadataUtilityItf(); + virtual ~CMetadataUtilityItf(); + TInt ParseSource(char* uri); + TInt OpenSource(char* uri); + TInt CalculateNumMetadataItems(TUint*); + char* GetKey(TInt index); + TInt GetValueSize(TInt index); + TInt GetValue(TInt index, char* data, TInt maxLength, TInt* outSize, + TInt* encodingType); - //helper function - //extracts left part of input descriptor upto (maxLen-1) and copies content in outPtr - //append a null terminator - static TInt ExtractUCS2(TDesC& inDes, char* outPtr,TInt maxLen); + //helper function + //extracts left part of input descriptor upto (maxLen-1) and copies content in outPtr + //append a null terminator + static TInt ExtractUCS2(TDesC& inDes, char* outPtr, TInt maxLen); private: - CS60MetadataUtilityItf* m_pS60Util; - CHXMetadataUtilityItf* m_pHXUtil; -}; - + CS60MetadataUtilityItf* m_pS60Util; + CHXMetadataUtilityItf* m_pHXUtil; + }; NONSHARABLE_CLASS(CS60MetadataUtilityItf) -{ + { public: - static CS60MetadataUtilityItf* New(); - ~CS60MetadataUtilityItf(); + static CS60MetadataUtilityItf* New(); + ~CS60MetadataUtilityItf(); - TInt CalculateNumMetadataItems(TUint*); - - char* GetKey(TInt index); - TInt GetValueSize(TInt index); - TInt GetValue(TInt index, char* data, TInt maxLength, TInt* outSize, TInt* encodingType); + TInt CalculateNumMetadataItems(TUint*); - TInt ParseSource(TDesC&); + char* GetKey(TInt index); + TInt GetValueSize(TInt index); + TInt GetValue(TInt index, char* data, TInt maxLength, TInt* outSize, + TInt* encodingType); + + TInt ParseSource(TDesC&); - char* KeyMapping(TMetaDataFieldId); - TInt ValueEncoding(TMetaDataFieldId); + char* KeyMapping(TMetaDataFieldId); + TInt ValueEncoding(TMetaDataFieldId); - static bool IsSupportedExtension(char* extn); + static bool IsSupportedExtension(char* extn); - TInt Reset(); + TInt Reset(); private: - + CS60MetadataUtilityItf(); void ConstructL(); - - CMetaDataUtility* pMetaDataUtility; //S60MetadataUtility - - TUint uNumMetadataItems; - -}; + + CMetaDataUtility* pMetaDataUtility; //S60MetadataUtility + + TUint uNumMetadataItems; + + }; NONSHARABLE_CLASS(CHXMetadataUtilityItf) -{ + { public: - static CHXMetadataUtilityItf* New(); - ~CHXMetadataUtilityItf(); + static CHXMetadataUtilityItf* New(); + ~CHXMetadataUtilityItf(); + + TInt CalculateNumMetadataItems(TUint*); + + char* GetKey(TInt index); - TInt CalculateNumMetadataItems(TUint*); - - char* GetKey(TInt index); - - TInt ValueEncoding(HXMetaDataKeys::EHXMetaDataId fldID); - TInt GetValueSize(TInt index); - TInt GetValue(TInt index, char* data, TInt maxLength, TInt* outSize, TInt* encodingType); - - TInt ParseSource(TDesC&); - char* KeyMapping(HXMetaDataKeys::EHXMetaDataId); - - TInt Reset(); + TInt ValueEncoding(HXMetaDataKeys::EHXMetaDataId fldID); + TInt GetValueSize(TInt index); + TInt GetValue(TInt index, char* data, TInt maxLength, TInt* outSize, + TInt* encodingType); + + TInt ParseSource(TDesC&); + char* KeyMapping(HXMetaDataKeys::EHXMetaDataId); + + TInt Reset(); private: - CHXMetadataUtilityItf(); + CHXMetadataUtilityItf(); void ConstructL(); - - CHXMetaDataUtility *pHXMetaDataUtility; - - TUint uNumMetadataItems; -}; + + CHXMetaDataUtility *pHXMetaDataUtility; + TUint uNumMetadataItems; + }; #else extern void* mmf_metadata_utility_init(char*); -extern void mmf_metadata_utility_destroy(void* context); +extern void mmf_metadata_utility_destroy(void* context); extern XAresult mmf_metadata_utility_parse_source(void* , char*); -extern XAresult mmf_get_item_count(void* context, XAuint32* itemCount); -extern XAresult mmf_get_key_size(void* context, XAuint32 keyIndex, XAuint32* keySize); -extern XAresult mmf_get_key(void* context, XAuint32 index,XAuint32 keySize, XAMetadataInfo *pKey); -extern XAresult mmf_get_value_size(void* context, XAuint32 index, XAuint32 *pValueSize); -extern XAresult mmf_get_value(void* context, XAuint32 index, XAuint32 valueSize, XAMetadataInfo *pValue); +extern XAresult mmf_get_item_count(void* context, XAuint32* itemCount); +extern XAresult mmf_get_key_size(void* context, XAuint32 keyIndex, XAuint32* keySize); +extern XAresult mmf_get_key(void* context, XAuint32 index,XAuint32 keySize, XAMetadataInfo *pKey); +extern XAresult mmf_get_value_size(void* context, XAuint32 index, XAuint32 *pValueSize); +extern XAresult mmf_get_value(void* context, XAuint32 index, XAuint32 valueSize, XAMetadataInfo *pValue); #endif //__cplusplus - #endif diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.cpp --- a/khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.cpp Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -1,32 +1,33 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ -#include "cmmfbackendengine.h" #include #include #include #include +#include "cmmfbackendengine.h" #include "markerpositiontimer.h" #include "positionupdatetimer.h" #include "profileutilmacro.h" -extern "C" { +extern "C" + { #include "xaadaptationmmf.h" -} + } #define RET_IF_ERR(res, val) if (res != KErrNone) return val @@ -47,11 +48,10 @@ Destroy(); } -CMMFBackendEngine::CMMFBackendEngine() -:iPositionUpdatePeriod(1000), /* default is 1000 millisec */ - iUriPtr(NULL,0) +CMMFBackendEngine::CMMFBackendEngine() : + iPositionUpdatePeriod(1000), /* default is 1000 millisec */ + iUriPtr(NULL, 0) { -/* m_bWindowReferencePassed = FALSE;*/ iRecordState = ERecorderNotReady; iPositionUpdateTimer = NULL; iMediaPlayerState = XA_PLAYSTATE_PLAYERUNINITIALIZED; @@ -69,7 +69,7 @@ if (!iAudioRecorder) { iBaseAudioRecorder = CMdaAudioRecorderUtility::NewL(*this); - iAudioRecorder = (CMdaAudioRecorderUtility*)iBaseAudioRecorder; + iAudioRecorder = (CMdaAudioRecorderUtility*) iBaseAudioRecorder; } } @@ -78,7 +78,7 @@ if (!iAudioPlayer) { iBaseAudioPlayer = CMdaAudioPlayerUtility::NewL(*this); - iAudioPlayer = (CMdaAudioPlayerUtility*)iBaseAudioPlayer; + iAudioPlayer = (CMdaAudioPlayerUtility*) iBaseAudioPlayer; } InitPlayerTimersL(); } @@ -87,8 +87,9 @@ { if (!iVideoPlayer) { - iBaseVideoPlayer = CVideoPlayerUtility2::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); - iVideoPlayer = (CVideoPlayerUtility2*)iBaseVideoPlayer; + iBaseVideoPlayer = CVideoPlayerUtility2::NewL(*this, + EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality); + iVideoPlayer = (CVideoPlayerUtility2*) iBaseVideoPlayer; iVideoPlayer->RegisterForVideoLoadingNotification(*this); } InitPlayerTimersL(); @@ -98,19 +99,22 @@ { if (!iMarkerPositionTimer) { - iMarkerPositionTimer = CMarkerPositionTimer::NewL(iAudioPlayer, iVideoPlayer); + iMarkerPositionTimer = CMarkerPositionTimer::NewL(iAudioPlayer, + iVideoPlayer); iMarkerPositionTimer->SetContext(iAdaptContext); } if (!iPlayItfPositionUpdateTimer) { - iPlayItfPositionUpdateTimer = CPositionUpdateTimer::NewL(iAudioPlayer, iVideoPlayer); + iPlayItfPositionUpdateTimer = CPositionUpdateTimer::NewL( + iAudioPlayer, iVideoPlayer); iPlayItfPositionUpdateTimer->SetContext(iAdaptContext); } iMarkerPositionTimer->Stop(); iPlayItfPositionUpdateTimer->Stop(); } -TInt CMMFBackendEngine::SetFileName(char* uri, XAuint32 format, TFuncInUse func) +TInt CMMFBackendEngine::SetFileName(char* uri, XAuint32 format, + TFuncInUse func) { TInt err(KErrNone); _LIT8(KFileSlash,"file:///"); @@ -130,23 +134,23 @@ /* Initalize Recorder related objects */ TRAP(err, InitAudioRecorderUtilityL()); RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); - + TRAP(err, iAudioRecorder->OpenFileL(iUriPtr)); RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); /* Wait until we receive moscostatechanged callback */ - if(!iActiveSchedulerWait->IsStarted()) + if (iActiveSchedulerWait && !iActiveSchedulerWait->IsStarted()) { iActiveSchedulerWait->Start(); } RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); - } + } } } else { /* The second one is needed for dynamic source interface */ - if ((iMediaPlayerState == XA_PLAYSTATE_PLAYERUNINITIALIZED) || - (iMediaPlayerState == XA_PLAYSTATE_STOPPED)) + if ((iMediaPlayerState == XA_PLAYSTATE_PLAYERUNINITIALIZED) + || (iMediaPlayerState == XA_PLAYSTATE_STOPPED)) { iFileFormat = format; iAPIBeingUsed = DetermineAPIToUse(uri, EPlay); @@ -162,13 +166,13 @@ TAG_TIME_PROFILING_BEGIN; TRAP(err, iAudioPlayer->OpenFileL(iUriPtr)); - RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); - TAG_TIME_PROFILING_END; + RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; /* Wait until we receive mapc init complete */ PRINT_TO_CONSOLE_HOME_TIME; - if (!iActiveSchedulerWait->IsStarted()) + if (iActiveSchedulerWait && !iActiveSchedulerWait->IsStarted()) { iActiveSchedulerWait->Start(); } @@ -183,13 +187,13 @@ TRAP(err, InitVideoPlayerUtilityL()); RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); - if(iUriType == ELocal) + if (iUriType == ELocal) { /* Open file */ TAG_TIME_PROFILING_BEGIN; TRAP(err, iVideoPlayer->OpenFileL(iUriPtr)); - RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); - TAG_TIME_PROFILING_END; + RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; } else @@ -197,13 +201,13 @@ /* Open URL */ TAG_TIME_PROFILING_BEGIN; TRAP(err, iVideoPlayer->OpenUrlL(iUriPtr)); - RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); - TAG_TIME_PROFILING_END; + RET_IF_ERR(err, XA_RESULT_INTERNAL_ERROR); + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; } /* Wait until we receive MvpuoOpenComplete */ PRINT_TO_CONSOLE_HOME_TIME; - if (!iActiveSchedulerWait->IsStarted()) + if (iActiveSchedulerWait && !iActiveSchedulerWait->IsStarted()) { iActiveSchedulerWait->Start(); } @@ -212,18 +216,18 @@ /* Prepare utility */ TAG_TIME_PROFILING_BEGIN_NO_VAR_DEF; iVideoPlayer->Prepare(); - TAG_TIME_PROFILING_END_NO_VAR_DEF; + TAG_TIME_PROFILING_END_NO_VAR_DEF; PRINT_TO_CONSOLE_TIME_DIFF; /* Wait until we receive MvpuoPrepareComplete */ PRINT_TO_CONSOLE_HOME_TIME_NO_VAR_DEF; - if (!iActiveSchedulerWait->IsStarted()) + if (iActiveSchedulerWait && !iActiveSchedulerWait->IsStarted()) { iActiveSchedulerWait->Start(); } RET_IF_ERR(iErrorCode, XA_RESULT_INTERNAL_ERROR); } - } + } } if (err != KErrNone) { @@ -235,59 +239,60 @@ TInt CMMFBackendEngine::DetermineAPIToUse(char* uri, TFuncInUse aFunc) { char* dotPtr = NULL; - char ext[MAX_EXTENSION_SIZE] = { 0 }; + char ext[MAX_EXTENSION_SIZE] = + { + 0 + }; int extLen; int colpos; - char urischeme[MAX_EXTENSION_SIZE] = { 0 }; + char urischeme[MAX_EXTENSION_SIZE] = + { + 0 + }; int urischemeLen; - dotPtr = strrchr(uri, (int)'.'); + dotPtr = strrchr(uri, (int) '.'); if (!dotPtr) { return KErrNotFound; } - strncpy(ext, dotPtr,strlen(dotPtr)); + strncpy(ext, dotPtr, strlen(dotPtr)); /*Null terminate the string*/ ext[strlen(dotPtr)] = '\0'; extLen = sizeof(ext); - for(unsigned int i=0; i < extLen; i++) + for (unsigned int i = 0; i < extLen; i++) { ext[i] = tolower(ext[i]); } - colpos = strcspn(uri,":"); + colpos = strcspn(uri, ":"); - strncpy(urischeme, uri, colpos+1); + strncpy(urischeme, uri, colpos + 1); /*Null terminate the string*/ - urischeme[colpos+1] = '\0'; + urischeme[colpos + 1] = '\0'; urischemeLen = sizeof(urischeme); - for(unsigned int i=0; i < urischemeLen; i++) + for (unsigned int i = 0; i < urischemeLen; i++) { urischeme[i] = tolower(urischeme[i]); } - - - + if (aFunc == ERecord) { return EAudioRecorderUtility; } else { - if(!strcasecmp(urischeme, "file:")) + if (!strcmp(urischeme, "file:")) { - if (!strcasecmp(ext, ".mp3") || - !strcasecmp(ext, ".amr") || - !strcasecmp(ext, ".aac") || - !strcasecmp(ext, ".mid") || - !strcasecmp(ext, ".wav") || - !strcasecmp(ext, ".awb")) + if (!strcmp(ext, ".mp3") || !strcmp(ext, ".amr") + || !strcmp(ext, ".aac") || !strcmp(ext, ".mid") + || !strcmp(ext, ".wav") || !strcmp(ext, ".awb")) { return EAudioPlayerUtility; } - else + else { return EVideoPlayerUtility; } @@ -309,7 +314,7 @@ { iMMFPlayerState = EPlayerOpened; } - if (iActiveSchedulerWait->IsStarted()) + if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) { iActiveSchedulerWait->AsyncStop(); } @@ -329,8 +334,8 @@ { iMMFPlayerState = EPlayerPrepared; TAG_TIME_PROFILING_BEGIN; - TRAP(iErrorCode, iMediaDuration = iVideoPlayer->DurationL()); - TAG_TIME_PROFILING_END; + TRAP(iErrorCode, iMediaDuration = iVideoPlayer->DurationL()); + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; if (iErrorCode == KErrNone) { @@ -341,22 +346,22 @@ if (m_pWs && m_pScr && m_pWindow) { TRect videoExtent = TRect(m_pWindow->Size()); - TRect clipRect = TRect(m_pWindow->Size()); + TRect clipRect = TRect(m_pWindow->Size()); TAG_TIME_PROFILING_BEGIN; TRAP_IGNORE(iVideoPlayer->AddDisplayWindowL(*m_pWs, *m_pScr, *m_pWindow, videoExtent, clipRect)); - TRAP_IGNORE(iVideoPlayer->SetAutoScaleL(*m_pWindow, autoScale)); - TAG_TIME_PROFILING_END; + TRAP_IGNORE(iVideoPlayer->SetAutoScaleL(*m_pWindow, autoScale)); + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; } } } - if (iActiveSchedulerWait->IsStarted()) + if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) { iActiveSchedulerWait->AsyncStop(); } } -void CMMFBackendEngine::MvpuoFrameReady(CFbsBitmap& /*aFrame*/,TInt /*aError*/) +void CMMFBackendEngine::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt /*aError*/) { } @@ -375,8 +380,12 @@ { iPlaybackHead = 0; iMediaPlayerState = XA_PLAYSTATE_STOPPED; - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL}; - XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); + XAAdaptEvent event = + { + XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL + }; + XAAdaptationBase_SendAdaptEvents( + (XAAdaptationBaseCtx*) iAdaptContext, &event); } iMMFPlayerState = EPlayerPrepared; iMarkerPositionTimer->Stop(); @@ -387,24 +396,28 @@ { //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent (0x%x %d)"), event.iEventType, event.iErrorCode); - if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError && - event.iErrorCode == KErrHardwareNotAvailable) + if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError + && event.iErrorCode == KErrHardwareNotAvailable) { //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: Hardware Not Available")); } - else if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError && - event.iErrorCode == KErrMMPartialPlayback) + else if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError + && event.iErrorCode == KErrMMPartialPlayback) { //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: Partial playback")); - } - if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError && - event.iErrorCode == -12014) + } + if (event.iEventType == KMMFEventCategoryVideoPlayerGeneralError + && event.iErrorCode == -12014) { //RDebug::Print(_L("CMMFBackendEngine::MvpuoEvent: Audio Device taken")); PausePlayback(); - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL}; - XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); + XAAdaptEvent event = + { + XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL + }; + XAAdaptationBase_SendAdaptEvents( + (XAAdaptationBaseCtx*) iAdaptContext, &event); } else if (event.iEventType == KMMFRefreshMetaData) { @@ -429,7 +442,7 @@ //MMdaAudioPlayerCallback void CMMFBackendEngine::MapcInitComplete(TInt aError, - const TTimeIntervalMicroSeconds& aDuration) + const TTimeIntervalMicroSeconds& aDuration) { PRINT_TO_CONSOLE_HOME_TIME; @@ -448,13 +461,12 @@ iMarkerPositionTimer->UseAudioPlayer(); iPlayItfPositionUpdateTimer->UseAudioPlayer(); } - if (iActiveSchedulerWait->IsStarted()) + if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) { iActiveSchedulerWait->AsyncStop(); } } - void CMMFBackendEngine::MapcPlayComplete(TInt aError) { iErrorCode = aError; @@ -474,22 +486,27 @@ iAudioPlayer->GetPosition(iPlaybackHead); iMediaPlayerState = XA_PLAYSTATE_PAUSED; iMMFPlayerState = EPlayerPaused; - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL}; - XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); + XAAdaptEvent event = + { + XA_PLAYITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL + }; + XAAdaptationBase_SendAdaptEvents( + (XAAdaptationBaseCtx*) iAdaptContext, &event); } iMarkerPositionTimer->Stop(); iPlayItfPositionUpdateTimer->Stop(); } // from MMdaObjectStateChangeObserver -void CMMFBackendEngine::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode) +void CMMFBackendEngine::MoscoStateChangeEvent(CBase* /*aObject*/, + TInt aPreviousState, TInt aCurrentState, TInt aErrorCode) { TInt err(KErrNone); iPreviousRecordState = aPreviousState; iCurrentRecordState = aCurrentState; iErrorCode = aErrorCode; //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 1 Error[%d]"),aErrorCode); - if (iCurrentRecordState == CMdaAudioClipUtility::EOpen) //EOpen + if (iCurrentRecordState == CMdaAudioClipUtility::EOpen) //EOpen { //outputfile is open and ready for recording iRecordState = CMMFBackendEngine::ERecorderOpen; @@ -499,23 +516,26 @@ { //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 2")); TRAP(err,iAudioInputRecord = CAudioInput::NewL( *iAudioRecorder )); - if(err == KErrNone) + if (err == KErrNone) { RArray inputArray; - inputArray.Append( CAudioInput::EDefaultMic ); + inputArray.Append(CAudioInput::EDefaultMic); // Set Audio Input TRAP(err, iAudioInputRecord->SetAudioInputL( inputArray.Array( ) )); inputArray.Close(); } - TMMFMessageDestination destination(KUidMetaDataWriteCustomCommand); - TMMFMessageDestinationPckg pckg = TMMFMessageDestinationPckg(destination); - TInt ret = iAudioRecorder->RecordControllerCustomCommandSync(pckg, 0, KNullDesC8, KNullDesC8); + TMMFMessageDestination destination( + KUidMetaDataWriteCustomCommand); + TMMFMessageDestinationPckg pckg = TMMFMessageDestinationPckg( + destination); + TInt ret = iAudioRecorder->RecordControllerCustomCommandSync( + pckg, 0, KNullDesC8, KNullDesC8); //RDebug::Print(_L("CMMFBackendEngine::MoscoStateChangeEvent 3 [%d]"),ret); if (ret != KErrNone && iFileFormat == XA_CONTAINERTYPE_MP4) { iPauseSupportMP4 = FALSE; } - if (iActiveSchedulerWait->IsStarted()) + if (iActiveSchedulerWait && iActiveSchedulerWait->IsStarted()) { iActiveSchedulerWait->AsyncStop(); } @@ -523,25 +543,34 @@ } else { - XAAdaptEvent event = {XA_RECORDITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL}; - XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); + XAAdaptEvent event = + { + XA_RECORDITFEVENTS, XA_OBJECT_EVENT_RESOURCES_LOST, 0, NULL + }; + XAAdaptationBase_SendAdaptEvents( + (XAAdaptationBaseCtx*) iAdaptContext, &event); } } - else if (iCurrentRecordState == CMdaAudioClipUtility::ERecording) //ERecording + else if (iCurrentRecordState == CMdaAudioClipUtility::ERecording) //ERecording { iRecordState = CMMFBackendEngine::ERecorderRecording; iPositionUpdateTimer->Start(iTimerDelay); - XAAdaptEvent event = {XA_RECORDITFEVENTS, XA_RECORDEVENT_HEADMOVING, 0, NULL}; - XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &event ); + XAAdaptEvent event = + { + XA_RECORDITFEVENTS, XA_RECORDEVENT_HEADMOVING, 0, NULL + }; + XAAdaptationBase_SendAdaptEvents( + (XAAdaptationBaseCtx*) iAdaptContext, &event); } - else //ENotReady + else //ENotReady { //outputfile is not open iRecordState = CMMFBackendEngine::ERecorderNotReady; } } -TInt CMMFBackendEngine::SetRecorderState(TRecorderState state, XAboolean stopCalled) +TInt CMMFBackendEngine::SetRecorderState(TRecorderState state, + XAboolean stopCalled) { TInt err(KErrNone); @@ -550,14 +579,15 @@ return XA_RESULT_INTERNAL_ERROR; } - switch(state) + switch (state) { case ERecorderNotReady: iAudioRecorder->Close(); iRecordState = ERecorderNotReady; break; case ERecorderOpen: - if (iFileFormat == XA_CONTAINERTYPE_MP4 && !iPauseSupportMP4 && !stopCalled) + if (iFileFormat == XA_CONTAINERTYPE_MP4 && !iPauseSupportMP4 + && !stopCalled) { err = KErrNotSupported; return err; @@ -567,7 +597,8 @@ iRecordState = ERecorderOpen; break; case ERecorderRecording: - TRAP(err, iAudioRecorder->RecordL()); + TRAP(err, iAudioRecorder->RecordL()) + ; break; } return err; @@ -586,31 +617,31 @@ if (iBaseVideoPlayer && iVideoPlayer) { - switch(iMMFPlayerState) + switch (iMMFPlayerState) { case EPlayerPlaying: case EPlayerPaused: case EPlayerPrepared: iVideoPlayer->Stop(); case EPlayerOpened: - if (m_pWs && m_pScr && m_pWindow) - { - iVideoPlayer->RemoveDisplayWindow(*m_pWindow); - } + if (m_pWs && m_pScr && m_pWindow) + { + iVideoPlayer->RemoveDisplayWindow(*m_pWindow); + } iVideoPlayer->Close(); case EPlayerClosed: default: break; }; } - + // deleting the AudioInput object - if(iAudioInputRecord) + if (iAudioInputRecord) { - delete iAudioInputRecord; - iAudioInputRecord = NULL; + delete iAudioInputRecord; + iAudioInputRecord = NULL; } - + if (iBaseAudioPlayer && iAudioPlayer) { iAudioPlayer->Close(); @@ -621,7 +652,7 @@ iAudioRecorder->Close(); } - if(iPositionUpdateTimer) + if (iPositionUpdateTimer) { iPositionUpdateTimer->Stop(); } @@ -687,30 +718,28 @@ { TInt err(KErrNone); - if(iAPIBeingUsed == EAudioRecorderUtility) + if (iAPIBeingUsed == EAudioRecorderUtility) { - if(iRecordState != CMMFBackendEngine::ERecorderNotReady) + if (iRecordState != CMMFBackendEngine::ERecorderNotReady) { TFourCC dest; TRAP(err, dest = iAudioRecorder->DestinationDataTypeL()); - if(err == KErrNone) + if (err == KErrNone) { *codecid = dest.FourCC(); } } } - else if(iAPIBeingUsed == EAudioPlayerUtility) + else if (iAPIBeingUsed == EAudioPlayerUtility) { - if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) + if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) { TMMFMessageDestinationPckg pckg(KUidInterfaceMMFAudioController); TPckgBuf configPackage; - TInt err = iAudioPlayer->CustomCommandSync(pckg, - EMMFAudioControllerGetSourceDataType, - KNullDesC8, - KNullDesC8, - configPackage); - if(err == KErrNone) + TInt err = iAudioPlayer->CustomCommandSync(pckg, + EMMFAudioControllerGetSourceDataType, KNullDesC8, + KNullDesC8, configPackage); + if (err == KErrNone) { *codecid = configPackage().iSourceDataTypeCode.FourCC(); } @@ -723,22 +752,22 @@ { TInt err(KErrNone); TUint br(0); - if(iAPIBeingUsed == EAudioRecorderUtility) + if (iAPIBeingUsed == EAudioRecorderUtility) { - if(iRecordState != CMMFBackendEngine::ERecorderNotReady) + if (iRecordState != CMMFBackendEngine::ERecorderNotReady) { TRAP(err, br = iAudioRecorder->DestinationBitRateL()); - if(err == KErrNone) + if (err == KErrNone) { *bitrate = br; } } } - else if(iAPIBeingUsed == EAudioPlayerUtility) + else if (iAPIBeingUsed == EAudioPlayerUtility) { - if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) + if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) { - TInt err = iAudioPlayer->GetBitRate(br); + TInt err = iAudioPlayer->GetBitRate(br); *bitrate = br; } } @@ -749,31 +778,29 @@ { TInt err(KErrNone); TUint sr(0); - if(iAPIBeingUsed == EAudioRecorderUtility) + if (iAPIBeingUsed == EAudioRecorderUtility) { - if(iRecordState != CMMFBackendEngine::ERecorderNotReady) + if (iRecordState != CMMFBackendEngine::ERecorderNotReady) { TRAP(err, sr = iAudioRecorder->DestinationSampleRateL()); - if(err == KErrNone) + if (err == KErrNone) { - *samplerate = sr*1000; + *samplerate = sr * 1000; } } } - else if(iAPIBeingUsed == EAudioPlayerUtility) + else if (iAPIBeingUsed == EAudioPlayerUtility) { - if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) + if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) { TMMFMessageDestinationPckg pckg(KUidInterfaceMMFAudioController); TPckgBuf configPackage; - TInt err = iAudioPlayer->CustomCommandSync(pckg, - EMMFAudioControllerGetSourceSampleRate, - KNullDesC8, - KNullDesC8, - configPackage); - if(err == KErrNone) + TInt err = iAudioPlayer->CustomCommandSync(pckg, + EMMFAudioControllerGetSourceSampleRate, KNullDesC8, + KNullDesC8, configPackage); + if (err == KErrNone) { - *samplerate = configPackage().iSampleRate*1000; + *samplerate = configPackage().iSampleRate * 1000; } } } @@ -784,29 +811,27 @@ { TInt err(KErrNone); TUint ch(0); - if(iAPIBeingUsed == EAudioRecorderUtility) + if (iAPIBeingUsed == EAudioRecorderUtility) { - if(iRecordState != CMMFBackendEngine::ERecorderNotReady) + if (iRecordState != CMMFBackendEngine::ERecorderNotReady) { TRAP(err,ch = iAudioRecorder->DestinationNumberOfChannelsL()); - if(err == KErrNone) + if (err == KErrNone) { *channels = ch; } } } - else if(iAPIBeingUsed == EAudioPlayerUtility) + else if (iAPIBeingUsed == EAudioPlayerUtility) { - if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) + if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) { TMMFMessageDestinationPckg pckg(KUidInterfaceMMFAudioController); TPckgBuf configPackage; - TInt err = iAudioPlayer->CustomCommandSync( pckg, - EMMFAudioControllerGetSourceNumChannels, - KNullDesC8, - KNullDesC8, - configPackage ); - if(err == KErrNone) + TInt err = iAudioPlayer->CustomCommandSync(pckg, + EMMFAudioControllerGetSourceNumChannels, KNullDesC8, + KNullDesC8, configPackage); + if (err == KErrNone) { *channels = configPackage().iChannels; } @@ -818,10 +843,10 @@ TInt CMMFBackendEngine::SetDestinationBitRate(XAuint32* bitrate) { TInt err(KErrNone); - if(iRecordState == CMMFBackendEngine::ERecorderOpen) + if (iRecordState == CMMFBackendEngine::ERecorderOpen) { TRAP(err, iAudioRecorder->SetDestinationBitRateL(*bitrate)); - if(err != KErrNone) + if (err != KErrNone) { return XA_RESULT_PARAMETER_INVALID; } @@ -832,10 +857,10 @@ TInt CMMFBackendEngine::SetDestinationSampleRate(XAmilliHertz* samplerate) { TInt err(KErrNone); - if(iRecordState == CMMFBackendEngine::ERecorderOpen) + if (iRecordState == CMMFBackendEngine::ERecorderOpen) { TRAP(err, iAudioRecorder->SetDestinationSampleRateL(*samplerate/1000)); - if(err != KErrNone) + if (err != KErrNone) { return XA_RESULT_PARAMETER_INVALID; } @@ -858,21 +883,21 @@ } /* -XAresult CMMFBackendEngine::SetWindowHandle(void* display_info) - { - XADataLocator_NativeDisplay* nativeDisplay; - XADataSink* videoSink = (XADataSink*)display_info; + XAresult CMMFBackendEngine::SetWindowHandle(void* display_info) + { + XADataLocator_NativeDisplay* nativeDisplay; + XADataSink* videoSink = (XADataSink*)display_info; - nativeDisplay = (XADataLocator_NativeDisplay*) (videoSink->pLocator); + nativeDisplay = (XADataLocator_NativeDisplay*) (videoSink->pLocator); - m_pWindow = ((RWindow*)(nativeDisplay->hWindow)); - m_pWs = ((RWsSession*)(nativeDisplay->hDisplay)); + m_pWindow = ((RWindow*)(nativeDisplay->hWindow)); + m_pWs = ((RWsSession*)(nativeDisplay->hDisplay)); - m_bWindowReferencePassed = TRUE; - return XA_RESULT_SUCCESS; - } + m_bWindowReferencePassed = TRUE; + return XA_RESULT_SUCCESS; + } -*/ + */ XAresult CMMFBackendEngine::CreateAndConfigureWindowL() { #ifdef USE_LOCAL_WINDOW_RESOURCES @@ -918,20 +943,20 @@ //display_info is of type XADataSink //display_info.pLocator is of type XADataLocator_NativeDisplay XADataLocator_NativeDisplay* nativeDisplay; - XADataSink* videoSink = (XADataSink*)display_info; + XADataSink* videoSink = (XADataSink*) display_info; if (videoSink) { nativeDisplay = (XADataLocator_NativeDisplay*) (videoSink->pLocator); - m_pWindow = ((RWindow*)(nativeDisplay->hWindow)); - m_pWs = ((RWsSession*)(nativeDisplay->hDisplay)); - /* - m_cropRegion = TRect(m_pWindow->Size()); - m_videoExtent = TRect(m_pWindow->Size()); - m_cropRect = TRect(m_pWindow->Size()); - m_clipRect = TRect(m_pWindow->Size()); - m_cropRegion = TRect(m_pWindow->Size()); - */ + m_pWindow = ((RWindow*) (nativeDisplay->hWindow)); + m_pWs = ((RWsSession*) (nativeDisplay->hDisplay)); + /* + m_cropRegion = TRect(m_pWindow->Size()); + m_videoExtent = TRect(m_pWindow->Size()); + m_cropRect = TRect(m_pWindow->Size()); + m_clipRect = TRect(m_pWindow->Size()); + m_cropRegion = TRect(m_pWindow->Size()); + */ if (m_pWs) { delete m_pScr; @@ -954,24 +979,22 @@ case XA_PLAYSTATE_PAUSED: /* If we are already at the end of clip, do nothing * check ::MapcPlayComplete for documentation */ - if ((iPlaybackHead < iMediaDuration) && - ((iAPIBeingUsed == EAudioPlayerUtility) || - (iAPIBeingUsed == EVideoPlayerUtility)) ) + if ((iPlaybackHead < iMediaDuration) && ((iAPIBeingUsed + == EAudioPlayerUtility) || (iAPIBeingUsed + == EVideoPlayerUtility))) { if (iAPIBeingUsed == EAudioPlayerUtility) { TAG_TIME_PROFILING_BEGIN; iAudioPlayer->Play(); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; } else if (iAPIBeingUsed == EVideoPlayerUtility) { TAG_TIME_PROFILING_BEGIN; //iVideoPlayer->Play( iPlaybackHead, iMediaDuration); iVideoPlayer->Play(); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; } postHeadMovingEvent = ETrue; iMediaPlayerState = XA_PLAYSTATE_PLAYING; @@ -1002,16 +1025,15 @@ { case XA_PLAYSTATE_PLAYING: case XA_PLAYSTATE_STOPPED: - if ((iAPIBeingUsed == EAudioPlayerUtility) || - (iAPIBeingUsed == EVideoPlayerUtility) ) + if ((iAPIBeingUsed == EAudioPlayerUtility) || (iAPIBeingUsed + == EVideoPlayerUtility)) { TInt pauseOpRes(KErrNone); if (iAPIBeingUsed == EAudioPlayerUtility) { TAG_TIME_PROFILING_BEGIN; pauseOpRes = iAudioPlayer->Pause(); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; } else if (iAPIBeingUsed == EVideoPlayerUtility) { @@ -1024,11 +1046,9 @@ { iPlaybackHead = 0; } - } - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; + } TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; } - if ( pauseOpRes == KErrNone) + if (pauseOpRes == KErrNone) { iMediaPlayerState = XA_PLAYSTATE_PAUSED; iMMFPlayerState = EPlayerPaused; @@ -1054,15 +1074,14 @@ { case XA_PLAYSTATE_PAUSED: case XA_PLAYSTATE_PLAYING: - if ((iAPIBeingUsed == EAudioPlayerUtility) || - (iAPIBeingUsed == EVideoPlayerUtility) ) + if ((iAPIBeingUsed == EAudioPlayerUtility) || (iAPIBeingUsed + == EVideoPlayerUtility)) { if (iAPIBeingUsed == EAudioPlayerUtility) { TAG_TIME_PROFILING_BEGIN; iAudioPlayer->Stop(); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; iMMFPlayerState = EPlayerOpened; } @@ -1070,9 +1089,8 @@ { TAG_TIME_PROFILING_BEGIN; iVideoPlayer->Stop(); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; - + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; + iMMFPlayerState = EPlayerPrepared; } iMediaPlayerState = XA_PLAYSTATE_STOPPED; @@ -1153,7 +1171,7 @@ TRAP(err, pos = iVideoPlayer->PositionL()); if (err == KErrNone) { - *pMsec = pos.Int64() / divider; + *pMsec = pos.Int64() / divider; retVal = XA_RESULT_SUCCESS; } } @@ -1175,13 +1193,12 @@ case XA_PLAYSTATE_STOPPED: case XA_PLAYSTATE_PAUSED: case XA_PLAYSTATE_PLAYING: - if(iAPIBeingUsed == EAudioPlayerUtility) + if (iAPIBeingUsed == EAudioPlayerUtility) { pos = pMsec * multiplier; TAG_TIME_PROFILING_BEGIN; iAudioPlayer->SetPosition(pos); - TAG_TIME_PROFILING_END; - PRINT_TO_CONSOLE_TIME_DIFF; + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; retVal = XA_RESULT_SUCCESS; } @@ -1189,8 +1206,8 @@ { pos = pMsec * multiplier; TAG_TIME_PROFILING_BEGIN; - TRAPD(err, iVideoPlayer->SetPositionL(pos)); - TAG_TIME_PROFILING_END; + TRAPD(err, iVideoPlayer->SetPositionL(pos)); + TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF; if (err == KErrNone) { @@ -1214,7 +1231,7 @@ case XA_PLAYSTATE_STOPPED: case XA_PLAYSTATE_PAUSED: case XA_PLAYSTATE_PLAYING: - if(iAPIBeingUsed == EAudioPlayerUtility) + if (iAPIBeingUsed == EAudioPlayerUtility) { numRepeats = repeat ? -2 : 0; iAudioPlayer->SetRepeats(numRepeats, 0); @@ -1231,7 +1248,8 @@ return retVal; } -XAresult CMMFBackendEngine::SetPlayWindow(XAmillisecond start, XAmillisecond end) +XAresult CMMFBackendEngine::SetPlayWindow(XAmillisecond start, + XAmillisecond end) { XAresult retVal(XA_RESULT_INTERNAL_ERROR); TInt64 multiplier(1000); @@ -1243,11 +1261,11 @@ case XA_PLAYSTATE_STOPPED: case XA_PLAYSTATE_PAUSED: case XA_PLAYSTATE_PLAYING: - if(iAPIBeingUsed == EAudioPlayerUtility) + if (iAPIBeingUsed == EAudioPlayerUtility) { startpos = start * multiplier; endpos = end * multiplier; - retVal = iAudioPlayer->SetPlayWindow(startpos,endpos); + retVal = iAudioPlayer->SetPlayWindow(startpos, endpos); } else { @@ -1311,7 +1329,8 @@ iPlayItfPositionUpdateTimer->SetCallbackEventMask(iPlayItfEventFlags); iPlayItfPositionUpdateTimer->RegisterCallback(iPlayItfCBFunction); - iPlayItfPositionUpdateTimer->SetPositionUpdatePeriod(iPositionUpdatePeriod); + iPlayItfPositionUpdateTimer->SetPositionUpdatePeriod( + iPositionUpdatePeriod); switch (iMediaPlayerState) { @@ -1331,11 +1350,14 @@ void CMMFBackendEngine::DoPostEvent(XAuint32 event) { - if ((iPlayItfEventFlags & event) && - (iPlayItfCBFunction != NULL)) + if ((iPlayItfEventFlags & event) && (iPlayItfCBFunction != NULL)) { - XAAdaptEvent xaevent = {XA_PLAYITFEVENTS, event, 0, 0 }; - XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iAdaptContext, &xaevent ); + XAAdaptEvent xaevent = + { + XA_PLAYITFEVENTS, event, 0, 0 + }; + XAAdaptationBase_SendAdaptEvents( + (XAAdaptationBaseCtx*) iAdaptContext, &xaevent); } } @@ -1344,7 +1366,7 @@ XAresult retVal(XA_RESULT_SUCCESS); TInt bitRate(0); TInt numS(0); - if(iAPIBeingUsed == EAudioPlayerUtility) + if (iAPIBeingUsed == EAudioPlayerUtility) { numS = 1; *numstreams = numS; @@ -1352,15 +1374,15 @@ else if (iAPIBeingUsed == EVideoPlayerUtility) { TRAPD(err, bitRate = iVideoPlayer->VideoBitRateL()); - if(!err && bitRate) + if (!err && bitRate) { numS++; *numstreams = numS; } - + bitRate = 0; TRAP(err, bitRate = iVideoPlayer->AudioBitRateL()); - if(!err && bitRate) + if (!err && bitRate) { numS++; *numstreams = numS; @@ -1369,16 +1391,17 @@ return retVal; } -XAresult CMMFBackendEngine::GetStreamInfo(XAuint32 streamindex, XAuint32* streamtype) +XAresult CMMFBackendEngine::GetStreamInfo(XAuint32 streamindex, + XAuint32* streamtype) { XAresult retVal(XA_RESULT_SUCCESS); - if(iAPIBeingUsed == EAudioPlayerUtility) + if (iAPIBeingUsed == EAudioPlayerUtility) { *streamtype = XA_DOMAINTYPE_AUDIO; } else if (iAPIBeingUsed == EVideoPlayerUtility) { - switch(streamindex) + switch (streamindex) { case 1: *streamtype = XA_DOMAINTYPE_VIDEO; @@ -1394,18 +1417,18 @@ return retVal; } - -XAresult CMMFBackendEngine::GetVideoFrameSize(XAuint32* height, XAuint32* width, XAuint32* frameRate) +XAresult CMMFBackendEngine::GetVideoFrameSize(XAuint32* height, + XAuint32* width, XAuint32* frameRate) { XAresult retVal(XA_RESULT_SUCCESS); - if(iAPIBeingUsed == EVideoPlayerUtility) + if (iAPIBeingUsed == EVideoPlayerUtility) { - if(iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) + if (iMediaPlayerState != XA_PLAYSTATE_PLAYERUNINITIALIZED) { TSize size; TReal32 framerate(0); TRAPD(err, iVideoPlayer->VideoFrameSizeL(size)); - if(!err) + if (!err) { *height = size.iHeight; *width = size.iWidth; @@ -1416,7 +1439,7 @@ } TRAP(err, framerate = iVideoPlayer->VideoFrameRateL()); - if(!err) + if (!err) { *frameRate = framerate; } @@ -1433,24 +1456,27 @@ return retVal; } -XAresult CMMFBackendEngine::SetActiveState(XAuint32 streamindex, XAboolean active) +XAresult CMMFBackendEngine::SetActiveState(XAuint32 streamindex, + XAboolean active) { XAresult retVal(XA_RESULT_SUCCESS); TInt err(KErrNone); - if(iAPIBeingUsed == EAudioPlayerUtility) + if (iAPIBeingUsed == EAudioPlayerUtility) { retVal = XA_RESULT_FEATURE_UNSUPPORTED; } else if (iAPIBeingUsed == EVideoPlayerUtility) { - switch(streamindex) + switch (streamindex) { case 1: - TRAP(err, iVideoPlayer->SetVideoEnabledL(active)); + TRAP(err, iVideoPlayer->SetVideoEnabledL(active)) + ; retVal = err; break; case 2: - TRAP(err, iVideoPlayer->SetAudioEnabledL(active)); + TRAP(err, iVideoPlayer->SetAudioEnabledL(active)) + ; retVal = err; break; default: @@ -1466,7 +1492,7 @@ /* Initializes and save uri param into iUri structure */ TInt err(KErrNone); TInt uriLen; - + if (!uri) return KErrArgument; @@ -1475,10 +1501,10 @@ delete iUri; iUri = NULL; } - + uriLen = strlen(uri); - TPtr8 uriParam((TUint8*)uri, uriLen, uriLen); - + TPtr8 uriParam((TUint8*) uri, uriLen, uriLen); + TRAP(err, iUri = HBufC::NewL(uriLen)); if (err != KErrNone) return err; @@ -1486,16 +1512,14 @@ iUriPtr.Set(iUri->Des()); iUriPtr.Copy(uriParam); /* Copy data*/ //iUriPtr.LowerCase(); - /* For file scheme convert from file:///c:/folder/file.ext * format to c:\\folder\\file.ext using TUriParser. */ _LIT(KFileScheme,"file:///"); if (iUriPtr.Find(KFileScheme) >= 0) { iUriType = ELocal; - TPtr tmp(const_cast(iUriPtr.Ptr()) + KFileScheme().Length(), - iUriPtr.Length(), - iUriPtr.Length()); + TPtr tmp(const_cast (iUriPtr.Ptr()) + + KFileScheme().Length(), iUriPtr.Length(), iUriPtr.Length()); /* Convert from c:/folder/file.ext format to * c:\\folder\\file.ext using TUriParser. * TUriParser8 accepts uri in format file:///c/folder/file.ext, @@ -1528,12 +1552,11 @@ return err; } - XAresult CMMFBackendEngine::SetVolume(XAuint32 volume) { XAresult retVal(XA_RESULT_SUCCESS); TInt err(KErrNone); - if(iAPIBeingUsed == EAudioPlayerUtility) + if (iAPIBeingUsed == EAudioPlayerUtility) { retVal = iAudioPlayer->SetVolume(volume); } @@ -1542,17 +1565,17 @@ TRAP(err, iVideoPlayer->SetVolumeL(volume)); retVal = err; } - else if(iAPIBeingUsed == EAudioRecorderUtility) + else if (iAPIBeingUsed == EAudioRecorderUtility) { retVal = iAudioRecorder->SetVolume(volume); } - return retVal; + return retVal; } XAresult CMMFBackendEngine::GetMaxVolume(XAuint32* maxvolume) { XAresult retVal(XA_RESULT_SUCCESS); - if(iAPIBeingUsed == EAudioPlayerUtility) + if (iAPIBeingUsed == EAudioPlayerUtility) { *maxvolume = iAudioPlayer->MaxVolume(); } @@ -1560,21 +1583,21 @@ { *maxvolume = iVideoPlayer->MaxVolume(); } - else if(iAPIBeingUsed == EAudioRecorderUtility) + else if (iAPIBeingUsed == EAudioRecorderUtility) { *maxvolume = iAudioRecorder->MaxVolume(); } - return retVal; + return retVal; } XAresult CMMFBackendEngine::GetVolume(XAuint32* volume) { XAresult retVal(XA_RESULT_SUCCESS); TInt mmfvolume(0); - if(iAPIBeingUsed == EAudioPlayerUtility) + if (iAPIBeingUsed == EAudioPlayerUtility) { retVal = iAudioPlayer->GetVolume(mmfvolume); - if(retVal == XA_RESULT_SUCCESS) + if (retVal == XA_RESULT_SUCCESS) { *volume = mmfvolume; } @@ -1583,228 +1606,252 @@ { *volume = iVideoPlayer->Volume(); } - else if(iAPIBeingUsed == EAudioRecorderUtility) + else if (iAPIBeingUsed == EAudioRecorderUtility) { retVal = iAudioRecorder->GetVolume(mmfvolume); - if(retVal == XA_RESULT_SUCCESS) + if (retVal == XA_RESULT_SUCCESS) { *volume = mmfvolume; } } - return retVal; + return retVal; } -extern "C" { +extern "C" + { int mmf_backend_engine_init(void** engine) - { + { TRAPD(err, *engine = CMMFBackendEngine::NewL()); return err; - } + } void mmf_backend_engine_deinit(void* engine) - { - delete ((CMMFBackendEngine*)engine); - } + { + delete ((CMMFBackendEngine*) engine); + } int mmf_set_recorder_uri(void* context, char* uri, XAuint32 format) - { - return ((CMMFBackendEngine*)(context))->SetFileName(uri,format,CMMFBackendEngine::ERecord); - } + { + return ((CMMFBackendEngine*) (context))->SetFileName(uri, format, + CMMFBackendEngine::ERecord); + } int mmf_set_adapt_context(void* context, void* adaptcontext) - { - return ((CMMFBackendEngine*)(context))->SetAdaptContext(adaptcontext); - } + { + return ((CMMFBackendEngine*) (context))->SetAdaptContext(adaptcontext); + } void mmf_close(void* context) - { - ((CMMFBackendEngine*)context)->Close(); - } + { + ((CMMFBackendEngine*) context)->Close(); + } int mmf_start_recording(void* context) - { - return ((CMMFBackendEngine*)(context))->SetRecorderState(CMMFBackendEngine::ERecorderRecording,FALSE); - } + { + return ((CMMFBackendEngine*) (context))->SetRecorderState( + CMMFBackendEngine::ERecorderRecording, FALSE); + } - int mmf_stop_recording(void* context, XAboolean stopCalled ) - { - return ((CMMFBackendEngine*)(context))->SetRecorderState(CMMFBackendEngine::ERecorderOpen, stopCalled); - } + int mmf_stop_recording(void* context, XAboolean stopCalled) + { + return ((CMMFBackendEngine*) (context))->SetRecorderState( + CMMFBackendEngine::ERecorderOpen, stopCalled); + } int mmf_get_record_position(void* context, XAuint64* position) - { - return ((CMMFBackendEngine*)(context))->GetRecordPosition(position); - } + { + return ((CMMFBackendEngine*) (context))->GetRecordPosition(position); + } - int mmf_set_record_position_update_period(void* context, XAmillisecond msec) - { - return ((CMMFBackendEngine*)(context))->SetPositionUpdatePerioed(msec); - } + int mmf_set_record_position_update_period(void* context, + XAmillisecond msec) + { + return ((CMMFBackendEngine*) (context))->SetPositionUpdatePerioed( + msec); + } int mmf_get_codec_id(void* context, XAuint32* encoderId) - { - return ((CMMFBackendEngine*)(context))->GetCodecId(encoderId); - } + { + return ((CMMFBackendEngine*) (context))->GetCodecId(encoderId); + } int mmf_get_channels(void* context, XAuint32* channelsIn) - { - return ((CMMFBackendEngine*)(context))->GetChannels(channelsIn); - } + { + return ((CMMFBackendEngine*) (context))->GetChannels(channelsIn); + } int mmf_get_samplerate(void* context, XAmilliHertz* sampleRate) - { - return ((CMMFBackendEngine*)(context))->GetSampleRate(sampleRate); - } + { + return ((CMMFBackendEngine*) (context))->GetSampleRate(sampleRate); + } int mmf_get_bitrate(void* context, XAuint32* bitRate) - { - return ((CMMFBackendEngine*)(context))->GetBitRate(bitRate); - } + { + return ((CMMFBackendEngine*) (context))->GetBitRate(bitRate); + } int mmf_set_destination_channels(void* context, XAuint32* channelsIn) - { - return ((CMMFBackendEngine*)(context))->SetDestinationChannels(channelsIn); - } + { + return ((CMMFBackendEngine*) (context))->SetDestinationChannels( + channelsIn); + } - int mmf_set_destination_samplerate(void* context, XAmilliHertz* sampleRate) - { - return ((CMMFBackendEngine*)(context))->SetDestinationSampleRate(sampleRate); - } + int mmf_set_destination_samplerate(void* context, + XAmilliHertz* sampleRate) + { + return ((CMMFBackendEngine*) (context))->SetDestinationSampleRate( + sampleRate); + } int mmf_set_destination_bitrate(void* context, XAuint32* bitRate) - { - return ((CMMFBackendEngine*)(context))->SetDestinationBitRate(bitRate); - } + { + return ((CMMFBackendEngine*) (context))->SetDestinationBitRate( + bitRate); + } XAresult mmf_set_play_adapt_context(void * context, void * adaptcontext) - { - return ((CMMFBackendEngine *)(context))->SetPlayAdaptContext(adaptcontext); - } + { + return ((CMMFBackendEngine *) (context))->SetPlayAdaptContext( + adaptcontext); + } XAresult mmf_set_player_uri(void * context, char * uri, XAuint32 format) - { - return ((CMMFBackendEngine *)(context))->SetFileName(uri,format,CMMFBackendEngine::EPlay); - } + { + return ((CMMFBackendEngine *) (context))->SetFileName(uri, format, + CMMFBackendEngine::EPlay); + } -/* - XAresult mmf_set_window_handle(void * context, void * display_info) - { - return ((CMMFBackendEngine *)(context))->SetWindowHandle(display_info); - } + /* + XAresult mmf_set_window_handle(void * context, void * display_info) + { + return ((CMMFBackendEngine *)(context))->SetWindowHandle(display_info); + } -*/ + */ XAresult mmf_setup_native_display(void * context, void * display_info) - { - return ((CMMFBackendEngine *)(context))->SetNativeDisplayInformation(display_info); - } + { + return ((CMMFBackendEngine *) (context))->SetNativeDisplayInformation( + display_info); + } XAresult mmf_playitf_resume_playback(void * context) - { - return ((CMMFBackendEngine *)(context))->ResumePlayback(); - } + { + return ((CMMFBackendEngine *) (context))->ResumePlayback(); + } XAresult mmf_playitf_pause_playback(void * context) - { - return ((CMMFBackendEngine *)(context))->PausePlayback(); - } + { + return ((CMMFBackendEngine *) (context))->PausePlayback(); + } XAresult mmf_playitf_stop_playback(void * context) - { - return ((CMMFBackendEngine *)(context))->StopPlayback(); - } + { + return ((CMMFBackendEngine *) (context))->StopPlayback(); + } XAresult mmf_playitf_get_play_state(void * context, XAuint32 * pState) - { - return ((CMMFBackendEngine *)(context))->GetPlayState(pState); - } + { + return ((CMMFBackendEngine *) (context))->GetPlayState(pState); + } XAresult mmf_playitf_get_duration(void * context, XAmillisecond * pMsec) - { - return ((CMMFBackendEngine *)(context))->GetDuration(pMsec); - } + { + return ((CMMFBackendEngine *) (context))->GetDuration(pMsec); + } XAresult mmf_playitf_get_position(void * context, XAmillisecond * pMsec) - { - return ((CMMFBackendEngine *)(context))->GetPosition(pMsec); - } + { + return ((CMMFBackendEngine *) (context))->GetPosition(pMsec); + } - XAresult mmf_playitf_register_callback(void * context, xaPlayCallback callback) - { - return ((CMMFBackendEngine *)(context))->RegisterCallback(callback); - } + XAresult mmf_playitf_register_callback(void * context, + xaPlayCallback callback) + { + return ((CMMFBackendEngine *) (context))->RegisterCallback(callback); + } - XAresult mmf_playitf_set_callback_events_mask(void * context, XAuint32 eventflags) - { - return ((CMMFBackendEngine *)(context))->SetCallbackEventsMask(eventflags); - } + XAresult mmf_playitf_set_callback_events_mask(void * context, + XAuint32 eventflags) + { + return ((CMMFBackendEngine *) (context))->SetCallbackEventsMask( + eventflags); + } - XAresult mmf_playitf_set_marker_position(void * context, XAmillisecond mSec) - { - return ((CMMFBackendEngine *)(context))->SetMarkerPosition(mSec); - } + XAresult mmf_playitf_set_marker_position(void * context, + XAmillisecond mSec) + { + return ((CMMFBackendEngine *) (context))->SetMarkerPosition(mSec); + } XAresult mmf_playitf_clear_marker_position(void * context) - { - return ((CMMFBackendEngine *)(context))->ClearMarkerPosition(); + { + return ((CMMFBackendEngine *) (context))->ClearMarkerPosition(); - } + } - XAresult mmf_playitf_set_position_update_period(void * context, XAmillisecond mSec) - { - return ((CMMFBackendEngine *)(context))->SetPositionUpdatePeriod(mSec); - } + XAresult mmf_playitf_set_position_update_period(void * context, + XAmillisecond mSec) + { + return ((CMMFBackendEngine *) (context))->SetPositionUpdatePeriod( + mSec); + } XAresult mmf_seekitf_set_position(void * context, XAmillisecond pMsec) - { - return ((CMMFBackendEngine *)(context))->SetPosition(pMsec); - } + { + return ((CMMFBackendEngine *) (context))->SetPosition(pMsec); + } - XAresult mmf_seekitf_set_playwindow(void * context, XAmillisecond start, XAmillisecond end) - { - return ((CMMFBackendEngine *)(context))->SetPlayWindow(start,end); - } + XAresult mmf_seekitf_set_playwindow(void * context, XAmillisecond start, + XAmillisecond end) + { + return ((CMMFBackendEngine *) (context))->SetPlayWindow(start, end); + } XAresult mmf_seekitf_set_repeats(void * context, XAboolean repeat) - { - return ((CMMFBackendEngine *)(context))->SetRepeats(repeat); - } + { + return ((CMMFBackendEngine *) (context))->SetRepeats(repeat); + } - XAresult mmf_streaminformationitf_get_streaminfo(void * context, XAuint32 streamindex, - XAuint32* streamtype) - { - return ((CMMFBackendEngine *)(context))->GetStreamInfo(streamindex, streamtype); - } + XAresult mmf_streaminformationitf_get_streaminfo(void * context, + XAuint32 streamindex, XAuint32* streamtype) + { + return ((CMMFBackendEngine *) (context))->GetStreamInfo(streamindex, + streamtype); + } - XAresult mmf_streaminformationitf_get_numstreams(void * context, XAuint32* numstreams) - { - return ((CMMFBackendEngine *)(context))->GetNumStreams(numstreams); - } + XAresult mmf_streaminformationitf_get_numstreams(void * context, + XAuint32* numstreams) + { + return ((CMMFBackendEngine *) (context))->GetNumStreams(numstreams); + } - XAresult mmf_streaminformationitf_get_videoframesize(void * context, XAuint32* height, - XAuint32* width, XAuint32* frameRate) - { - return ((CMMFBackendEngine *)(context))->GetVideoFrameSize(height,width,frameRate); - } + XAresult mmf_streaminformationitf_get_videoframesize(void * context, + XAuint32* height, XAuint32* width, XAuint32* frameRate) + { + return ((CMMFBackendEngine *) (context))->GetVideoFrameSize(height, + width, frameRate); + } - XAresult mmf_streaminformationitf_set_activestream(void * context, XAuint32 streamindex, - XAboolean active) - { - return ((CMMFBackendEngine *)(context))->SetActiveState(streamindex, active); - } - + XAresult mmf_streaminformationitf_set_activestream(void * context, + XAuint32 streamindex, XAboolean active) + { + return ((CMMFBackendEngine *) (context))->SetActiveState(streamindex, + active); + } + XAresult mmf_volumeitf_set_volume(void * context, XAuint32 volume) - { - return ((CMMFBackendEngine *)(context))->SetVolume(volume); - } + { + return ((CMMFBackendEngine *) (context))->SetVolume(volume); + } XAresult mmf_volumeitf_get_maxvolume(void * context, XAuint32* volume) - { - return ((CMMFBackendEngine *)(context))->GetMaxVolume(volume); - } - + { + return ((CMMFBackendEngine *) (context))->GetMaxVolume(volume); + } + XAresult mmf_volumeitf_get_volume(void * context, XAuint32* volume) - { - return ((CMMFBackendEngine *)(context))->GetVolume(volume); - } -} + { + return ((CMMFBackendEngine *) (context))->GetVolume(volume); + } + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.h --- a/khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/cmmfbackendengine.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,22 +1,22 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MMF Backend Engine Header + * + */ -#ifndef XA_CMMFBackendEngine_H -#define XA_CMMFBackendEngine_H +#ifndef CMMFBackendEngine_H +#define CMMFBackendEngine_H #define ENABLE_GRAPHICS_SURFACE_INTEGRATION @@ -45,52 +45,55 @@ #endif // MetaDataWrite Custom Command UID -const TUid KUidMetaDataWriteCustomCommand = {0x10207af9}; +const TUid KUidMetaDataWriteCustomCommand = + { + 0x10207af9 + }; #define MAX_EXTENSION_SIZE 10 class CMarkerPositionTimer; class CPositionUpdateTimer; NONSHARABLE_CLASS(CMMFBackendEngine) : public CBase, - public MVideoPlayerUtilityObserver, - public MVideoLoadingObserver, - public MMdaAudioPlayerCallback, - public MMdaObjectStateChangeObserver + public MVideoPlayerUtilityObserver, + public MVideoLoadingObserver, + public MMdaAudioPlayerCallback, + public MMdaObjectStateChangeObserver { -public: - enum TFuncInUse - { - EPlay = 0, - ERecord - }; - - enum TUriType - { - ELocal = 0, - EStreaming - }; +public: + enum TFuncInUse + { + EPlay = 0, + ERecord + }; - enum TMMFUtiltyInUse - { + enum TUriType + { + ELocal = 0, + EStreaming + }; + + enum TMMFUtiltyInUse + { ENoUtility, EVideoPlayerUtility, EAudioPlayerUtility, EAudioRecorderUtility - }; - - enum TRecorderState - { - ERecorderNotReady = 0, - ERecorderOpen, - ERecorderRecording - }; - + }; + + enum TRecorderState + { + ERecorderNotReady = 0, + ERecorderOpen, + ERecorderRecording + }; + public: static CMMFBackendEngine* NewL(); ~CMMFBackendEngine(); - - TInt SetFileName(char* uri,XAuint32 format,TFuncInUse func); + + TInt SetFileName(char* uri, XAuint32 format, TFuncInUse func); void Close(); void Destroy(); TInt SetRecorderState(TRecorderState state, XAboolean stopCalled); @@ -105,11 +108,10 @@ TInt SetDestinationSampleRate(XAmilliHertz* samplerate); TInt SetDestinationChannels(XAuint32* channels); -/* XAresult SetWindowHandle(void* display_info);*/ XAresult CreateAndConfigureWindowL(); XAresult SetNativeDisplayInformation(void* display_info); XAresult ResumePlayback(); - XAresult PausePlayback(); + XAresult PausePlayback(); XAresult StopPlayback(); XAresult GetPlayState(XAuint32 *pState); XAresult GetDuration(XAmillisecond *pMsec); @@ -124,30 +126,27 @@ XAresult SetPosition(XAmillisecond pMsec); XAresult SetRepeats(XAboolean repeat); XAresult SetPlayWindow(XAmillisecond start, XAmillisecond end); - + XAresult GetNumStreams(XAuint32* numstreams); XAresult GetStreamInfo(XAuint32 streamindex, XAuint32* streamtype); - XAresult GetVideoFrameSize(XAuint32* height, XAuint32* width, XAuint32* frameRate); + XAresult GetVideoFrameSize(XAuint32* height, XAuint32* width, + XAuint32* frameRate); XAresult SetActiveState(XAuint32 streamindex, XAboolean active); - + XAresult SetVolume(XAuint32 volume); XAresult GetVolume(XAuint32* volume); XAresult GetMaxVolume(XAuint32* maxvolume); public: // MMdaObjectStateChangeObserver - void MoscoStateChangeEvent( - CBase* aObject, - TInt aPreviousState, - TInt aCurrentState, - TInt aErrorcCode); + void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, + TInt aCurrentState, TInt aErrorcCode); //MMdaAudioPlayerCallback - void MapcInitComplete( - TInt aError, + void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); void MapcPlayComplete(TInt aError); - + //From MVidePlayerUtilityObserver void MvpuoOpenComplete(TInt aError); void MvpuoPrepareComplete(TInt aError); @@ -157,18 +156,18 @@ // From MRebufferCallback void MvloLoadingStarted(); - void MvloLoadingComplete(); + void MvloLoadingComplete(); -private: +private: enum TPlayerState - { - EPlayerClosed, - EPlayerOpened, - EPlayerPrepared, - EPlayerPaused, - EPlayerPlaying, - }; - + { + EPlayerClosed, + EPlayerOpened, + EPlayerPrepared, + EPlayerPaused, + EPlayerPlaying, + }; + private: CMMFBackendEngine(); void ConstructL(); @@ -182,29 +181,29 @@ TInt InitializeURIForMMFUtil(char *uri); private: - CVideoPlayerUtility2* iVideoPlayer; - CBase* iBaseVideoPlayer; - CMdaAudioPlayerUtility* iAudioPlayer; - CBase* iBaseAudioPlayer; - CMdaAudioRecorderUtility* iAudioRecorder; - CBase* iBaseAudioRecorder; - TFileName iFileName; - TInt iAPIBeingUsed; - TInt iPreviousRecordState; - TInt iCurrentRecordState; - TInt iErrorCode; - TRecorderState iRecordState; - LocalTimer* iPositionUpdateTimer; - TUint64 iTimerDelay; - void* iAdaptContext; - XAuint32 iFileFormat; - TInt iPauseSupportMP4; - CActiveSchedulerWait* iActiveSchedulerWait; - CAudioInput* iAudioInputRecord; + CVideoPlayerUtility2* iVideoPlayer; + CBase* iBaseVideoPlayer; + CMdaAudioPlayerUtility* iAudioPlayer; + CBase* iBaseAudioPlayer; + CMdaAudioRecorderUtility* iAudioRecorder; + CBase* iBaseAudioRecorder; + TFileName iFileName; + TInt iAPIBeingUsed; + TInt iPreviousRecordState; + TInt iCurrentRecordState; + TInt iErrorCode; + TRecorderState iRecordState; + LocalTimer* iPositionUpdateTimer; + TUint64 iTimerDelay; + void* iAdaptContext; + XAuint32 iFileFormat; + TInt iPauseSupportMP4; + CActiveSchedulerWait* iActiveSchedulerWait; + CAudioInput* iAudioInputRecord; #ifdef USE_LOCAL_WINDOW_RESOURCES CMediaClientVideoDisplay* iMediaClientVideoDisplay; TRect m_clipRect; - TRect m_videoExtent; + TRect m_videoExtent; TRect m_cropRegion; TVideoAspectRatio m_pixelAspectRatio; RWindow m_Window; @@ -214,8 +213,8 @@ TReal32 m_scaleWidth; TReal32 m_scaleHeight; TInt m_horizPos; - TInt m_vertPos; - TInt m_displayId; + TInt m_vertPos; + TInt m_displayId; /*TBool m_bWindowReferencePassed;*/ RWsSession m_ws; #endif /* USE_LOCAL_WINDOW_RESOURCES */ @@ -249,18 +248,16 @@ /* Property set by client */ RWsSession* m_pWs; /* Property set by client */ - RWindow* m_pWindow; + RWindow* m_pWindow; }; #else /* __cplusplus */ - extern int mmf_backend_engine_init(void** engine); extern int mmf_backend_engine_deinit(void* engine); extern int mmf_set_recorder_uri(void* context, char* uri, XAuint32 format); - extern void mmf_close(void* context); extern int mmf_set_adapt_context(void* context, void* adaptcontext); @@ -305,15 +302,15 @@ extern XAresult mmf_streaminformationitf_get_numstreams(void * context, XAuint32* numstreams); extern XAresult mmf_streaminformationitf_get_streaminfo(void * context, XAuint32 streamindex, - XAuint32* streamtype); + XAuint32* streamtype); extern XAresult mmf_streaminformationitf_get_videoframesize(void * context, XAuint32* height, - XAuint32* width, XAuint32* frameRate); + XAuint32* width, XAuint32* frameRate); extern XAresult mmf_streaminformationitf_set_activestream(void * context, XAuint32 streamindex, - XAboolean active); + XAboolean active); extern XAresult mmf_volumeitf_set_volume(void * context, XAuint32 volume); extern XAresult mmf_volumeitf_get_volume(void * context, XAuint32* volume); extern XAresult mmf_volumeitf_get_maxvolume(void * context, XAuint32* volume); #endif /* __cplusplus */ -#endif /* XA_CMMFBackendEngine_H */ +#endif /* CMMFBackendEngine_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.h --- a/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.h Fri Jun 11 19:59:23 2010 -0500 @@ -21,11 +21,11 @@ #ifdef __cplusplus #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include "xaadaptationmmf.h" diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/markerpositiontimer.cpp --- a/khronosfws/openmax_al/src/mmf_adaptation/markerpositiontimer.cpp Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/markerpositiontimer.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -1,38 +1,38 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles marker timer implementation -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Handles marker timer implementation + * + */ #include "markerpositiontimer.h" #include #include #include -extern "C" { +extern "C" + { #include "xarecorditfadaptationmmf.h" -} + } #define RET_ERR_IF_ERR(s) if (s!=KErrNone) return s; #define RET_IF_ERR(s) if (s!=KErrNone) return; CMarkerPositionTimer::CMarkerPositionTimer( CMdaAudioPlayerUtility* aAudioPlayer, - CVideoPlayerUtility2* aVideoPlayer) -:CActive(CActive::EPriorityStandard), - iAudioPlayer(aAudioPlayer), - iVideoPlayer(aVideoPlayer) + CVideoPlayerUtility2* aVideoPlayer) : + CActive(CActive::EPriorityStandard), iAudioPlayer(aAudioPlayer), + iVideoPlayer(aVideoPlayer) { CActiveScheduler::Add(this); } @@ -47,7 +47,8 @@ CMdaAudioPlayerUtility* aAudioPlayer, CVideoPlayerUtility2* aVideoPlayer) { - CMarkerPositionTimer* self = new (ELeave)CMarkerPositionTimer(aAudioPlayer, aVideoPlayer); + CMarkerPositionTimer* self = new (ELeave) CMarkerPositionTimer( + aAudioPlayer, aVideoPlayer); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); @@ -56,12 +57,12 @@ void CMarkerPositionTimer::ConstructL() { - User::LeaveIfError(iTimer.CreateLocal()); + User::LeaveIfError(iTimer.CreateLocal()); } void CMarkerPositionTimer::SetContext(TAny* aCtx) { - iCtx = aCtx; + iCtx = aCtx; } void CMarkerPositionTimer::SetMarkerPosition(XAmillisecond aMarkerPos) @@ -81,11 +82,11 @@ void CMarkerPositionTimer::UseAudioPlayer() { - iPlayerToUse = static_cast(iAudioPlayer); + iPlayerToUse = static_cast (iAudioPlayer); } void CMarkerPositionTimer::UseVideoPlayer() { - iPlayerToUse = static_cast(iVideoPlayer); + iPlayerToUse = static_cast (iVideoPlayer); } void CMarkerPositionTimer::ResetPlayer() @@ -100,10 +101,8 @@ { Cancel(); } - if ((iMarkerPosition != XA_TIME_UNKNOWN) && - (iCallbackEventMask & XA_PLAYEVENT_HEADATMARKER) && - iCallback && - iPlayerToUse) + if ((iMarkerPosition != XA_TIME_UNKNOWN) && (iCallbackEventMask + & XA_PLAYEVENT_HEADATMARKER) && iCallback && iPlayerToUse) { TTimeIntervalMicroSeconds32 delay; /* Convert milli to micro */ @@ -132,7 +131,7 @@ iSyncToPlayHeadStartPos.Int64(), delay.Int()); #endif /* MARKERPOSITIONTIMERLOG */ - if ( delay >= TTimeIntervalMicroSeconds32(0)) + if (delay >= TTimeIntervalMicroSeconds32(0)) { iStatus = KRequestPending; iTimer.After(iStatus, delay); @@ -151,12 +150,9 @@ { TInt retVal(KErrNone); /* Make sure some of the attributes are not unset */ - if ((iStatus == KErrNone) && - iCtx && - (iMarkerPosition != XA_TIME_UNKNOWN) && - (iCallbackEventMask & XA_PLAYEVENT_HEADATMARKER) && - iCallback && - iPlayerToUse) + if ((iStatus == KErrNone) && iCtx && (iMarkerPosition != XA_TIME_UNKNOWN) + && (iCallbackEventMask & XA_PLAYEVENT_HEADATMARKER) && iCallback + && iPlayerToUse) { TTimeIntervalMicroSeconds curPlayPos; if (iSyncToPlayHead) @@ -168,9 +164,9 @@ if (curPlayPos == iSyncToPlayHeadStartPos) { #ifdef MARKERPOSITIONTIMERLOG - RDebug::Print(_L("CMarkerPositionTimer::RunL:CurPlayPos[%u]SyncPlayHead[%u]microSec. Restart"), - iSyncToPlayHeadStartPos.Int64(), - curPlayPos.Int64()); + RDebug::Print(_L("CMarkerPositionTimer::RunL:CurPlayPos[%u]SyncPlayHead[%u]microSec. Restart"), + iSyncToPlayHeadStartPos.Int64(), + curPlayPos.Int64()); #endif /* MARKERPOSITIONTIMERLOG */ Start(); return; @@ -195,7 +191,7 @@ curPlayPos.Int64(), delay.Int()); #endif /* MARKERPOSITIONTIMERLOG */ - if ( delay >= TTimeIntervalMicroSeconds32(0)) + if (delay >= TTimeIntervalMicroSeconds32(0)) { iStatus = KRequestPending; iTimer.After(iStatus, delay); @@ -208,8 +204,12 @@ retVal = GetCurrentPlayPosition(curPlayPos); RDebug::Print(_L("CMarkerPositionTimer::RunL:CurPlayPos[%u]microSec. Posting XA_PLAYEVENT_HEADATMARKER."), curPlayPos.Int64()); #endif /* MARKERPOSITIONTIMERLOG */ - XAAdaptEvent xaevent = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADATMARKER, 0, 0 }; - XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iCtx, &xaevent ); + XAAdaptEvent xaevent = + { + XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADATMARKER, 0, 0 + }; + XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*) iCtx, + &xaevent); } } @@ -223,7 +223,8 @@ return KErrNone; } -TInt CMarkerPositionTimer::GetCurrentPlayPosition(TTimeIntervalMicroSeconds& aPos) +TInt CMarkerPositionTimer::GetCurrentPlayPosition( + TTimeIntervalMicroSeconds& aPos) { TTimeIntervalMicroSeconds pos; TInt err(KErrNone); diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/markerpositiontimer.h --- a/khronosfws/openmax_al/src/mmf_adaptation/markerpositiontimer.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/markerpositiontimer.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles marker timer implementation -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Handles marker timer implementation + * + */ #ifndef CMARKERPOSITIONTIMER_H #define CMARKERPOSITIONTIMER_H @@ -29,8 +29,8 @@ public: // Construct/destruct static CMarkerPositionTimer* NewL(CMdaAudioPlayerUtility* aAudioPlayer, - CVideoPlayerUtility2* aVideoPlayer); - ~CMarkerPositionTimer(); + CVideoPlayerUtility2* aVideoPlayer); + virtual ~CMarkerPositionTimer(); public: void SetContext(TAny* aCtx); @@ -56,7 +56,7 @@ TInt GetCurrentPlayPosition(TTimeIntervalMicroSeconds& aPos); private: - RTimer iTimer; // Has + RTimer iTimer; // Has TAny* iCtx; CMdaAudioPlayerUtility* iAudioPlayer; CVideoPlayerUtility2* iVideoPlayer; diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/positionupdatetimer.cpp --- a/khronosfws/openmax_al/src/mmf_adaptation/positionupdatetimer.cpp Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/positionupdatetimer.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -1,38 +1,38 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles new position timer implementation -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Handles new position timer implementation + * + */ #include "positionupdatetimer.h" #include #include #include -extern "C" { +extern "C" + { #include "xarecorditfadaptationmmf.h" -} + } #define RET_ERR_IF_ERR(s) if (s!=KErrNone) return s; #define RET_IF_ERR(s) if (s!=KErrNone) return; CPositionUpdateTimer::CPositionUpdateTimer( CMdaAudioPlayerUtility* aAudioPlayer, - CVideoPlayerUtility2* aVideoPlayer) -:CActive(CActive::EPriorityStandard), - iAudioPlayer(aAudioPlayer), - iVideoPlayer(aVideoPlayer) + CVideoPlayerUtility2* aVideoPlayer) : + CActive(CActive::EPriorityStandard), iAudioPlayer(aAudioPlayer), + iVideoPlayer(aVideoPlayer) { CActiveScheduler::Add(this); } @@ -47,7 +47,8 @@ CMdaAudioPlayerUtility* aAudioPlayer, CVideoPlayerUtility2* aVideoPlayer) { - CPositionUpdateTimer* self = new (ELeave)CPositionUpdateTimer(aAudioPlayer, aVideoPlayer); + CPositionUpdateTimer* self = new (ELeave) CPositionUpdateTimer( + aAudioPlayer, aVideoPlayer); CleanupStack::PushL(self); self->CostructL(); CleanupStack::Pop(self); @@ -56,18 +57,18 @@ void CPositionUpdateTimer::CostructL() { - User::LeaveIfError(iTimer.CreateLocal()); + User::LeaveIfError(iTimer.CreateLocal()); } void CPositionUpdateTimer::SetContext(TAny* aCtx) { - iCtx = aCtx; + iCtx = aCtx; } void CPositionUpdateTimer::SetPositionUpdatePeriod(XAmillisecond aPos) { iPositionUpdatePeriod = aPos; - iDelay = TTimeIntervalMicroSeconds32(aPos*1000); + iDelay = TTimeIntervalMicroSeconds32(aPos * 1000); } void CPositionUpdateTimer::SetCallbackEventMask(XAuint32 aMask) @@ -82,11 +83,11 @@ void CPositionUpdateTimer::UseAudioPlayer() { - iPlayerToUse = static_cast(iAudioPlayer); + iPlayerToUse = static_cast (iAudioPlayer); } void CPositionUpdateTimer::UseVideoPlayer() { - iPlayerToUse = static_cast(iVideoPlayer); + iPlayerToUse = static_cast (iVideoPlayer); } void CPositionUpdateTimer::ResetPlayer() @@ -101,13 +102,13 @@ { Cancel(); } - if ((iCallbackEventMask & XA_PLAYEVENT_HEADATNEWPOS) && - iCallback && - iPlayerToUse) + if ((iCallbackEventMask & XA_PLAYEVENT_HEADATNEWPOS) && iCallback + && iPlayerToUse) { TTimeIntervalMicroSeconds curPlayPos; /* Convert milli to micro */ - TTimeIntervalMicroSeconds posUpdatePeriod(iPositionUpdatePeriod * 1000); + TTimeIntervalMicroSeconds posUpdatePeriod(iPositionUpdatePeriod + * 1000); TTimeIntervalMicroSeconds32 delay; /* Convert milli to micro */ TReal res; @@ -134,7 +135,7 @@ iSyncToPlayHeadStartPos.Int64(), delay.Int()); #endif /* POSITIONUPDATETIMERLOG */ - if ( delay >= TTimeIntervalMicroSeconds32(0)) + if (delay >= TTimeIntervalMicroSeconds32(0)) { iStatus = KRequestPending; iTimer.After(iStatus, delay); @@ -153,11 +154,8 @@ { TInt retVal(KErrNone); /* Make sure some of the attributes are not unset */ - if ((iStatus == KErrNone) && - iCtx && - (iCallbackEventMask & XA_PLAYEVENT_HEADATNEWPOS) && - iCallback && - iPlayerToUse) + if ((iStatus == KErrNone) && iCtx && (iCallbackEventMask + & XA_PLAYEVENT_HEADATNEWPOS) && iCallback && iPlayerToUse) { TTimeIntervalMicroSeconds curPlayPos; if (iSyncToPlayHead) @@ -169,16 +167,17 @@ if (curPlayPos == iSyncToPlayHeadStartPos) { #ifdef POSITIONUPDATETIMERLOG - RDebug::Print(_L("CPositionUpdateTimer::RunL:CurPlayPos[%u]SyncPlayHead[%u]microSec. Restart"), - iSyncToPlayHeadStartPos.Int64(), - curPlayPos.Int64()); + RDebug::Print(_L("CPositionUpdateTimer::RunL:CurPlayPos[%u]SyncPlayHead[%u]microSec. Restart"), + iSyncToPlayHeadStartPos.Int64(), + curPlayPos.Int64()); #endif /* POSITIONUPDATETIMERLOG */ Start(); return; } /* Play head has moved. calculate remaining time and set the timer */ /* Convert milli to micro */ - TTimeIntervalMicroSeconds posUpdatePeriod(iPositionUpdatePeriod * 1000); + TTimeIntervalMicroSeconds posUpdatePeriod(iPositionUpdatePeriod + * 1000); TReal res; TReal p; TReal q(posUpdatePeriod.Int64()); @@ -189,14 +188,15 @@ retVal = Math::Mod(res, p, q); RET_IF_ERR(retVal); - TTimeIntervalMicroSeconds32 delay = (posUpdatePeriod.Int64() - res); + TTimeIntervalMicroSeconds32 delay = (posUpdatePeriod.Int64() + - res); #ifdef POSITIONUPDATETIMERLOG RDebug::Print(_L("CPositionUpdateTimer::RunL:CurPlayPos[%u]SyncPlayHead[%u]Delay Reset[%u]microSec"), iSyncToPlayHeadStartPos.Int64(), curPlayPos.Int64(), delay.Int()); #endif /* POSITIONUPDATETIMERLOG */ - if ( delay >= TTimeIntervalMicroSeconds32(0)) + if (delay >= TTimeIntervalMicroSeconds32(0)) { iStatus = KRequestPending; iTimer.After(iStatus, delay); @@ -209,8 +209,12 @@ retVal = GetCurrentPlayPosition(curPlayPos); RDebug::Print(_L("CPositionUpdateTimer::RunL:CurPlayPos[%u]microSec. Posting XA_PLAYEVENT_HEADATNEWPOS."), curPlayPos.Int64()); #endif /* POSITIONUPDATETIMERLOG */ - XAAdaptEvent xaevent = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADATNEWPOS, 0, 0 }; - XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*)iCtx, &xaevent ); + XAAdaptEvent xaevent = + { + XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADATNEWPOS, 0, 0 + }; + XAAdaptationBase_SendAdaptEvents((XAAdaptationBaseCtx*) iCtx, + &xaevent); iStatus = KRequestPending; iTimer.After(iStatus, iDelay); SetActive(); @@ -222,20 +226,21 @@ iTimer.Cancel(); } -TInt CPositionUpdateTimer::RunError(TInt /*aError*/) +TInt CPositionUpdateTimer::RunError(TInt aError) { - return KErrNone; + return aError; } -TInt CPositionUpdateTimer::GetCurrentPlayPosition(TTimeIntervalMicroSeconds& aPos) +TInt CPositionUpdateTimer::GetCurrentPlayPosition( + TTimeIntervalMicroSeconds& aPos) { TTimeIntervalMicroSeconds pos; TInt err(KErrNone); - if (iPlayerToUse == iAudioPlayer) + if (iPlayerToUse && (iPlayerToUse == iAudioPlayer)) { iAudioPlayer->GetPosition(aPos); } - else if (iPlayerToUse == iVideoPlayer) + else if (iPlayerToUse && (iPlayerToUse == iVideoPlayer)) { TRAP(err, aPos = iVideoPlayer->PositionL()); } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/positionupdatetimer.h --- a/khronosfws/openmax_al/src/mmf_adaptation/positionupdatetimer.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/positionupdatetimer.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Handles marker timer implementation -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Handles marker timer implementation + * + */ #ifndef CPOSITIONUPDATETIMER_H #define CPOSITIONUPDATETIMER_H @@ -29,8 +29,8 @@ public: // Construct/destruct static CPositionUpdateTimer* NewL(CMdaAudioPlayerUtility* aAudioPlayer, - CVideoPlayerUtility2* aVideoPlayer); - ~CPositionUpdateTimer(); + CVideoPlayerUtility2* aVideoPlayer); + virtual ~CPositionUpdateTimer(); public: void SetContext(TAny* aCtx); @@ -56,7 +56,7 @@ TInt GetCurrentPlayPosition(TTimeIntervalMicroSeconds& aPos); private: - RTimer iTimer; // Has + RTimer iTimer; // Has TAny* iCtx; CMdaAudioPlayerUtility* iAudioPlayer; CVideoPlayerUtility2* iVideoPlayer; @@ -65,8 +65,8 @@ XAuint32 iCallbackEventMask; xaPlayCallback iCallback; TTimeIntervalMicroSeconds32 iDelay; - TBool iSyncToPlayHead; - TTimeIntervalMicroSeconds iSyncToPlayHeadStartPos; + TBool iSyncToPlayHead; + TTimeIntervalMicroSeconds iSyncToPlayHeadStartPos; }; #endif /* CPOSITIONUPDATETIMER_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/sfmrlocaltimer.cpp --- a/khronosfws/openmax_al/src/mmf_adaptation/sfmrlocaltimer.cpp Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/sfmrlocaltimer.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -1,33 +1,31 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -// sfmrlocaltimer.cpp + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Local timer to update position for recording + * + */ #include "sfmrlocaltimer.h" -extern "C" { +extern "C" + { #include "xarecorditfadaptationmmf.h" -} + } #include "cmmfbackendengine.h" - -LocalTimer::LocalTimer(CMMFBackendEngine* parent, void* adaptContext) -:CActive(CActive::EPriorityStandard), -iTime(0) +LocalTimer::LocalTimer(CMMFBackendEngine* parent, void* adaptContext) : + CActive(CActive::EPriorityStandard), iTime(0) { CActiveScheduler::Add(this); iParent = parent; @@ -77,11 +75,11 @@ { if (iStatus == KErrNone) { - iTime+= iDelay; + iTime += iDelay; XAuint64 position; iParent->GetRecordPosition(&position); - - XARecordItfAdaptMMF_PositionUpdate(iAdaptContext,position); + + XARecordItfAdaptMMF_PositionUpdate(iAdaptContext, position); Start(iDelay); } } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/sfmrlocaltimer.h --- a/khronosfws/openmax_al/src/mmf_adaptation/sfmrlocaltimer.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/sfmrlocaltimer.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -// sfmrlocaltimer.h + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #ifndef SFMRLOCALTIMER_H #define SFMRLOCALTIMER_H @@ -28,7 +27,7 @@ // Construct/destruct LocalTimer(CMMFBackendEngine* parent, void* adaptContext); TInt PostInit(); - ~LocalTimer(); + virtual ~LocalTimer(); public: // Starts ticking after every aDelay microsecs @@ -42,9 +41,8 @@ void RunL(); void DoCancel(); - private: - RTimer iTimer; // Has + RTimer iTimer; // Has TUint64 iTime; TUint64 iDelay; CMMFBackendEngine* iParent; diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MMF Adaptation Context + * + */ #include #include @@ -27,53 +27,63 @@ * 1st phase initialization function for Adaptation Base context structure. * Reserves memory for base context and initializes GStreamer FW. */ -XAresult XAAdaptationBaseMMF_Init( XAAdaptationMMFCtx* pSelf, XAuint32 ctxId ) -{ +XAresult XAAdaptationBaseMMF_Init(XAAdaptationMMFCtx* pSelf, XAuint32 ctxId) + { DEBUG_API("->XAAdaptationBase_Init"); - if ( pSelf ) - { - if(XAAdaptationBase_Init(&(pSelf->baseObj), ctxId) != XA_RESULT_SUCCESS) + if (pSelf) { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; + if (XAAdaptationBase_Init(&(pSelf->baseObj), ctxId) + != XA_RESULT_SUCCESS) + { + DEBUG_ERR("Failed to init base context!!!"); + free(pSelf); + pSelf = NULL; + DEBUG_API("<-XAAdaptationBase_Init"); + return XA_RESULT_MEMORY_FAILURE; + } } - } else - { + { DEBUG_ERR("Invalid Adaptation Base Context.") return XA_RESULT_PARAMETER_INVALID; - } + } DEBUG_API("<-XAAdaptationBase_Init"); return XA_RESULT_SUCCESS; -} + } /* * XAresult XAAdaptationBase_PostInit() * 2nd phase initialization for Adaptation Base. */ -XAresult XAAdaptationBaseMMF_PostInit( XAAdaptationMMFCtx* ctx ) -{ +XAresult XAAdaptationBaseMMF_PostInit(XAAdaptationMMFCtx* ctx) + { XAresult ret = XA_RESULT_SUCCESS; DEBUG_API("->XAAdaptationBase_PostInit"); - - XAAdaptationBase_PostInit(&ctx->baseObj); - + if(ctx) + { + ret = XAAdaptationBase_PostInit(&ctx->baseObj); + } + else + { + ret = XA_RESULT_PARAMETER_INVALID; + } DEBUG_API("<-XAAdaptationBase_PostInit"); return ret; -} + } /* * void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx ) * Frees all Base context variables . */ -void XAAdaptationBaseMMF_Free( XAAdaptationMMFCtx* ctx ) -{ +void XAAdaptationBaseMMF_Free(XAAdaptationMMFCtx* ctx) + { DEBUG_API("->XAAdaptationBaseMMF_Free"); - XAAdaptationBase_Free(&ctx->baseObj); + if(ctx) + { + XAAdaptationBase_Free(&ctx->baseObj); + } DEBUG_API("<-XAAdaptationBaseMMF_Free"); -} + } - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xaadaptationmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #ifndef XAADAPTATIONMMF_H_ #define XAADAPTATIONMMF_H_ @@ -25,7 +25,6 @@ #include #include "openmaxalwrapper.h" #include "xaglobals.h" -//#include "OpenMAXAL_ContentPipe.h" #include "xaplatform.h" #include "xaadptbasectx.h" #ifdef XA_IMPL_MEASURE_GST_DELAY @@ -41,43 +40,11 @@ #define FLIP_VERTICAL 5 /* Flip image vertically */ /* TYPEDEFS */ -//typedef gboolean (*GstBusCb)( GstBus *bus, GstMessage *message, gpointer data ); #define CONTENT_PIPE_BUFFER_SIZE 1000 #define TEST_VIDEO_WIDTH 640 #define TEST_VIDEO_HEIGHT 480 -/* -typedef enum -{ - XA_AUDIO_WAVENC = 0, - XA_AUDIO_VORBISENC, - XA_AUDIO_PCM, - XA_NUM_OF_AUDIOENCODERS Do not move this line -} XAAudioEnc; - -typedef enum -{ - XA_VIDEO_JPEGENC = 0, - XA_VIDEO_THEORAENC, - XA_NUM_OF_VIDEOENCODERS Do not move this line -} XAVideoEnc; - -typedef enum CP_STATE -{ - CPStateNull =0, - CPStateInitialized, - CPStatePrerolling, - CPStateStarted, - CPStateRunning, - CPStatePaused, - CPStateStopped, - CPStateWaitForData, - CPStateEOS, - CPStateError -}CP_STATE; -*/ - /* Forward declaration of adaptation basecontext */ typedef struct XAAdaptationMMFCtx_ XAAdaptationMMFCtx; @@ -86,88 +53,86 @@ * mmf-Adaptation context structures. */ typedef struct XAAdaptationMMFCtx_ -{ -XAAdaptationBaseCtx baseObj; + { + XAAdaptationBaseCtx baseObj; -} XAAdaptationMMFCtx_; + } XAAdaptationMMFCtx_; typedef struct XAEngineAdaptationMMFCtx_ -{ + { /* Parent*/ - XAAdaptationMMFCtx_ baseObj; + XAAdaptationMMFCtx_ baseObj; -} XAEngineAdaptationMMFCtx_; + } XAEngineAdaptationMMFCtx_; /* * Structure for Media Player specific gst-adaptation. */ typedef struct XAMediaPlayerAdaptationMMFCtx_ -{ + { /* Parent*/ - XAAdaptationMMFCtx_ baseObj; + XAAdaptationMMFCtx_ baseObj; /* OMX-AL Variables */ - XADataSource *xaSource, *xaBankSrc; - XADataSink *xaAudioSink, *xaVideoSink, *xaLEDArray, *xaVibra; + XADataSource *xaSource, *xaBankSrc; + XADataSink *xaAudioSink, *xaVideoSink, *xaLEDArray, *xaVibra; /* MMF elements */ - XAboolean isobjsrc; /*is source another XA object?*/ + XAboolean isobjsrc; /*is source another XA object?*/ - XAboolean isobjasink; /*is audio sink another XA object?*/ - XAboolean isobjvsink; /*is video sink another XA object?*/ + XAboolean isobjasink; /*is audio sink another XA object?*/ + XAboolean isobjvsink; /*is video sink another XA object?*/ - XAboolean mute; - XAuint32 premutevol; - XAuint32 imageEffectID; - XAboolean isStereoPosition; - XAmillidegree curRotation; - XAuint32 curMirror; + XAboolean mute; + XAuint32 premutevol; + XAuint32 imageEffectID; + XAboolean isStereoPosition; + XAmillidegree curRotation; + XAuint32 curMirror; - XAint32 buffering; + XAint32 buffering; /* internals */ - XAboolean trackpositionenabled; + XAboolean trackpositionenabled; - - XAboolean loopingenabled; + XAboolean loopingenabled; - XAboolean cameraSinkSynced; - void* mmfContext; - void* mmfMetadataContext; - XAboolean isForRadio; -/* - XAuint32 playerState; -*/ + XAboolean cameraSinkSynced; + void* mmfContext; + void* mmfMetadataContext; + XAboolean isForRadio; + /* + XAuint32 playerState; + */ -} XAMediaPlayerAdaptationMMFCtx_; + } XAMediaPlayerAdaptationMMFCtx_; typedef struct XAMetadataAdaptationMMFCtx_ -{ + { /* Parent*/ - XAAdaptationMMFCtx_ baseObj; + XAAdaptationMMFCtx_ baseObj; /* OMX-AL Variables */ - XADataSource *xaSource; + XADataSource *xaSource; - void* mmfContext; -} XAMetadataAdaptationMMFCtx_; - - + void* mmfContext; + } XAMetadataAdaptationMMFCtx_; /* * Structure for Radio specific variables */ -typedef struct XARadioAdaptationCtx_ { +typedef struct XARadioAdaptationCtx_ + { /* Parent*/ - XAAdaptationMMFCtx_ baseObj; + XAAdaptationMMFCtx_ baseObj; XAuint32 frequency; XAuint8 range; pthread_t emulationThread; pthread_t rdsEmulationThread; -} XARadioAdaptationCtx_; + } XARadioAdaptationCtx_; /* FUNCTIONS */ /* * gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ); @@ -175,8 +140,8 @@ * not implemented. */ -XAresult XAAdaptationBaseMMF_Init( XAAdaptationMMFCtx* pSelf, XAuint32 ctxId ); -XAresult XAAdaptationBaseMMF_PostInit( XAAdaptationMMFCtx* ctx ); -void XAAdaptationBaseMMF_Free( XAAdaptationMMFCtx* ctx ); +XAresult XAAdaptationBaseMMF_Init(XAAdaptationMMFCtx* pSelf, XAuint32 ctxId); +XAresult XAAdaptationBaseMMF_PostInit(XAAdaptationMMFCtx* ctx); +void XAAdaptationBaseMMF_Free(XAAdaptationMMFCtx* ctx); #endif /* XAADAPTATIONMMF_H_ */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xadynamicsourceitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xadynamicsourceitfadaptationmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xadynamicsourceitfadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Dynamic Src Itf MMF Adapt Implementation + * + */ #include "xamediaplayeradaptctxmmf.h" #include "xametadataadaptctxmmf.h" @@ -28,37 +28,44 @@ * @param XADataSource *pDataSource - new data source * @return XAresult ret - Success value */ -XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationMMFCtx *bCtx, XADataSource *pDataSource) -{ +XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationMMFCtx *bCtx, + XADataSource *pDataSource) + { XAresult ret = XA_RESULT_SUCCESS; XAuint32 origstate; DEBUG_API("->XADynamicSourceItfAdaptMMF_SetSource"); - if( !bCtx || !pDataSource || !pDataSource->pLocator ) - { + if (!bCtx || !pDataSource || !pDataSource->pLocator) + { DEBUG_ERR("Invalid NULL parameter"); ret = XA_RESULT_PARAMETER_INVALID; - } - else if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) - { - XADataLocator_URI* tempUri = (XADataLocator_URI*)(pDataSource->pLocator); - XADataFormat_MIME* tempFormat = (XADataFormat_MIME*)(pDataSource->pFormat); - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + } + else if (bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) + { + XADataLocator_URI* tempUri = + (XADataLocator_URI*) (pDataSource->pLocator); + XADataFormat_MIME* tempFormat = + (XADataFormat_MIME*) (pDataSource->pFormat); + XAMediaPlayerAdaptationMMFCtx* mCtx = + (XAMediaPlayerAdaptationMMFCtx*) bCtx; ret = XAPlayItfAdaptMMF_GetPlayState(&bCtx->baseObj, &origstate); - - ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, XA_PLAYSTATE_STOPPED); - + + ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, + XA_PLAYSTATE_STOPPED); + mmf_close(mCtx->mmfContext); mCtx->xaSource = pDataSource; - if(mCtx->xaVideoSink) + if (mCtx->xaVideoSink) { - ret = mmf_setup_native_display(mCtx->mmfContext, mCtx->xaVideoSink); + ret = mmf_setup_native_display(mCtx->mmfContext, + mCtx->xaVideoSink); } if (ret == XA_RESULT_SUCCESS) { - ret = mmf_set_player_uri(mCtx->mmfContext, (char *)(tempUri->URI), tempFormat->containerType); + ret = mmf_set_player_uri(mCtx->mmfContext, + (char *) (tempUri->URI), tempFormat->containerType); } - if(ret == XA_RESULT_SUCCESS) + if (ret == XA_RESULT_SUCCESS) { ret = XAPlayItfAdaptMMF_SetPlayState(&bCtx->baseObj, origstate); } @@ -67,22 +74,25 @@ DEBUG_ERR("Set Play state failed"); ret = XA_RESULT_INTERNAL_ERROR; } - if((ret == XA_RESULT_SUCCESS) && (mCtx->mmfMetadataContext)) + if ((ret == XA_RESULT_SUCCESS) && (mCtx->mmfMetadataContext)) { - mmf_metadata_utility_parse_source(mCtx->mmfMetadataContext, (char *)(tempUri->URI)); + mmf_metadata_utility_parse_source(mCtx->mmfMetadataContext, + (char *) (tempUri->URI)); } - } - else if(bCtx->baseObj.ctxId == XAMDAdaptation) - { - + } + else if (bCtx->baseObj.ctxId == XAMDAdaptation) + { + XAMetadataAdaptationMMFCtx* mCtx = (XAMetadataAdaptationMMFCtx*) bCtx; - if(mCtx->mmfContext) - { - mCtx->xaSource = pDataSource; - mmf_metadata_utility_parse_source(mCtx->mmfContext, (char *)(( (XADataLocator_URI*)(pDataSource->pLocator))->URI)); - } - } + if (mCtx->mmfContext) + { + mCtx->xaSource = pDataSource; + mmf_metadata_utility_parse_source( + mCtx->mmfContext, + (char *) (((XADataLocator_URI*) (pDataSource->pLocator))->URI)); + } + } DEBUG_API("<-XADynamicSourceItfAdaptMMF_SetSource"); return ret; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xadynamicsourceitfadaptationmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xadynamicsourceitfadaptationmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xadynamicsourceitfadaptationmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,28 +1,28 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Dynamic Src Itf MMF Adapt header + * + */ #ifndef XADYNAMICSOURCEITFADAPTATIONMMF_H #define XADYNAMICSOURCEITFADAPTATIONMMF_H #include "xaadaptationmmf.h" - /* FUNCTIONS */ -XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationMMFCtx *bCtx, XADataSource *pDataSource); +XAresult XADynamicSourceItfAdaptMMF_SetSource(XAAdaptationMMFCtx *bCtx, + XADataSource *pDataSource); #endif /* XADYNAMICSOURCEITFADAPTATION_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Media Player Adapt Code MMF + * + */ #include #include @@ -21,11 +21,8 @@ #include "xaadaptationmmf.h" #include "xaobjectitf.h" #include "cmmfbackendengine.h" - #include "cmetadatautilityitf.h" - - /* * XAMediaPlayerAdaptationMMFCtx* XAMediaPlayerAdapt_Create() * Allocates memory for Media Player Adaptation Context and makes 1st phase initialization @@ -35,114 +32,121 @@ * @param XADataSink *pImageVideoSnk - pointer to OMX-AL image and video sink definition * @returns XAMediaPlayerAdaptationMMFCtx* - Pointer to created context, NULL if error occurs. */ -XAAdaptationBaseCtx* XAMediaPlayerAdaptMMF_Create(XADataSource *pDataSrc, XADataSource *pBankSrc, - XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, - XADataSink *pVibra, XADataSink *pLEDArray) -{ +XAAdaptationBaseCtx* XAMediaPlayerAdaptMMF_Create(XADataSource *pDataSrc, + XADataSource *pBankSrc, XADataSink *pAudioSnk, + XADataSink *pImageVideoSnk, XADataSink *pVibra, XADataSink *pLEDArray) + { XAMediaPlayerAdaptationMMFCtx *pSelf = NULL; XAuint32 locType = 0; - XADataLocator_IODevice *ioDevice; + XADataLocator_IODevice *ioDevice; XAresult res; DEBUG_API("->XAMediaPlayerAdaptMMF_Create"); - + pSelf = calloc(1, sizeof(XAMediaPlayerAdaptationMMFCtx)); - if ( pSelf) - { - if ( pDataSrc ) - { - locType = *((XAuint32*)(pDataSrc->pLocator)); - if ( locType == XA_DATALOCATOR_IODEVICE ) - { - ioDevice = (XADataLocator_IODevice*)(pDataSrc->pLocator); - if ( ioDevice->deviceType == XA_IODEVICE_RADIO ) - { - return XAMediaPlayerAdaptMMF_CreateRadio(pSelf, pDataSrc, pBankSrc, pAudioSnk, pImageVideoSnk, pVibra, pLEDArray); - } - } - } - if( XAAdaptationBaseMMF_Init(&(pSelf->baseObj),XAMediaPlayerAdaptation) != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - pSelf->isForRadio = XA_BOOLEAN_FALSE; - pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; - pSelf->xaSource = pDataSrc; - pSelf->xaBankSrc = pBankSrc; - pSelf->xaAudioSink = pAudioSnk; - pSelf->xaVideoSink = pImageVideoSnk; - pSelf->xaLEDArray = pLEDArray; - pSelf->xaVibra = pVibra; - pSelf->curMirror = XA_VIDEOMIRROR_NONE; - pSelf->curRotation = 0; - pSelf->isobjsrc = XA_BOOLEAN_FALSE; - pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE; - /*pSelf->waitData = XA_BOOLEAN_FALSE;*/ - } - } - else - { - DEBUG_ERR("Failed to create XAMediaPlayerAdaptationMMFCtx !!!"); - return NULL; - } - if(pSelf) - { - res = mmf_backend_engine_init(&(pSelf->mmfContext)); - if(!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS)) - { - /* TODO Check to make sure there is no undeleted MMF objects here*/ - DEBUG_ERR("Failed to init mmf context!!!"); - free(pSelf); - pSelf = NULL; - return NULL; - } - res = mmf_set_play_adapt_context(pSelf->mmfContext, &(pSelf->baseObj)); - if(pDataSrc) - { - pSelf->mmfMetadataContext = mmf_metadata_utility_init((char *)(( (XADataLocator_URI*)(pDataSrc->pLocator))->URI)); - if(!pSelf->mmfMetadataContext) + if (pSelf) + { + if (pDataSrc) + { + locType = *((XAuint32*) (pDataSrc->pLocator)); + if (locType == XA_DATALOCATOR_IODEVICE) { - DEBUG_ERR("Failed to init mmf metadata context!!!"); - pSelf->mmfMetadataContext = NULL; + ioDevice = (XADataLocator_IODevice*) (pDataSrc->pLocator); + if (ioDevice->deviceType == XA_IODEVICE_RADIO) + { + return XAMediaPlayerAdaptMMF_CreateRadio(pSelf, pDataSrc, + pBankSrc, pAudioSnk, pImageVideoSnk, pVibra, + pLEDArray); + } } - } - else - { - DEBUG_ERR("Failed to create XAMediaPlayerAdaptationMMFCtx !!!"); - return NULL; - } - } + } + if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), + XAMediaPlayerAdaptation) != XA_RESULT_SUCCESS) + { + DEBUG_ERR("Failed to init base context!!!"); + free(pSelf); + pSelf = NULL; + } + else + { + pSelf->isForRadio = XA_BOOLEAN_FALSE; + pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; + pSelf->xaSource = pDataSrc; + pSelf->xaBankSrc = pBankSrc; + pSelf->xaAudioSink = pAudioSnk; + pSelf->xaVideoSink = pImageVideoSnk; + pSelf->xaLEDArray = pLEDArray; + pSelf->xaVibra = pVibra; + pSelf->curMirror = XA_VIDEOMIRROR_NONE; + pSelf->curRotation = 0; + pSelf->isobjsrc = XA_BOOLEAN_FALSE; + pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE; + } + } + else + { + DEBUG_ERR("Failed to create XAMediaPlayerAdaptationMMFCtx !!!"); + return NULL; + } + + if (pSelf) + { + res = mmf_backend_engine_init(&(pSelf->mmfContext)); + if (!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS)) + { + /* TODO Check to make sure there is no undeleted MMF objects here*/ + DEBUG_ERR("Failed to init mmf context!!!"); + free(pSelf); + pSelf = NULL; + return NULL; + } + res = mmf_set_play_adapt_context(pSelf->mmfContext, + &(pSelf->baseObj)); + if (pDataSrc) + { + pSelf->mmfMetadataContext + = mmf_metadata_utility_init( + (char *) (((XADataLocator_URI*) (pDataSrc->pLocator))->URI)); + if (!pSelf->mmfMetadataContext) + { + DEBUG_ERR("Failed to init mmf metadata context!!!"); + pSelf->mmfMetadataContext = NULL; + } + } + else + { + DEBUG_ERR("Failed to create XAMediaPlayerAdaptationMMFCtx !!!"); + return NULL; + } + } DEBUG_API("<-XAMediaPlayerAdaptMMF_Create"); - return (XAAdaptationBaseCtx*)(&pSelf->baseObj.baseObj); -} + return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj); + } /* * XAMediaPlayerAdaptationMMFCtx* XAMediaPlayerAdapt_CreateRadio() * @returns XAMediaPlayerAdaptationMMFCtx* - Pointer to created context, NULL if error occurs. */ -XAAdaptationBaseCtx* XAMediaPlayerAdaptMMF_CreateRadio(XAMediaPlayerAdaptationMMFCtx *pSelf, XADataSource *pDataSrc, XADataSource *pBankSrc, - XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, - XADataSink *pVibra, XADataSink *pLEDArray) -{ +XAAdaptationBaseCtx* XAMediaPlayerAdaptMMF_CreateRadio( + XAMediaPlayerAdaptationMMFCtx *pSelf, XADataSource *pDataSrc, + XADataSource *pBankSrc, XADataSink *pAudioSnk, + XADataSink *pImageVideoSnk, XADataSink *pVibra, XADataSink *pLEDArray) + { XAresult res; DEBUG_API("->XAMediaPlayerAdaptMMF_CreateRadio"); - - res = XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XARadioAdaptation); - if (res != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - return NULL; - } - pSelf->isForRadio = XA_BOOLEAN_TRUE; - pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; + res = XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XARadioAdaptation); + if (res != XA_RESULT_SUCCESS) + { + DEBUG_ERR("Failed to init base context!!!"); + free(pSelf); + pSelf = NULL; + return NULL; + } + + pSelf->isForRadio = XA_BOOLEAN_TRUE; + pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; pSelf->xaSource = pDataSrc; pSelf->xaBankSrc = pBankSrc; pSelf->xaAudioSink = pAudioSnk; @@ -155,18 +159,17 @@ pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE; /*pSelf->waitData = XA_BOOLEAN_FALSE;*/ - res = mmf_backend_engine_init(&(pSelf->mmfContext)); - if(!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS)) - { - /* TODO Check to make sure there is no undeleted MMF objects here*/ - DEBUG_ERR("Failed to init mmf context!!!"); - free(pSelf); - pSelf = NULL; - return NULL; + res = mmf_backend_engine_init(&(pSelf->mmfContext)); + if (!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS)) + { + /* TODO Check to make sure there is no undeleted MMF objects here*/ + DEBUG_ERR("Failed to init mmf context!!!"); + free(pSelf); + pSelf = NULL; + return NULL; + }DEBUG_API("<-XAMediaPlayerAdaptMMF_Create"); + return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj); } - DEBUG_API("<-XAMediaPlayerAdaptMMF_Create"); - return (XAAdaptationBaseCtx*)(&pSelf->baseObj.baseObj); -} /* * XAresult XAMediaPlayerAdaptMMF_PostInit() @@ -174,74 +177,85 @@ * @param XAMediaPlayerAdaptationMMFCtx* ctx - pointer to Media Player adaptation context * @return XAresult - Success value */ -XAresult XAMediaPlayerAdaptMMF_PostInit( XAAdaptationMMFCtx* bCtx ) -{ +XAresult XAMediaPlayerAdaptMMF_PostInit(XAAdaptationMMFCtx* bCtx) + { XAresult ret = XA_RESULT_PRECONDITIONS_VIOLATED; - XAMediaPlayerAdaptationMMFCtx *pSelf = (XAMediaPlayerAdaptationMMFCtx*)bCtx; + XAMediaPlayerAdaptationMMFCtx *pSelf = NULL; + if(!bCtx) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XAMediaPlayerAdaptMMF_PostInit"); - - XAAdaptationBaseMMF_PostInit(bCtx); - - if (pSelf->isForRadio) - { - DEBUG_API("<-XAMediaPlayerAdaptMMF_PostInit"); - return XA_RESULT_SUCCESS; - } + + ret = XAAdaptationBaseMMF_PostInit(bCtx); + if(ret == XA_RESULT_SUCCESS) + { + if (pSelf->isForRadio) + { + DEBUG_API("<-XAMediaPlayerAdaptMMF_PostInit"); + return XA_RESULT_SUCCESS; + } - if(pSelf->mmfContext) - { - XADataLocator_URI* tempUri = (XADataLocator_URI*)(pSelf->xaSource->pLocator); - XADataFormat_MIME* tempFormat = (XADataFormat_MIME*)(pSelf->xaSource->pFormat); - ret = XA_RESULT_SUCCESS; - if(pSelf->xaVideoSink) - { - ret = mmf_setup_native_display(pSelf->mmfContext, pSelf->xaVideoSink); - } - if (ret == XA_RESULT_SUCCESS) - { - ret = mmf_set_player_uri(pSelf->mmfContext, (char *)(tempUri->URI), tempFormat->containerType); + if (pSelf->mmfContext) + { + XADataLocator_URI* tempUri = + (XADataLocator_URI*) (pSelf->xaSource->pLocator); + XADataFormat_MIME* tempFormat = + (XADataFormat_MIME*) (pSelf->xaSource->pFormat); + ret = XA_RESULT_SUCCESS; + if (pSelf->xaVideoSink) + { + ret = mmf_setup_native_display(pSelf->mmfContext, + pSelf->xaVideoSink); + } + if (ret == XA_RESULT_SUCCESS) + { + ret = mmf_set_player_uri(pSelf->mmfContext, + (char *) (tempUri->URI), tempFormat->containerType); + } + } } - } DEBUG_API("<-XAMediaPlayerAdaptMMF_PostInit"); return ret; -} + } /* * void XAMediaPlayerAdaptMMF_Destroy( XAMediaPlayerAdaptationMMFCtx* ctx ) * Destroys Media Player Adaptation Context * @param ctx - Media Player Adaptation context to be destroyed */ -void XAMediaPlayerAdaptMMF_Destroy( XAAdaptationMMFCtx* bCtx ) -{ +void XAMediaPlayerAdaptMMF_Destroy(XAAdaptationMMFCtx* bCtx) + { XAMediaPlayerAdaptationMMFCtx* ctx = NULL; - DEBUG_API("->XAMediaPlayerAdaptMMF_Destroy"); - if(bCtx == NULL) - { + if (bCtx == NULL) + { DEBUG_ERR("Invalid parameter!!"); DEBUG_API("<-XAMediaPlayerAdaptMMF_Destroy"); return; - } - ctx = (XAMediaPlayerAdaptationMMFCtx*)bCtx; + } + ctx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; - if(ctx->mmfContext) + if (ctx->mmfContext) { mmf_backend_engine_deinit(ctx->mmfContext); } - if(ctx->mmfMetadataContext) - { - mmf_metadata_utility_destroy(ctx->mmfMetadataContext); - } - - XAAdaptationBaseMMF_Free( bCtx ); - + if (ctx->mmfMetadataContext) + { + mmf_metadata_utility_destroy(ctx->mmfMetadataContext); + } + + XAAdaptationBaseMMF_Free(bCtx); + free(ctx); ctx = NULL; DEBUG_API("<-XAMediaPlayerAdaptMMF_Destroy"); -} + } - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MediaPlayer Adapt MMF HEader + * + */ #ifndef XAMEDIAPLAYERADAPTCTXMMF_H #define XAMEDIAPLAYERADAPTCTXMMF_H @@ -25,14 +25,18 @@ typedef struct XAMediaPlayerAdaptationMMFCtx_ XAMediaPlayerAdaptationMMFCtx; /* FUNCTIONS */ -XAAdaptationBaseCtx* XAMediaPlayerAdaptMMF_Create( XADataSource *pDataSrc, XADataSource *pBankSrc, - XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, - XADataSink *pVibra, XADataSink *pLEDArray); -XAAdaptationBaseCtx* XAMediaPlayerAdaptMMF_CreateRadio(XAMediaPlayerAdaptationMMFCtx *pSelf, XADataSource *pDataSrc, XADataSource *pBankSrc, - XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, - XADataSink *pVibra, XADataSink *pLEDArray); -XAresult XAMediaPlayerAdaptMMF_PostInit( XAAdaptationMMFCtx* bCtx ); -void XAMediaPlayerAdaptMMF_Destroy( XAAdaptationMMFCtx* bCtx ); +XAAdaptationBaseCtx + * XAMediaPlayerAdaptMMF_Create(XADataSource *pDataSrc, + XADataSource *pBankSrc, XADataSink *pAudioSnk, + XADataSink *pImageVideoSnk, XADataSink *pVibra, + XADataSink *pLEDArray); +XAAdaptationBaseCtx +* XAMediaPlayerAdaptMMF_CreateRadio(XAMediaPlayerAdaptationMMFCtx *pSelf, + XADataSource *pDataSrc, XADataSource *pBankSrc, + XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, + XADataSink *pVibra, XADataSink *pLEDArray); +XAresult XAMediaPlayerAdaptMMF_PostInit(XAAdaptationMMFCtx* bCtx); +void XAMediaPlayerAdaptMMF_Destroy(XAAdaptationMMFCtx* bCtx); //XAresult XAMediaPlayerAdapt_InitContentPipeSrc(XAMediaPlayerAdaptationCtx* ctx); #endif /*XAMEDIAPLAYERADAPTCTXMMF_H*/ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MediaRecorder MMF Adaptation + * + */ #include #include @@ -21,16 +21,9 @@ #include "xaadaptationmmf.h" #include "cmmfbackendengine.h" #include "xaadptbasectx.h" -//#include "XAMetadataAdaptation.h" -//#include "XAStaticCapsAdaptation.h" - extern XAboolean cameraRealized; -//extern XACameraAdaptationCtx_* cameraCtx; - - - /* * XAAdaptationBaseCtx* XAMediaRecorderAdaptMMF_Create() * Allocates memory for Media Recorder Adaptation Context and makes 1st phase initialization @@ -48,9 +41,10 @@ XADataLocator_IODevice *ioDevice; DEBUG_API("->XAMediaRecorderAdaptMMF_Create"); - pSelf = (XAMediaRecorderAdaptationMMFCtx*)calloc(1, sizeof(XAMediaRecorderAdaptationMMFCtx)); + pSelf = (XAMediaRecorderAdaptationMMFCtx*) calloc(1, + sizeof(XAMediaRecorderAdaptationMMFCtx)); if (pSelf) - { + { if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XAMediaRecorderAdaptation) != XA_RESULT_SUCCESS) { @@ -58,7 +52,7 @@ free(pSelf); pSelf = NULL; } - else + else { pSelf->xaAudioSource = pAudioSrc; pSelf->xaVideoSource = pImageVideoSrc; @@ -96,10 +90,10 @@ ioDevice = (XADataLocator_IODevice*) (pImageVideoSrc->pLocator); if (ioDevice->deviceType == XA_IODEVICE_CAMERA - - && !cameraRealized - - ) + + && !cameraRealized + + ) { DEBUG_ERR("Preconditions violated - Camera object not realized"); XAAdaptationBaseMMF_Free(&pSelf->baseObj); @@ -109,18 +103,23 @@ } } } - - if(pSelf) + else { - res = mmf_backend_engine_init(&(pSelf->mmfContext) ); - if(!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS)) + DEBUG_ERR("Failed to create XAMediaRecorderAdaptationMMFCtx !!!"); + return NULL; + } + + if (pSelf) + { + res = mmf_backend_engine_init(&(pSelf->mmfContext)); + if (!(pSelf->mmfContext) || (res != XA_RESULT_SUCCESS)) { DEBUG_ERR("Failed to init mmf context!!!"); free(pSelf); - pSelf = NULL; - } + pSelf = NULL; + } } - + DEBUG_API("<-XAMediaRecorderAdaptMMF_Create"); return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj); } @@ -135,16 +134,27 @@ { XAresult ret = XA_RESULT_SUCCESS; - XADataLocator_URI* tempUri; + XADataLocator_URI* tempUri; XADataFormat_MIME* tempFormat; - XAMediaRecorderAdaptationMMFCtx *pSelf = (XAMediaRecorderAdaptationMMFCtx*)bCtx; + XAMediaRecorderAdaptationMMFCtx *pSelf; DEBUG_API("->XAMediaRecorderAdapt_PostInit"); - if(pSelf->mmfContext) + if(bCtx) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaRecorderAdaptationMMFCtx*) bCtx; + if (pSelf->mmfContext) { - tempUri = (XADataLocator_URI*)(pSelf->xaSink->pLocator); - tempFormat = (XADataFormat_MIME*)(pSelf->xaSink->pFormat); - mmf_set_recorder_uri(pSelf->mmfContext, (char *)(tempUri->URI), tempFormat->containerType); - mmf_set_adapt_context(pSelf->mmfContext, &(pSelf->baseObj)); + tempUri = (XADataLocator_URI*) (pSelf->xaSink->pLocator); + tempFormat = (XADataFormat_MIME*) (pSelf->xaSink->pFormat); + ret = mmf_set_recorder_uri(pSelf->mmfContext, (char *) (tempUri->URI), + tempFormat->containerType); + if(ret == XA_RESULT_SUCCESS) + { + ret = mmf_set_adapt_context(pSelf->mmfContext, &(pSelf->baseObj)); + } } DEBUG_API("<-XAMediaRecorderAdapt_PostInit"); @@ -159,17 +169,18 @@ void XAMediaRecorderAdaptMMF_Destroy(XAAdaptationMMFCtx* bCtx) { XAMediaRecorderAdaptationMMFCtx* ctx = NULL; - + DEBUG_API("->XAMediaRecorderAdaptMMF_Destroy"); if (bCtx == NULL) - { - DEBUG_ERR("Invalid parameter!!");DEBUG_API("<-XAMediaRecorderAdaptMMF_Destroy"); + { + DEBUG_ERR("Invalid parameter!!"); + DEBUG_API("<-XAMediaRecorderAdaptMMF_Destroy"); return; - } + } ctx = (XAMediaRecorderAdaptationMMFCtx*) bCtx; - if(ctx->mmfContext) + if (ctx->mmfContext) { mmf_backend_engine_deinit(ctx->mmfContext); } @@ -181,5 +192,3 @@ DEBUG_API("<-XAMediaRecorderAdaptMMF_Destroy"); } -/***************** INTERNAL FUNCTIONS *******************************/ - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,75 +1,73 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MediaRecorder Adaptation MMF header + * + */ #ifndef XAMEDIARECORDERADAPTCTXMMF_H_ #define XAMEDIARECORDERADAPTCTXMMF_H_ #include "xaadaptationmmf.h" - /* TYPEDEFS */ -typedef struct XAMediaRecorderAdaptationMMFCtx_ XAMediaRecorderAdaptationMMFCtx; +typedef struct XAMediaRecorderAdaptationMMFCtx_ + XAMediaRecorderAdaptationMMFCtx; typedef struct XAMediaRecorderAdaptationMMFCtx_ -{ + { /* Parent*/ XAAdaptationMMFCtx_ baseObj; /* OMX-AL Variables */ - XADataSource *xaAudioSource, *xaVideoSource; - XADataSink *xaSink; - XAuint8 recModes; + XADataSource *xaAudioSource, *xaVideoSource; + XADataSink *xaSink; + XAuint8 recModes; /* GST elements */ - XAboolean isobjsink; /*is sink another XA object?*/ - XAboolean isobjasrc; /*is audio source another XA object?*/ - XAboolean isobjvsrc; /*is video source another XA object?*/ - XAboolean encodingchanged; + XAboolean isobjsink; /*is sink another XA object?*/ + XAboolean isobjasrc; /*is audio source another XA object?*/ + XAboolean isobjvsrc; /*is video source another XA object?*/ + XAboolean encodingchanged; - XAboolean mute; - XAuint32 premutevol; - XAuint32 imageEffectID; - XAboolean isStereoPosition; - XAuint32 xaRecordState; - XAmillidegree curRotation; - XAuint32 curMirror; - XAboolean isRecord; + XAboolean mute; + XAuint32 premutevol; + XAuint32 imageEffectID; + XAboolean isStereoPosition; + XAuint32 xaRecordState; + XAmillidegree curRotation; + XAuint32 curMirror; + XAboolean isRecord; /* internals */ - XAboolean trackpositionenabled; - gboolean runpositiontimer; + XAboolean trackpositionenabled; + gboolean runpositiontimer; - XAImplThreadHandle recordingEventThr; + XAImplThreadHandle recordingEventThr; /* Variables for encoders */ - XAAudioEncoderSettings audioEncSettings; - XAVideoSettings videoEncSettings; - XAImageSettings imageEncSettings; - - void* mmfContext; + XAAudioEncoderSettings audioEncSettings; + XAVideoSettings videoEncSettings; + XAImageSettings imageEncSettings; + void* mmfContext; -} XAMediaRecorderAdaptationMMFCtx_; + } XAMediaRecorderAdaptationMMFCtx_; /* FUNCTIONS */ -XAAdaptationBaseCtx* XAMediaRecorderAdaptMMF_Create( XADataSource* pAudioSrc, - XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes ); -XAresult XAMediaRecorderAdaptMMF_PostInit( XAAdaptationMMFCtx* bCtx ); -void XAMediaRecorderAdaptMMF_Destroy( XAAdaptationMMFCtx* bCtx ); - +XAAdaptationBaseCtx* XAMediaRecorderAdaptMMF_Create(XADataSource* pAudioSrc, + XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes); +XAresult XAMediaRecorderAdaptMMF_PostInit(XAAdaptationMMFCtx* bCtx); +void XAMediaRecorderAdaptMMF_Destroy(XAAdaptationMMFCtx* bCtx); #endif /* XAMEDIARECORDERADAPTCTXMMF_H_ */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata Adaptation MMF + * + */ + #include #include #include "xametadataadaptctxmmf.h" @@ -5,46 +22,53 @@ #include "cmetadatautilityitf.h" XAAdaptationBaseCtx* XAMetadataAdaptCtxMMF_Create(XADataSource * pDataSrc) -{ + { XAMetadataAdaptationMMFCtx *pSelf = NULL; DEBUG_API("->XAMetadataAdaptCtxMMF_Create"); - + pSelf = calloc(1, sizeof(XAMetadataAdaptationMMFCtx)); - if ( pSelf) - { - - if( XAAdaptationBaseMMF_Init(&(pSelf->baseObj),XAMDAdaptation) - != XA_RESULT_SUCCESS ) + if (pSelf) { + + if (XAAdaptationBaseMMF_Init(&(pSelf->baseObj), XAMDAdaptation) + != XA_RESULT_SUCCESS) + { DEBUG_ERR("Failed to init base context!!!"); free(pSelf); pSelf = NULL; - } + } else - - { + + { pSelf->baseObj.baseObj.fwtype = FWMgrFWMMF; pSelf->xaSource = pDataSrc; - } + } - if(pDataSrc) - { - pSelf->mmfContext = mmf_metadata_utility_init((char *)(( (XADataLocator_URI*)(pDataSrc->pLocator))->URI)); - if(!pSelf->mmfContext) + if (pDataSrc) { - DEBUG_ERR("Failed to init mmf context!!!"); - free(pSelf); - pSelf = NULL; + pSelf->mmfContext + = mmf_metadata_utility_init( + (char *) (((XADataLocator_URI*) (pDataSrc->pLocator))->URI)); + if (!pSelf->mmfContext) + { + DEBUG_ERR("Failed to init mmf context!!!"); + free(pSelf); + pSelf = NULL; + } } - } - } + } + else + { + DEBUG_ERR("Failed to create XAMetadataAdaptationMMFCtx !!!"); + return NULL; + } + DEBUG_API("<- XAMetadataAdaptCtxMMF_Create"); - return (XAAdaptationBaseCtx*)(&pSelf->baseObj.baseObj); -} - + return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj); + } /* * XAresult XAMediaPlayerAdaptMMF_PostInit() @@ -52,39 +76,38 @@ * @param XAMediaPlayerAdaptationMMFCtx* ctx - pointer to Media Player adaptation context * @return XAresult - Success value */ -XAresult XAMetadataAdaptCtxMMF_PostInit( XAAdaptationMMFCtx* bCtx ) -{ - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("<-XAMetadataAdaptCtxMMF_PostInit"); - return ret; -} +XAresult XAMetadataAdaptCtxMMF_PostInit(XAAdaptationMMFCtx* bCtx) + { + XAresult ret = XA_RESULT_SUCCESS; + + DEBUG_API("<-XAMetadataAdaptCtxMMF_PostInit"); + return ret; + } /* * void XAMediaPlayerAdaptMMF_Destroy( XAMediaPlayerAdaptationMMFCtx* ctx ) * Destroys Media Player Adaptation Context * @param ctx - Media Player Adaptation context to be destroyed */ -void XAMetadataAdaptCtxMMF_Destroy( XAAdaptationMMFCtx* bCtx ) -{ +void XAMetadataAdaptCtxMMF_Destroy(XAAdaptationMMFCtx* bCtx) + { DEBUG_API("->XAMetadataAdaptCtxMMF_Destroy"); - if(bCtx == NULL) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAMetadataAdaptCtxMMF_Destroy"); + if (bCtx == NULL) + { + DEBUG_ERR("Invalid parameter!!");DEBUG_API("<-XAMetadataAdaptCtxMMF_Destroy"); return; - } - - if(((XAMetadataAdaptationMMFCtx*)bCtx)->mmfContext) - { - mmf_metadata_utility_destroy(((XAMetadataAdaptationMMFCtx*)bCtx)->mmfContext); - } + } - XAAdaptationBase_Free( &bCtx->baseObj ); + if (((XAMetadataAdaptationMMFCtx*) bCtx)->mmfContext) + { + mmf_metadata_utility_destroy( + ((XAMetadataAdaptationMMFCtx*) bCtx)->mmfContext); + } + + XAAdaptationBase_Free(&bCtx->baseObj); free(bCtx); bCtx = NULL; DEBUG_API("<-XAMetadataExtractorAdaptMMF_Destroy"); -} + } - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Metadata Adaptation MMF + * + */ + #ifndef XAMETADATAADAPTCTXMMF_H #define XAMETADATAADAPTCTXMMF_H @@ -8,8 +25,8 @@ typedef struct XAMetadataAdaptationMMFCtx_ XAMetadataAdaptationMMFCtx; /* FUNCTIONS */ -XAAdaptationBaseCtx* XAMetadataAdaptCtxMMF_Create( XADataSource *pDataSrc ); -XAresult XAMetadataAdaptCtxMMF_PostInit( XAAdaptationMMFCtx* bCtx ); -void XAMetadataAdaptCtxMMF_Destroy( XAAdaptationMMFCtx* bCtx ); +XAAdaptationBaseCtx* XAMetadataAdaptCtxMMF_Create(XADataSource *pDataSrc); +XAresult XAMetadataAdaptCtxMMF_PostInit(XAAdaptationMMFCtx* bCtx); +void XAMetadataAdaptCtxMMF_Destroy(XAAdaptationMMFCtx* bCtx); #endif /*XAMETADATAADAPTCTXMMF_H*/ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,35 +1,37 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -#include "xammfcapabilitiesmgr.h" + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MMF capabilities mgr + * + */ #include #include +#include "xammfcapabilitiesmgr.h" -static XAresult XAMMFCapabilitiesMgr_GetAudioAACEncoderCapabilities(XACapabilities **ppNode); -static XAresult XAMMFCapabilitiesMgr_GetAudioAMREncoderCapabilities(XACapabilities **ppNode); -static XAresult XAMMFCapabilitiesMgr_GetAudioPCMEncoderCapabilities(XACapabilities **ppNode); +static XAresult XAMMFCapabilitiesMgr_GetAudioAACEncoderCapabilities( + XACapabilities **ppNode); +static XAresult XAMMFCapabilitiesMgr_GetAudioAMREncoderCapabilities( + XACapabilities **ppNode); +static XAresult XAMMFCapabilitiesMgr_GetAudioPCMEncoderCapabilities( + XACapabilities **ppNode); /* XAresult XAMMFCapabilitiesMgr_UpdateCapabilitieList * Description: Update the capabilities list supported by GStreamer framework. */ XAresult XAMMFCapabilitiesMgr_UpdateCapabilitieList( - FrameworkMap *frameworkMap, - XACapabilities **ppListHead) + FrameworkMap *frameworkMap, XACapabilities **ppListHead) -{ + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *lastNode; XACapabilities *firstNode; @@ -38,28 +40,25 @@ char *uri = NULL; DEBUG_API("->XAGSTCapabilitiesMgr_UpdateCapabilitieList"); - if(!frameworkMap || !ppListHead) - { + if (!frameworkMap || !ppListHead) + { res = XA_RESULT_PARAMETER_INVALID; return res; - } + } lastNode = firstNode = *ppListHead; - + /* traverse and point to the last node in the list */ - while(lastNode && lastNode->next) - { + while (lastNode && lastNode->next) + { lastNode = lastNode->next; - } + } uri = "file:///c:/test.mp4"; - fwtype = XAFrameworkMgr_GetFramework( - frameworkMap, - uri, - FWMgrMORecorder); - - if(fwtype == FWMgrFWMMF) - { + fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder); + + if (fwtype == FWMgrFWMMF) + { /* Add codec capabilities */ newNode = NULL; res = XAMMFCapabilitiesMgr_GetAudioAACEncoderCapabilities(&newNode); @@ -68,26 +67,24 @@ return res; } if (lastNode) - { + { lastNode->next = newNode; - } + } if (newNode) - { /* if a new node is created move lastNode to the new item */ + { /* if a new node is created move lastNode to the new item */ if (!firstNode) + { firstNode = newNode; + } lastNode = newNode; + } } - } - uri = "file:///c:/test.amr"; - fwtype = XAFrameworkMgr_GetFramework( - frameworkMap, - uri, - FWMgrMORecorder); - - if(fwtype == FWMgrFWMMF) - { + fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder); + + if (fwtype == FWMgrFWMMF) + { newNode = NULL; res = XAMMFCapabilitiesMgr_GetAudioAMREncoderCapabilities(&newNode); if (res != XA_RESULT_SUCCESS) @@ -95,25 +92,24 @@ return res; } if (lastNode) - { + { lastNode->next = newNode; - } + } if (newNode) - { /* if a new node is created move lastNode to the new item */ + { /* if a new node is created move lastNode to the new item */ if (!firstNode) + { firstNode = newNode; + } lastNode = newNode; + } } - } uri = "file:///c:/test.wav"; - fwtype = XAFrameworkMgr_GetFramework( - frameworkMap, - uri, - FWMgrMORecorder); - - if(fwtype == FWMgrFWMMF) - { + fwtype = XAFrameworkMgr_GetFramework(frameworkMap, uri, FWMgrMORecorder); + + if (fwtype == FWMgrFWMMF) + { newNode = NULL; res = XAMMFCapabilitiesMgr_GetAudioPCMEncoderCapabilities(&newNode); if (res != XA_RESULT_SUCCESS) @@ -121,68 +117,71 @@ return res; } if (lastNode) - { + { lastNode->next = newNode; - } + } if (newNode) - { /* if a new node is created move lastNode to the new item */ + { /* if a new node is created move lastNode to the new item */ if (!firstNode) + { firstNode = newNode; + } lastNode = newNode; + } } - } /* if empty list, then append first node as the head */ if (!(*ppListHead)) { *ppListHead = firstNode; - } - DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList"); + }DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList"); return res; -} - + } -XAresult XAMMFCapabilitiesMgr_GetAudioAACEncoderCapabilities(XACapabilities **ppNode) -{ +XAresult XAMMFCapabilitiesMgr_GetAudioAACEncoderCapabilities( + XACapabilities **ppNode) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *newNode = NULL; XAAudioCodecDescriptor *entries = NULL; - newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities)); + newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities)); if (!newNode) - { + { res = XA_RESULT_MEMORY_FAILURE; return res; - } + } newNode->capsType = AUD_E; newNode->xaid = XA_AUDIOCODEC_AAC; newNode->noOfEntries = 1; /* Allocate array */ - entries = (XAAudioCodecDescriptor*)calloc(1, sizeof(XAAudioCodecDescriptor)); + entries = (XAAudioCodecDescriptor*) calloc(1, + sizeof(XAAudioCodecDescriptor)); if (!entries) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } - newNode->pEntry = (void*)entries; - + newNode->pEntry = (void*) entries; + entries->maxChannels = 2; entries->minBitsPerSample = 16; entries->maxBitsPerSample = 16; - entries->minSampleRate = 8000000; /*milliHz*/ + entries->minSampleRate = 8000000; /*milliHz*/ entries->maxSampleRate = 48000000; - entries->isFreqRangeContinuous=XA_BOOLEAN_FALSE; + entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE; entries->numSampleRatesSupported = 7; - entries->pSampleRatesSupported = (XAmilliHertz*)calloc(entries->numSampleRatesSupported, sizeof(XAmilliHertz)); + entries->pSampleRatesSupported = (XAmilliHertz*) calloc( + entries->numSampleRatesSupported, sizeof(XAmilliHertz)); if (!entries->pSampleRatesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } /* entries in milliHz */ entries->pSampleRatesSupported[0] = 8000000; entries->pSampleRatesSupported[1] = 11025000; @@ -196,13 +195,14 @@ entries->maxBitRate = 256000; entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; entries->numBitratesSupported = 8; - entries->pBitratesSupported = (XAuint32*)calloc(entries->numBitratesSupported, sizeof(XAuint32)); + entries->pBitratesSupported = (XAuint32*) calloc( + entries->numBitratesSupported, sizeof(XAuint32)); if (!entries->pBitratesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } (entries->pBitratesSupported)[0] = 32000; (entries->pBitratesSupported)[1] = 64000; (entries->pBitratesSupported)[2] = 96000; @@ -215,58 +215,59 @@ entries->profileSetting = XA_AUDIOPROFILE_AAC_AAC; entries->modeSetting = XA_AUDIOMODE_AAC_LC; - newNode->pEntry = (void*)entries; - *ppNode = newNode; return res; -} + } -XAresult XAMMFCapabilitiesMgr_GetAudioAMREncoderCapabilities(XACapabilities **ppNode) -{ +XAresult XAMMFCapabilitiesMgr_GetAudioAMREncoderCapabilities( + XACapabilities **ppNode) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *newNode = NULL; XAAudioCodecDescriptor *entries = NULL; - - newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities)); + + newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities)); if (!newNode) - { + { res = XA_RESULT_MEMORY_FAILURE; return res; - } + } newNode->capsType = AUD_E; newNode->xaid = XA_AUDIOCODEC_AMR; newNode->noOfEntries = 1; /* Allocate array */ - entries = (XAAudioCodecDescriptor*)calloc(1, sizeof(XAAudioCodecDescriptor)); + entries = (XAAudioCodecDescriptor*) calloc(1, + sizeof(XAAudioCodecDescriptor)); if (!entries) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } - newNode->pEntry = (void*)entries; - + newNode->pEntry = (void*) entries; + entries->maxChannels = 1; entries->minBitsPerSample = 8; entries->maxBitsPerSample = 8; - entries->minSampleRate = 8000000; /*milliHz*/ + entries->minSampleRate = 8000000; /*milliHz*/ entries->maxSampleRate = 8000000; - entries->isFreqRangeContinuous=XA_BOOLEAN_TRUE; + entries->isFreqRangeContinuous = XA_BOOLEAN_TRUE; entries->numSampleRatesSupported = 1; - entries->minBitRate=4750; - entries->maxBitRate=12200; - entries->isBitrateRangeContinuous=XA_BOOLEAN_FALSE; + entries->minBitRate = 4750; + entries->maxBitRate = 12200; + entries->isBitrateRangeContinuous = XA_BOOLEAN_FALSE; entries->numBitratesSupported = 8; - entries->pBitratesSupported = (XAuint32*)calloc(entries->numBitratesSupported, sizeof(XAuint32)); + entries->pBitratesSupported = (XAuint32*) calloc( + entries->numBitratesSupported, sizeof(XAuint32)); if (!entries->pBitratesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } (entries->pBitratesSupported)[0] = 4750; (entries->pBitratesSupported)[1] = 5150; (entries->pBitratesSupported)[2] = 5900; @@ -279,54 +280,55 @@ entries->profileSetting = XA_AUDIOPROFILE_AMR; entries->modeSetting = 0; - newNode->pEntry = (void*)entries; - *ppNode = newNode; return res; -} + } -XAresult XAMMFCapabilitiesMgr_GetAudioPCMEncoderCapabilities(XACapabilities **ppNode) -{ +XAresult XAMMFCapabilitiesMgr_GetAudioPCMEncoderCapabilities( + XACapabilities **ppNode) + { XAresult res = XA_RESULT_SUCCESS; XACapabilities *newNode = NULL; XAAudioCodecDescriptor *entries = NULL; - newNode = (XACapabilities *)calloc(1, sizeof(XACapabilities)); + newNode = (XACapabilities *) calloc(1, sizeof(XACapabilities)); if (!newNode) - { + { res = XA_RESULT_MEMORY_FAILURE; return res; - } + } newNode->capsType = AUD_E; newNode->xaid = XA_AUDIOCODEC_PCM; newNode->noOfEntries = 1; /* Allocate array */ - entries = (XAAudioCodecDescriptor*)calloc(1, sizeof(XAAudioCodecDescriptor)); + entries = (XAAudioCodecDescriptor*) calloc(1, + sizeof(XAAudioCodecDescriptor)); if (!entries) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } - newNode->pEntry = (void*)entries; + newNode->pEntry = (void*) entries; entries->maxChannels = 2; entries->minBitsPerSample = 16; entries->maxBitsPerSample = 16; - entries->minSampleRate = 8000000; /*milliHz*/ + entries->minSampleRate = 8000000; /*milliHz*/ entries->maxSampleRate = 96000000; - entries->isFreqRangeContinuous=XA_BOOLEAN_FALSE; + entries->isFreqRangeContinuous = XA_BOOLEAN_FALSE; entries->numSampleRatesSupported = 10; - entries->pSampleRatesSupported = (XAmilliHertz*)calloc(entries->numSampleRatesSupported, sizeof(XAmilliHertz)); + entries->pSampleRatesSupported = (XAmilliHertz*) calloc( + entries->numSampleRatesSupported, sizeof(XAmilliHertz)); if (!entries->pSampleRatesSupported) - { + { res = XA_RESULT_MEMORY_FAILURE; XACapabilitiesMgr_DeleteCapabilitieList(&newNode); return res; - } + } /* entries in milliHz */ entries->pSampleRatesSupported[0] = 12000000; entries->pSampleRatesSupported[1] = 16000000; @@ -347,8 +349,6 @@ entries->profileSetting = XA_AUDIOPROFILE_PCM; entries->modeSetting = 0; - newNode->pEntry = (void*)entries; - *ppNode = newNode; return res; -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: MMF capability manager + * + */ #ifndef XAMMFCAPABILITIESMGR_H #define XAMMFCAPABILITIESMGR_H @@ -23,7 +23,6 @@ #include "xacapabilitiesmgr.h" XAresult XAMMFCapabilitiesMgr_UpdateCapabilitieList( - FrameworkMap *frameworkMap, - XACapabilities** ppListHead); + FrameworkMap *frameworkMap, XACapabilities** ppListHead); #endif /* XAGSTCAPABILITIESMGR_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,22 +1,20 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Nokia Linear Volume MMF impl + * + */ - -//#include #include "xaadaptationmmf.h" #include "xanokialinearvolumeitfadaptationmmf.h" #include "xamediaplayeradaptctxmmf.h" @@ -30,73 +28,79 @@ * XAuint32 percentage - Requested volume level, in between MIN_VOLUME_LEVEL and MAX_VOLUME_LEVEL * @return XAresult ret - Success value */ -XAresult XANokiaLinearVolumeItfAdapt_SetVolumeLevel(XAAdaptationMMFCtx *ctx, XAuint32 percentage) -{ +XAresult XANokiaLinearVolumeItfAdapt_SetVolumeLevel(XAAdaptationMMFCtx *ctx, + XAuint32 percentage) + { XAresult res = XA_RESULT_SUCCESS; XAuint32 maxvol; XAuint32 vol; DEBUG_API_A1("->XANokiaLinearVolumeItfAdapt_SetVolumeLevel to: %d", percentage); - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation && - ctx->baseObj.ctxId != XARadioAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); + if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation + && ctx->baseObj.ctxId != XAMediaRecorderAdaptation + && ctx->baseObj.ctxId != XARadioAdaptation)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if(ctx->baseObj.ctxId == XAMediaPlayerAdaptation) + res = XA_RESULT_PARAMETER_INVALID; + return res; + } + + if (ctx->baseObj.ctxId == XAMediaPlayerAdaptation) { - mmf_volumeitf_get_maxvolume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, - &maxvol); - - vol = (percentage * maxvol) / MAX_PERCENTAGE_VOLUME; - - mmf_volumeitf_set_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, - vol); + res = mmf_volumeitf_get_maxvolume( + ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext, &maxvol); + + if(res == XA_RESULT_SUCCESS) + { + vol = (percentage * maxvol) / MAX_PERCENTAGE_VOLUME; + res = mmf_volumeitf_set_volume( + ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext, vol); + } + } else if (ctx->baseObj.ctxId == XARadioAdaptation) - { - mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx); - res = set_volume(cmmfradiobackendengine_init(), percentage); - } - DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); + { + mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx); + res = set_volume(cmmfradiobackendengine_init(), percentage); + }DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); return res; -} + } XAresult XANokiaLinearVolumeItfAdapt_GetStepCount(XAAdaptationMMFCtx *ctx, - XAuint32* stepcount) + XAuint32* stepcount) { XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XANokiaLinearVolumeItfAdapt_GetStepCount "); - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation && - ctx->baseObj.ctxId != XARadioAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); + if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation + && ctx->baseObj.ctxId != XAMediaRecorderAdaptation + && ctx->baseObj.ctxId != XARadioAdaptation)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; + } + + if (ctx->baseObj.ctxId == XAMediaPlayerAdaptation) + { + res = mmf_volumeitf_get_maxvolume( + ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext, stepcount); + } + + DEBUG_API("<-XANokiaLinearVolumeItfAdapt_GetStepCount"); + return res; } - if(ctx->baseObj.ctxId == XAMediaPlayerAdaptation) +void XANokiaLinearVolumeItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx, + TInt aVolume) + { + XAAdaptEvent event = { - mmf_volumeitf_get_maxvolume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, - stepcount); + XA_NOKIALINEARVOLITFEVENTS, XA_ADAPT_VOLUME_VOLUME_CHANGED, 1, 0 + }; + if (ctx) + { + event.data = &aVolume; + XAAdaptationBase_SendAdaptEvents(ctx, &event); } - - DEBUG_API("<-XANokiaLinearVolumeItfAdapt_GetStepCount"); - return res; } -void XANokiaLinearVolumeItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx, TInt aVolume) -{ - XAAdaptEvent event = {XA_NOKIALINEARVOLITFEVENTS, XA_ADAPT_VOLUME_VOLUME_CHANGED,1,0}; - if (ctx) - { - event.data = &aVolume; - XAAdaptationBase_SendAdaptEvents(ctx, &event ); - } -} - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Nokia Linear Volume Header + * + */ #ifndef XANOKIALINEARVOLUMEITFADAPTATIONMMF_H #define XANOKIALINEARVOLUMEITFADAPTATIONMMF_H @@ -27,13 +27,14 @@ /* FUNCTIONS */ XAresult XANokiaLinearVolumeItfAdapt_SetVolumeLevel(XAAdaptationMMFCtx *ctx, - XAuint32 percentage); -XAresult XANokiaLinearVolumeItfAdapt_GetMaxVolumeLevel(XAAdaptationMMFCtx *ctx, - XAuint32 * pPercentage); - + XAuint32 percentage); +XAresult XANokiaLinearVolumeItfAdapt_GetMaxVolumeLevel( + XAAdaptationMMFCtx *ctx, XAuint32 * pPercentage); + XAresult XANokiaLinearVolumeItfAdapt_GetStepCount(XAAdaptationMMFCtx *ctx, - XAuint32 * pStepCount); + XAuint32 * pStepCount); -void XANokiaLinearVolumeItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx, TInt volume); +void XANokiaLinearVolumeItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx, + TInt volume); #endif /* XANOKIALINEARVOLUMEITFADAPTATIONMMF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Nokia Volume Ext Impl + * + */ #include "xanokiavolumeextitfadaptationmmf.h" #include "xamediaplayeradaptctxmmf.h" @@ -28,65 +28,77 @@ * @param XAboolean mute - status of mute value * @return XAresult ret - Success value */ -XAresult XANokiaVolumeExtItfAdapt_SetMute(XAAdaptationMMFCtx *ctx, XAboolean mute) -{ +XAresult XANokiaVolumeExtItfAdapt_SetMute(XAAdaptationMMFCtx *ctx, + XAboolean mute) + { XAuint32 volume; XAresult res = XA_RESULT_SUCCESS; - + DEBUG_API("->XANokiaVolumeExtItfAdapt_SetMute"); - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation && - ctx->baseObj.ctxId != XARadioAdaptation ) ) - { + if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation + && ctx->baseObj.ctxId != XAMediaRecorderAdaptation + && ctx->baseObj.ctxId != XARadioAdaptation)) + { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetMute"); /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } + res = XA_RESULT_PARAMETER_INVALID; + return res; + } - if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - if(mute) + if (ctx->baseObj.ctxId == XAMediaPlayerAdaptation) { - - mmf_volumeitf_get_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, - &volume); - ((XAMediaPlayerAdaptationMMFCtx*)ctx)->premutevol = volume; - mmf_volumeitf_set_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, - 0); - } - else - { - mmf_volumeitf_set_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, - ((XAMediaPlayerAdaptationMMFCtx*)ctx)->premutevol); + if (mute) + { + + res = mmf_volumeitf_get_volume( + ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext, + &volume); + if(res == XA_RESULT_SUCCESS) + { + ((XAMediaPlayerAdaptationMMFCtx*) ctx)->premutevol = volume; + res = mmf_volumeitf_set_volume( + ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext, 0); + } + } + else + { + res = mmf_volumeitf_set_volume( + ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext, + ((XAMediaPlayerAdaptationMMFCtx*) ctx)->premutevol); + } } - } - else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - if(mute) + else if (ctx->baseObj.ctxId == XAMediaRecorderAdaptation) { - - mmf_volumeitf_get_volume(((XAMediaRecorderAdaptationMMFCtx*)ctx)->mmfContext, - &volume); - ((XAMediaRecorderAdaptationMMFCtx*)ctx)->premutevol = volume; - mmf_volumeitf_set_volume(((XAMediaRecorderAdaptationMMFCtx*)ctx)->mmfContext, - 0); + if (mute) + { + + res = mmf_volumeitf_get_volume( + ((XAMediaRecorderAdaptationMMFCtx*) ctx)->mmfContext, + &volume); + if(res == XA_RESULT_SUCCESS) + { + ((XAMediaRecorderAdaptationMMFCtx*) ctx)->premutevol = volume; + res = mmf_volumeitf_set_volume( + ((XAMediaRecorderAdaptationMMFCtx*) ctx)->mmfContext, 0); + } + } + else + { + res = mmf_volumeitf_set_volume( + ((XAMediaRecorderAdaptationMMFCtx*) ctx)->mmfContext, + ((XAMediaRecorderAdaptationMMFCtx*) ctx)->premutevol); + } } - else + else if (ctx->baseObj.ctxId == XARadioAdaptation) { - mmf_volumeitf_set_volume(((XAMediaRecorderAdaptationMMFCtx*)ctx)->mmfContext, - ((XAMediaRecorderAdaptationMMFCtx*)ctx)->premutevol); - } - } - else if ( ctx->baseObj.ctxId == XARadioAdaptation ) - { - mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx); - res = set_mute(cmmfradiobackendengine_init(), mute); - } - + mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx); + res = set_mute(cmmfradiobackendengine_init(), mute); + } + DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetMute"); return res; -} + } /* * XAresult XANokiaVolumeExtItfAdapt_EnableStereoPosition(XAAdaptationBaseCtx *ctx, XAboolean enable) @@ -94,35 +106,36 @@ * @param XAboolean enable - Enable Stereo Position * @return XAresult - Success value */ -XAresult XANokiaVolumeExtItfAdapt_EnableStereoPosition(XAAdaptationMMFCtx *ctx, XAboolean enable) -{ +XAresult XANokiaVolumeExtItfAdapt_EnableStereoPosition( + XAAdaptationMMFCtx *ctx, XAboolean enable) + { + XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XANokiaVolumeExtItfAdapt_EnableStereoPosition"); - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation ) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition"); + if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation + && ctx->baseObj.ctxId != XAMediaRecorderAdaptation)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } + } - if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { + if (ctx->baseObj.ctxId == XAMediaPlayerAdaptation) + { + res = XA_RESULT_FEATURE_UNSUPPORTED; + } + else if (ctx->baseObj.ctxId == XAMediaRecorderAdaptation) + { + res = XA_RESULT_FEATURE_UNSUPPORTED; + } + else if (ctx->baseObj.ctxId == XARadioAdaptation) + { + res = XA_RESULT_FEATURE_UNSUPPORTED; + } + DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition"); + return res; } - else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - - } - else if ( ctx->baseObj.ctxId == XARadioAdaptation ) - { - return XA_RESULT_FEATURE_UNSUPPORTED; - } - - DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition"); - return XA_RESULT_SUCCESS; -} /* * XAresult XANokiaVolumeExtItfAdapt_SetStereoPosition(XAAdaptationMMFCtx *ctx, XApermille stereoPosition) @@ -131,42 +144,46 @@ * @return XAresult - Success value */ XAresult XANokiaVolumeExtItfAdapt_SetStereoPosition(XAAdaptationMMFCtx *ctx, - XApermille stereoPosition) -{ + XApermille stereoPosition) + { + XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XANokiaVolumeExtItfAdapt_SetStereoPosition"); - - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation ) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition"); + + if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation + && ctx->baseObj.ctxId != XAMediaRecorderAdaptation)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition"); return XA_RESULT_PARAMETER_INVALID; + } + + if (ctx->baseObj.ctxId == XAMediaPlayerAdaptation) + { + res = XA_RESULT_FEATURE_UNSUPPORTED; + } + else if (ctx->baseObj.ctxId == XAMediaRecorderAdaptation) + { + res = XA_RESULT_FEATURE_UNSUPPORTED; + } + else if (ctx->baseObj.ctxId == XARadioAdaptation) + { + res = XA_RESULT_FEATURE_UNSUPPORTED; + } + + DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition"); + return res; } - if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - - } - else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation ) +void XANokiaVolumeExtItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx, + XAboolean aMute) { - + XAAdaptEvent event = + { + XA_NOKIAEXTVOLITFEVENTS, XA_ADAPT_VOLUME_MUTE_CHANGED, 1, 0 + }; + if (ctx) + { + event.data = &aMute; + XAAdaptationBase_SendAdaptEvents(ctx, &event); + } } - else if ( ctx->baseObj.ctxId == XARadioAdaptation ) - { - return XA_RESULT_FEATURE_UNSUPPORTED; - } - DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition"); - return XA_RESULT_SUCCESS; -} - -void XANokiaVolumeExtItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx, XAboolean aMute) -{ - XAAdaptEvent event = {XA_NOKIAEXTVOLITFEVENTS, XA_ADAPT_VOLUME_MUTE_CHANGED,1,0}; - if (ctx) - { - event.data = &aMute; - XAAdaptationBase_SendAdaptEvents(ctx, &event ); - } -} - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #ifndef XANOKIAVOLUMEEXTITFADAPTATIONMMF_H #define XANOKIAVOLUMEEXTITFADAPTATIONMMF_H @@ -28,14 +28,16 @@ /* FUNCTIONS */ -XAresult XANokiaVolumeExtItfAdapt_SetMute(XAAdaptationMMFCtx *ctx, XAboolean mute); +XAresult XANokiaVolumeExtItfAdapt_SetMute(XAAdaptationMMFCtx *ctx, + XAboolean mute); -XAresult XANokiaVolumeExtItfAdapt_EnableStereoPosition(XAAdaptationMMFCtx *ctx, - XAboolean enable); +XAresult XANokiaVolumeExtItfAdapt_EnableStereoPosition( + XAAdaptationMMFCtx *ctx, XAboolean enable); XAresult XANokiaVolumeExtItfAdapt_SetStereoPosition(XAAdaptationMMFCtx *ctx, - XApermille stereoPosition); + XApermille stereoPosition); -void XANokiaVolumeExtItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx, XAboolean aMute); +void XANokiaVolumeExtItfAdapt_MuteChange(XAAdaptationBaseCtx* ctx, + XAboolean aMute); #endif /* XANOKIAVOLUMEEXTITFADAPTATIONMMF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Play Itf Adapt MMF + * + */ #include "unistd.h" #include "xamediaplayeradaptctxmmf.h" @@ -35,54 +35,65 @@ * XAuint32 state - Play state to be set * @return XAresult ret - Success value */ -XAresult XAPlayItfAdaptMMF_SetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 state) -{ +XAresult XAPlayItfAdaptMMF_SetPlayState(XAAdaptationBaseCtx *bCtx, + XAuint32 state) + { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* mCtx; + if (!bCtx) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + DEBUG_API_A1("->XAPlayItfAdaptMMF_SetPlayState %s",PLAYSTATENAME(state)); /* bCtx and parameter pointer validation happens in the calling function. * We don't need to repeat it here*/ - switch ( state ) - { - case XA_PLAYSTATE_STOPPED: + switch (state) { - if ( bCtx->ctxId == XARadioAdaptation ) - { - mmf_set_player_adapt_context(cmmfradiobackendengine_init(), bCtx); - stop_radio(cmmfradiobackendengine_init()); - } - else - { - ret = mmf_playitf_stop_playback(mCtx->mmfContext); - } - break; - } + case XA_PLAYSTATE_STOPPED: + { + if (bCtx->ctxId == XARadioAdaptation) + { + mmf_set_player_adapt_context(cmmfradiobackendengine_init(), + bCtx); + stop_radio(cmmfradiobackendengine_init()); + } + else + { + ret = mmf_playitf_stop_playback(mCtx->mmfContext); + } + break; + } case XA_PLAYSTATE_PAUSED: ret = mmf_playitf_pause_playback(mCtx->mmfContext); break; case XA_PLAYSTATE_PLAYING: - { - if ( bCtx->ctxId == XARadioAdaptation ) - { - mmf_set_player_adapt_context(cmmfradiobackendengine_init(), bCtx); - play_radio(cmmfradiobackendengine_init()); - } - else - { - ret = mmf_playitf_resume_playback(mCtx->mmfContext); - } - break; - } + { + if (bCtx->ctxId == XARadioAdaptation) + { + mmf_set_player_adapt_context(cmmfradiobackendengine_init(), + bCtx); + play_radio(cmmfradiobackendengine_init()); + } + else + { + ret = mmf_playitf_resume_playback(mCtx->mmfContext); + } + break; + } default: ret = XA_RESULT_PARAMETER_INVALID; break; - } + } DEBUG_API("<-XAPlayItfAdaptMMF_SetPlayState"); return ret; -} + } /* * XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 *pState) @@ -90,16 +101,24 @@ * XAuint32 *state - XAmillisecond *pMsec - Pointer where to store play state * @return XAresult ret - Success value */ -XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 *pState) +XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, + XAuint32 *pState) { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* pSelf; + if (!bCtx || !pState) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XAPlayItfAdaptMMF_GetPlayState"); /* If playhead reaches eof, state will transition to paused. * This object does not have visibility to callback*/ - ret = mmf_playitf_get_play_state(mCtx->mmfContext, pState); + ret = mmf_playitf_get_play_state(pSelf->mmfContext, pState); DEBUG_API("<-XAPlayItfAdaptMMF_GetPlayState"); return ret; @@ -112,18 +131,26 @@ * XAmillisecond *pMsec - Pointer where to store duration of stream. * @return XAresult ret - Success value */ -XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) -{ +XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx, + XAmillisecond *pMsec) + { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* pSelf; + if (!bCtx || !pMsec) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XAPlayItfAdaptMMF_GetDuration"); - ret = mmf_playitf_get_duration(mCtx->mmfContext, pMsec); + ret = mmf_playitf_get_duration(pSelf->mmfContext, pMsec); DEBUG_API("<-XAPlayItfAdaptMMF_GetDuration"); return ret; -} + } /* * XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) @@ -131,118 +158,172 @@ * XAmillisecond *pMsec - Pointer where to store current position in stream. * @return XAresult ret - Success value */ -XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) -{ +XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, + XAmillisecond *pMsec) + { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* pSelf; + if (!bCtx || !pMsec) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XAPlayItfAdaptMMF_GetPosition"); - ret = mmf_playitf_get_position(mCtx->mmfContext, pMsec); + ret = mmf_playitf_get_position(pSelf->mmfContext, pMsec); DEBUG_API("<-XAPlayItfAdaptMMF_GetPosition"); return ret; -} + } /* * XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, xaPlayCallback callback) * Description: Sets the playback callback function. */ -XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, xaPlayCallback callback) -{ +XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, + xaPlayCallback callback) + { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* pSelf; + if (!bCtx) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XAPlayItfAdaptMMF_RegisterCallback"); - ret = mmf_playitf_register_callback(mCtx->mmfContext, callback); + ret = mmf_playitf_register_callback(pSelf->mmfContext, callback); DEBUG_API("<-XAPlayItfAdaptMMF_RegisterCallback"); return ret; -} + } /** * XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags) * Description: Enables/disables notification of playback events. **/ -XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags) -{ +XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, + XAuint32 eventFlags) + { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* pSelf; + if (!bCtx) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XAPlayItfAdaptMMF_SetCallbackEventsMask"); - ret = mmf_playitf_set_callback_events_mask(mCtx->mmfContext, eventFlags); + ret = mmf_playitf_set_callback_events_mask(pSelf->mmfContext, eventFlags); DEBUG_API("<-XAPlayItfAdaptMMF_SetCallbackEventsMask"); return ret; -} + } /** * XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) * Description: Sets marker position. **/ -XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) -{ +XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, + XAmillisecond mSec) + { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* pSelf; + if (!bCtx) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XAPlayItfAdaptMMF_SetMarkerPosition"); - ret = mmf_playitf_set_marker_position(mCtx->mmfContext, mSec); + ret = mmf_playitf_set_marker_position(pSelf->mmfContext, mSec); DEBUG_API("<-XAPlayItfAdaptMMF_SetMarkerPosition"); return ret; -} + } /** * XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags) * Description: Clears marker position. **/ XAresult XAPlayItfAdaptMMF_ClearMarkerPosition(XAAdaptationBaseCtx *bCtx) -{ + { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* pSelf; + if (!bCtx) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XAPlayItfAdaptMMF_ClearMarkerPosition"); - ret = mmf_playitf_clear_marker_position(mCtx->mmfContext); + ret = mmf_playitf_clear_marker_position(pSelf->mmfContext); DEBUG_API("<-XAPlayItfAdaptMMF_ClearMarkerPosition"); return ret; -} + } /** * XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) * Description: Sets position update period. **/ -XAresult XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec) -{ +XAresult XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, + XAmillisecond mSec) + { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* pSelf; + if (!bCtx) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + pSelf = (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XAPlayItfAdaptMMF_SetPositionUpdatePeriod"); - ret = mmf_playitf_set_position_update_period(mCtx->mmfContext, mSec); + ret = mmf_playitf_set_position_update_period(pSelf->mmfContext, mSec); DEBUG_API("<-XAPlayItfAdaptMMF_SetPositionUpdatePeriod"); return ret; -} + } /* * XAresult XAPlayItfAdapt_StateChange * Handle callback from Radio utility */ -void XAPlayItfAdaptMMF_StateChange(XAAdaptationBaseCtx *bCtx, XAboolean playing) -{ - if (playing) - { - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADMOVING,1,0}; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - else - { - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADSTALLED,1,0}; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } +void XAPlayItfAdaptMMF_StateChange(XAAdaptationBaseCtx *bCtx, + XAboolean playing) + { + if (playing) + { + XAAdaptEvent event = + { + XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADMOVING, 1, 0 + }; + XAAdaptationBase_SendAdaptEvents(bCtx, &event); + } + else + { + XAAdaptEvent event = + { + XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADSTALLED, 1, 0 + }; + XAAdaptationBase_SendAdaptEvents(bCtx, &event); + } -} + } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,48 +1,53 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Play Itf Adaptation MMF Header + * + */ #ifndef XAPLAYITFADAPTATIONMMF_H #define XAPLAYITFADAPTATIONMMF_H #include "xaadaptationmmf.h" - #ifdef _DEBUG /*parse state names for debug prints*/ static const char* playstatenamemmf[3] = -{ - "XA_PLAYSTATE_STOPPED", - "XA_PLAYSTATE_PAUSED", - "XA_PLAYSTATE_PLAYING" -}; + { + "XA_PLAYSTATE_STOPPED", "XA_PLAYSTATE_PAUSED", "XA_PLAYSTATE_PLAYING" + }; #define PLAYSTATENAME(i) (const char*)((i>0&&i<4)?playstatenamemmf[i-1]:"INVALID") #endif /*_DEBUG*/ - /* FUNCTIONS */ -XAresult XAPlayItfAdaptMMF_SetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 state); -XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 *pState); -XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec); -XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec); -XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, xaPlayCallback callback); -XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, XAuint32 eventFlags); -XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec); +XAresult XAPlayItfAdaptMMF_SetPlayState(XAAdaptationBaseCtx *bCtx, + XAuint32 state); +XAresult XAPlayItfAdaptMMF_GetPlayState(XAAdaptationBaseCtx *bCtx, + XAuint32 *pState); +XAresult XAPlayItfAdaptMMF_GetDuration(XAAdaptationBaseCtx *bCtx, + XAmillisecond *pMsec); +XAresult XAPlayItfAdaptMMF_GetPosition(XAAdaptationBaseCtx *bCtx, + XAmillisecond *pMsec); +XAresult XAPlayItfAdaptMMF_RegisterCallback(XAAdaptationBaseCtx *bCtx, + xaPlayCallback callback); +XAresult XAPlayItfAdaptMMF_SetCallbackEventsMask(XAAdaptationBaseCtx *bCtx, + XAuint32 eventFlags); +XAresult XAPlayItfAdaptMMF_SetMarkerPosition(XAAdaptationBaseCtx *bCtx, + XAmillisecond mSec); XAresult XAPlayItfAdaptMMF_ClearMarkerPosition(XAAdaptationBaseCtx *bCtx); -XAresult XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, XAmillisecond mSec); -void XAPlayItfAdaptMMF_StateChange(XAAdaptationBaseCtx *bCtx, XAboolean playing); +XAresult XAPlayItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationBaseCtx *bCtx, + XAmillisecond mSec); +void XAPlayItfAdaptMMF_StateChange(XAAdaptationBaseCtx *bCtx, + XAboolean playing); #endif /* XAPLAYITFADAPTATIONMMF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.c Fri Jun 11 19:59:23 2010 -0500 @@ -16,10 +16,10 @@ */ #include -#include "XADebug.h" -#include "XAAdaptationMMF.h" -#include "XARadioItfAdaptation.h" -#include "XARadioAdaptCtx.h" +#include "xadebug.h" +#include "xaadaptationmmf.h" +#include "xaradioitfadaptation.h" +#include "xaradioadaptctx.h" #include "cmmfradiobackendengine.h" /* diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xaradioitfadaptation.h Fri Jun 11 19:59:23 2010 -0500 @@ -18,7 +18,7 @@ #define XARADIOITFFADAPTATION_H #include "xaadaptationmmf.h" -#include "XADebug.h" +#include "xadebug.h" /* FUNCTIONS */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xarecorditfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xarecorditfadaptationmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xarecorditfadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ #include "xamediarecorderadaptctxmmf.h" #include "xarecorditfadaptationmmf.h" @@ -28,88 +28,92 @@ * XAuint32 state - Record state to be set * @return XAresult ret - Success value */ -XAresult XARecordItfAdaptMMF_SetRecordState(XAAdaptationMMFCtx *bCtx, XAuint32 state) -{ +XAresult XARecordItfAdaptMMF_SetRecordState(XAAdaptationMMFCtx *bCtx, + XAuint32 state) + { XAresult ret = XA_RESULT_SUCCESS; int mmfretCode; - XAAdaptEvent stalledevent = {XA_RECORDITFEVENTS, XA_RECORDEVENT_HEADSTALLED, 0, NULL}; + XAAdaptEvent stalledevent = + { + XA_RECORDITFEVENTS, XA_RECORDEVENT_HEADSTALLED, 0, NULL + }; XAMediaRecorderAdaptationMMFCtx* mCtx = NULL; DEBUG_API_A1("->XARecordItfAdaptMMF_SetRecordState %s",RECORDSTATENAME(state)); - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARecordItfAdaptMMF_SetRecordState"); + if (!bCtx) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdaptMMF_SetRecordState"); return XA_RESULT_PARAMETER_INVALID; - } + } mCtx = (XAMediaRecorderAdaptationMMFCtx*) bCtx; mCtx->isRecord = XA_BOOLEAN_TRUE; - switch ( state ) - { + switch (state) + { case XA_RECORDSTATE_STOPPED: - { - mmfretCode= mmf_stop_recording(mCtx->mmfContext, TRUE); - if(mmfretCode != XA_RESULT_SUCCESS) + { + mmfretCode = mmf_stop_recording(mCtx->mmfContext, TRUE); + if (mmfretCode != XA_RESULT_SUCCESS) { ret = XA_RESULT_PARAMETER_INVALID; } break; - } + } case XA_RECORDSTATE_PAUSED: - { - mmfretCode = mmf_stop_recording(mCtx->mmfContext,FALSE); - if(mmfretCode != XA_RESULT_SUCCESS) + { + mmfretCode = mmf_stop_recording(mCtx->mmfContext, FALSE); + if (mmfretCode != XA_RESULT_SUCCESS) { ret = XA_RESULT_PARAMETER_INVALID; } else { - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &stalledevent ); + XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, + &stalledevent); } break; - } + } case XA_RECORDSTATE_RECORDING: - { + { mmfretCode = mmf_start_recording(mCtx->mmfContext); - if(mmfretCode != XA_RESULT_SUCCESS) + if (mmfretCode != XA_RESULT_SUCCESS) { ret = XA_RESULT_PARAMETER_INVALID; } break; - } + } default: - DEBUG_ERR("Unhandled state"); + DEBUG_ERR("Unhandled state") + ; ret = XA_RESULT_PARAMETER_INVALID; break; - } + } - if( ret == XA_RESULT_SUCCESS ) - { + if (ret == XA_RESULT_SUCCESS) + { mCtx->xaRecordState = state; - } - + } DEBUG_API("<-XARecordItfAdaptMMF_SetRecordState %d"); return ret; -} + } /* * XAresult XARecordItfAdapt_GetRecordState(XAAdaptationBaseCtx *bCtx, XAuint32 *state) * Description: Return record state */ -XAresult XARecordItfAdaptMMF_GetRecordState(XAAdaptationMMFCtx *bCtx, XAuint32 *state) -{ +XAresult XARecordItfAdaptMMF_GetRecordState(XAAdaptationMMFCtx *bCtx, + XAuint32 *state) + { XAMediaRecorderAdaptationMMFCtx* mCtx = NULL; DEBUG_API("->XARecordItfAdaptMMF_GetRecordState"); - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARecordItfAdaptMMF_GetRecordState"); + if (!bCtx) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdaptMMF_GetRecordState"); return XA_RESULT_PARAMETER_INVALID; - } + } mCtx = (XAMediaRecorderAdaptationMMFCtx*) bCtx; @@ -117,7 +121,7 @@ DEBUG_API("<-XARecordItfAdaptMMF_GetRecordState"); return XA_RESULT_SUCCESS; -} + } /* * XAresult XARecordItfAdapt_GetPosition(XAAdaptationBaseCtx *ctx, AdaptationContextIDS ctxIDs, XAmillisecond *pMsec) @@ -125,28 +129,29 @@ * XAmillisecond *pMsec - Pointer where to store current position in stream. * @return XAresult ret - Success value */ -XAresult XARecordItfAdaptMMF_GetPosition(XAAdaptationMMFCtx *bCtx, XAmillisecond *pMsec) -{ +XAresult XARecordItfAdaptMMF_GetPosition(XAAdaptationMMFCtx *bCtx, + XAmillisecond *pMsec) + { XAresult ret = XA_RESULT_SUCCESS; XAuint64 position; XAMediaRecorderAdaptationMMFCtx* mCtx = NULL; DEBUG_API("->XARecordItfAdaptMMF_GetPosition"); - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARecordItfAdaptMMF_GetPosition"); + if (!bCtx) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdaptMMF_GetPosition"); /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } mCtx = (XAMediaRecorderAdaptationMMFCtx*) bCtx; - mmf_get_record_position(mCtx->mmfContext, &position); - - *pMsec = (XAmillisecond)position; - + ret = mmf_get_record_position(mCtx->mmfContext, &position); + + *pMsec = (XAmillisecond) position; + DEBUG_API("<-XARecordItfAdaptMMF_GetPosition"); return ret; -} + } /* * gboolean XARecordItfAdapt_PositionUpdate(gpointer ctx) @@ -155,79 +160,84 @@ * @return false to stop periodic calls */ gboolean XARecordItfAdaptMMF_PositionUpdate(gpointer ctx, XAuint64 position) -{ + { XAAdaptationMMFCtx *bCtx = (XAAdaptationMMFCtx*) ctx; - XAMediaRecorderAdaptationMMFCtx* mCtx = (XAMediaRecorderAdaptationMMFCtx*) ctx; - XAAdaptEvent event = {XA_RECORDITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL}; + XAMediaRecorderAdaptationMMFCtx* mCtx = + (XAMediaRecorderAdaptationMMFCtx*) ctx; + XAAdaptEvent event = + { + XA_RECORDITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL + }; DEBUG_API("->XARecordItfAdapt_PositionUpdate"); - if( mCtx && mCtx->trackpositionenabled ) - { + if (mCtx && mCtx->trackpositionenabled) + { XAmillisecond posInMsec = 0; - { - XARecordItfAdaptMMF_GetPosition(bCtx , &posInMsec); + { + XARecordItfAdaptMMF_GetPosition(bCtx, &posInMsec); event.data = &posInMsec; DEBUG_API_A1("XARecordItfAdapt_PositionUpdate: pos %lu ms", posInMsec); - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); + XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event); + }DEBUG_API_A1("<-XARecordItfAdapt_PositionUpdate: %d", mCtx->runpositiontimer); + return (mCtx->runpositiontimer); } - DEBUG_API_A1("<-XARecordItfAdapt_PositionUpdate: %d", mCtx->runpositiontimer); - return( mCtx->runpositiontimer ); - } /* return false to stop timer */ return FALSE; -} + } /* * XAresult XARecordItfAdapt_EnablePositionTracking * Enable/disable periodic position tracking callbacks */ -XAresult XARecordItfAdaptMMF_EnablePositionTracking(XAAdaptationMMFCtx *bCtx, XAboolean enable) -{ - XAMediaRecorderAdaptationMMFCtx* mCtx = (XAMediaRecorderAdaptationMMFCtx*) bCtx; +XAresult XARecordItfAdaptMMF_EnablePositionTracking(XAAdaptationMMFCtx *bCtx, + XAboolean enable) + { + XAMediaRecorderAdaptationMMFCtx* mCtx = + (XAMediaRecorderAdaptationMMFCtx*) bCtx; DEBUG_API_A1("->XARecordItfAdapt_EnablePositionTracking (enable: %lu)", enable); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); + if (!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; - } - + } /* create a timer to track position of playback */ - if(enable && !(mCtx->trackpositionenabled)) - { + if (enable && !(mCtx->trackpositionenabled)) + { mCtx->trackpositionenabled = XA_BOOLEAN_TRUE; //mCtx->positionCb = &XARecordItfAdaptMMF_PositionUpdate; - } + } else if (!enable && (mCtx->trackpositionenabled)) - { + { mCtx->trackpositionenabled = XA_BOOLEAN_FALSE; - if(mCtx->runpositiontimer > 0) - { - mCtx->runpositiontimer=0; + if (mCtx->runpositiontimer > 0) + { + mCtx->runpositiontimer = 0; + } } - } DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); return XA_RESULT_SUCCESS; -} + } -XAresult XARecordItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationMMFCtx *bCtx, XAmillisecond pMsec) +XAresult XARecordItfAdaptMMF_SetPositionUpdatePeriod( + XAAdaptationMMFCtx *bCtx, XAmillisecond pMsec) { - XAMediaRecorderAdaptationMMFCtx* mCtx = (XAMediaRecorderAdaptationMMFCtx*) bCtx; + XAresult ret = XA_RESULT_SUCCESS; + XAMediaRecorderAdaptationMMFCtx* mCtx = + (XAMediaRecorderAdaptationMMFCtx*) bCtx; DEBUG_API_A1("->XARecordItfAdaptMMF_SetPositionUpdatePeriod (pMsec: %lu)", pMsec); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) + if (!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); + /* invalid parameter */ + return XA_RESULT_PARAMETER_INVALID; } - - mmf_set_record_position_update_period(mCtx->mmfContext, pMsec); - return XA_RESULT_SUCCESS; + + ret = mmf_set_record_position_update_period(mCtx->mmfContext, pMsec); + return ret; } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xarecorditfadaptationmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xarecorditfadaptationmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xarecorditfadaptationmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Record Itf adapt header + * + */ #ifndef XARECORDITFADAPTATIONMMF_H #define XARECORDITFADAPTATIONMMF_H @@ -22,28 +22,31 @@ #include "xadebug.h" #include - #ifdef _DEBUG /*parse state names for debug prints*/ static const char* recordstatenamesmmf[3] = -{ - "XA_RECORDSTATE_STOPPED", - "XA_RECORDSTATE_PAUSED", - "XA_RECORDSTATE_RECORDING", -}; + { + "XA_RECORDSTATE_STOPPED", + "XA_RECORDSTATE_PAUSED", + "XA_RECORDSTATE_RECORDING", + }; #define RECORDSTATENAME(i) ((i>0&&i<4)?recordstatenamesmmf[i-1]:"INVALID") #endif /*_DEBUG*/ /*forward declaration of position updater callback*/ gboolean XARecordItfAdaptMMF_PositionUpdate(gpointer ctx, XAuint64 position); - /* FUNCTIONS */ -XAresult XARecordItfAdaptMMF_SetRecordState(XAAdaptationMMFCtx *ctx, XAuint32 state ); -XAresult XARecordItfAdaptMMF_GetPosition( XAAdaptationMMFCtx *ctx, XAmillisecond *pMsec ); -XAresult XARecordItfAdaptMMF_GetRecordState(XAAdaptationMMFCtx *bCtx, XAuint32 *state); -XAresult XARecordItfAdaptMMF_EnablePositionTracking(XAAdaptationMMFCtx *ctx, XAboolean enable); -XAresult XARecordItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationMMFCtx *ctx, XAmillisecond pMsec); +XAresult XARecordItfAdaptMMF_SetRecordState(XAAdaptationMMFCtx *ctx, + XAuint32 state); +XAresult XARecordItfAdaptMMF_GetPosition(XAAdaptationMMFCtx *ctx, + XAmillisecond *pMsec); +XAresult XARecordItfAdaptMMF_GetRecordState(XAAdaptationMMFCtx *bCtx, + XAuint32 *state); +XAresult XARecordItfAdaptMMF_EnablePositionTracking(XAAdaptationMMFCtx *ctx, + XAboolean enable); +XAresult XARecordItfAdaptMMF_SetPositionUpdatePeriod(XAAdaptationMMFCtx *ctx, + XAmillisecond pMsec); #endif /* XARECORDITFADAPTATIONMMF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xaseekitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xaseekitfadaptationmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xaseekitfadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,25 +1,25 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Seek Itf Adaptation MMF + * + */ +#include #include "unistd.h" #include "xamediaplayeradaptctxmmf.h" #include "xaseekitfadaptationmmf.h" #include "cmmfbackendengine.h" -#include /* * XAresult XAPlayItfAdaptMMF_SetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 state) @@ -28,10 +28,12 @@ * XAuint32 state - Play state to be set * @return XAresult ret - Success value */ -XAresult XASeekItfAdaptMMF_SetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond pos, XAuint32 seekMode) -{ +XAresult XASeekItfAdaptMMF_SetPosition(XAAdaptationBaseCtx *bCtx, + XAmillisecond pos, XAuint32 seekMode) + { XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; + XAMediaPlayerAdaptationMMFCtx* mCtx = + (XAMediaPlayerAdaptationMMFCtx*) bCtx; DEBUG_API("->XASeekItfAdaptMMF_SetPosition "); ret = mmf_seekitf_set_position(mCtx->mmfContext, pos); @@ -40,24 +42,23 @@ DEBUG_API("<-XASeekItfAdaptMMF_SetPosition"); return ret; -} + } -XAresult XASeekItfAdaptMMF_SetLoop(XAAdaptationBaseCtx *bCtx, XAboolean loopEnable, - XAmillisecond startPos, XAmillisecond endPos) +XAresult XASeekItfAdaptMMF_SetLoop(XAAdaptationBaseCtx *bCtx, + XAboolean loopEnable, XAmillisecond startPos, XAmillisecond endPos) { - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationMMFCtx* mCtx = (XAMediaPlayerAdaptationMMFCtx*) bCtx; - - DEBUG_API("->XASeekItfAdaptMMF_SetLoop "); + XAresult ret = XA_RESULT_SUCCESS; + XAMediaPlayerAdaptationMMFCtx* mCtx = + (XAMediaPlayerAdaptationMMFCtx*) bCtx; - /* bCtx and parameter pointer validation happens in the calling function. - * We don't need to repeat it here*/ - ret = mmf_seekitf_set_repeats(mCtx->mmfContext, loopEnable); - - ret = mmf_seekitf_set_playwindow(mCtx->mmfContext, startPos, endPos); - - - - DEBUG_API("<-XASeekItfAdaptMMF_SetLoop"); - return ret; + DEBUG_API("->XASeekItfAdaptMMF_SetLoop "); + + /* bCtx and parameter pointer validation happens in the calling function. + * We don't need to repeat it here*/ + ret = mmf_seekitf_set_repeats(mCtx->mmfContext, loopEnable); + + ret = mmf_seekitf_set_playwindow(mCtx->mmfContext, startPos, endPos); + + DEBUG_API("<-XASeekItfAdaptMMF_SetLoop"); + return ret; } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xaseekitfadaptationmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xaseekitfadaptationmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xaseekitfadaptationmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,30 +1,30 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Seek Itf Adaptation Header + * + */ #ifndef XASEEKITFADAPTATIONMMF_H #define XASEEKITFADAPTATIONMMF_H #include "xaadaptationmmf.h" - /* FUNCTIONS */ -XAresult XASeekItfAdaptMMF_SetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond pos, XAuint32 seekMode); -XAresult XASeekItfAdaptMMF_SetLoop(XAAdaptationBaseCtx *bCtx, XAboolean loopEnable, - XAmillisecond startPos, XAmillisecond endPos); +XAresult XASeekItfAdaptMMF_SetPosition(XAAdaptationBaseCtx *bCtx, + XAmillisecond pos, XAuint32 seekMode); +XAresult XASeekItfAdaptMMF_SetLoop(XAAdaptationBaseCtx *bCtx, + XAboolean loopEnable, XAmillisecond startPos, XAmillisecond endPos); #endif /* XASEEKITFADAPTATIONMMF_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xastreaminformationitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xastreaminformationitfadaptationmmf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xastreaminformationitfadaptationmmf.c Fri Jun 11 19:59:23 2010 -0500 @@ -1,10 +1,19 @@ -/** - * src\adaptation\XAStreamInformationItfAdaptation.c - * Part of OpenMAX AL Implementation - * Copyright (c) 2009 Nokia Inc. +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * - * This file contains implementation of XAStreamInformationItfAdaptation - **/ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: StreamInfo Itf Adaptation MMF + * + */ #include "xadebug.h" #include "xathreadsafety.h" @@ -18,55 +27,51 @@ * XAMediaContainerInformation *info); * Description: Obtains media container information */ -XAresult XAStreamInformationItfAdaptMMF_QueryMediaContainerInformation( - XAAdaptationBaseCtx *adaptCtx, - XAuint32 *containerType, - XAmillisecond *mediaDuration, - XAuint32 *numStreams) -{ +XAresult XAStreamInformationItfAdaptMMF_QueryMediaContainerInformation( + XAAdaptationBaseCtx *adaptCtx, XAuint32 *containerType, + XAmillisecond *mediaDuration, XAuint32 *numStreams) + { XAresult ret = XA_RESULT_SUCCESS; XADataSource *xaDataSource = NULL; DEBUG_API("->XAStreamInformationItfAdaptMMF_QueryMediaContainerInformation"); /* Both Media Player and Metadata Extractor objec uses the same ctxId */ - if( !adaptCtx || - (adaptCtx->ctxId != XAMediaPlayerAdaptation) ) -/* !((adaptCtx->ctxId == XAMediaPlayerAdaptation) || - (adaptCtx->ctxId == XAMDAdaptation) ) ) -*/ - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-ctxId != XAMediaPlayerAdaptation)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-xaSource; -/* DEBUG_INFO("Obtained handle to xaDataSource");*/ - if ( xaDataSource && - xaDataSource->pFormat && - ( (*(XAuint32*)xaDataSource->pFormat ) == XA_DATAFORMAT_MIME) ) - { - *containerType = ((XADataFormat_MIME*)(xaDataSource->pFormat))->containerType; + /* DEBUG_INFO("Obtained handle to xaDataSource");*/ + if (xaDataSource && xaDataSource->pFormat + && ((*(XAuint32*) xaDataSource->pFormat) == XA_DATAFORMAT_MIME)) + { + *containerType + = ((XADataFormat_MIME*) (xaDataSource->pFormat))->containerType; DEBUG_INFO_A1("Container type obtained from xaDataSource->pFormat is [%u]", (unsigned int)(*containerType)); - } + } else - { + { DEBUG_INFO("Container type unspecified"); - } + } /* Get media duration */ ret = XAPlayItfAdaptMMF_GetDuration(adaptCtx, mediaDuration); - if ( ret != XA_RESULT_SUCCESS ) + if (ret != XA_RESULT_SUCCESS) + { return ret; + } - ret = mmf_streaminformationitf_get_numstreams(((XAMediaPlayerAdaptationMMFCtx*)adaptCtx)->mmfContext, - numStreams); + ret = mmf_streaminformationitf_get_numstreams( + ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, + numStreams); DEBUG_API("-XAStreamInformationItfAdaptMMF_QueryStreamType"); - ret = mmf_streaminformationitf_get_numstreams(((XAMediaPlayerAdaptationMMFCtx*)adaptCtx)->mmfContext, - &numStreams); + ret = mmf_streaminformationitf_get_numstreams( + ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, + &numStreams); if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); - DEBUG_API("- numStreams ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("- numStreams) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-xaSource; - if( xaDataSource->pFormat && - ( (*(XAuint32*)xaDataSource->pFormat ) == XA_DATAFORMAT_RAWIMAGE) ) - { + if (xaDataSource && xaDataSource->pFormat + && ((*(XAuint32*) xaDataSource->pFormat) + == XA_DATAFORMAT_RAWIMAGE)) + { *domain = XA_DOMAINTYPE_IMAGE; return XA_RESULT_SUCCESS; - } + } else - { - ret = mmf_streaminformationitf_get_streaminfo(((XAMediaPlayerAdaptationMMFCtx*)adaptCtx)->mmfContext, - streamIndex,domain); - } + { + ret = mmf_streaminformationitf_get_streaminfo( + ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, + streamIndex, domain); + } DEBUG_API("-mmfContext; -/* GstElement *codecbin = NULL;*/ + + if (!adaptCtx || !info) + { + ret = XA_RESULT_PARAMETER_INVALID; + return ret; + } + + mmfctx = ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext; DEBUG_API("->XAStreamInformationItfAdaptMMF_QueryStreamInformation"); /* stream index is validated in XAStreamInformationItfAdaptMMF_QueryStreamType */ - ret = XAStreamInformationItfAdaptMMF_QueryStreamType( - adaptCtx, streamIndex, &domain); + ret = XAStreamInformationItfAdaptMMF_QueryStreamType(adaptCtx, + streamIndex, &domain); if (ret != XA_RESULT_SUCCESS) - { + { DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); DEBUG_API("-codecId = codecId; streamInfo->channels = channels; @@ -212,11 +222,12 @@ streamInfo->bitRate = bitRate; streamInfo->langCountry[0] = '\0'; streamInfo->duration = duration; - } + } break; case XA_DOMAINTYPE_MIDI: - { - XAMIDIStreamInformation* streamInfo = (XAMIDIStreamInformation*)info; + { + XAMIDIStreamInformation* streamInfo = + (XAMIDIStreamInformation*) info; DEBUG_INFO("Assigning values for XAMIDIStreamInformation"); /*currently there is no way to get these information from gstreamer*/ streamInfo->channels = XA_MIDI_UNKNOWN; @@ -225,11 +236,12 @@ /*streamInfo->bitRate = 0;*/ streamInfo->langCountry[0] = '\0'; streamInfo->duration = duration; - } + } break; case XA_DOMAINTYPE_VIDEO: - { - XAVideoStreamInformation* streamInfo = (XAVideoStreamInformation*)info; + { + XAVideoStreamInformation* streamInfo = + (XAVideoStreamInformation*) info; DEBUG_INFO("Assigning values for XAVideoStreamInformation"); streamInfo->codecId = codecId; streamInfo->width = width; @@ -237,26 +249,27 @@ streamInfo->bitRate = bitRate; streamInfo->duration = duration; streamInfo->frameRate = frameRate; - } + } break; case XA_DOMAINTYPE_IMAGE: - { - XAImageStreamInformation* streamInfo = (XAImageStreamInformation*)info; + { + XAImageStreamInformation* streamInfo = + (XAImageStreamInformation*) info; DEBUG_INFO("Assigning values for XAImageStreamInformation"); streamInfo->codecId = codecId; streamInfo->width = width; streamInfo->height = height; streamInfo->presentationDuration = duration; - } + } break; default: break; - }; - } /*if ( ret == XA_RESULT_SUCCESS)*/ + }; + } /*if ( ret == XA_RESULT_SUCCESS)*/ DEBUG_API("-XAStreamInformationItfAdaptMMF_QueryStreamName"); /* Both Media Player and Metadata Extractor objec uses the same ctxId */ - if( !adaptCtx || - (adaptCtx->ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-ctxId + != XAMediaPlayerAdaptation)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-mmfContext, - &numStreams); + ret = mmf_streaminformationitf_get_numstreams( + ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, + &numStreams); if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); - DEBUG_API("- numStreams ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("- numStreams) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-XAStreamInformationItfAdaptMMF_QueryActiveStreams"); /* Both Media Player and Metadata Extractor objec uses the same ctxId */ - if( !adaptCtx || - (adaptCtx->ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-ctxId + != XAMediaPlayerAdaptation)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-ctxId == XAMDAdaptation) - { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); - DEBUG_API("-ctxId == XAMDAdaptation) + { + DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED");DEBUG_API("-mmfContext, - &inputNumStreams); + ret = mmf_streaminformationitf_get_numstreams( + ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, + &inputNumStreams); if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); - DEBUG_API("-XAStreamInformationItfAdaptMMF_QueryActiveStreams"); return XA_RESULT_SUCCESS; -} + } XAresult XAStreamInformationItfAdaptMMF_SetActiveStream( - XAAdaptationBaseCtx *adaptCtx, - XAuint32 streamNum, - XAboolean active, - XAboolean commitNow) -{ + XAAdaptationBaseCtx *adaptCtx, XAuint32 streamNum, XAboolean active, + XAboolean commitNow) + { XAresult ret = XA_RESULT_SUCCESS; XAuint32 numStreams; DEBUG_API("->XAStreamInformationItfAdaptMMF_SetActiveStream"); /* Both Media Player and Metadata Extractor objec uses the same ctxId */ - if( !adaptCtx || - (adaptCtx->ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-ctxId != XAMediaPlayerAdaptation)) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-ctxId == XAMDAdaptation) - { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); - DEBUG_API("-ctxId == XAMDAdaptation) + { + DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED");DEBUG_API("-mmfContext, - &numStreams); + ret = mmf_streaminformationitf_get_numstreams( + ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, + &numStreams); if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); - DEBUG_API("- numStreams ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("- numStreams) + { + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-mmfContext, - streamNum, active); + ret = mmf_streaminformationitf_set_activestream( + ((XAMediaPlayerAdaptationMMFCtx*) adaptCtx)->mmfContext, + streamNum, active); } DEBUG_API("->XAStreamInformationItfAdaptMMF_SetActiveStream"); return ret; -} + } - diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/mmf_adaptation/xastreaminformationitfadaptationmmf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/xastreaminformationitfadaptationmmf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xastreaminformationitfadaptationmmf.h Fri Jun 11 19:59:23 2010 -0500 @@ -1,10 +1,20 @@ -/** - * src\adaptation\XAStreamInformationItfAdaptation.h - * Part of OpenMAX AL Implementation - * Copyright (c) 2009 Nokia Inc. +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". * - * This file contains implementation of XAStreamInformationItfAdaptation - **/ + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: StreamInfo Itf Adaptation MMF header + * + */ + #ifndef XASTREAMINFORMATIONITFADAPTATIONMMF_H #define XASTREAMINFORMATIONITFADAPTATIONMMF_H @@ -14,36 +24,26 @@ /* FUNCTIONS */ XAresult XAStreamInformationItfAdaptMMF_QueryMediaContainerInformation( - XAAdaptationBaseCtx *adaptCtx, - XAuint32 *containerType, - XAmillisecond *mediaDuration, - XAuint32 *numStreams); + XAAdaptationBaseCtx *adaptCtx, XAuint32 *containerType, + XAmillisecond *mediaDuration, XAuint32 *numStreams); XAresult XAStreamInformationItfAdaptMMF_QueryStreamType( - XAAdaptationBaseCtx *adaptCtx, - XAuint32 streamIndex, + XAAdaptationBaseCtx *adaptCtx, XAuint32 streamIndex, XAuint32 *domain); XAresult XAStreamInformationItfAdaptMMF_QueryStreamInformation( - XAAdaptationBaseCtx *adaptCtx, - XAuint32 streamIndex, - void * info); + XAAdaptationBaseCtx *adaptCtx, XAuint32 streamIndex, void * info); XAresult XAStreamInformationItfAdaptMMF_QueryStreamName( - XAAdaptationBaseCtx *adaptCtx, - XAuint32 streamIndex, - XAuint16 * pNameSize, - XAchar * pName); + XAAdaptationBaseCtx *adaptCtx, XAuint32 streamIndex, + XAuint16 * pNameSize, XAchar * pName); XAresult XAStreamInformationItfAdaptMMF_QueryActiveStreams( - XAAdaptationBaseCtx *adaptCtx, - XAuint32 *numStreams, - XAboolean *activeStreams); + XAAdaptationBaseCtx *adaptCtx, XAuint32 *numStreams, + XAboolean *activeStreams); XAresult XAStreamInformationItfAdaptMMF_SetActiveStream( - XAAdaptationBaseCtx *adaptCtx, - XAuint32 streamNum, - XAboolean active, - XAboolean commitNow); + XAAdaptationBaseCtx *adaptCtx, XAuint32 streamNum, XAboolean active, + XAboolean commitNow); #endif /* XASTREAMINFORMATIONITFADAPTATION_H */ diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/radio/xaradioitf.c --- a/khronosfws/openmax_al/src/radio/xaradioitf.c Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/radio/xaradioitf.c Fri Jun 11 19:59:23 2010 -0500 @@ -481,6 +481,65 @@ } /** + * XAresult XARadioItfImpl_GetNumberOfPresets(XARadioItf self, XAuint32 * pNumPresets) + * Description: Returns the number of preset slots the device has for storing the presets. + **/ +XAresult XARadioItfImpl_GetNumberOfPresets(XARadioItf self, XAuint32 * pNumPresets) +{ + XAresult ret = XA_RESULT_FEATURE_UNSUPPORTED; + + DEBUG_API("->XARadioItfImpl_GetNumberOfPresets"); + + return ret; +} + +/** + * XAresult XARadioItfImpl_SetPreset(XARadioItf self, + * XAuint32 preset, + * XAuint32 freq, + * XAuint8 range, + * XAuint32 mode, + * const XAchar * name) + * Description: Sets the preset. + **/ +XAresult XARadioItfImpl_SetPreset(XARadioItf self, + XAuint32 preset, + XAuint32 freq, + XAuint8 range, + XAuint32 mode, + const XAchar * name) +{ + XAresult ret = XA_RESULT_FEATURE_UNSUPPORTED; + + return ret; +} + +/** + * XAresult XARadioItfImpl_GetPreset(XARadioItf self, + * XAuint32 preset, + * XAuint32 * pFreq, + * XAuint8 * pRange, + * XAuint32 * pMode, + * XAchar * pName, + * XAuint16 * pNameLength) + * Description: Gets the settings stored into a preset. + **/ +XAresult XARadioItfImpl_GetPreset(XARadioItf self, + XAuint32 preset, + XAuint32 * pFreq, + XAuint8 * pRange, + XAuint32 * pMode, + XAchar * pName, + XAuint16 * pNameLength) +{ + + XAresult ret = XA_RESULT_FEATURE_UNSUPPORTED; + + DEBUG_API("<-XARadioItfImpl_GetPreset"); + return ret; +} + +/** * XAresult XARadioItfImpl_RegisterRadioCallback(XARadioItf self, * xaRadioCallback callback, * void * pContext) diff -r 2ed61feeead6 -r 6f7ceef7b1d1 khronosfws/openmax_al/src/radio/xaradioitf.h --- a/khronosfws/openmax_al/src/radio/xaradioitf.h Fri May 28 19:26:28 2010 -0500 +++ b/khronosfws/openmax_al/src/radio/xaradioitf.h Fri Jun 11 19:59:23 2010 -0500 @@ -23,11 +23,20 @@ /** MACROS **/ #define RADIO_DEFAULT_STEREO_MODE 2 +#define RADIO_NUM_OF_PRESETS 20 /** TYPES **/ /** ENUMERATIONS **/ /** STRUCTURES **/ +typedef struct RadioPreset_ +{ + XAuint32 freq; + XAuint8 range; + XAuint32 stereoMode; + char* name; +} RadioPreset; + /* Definition of XAEqualizerItf implementation */ typedef struct XARadioItfImpl_ @@ -44,6 +53,10 @@ XARadioItf cbPtrToSelf; xaRadioCallback callback; void *context; + XAuint32 preset; + XAuint32 numOfPresets; + + RadioPreset presets[RADIO_NUM_OF_PRESETS]; /*Adaptation variables*/ XAAdaptationBaseCtx *adapCtx; @@ -89,6 +102,23 @@ XAresult XARadioItfImpl_RegisterRadioCallback(XARadioItf self, xaRadioCallback callback, void * pContext); + +XAresult XARadioItfImpl_GetNumberOfPresets(XARadioItf self, XAuint32 * pNumPresets); + +XAresult XARadioItfImpl_SetPreset(XARadioItf self, + XAuint32 preset, + XAuint32 freq, + XAuint8 range, + XAuint32 mode, + const XAchar * name); + +XAresult XARadioItfImpl_GetPreset(XARadioItf self, + XAuint32 preset, + XAuint32 * pFreq, + XAuint8 * pRange, + XAuint32 * pMode, + XAchar * pName, + XAuint16 * pNameLength); /* XARadioItfImpl -specific methods */ XARadioItfImpl* XARadioItfImpl_Create(XAAdaptationBaseCtx *adapCtx); diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioPlayController.h --- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioPlayController.h Fri May 28 19:26:28 2010 -0500 +++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioPlayController.h Fri Jun 11 19:59:23 2010 -0500 @@ -976,6 +976,7 @@ mutable CActiveSchedulerWait* iWait; mutable CActiveSchedulerWait* iBlockSetPos; + mutable CActiveSchedulerWait* iBlockPrime; TUint32 iPlayStartTime; TUint32 iZeroTime; diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp --- a/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -123,6 +123,8 @@ delete iDataSourceAdapter; delete iWait; delete iBlockSetPos; + delete iBlockPrime; + iSharedBuffers.ResetAndDestroy(); iSharedBuffers.Close(); DP0(_L("CAdvancedAudioPlayController::~CAdvancedAudioPlayController end")); @@ -679,7 +681,13 @@ iBlockSetPos->AsyncStop(); } } - + if(iBlockPrime) + { + if(iBlockPrime->IsStarted()) + { + iBlockPrime->AsyncStop(); + } + } iRequestState = EPaused; TRAP(err, DoPauseL(ETrue)); // this is a preemption pause // In case of pre-emption we should only Pause ... but not Stop. @@ -1631,7 +1639,11 @@ iBlockSetPos->AsyncStop(); } } - + if(iBlockPrime) + { + if(iBlockPrime->IsStarted()) + iBlockPrime->AsyncStop(); + } iPlayingForDuration = EFalse; iBlockDuration = EFalse; iPlayingForPauseSeek = EFalse; @@ -1720,11 +1732,17 @@ case EInitializing: if (position != 0) { // if we are priming, we will already be ready to play from 0. - DP2(_L("CAdvancedAudioPlayController::SetPositionL, saving pos iReadHeader[%d] iState[%d]"),iReadHeader,iState); - iInitPosition = position; + DP2(_L("CAdvancedAudioPlayController::SetPositionL, saving pos iReadHeader[%d] iState[%d]"),iReadHeader,iState); + iInitPosition = position; } - DP0(_L("CAdvancedAudioPlayController::SetPositionL, can ignore")); - break; + DP0(_L("CAdvancedAudioPlayController::SetPositionL, can ignore")); + DP0(_L("CAdvancedAudioController::PrimeL() blocking")); + iBlockPrime= new (ELeave) CActiveSchedulerWait(); + iBlockPrime->Start(); + DP0(_L("CAdvancedAudioController::PrimeL() continuing")); + delete iBlockPrime; + iBlockPrime= NULL; + case EInitialized: case EPaused: iSavedSetPosition = position; @@ -1899,6 +1917,14 @@ return; } iState = EInitialized; + if(iBlockPrime) + { + if(iBlockPrime->IsStarted()) + { + iBlockPrime->AsyncStop(); + } + } + // when playwindow is active for a non-seekable source during loop play // we must seek to the playwindow start position and then start the playback if (iPlayWindowStartPosition > 0) // do we need additional checks as loop play / non-seekable source ?? diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/ActiveScheduledTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioPlaybackTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioRecorderTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioStreamTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioToneTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common.cfg --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common.cfg Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common.cfg Fri Jun 11 19:59:23 2010 -0500 @@ -52,7 +52,7 @@ MO_ENGINE 1 MO_PLAYER 4 MO_RECORDER 5 -MO_RADIO 6 6 +MO_RADIO 6 XA_BOOLEAN_FALSE 0 XA_BOOLEAN_TRUE 1 diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common_noklinvolitf.cfg --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common_noklinvolitf.cfg Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common_noklinvolitf.cfg Fri Jun 11 19:59:23 2010 -0500 @@ -79,7 +79,7 @@ [Endtest] [Test] -title 17.4 NokiaLinearVolumeItf GetStereoPosition +title 17.4 NokiaLinearVolumeItf RegisterVolumeCallback create openmaxaltestmodule ALImpl ALImpl al_createEngine 1 1 0 0 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common_nokvolextitf.cfg --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common_nokvolextitf.cfg Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common_nokvolextitf.cfg Fri Jun 11 19:59:23 2010 -0500 @@ -148,6 +148,7 @@ ALImpl al_engitf_CreateMediaPlayer 1 XA_IID_NOKIAVOLUMEEXT ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_PLAYER XA_IID_NOKIAVOLUMEEXT +allownextresult 12 ALImpl al_nokiavolumeextitf_EnableStereoPosition 1 ALImpl al_objitf_Destroy MO_PLAYER ALImpl al_objitf_Destroy MO_ENGINE @@ -167,6 +168,7 @@ ALImpl al_engitf_CreateMediaPlayer 1 XA_IID_NOKIAVOLUMEEXT ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_PLAYER XA_IID_NOKIAVOLUMEEXT +allownextresult 12 ALImpl al_nokiavolumeextitf_EnableStereoPosition 1 ALImpl al_nokiavolumeextitf_IsEnabledStereoPosition ALImpl al_objitf_Destroy MO_PLAYER @@ -187,6 +189,7 @@ ALImpl al_engitf_CreateMediaPlayer 1 XA_IID_NOKIAVOLUMEEXT ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_PLAYER XA_IID_NOKIAVOLUMEEXT +allownextresult 12 ALImpl al_nokiavolumeextitf_EnableStereoPosition 1 ALImpl al_nokiavolumeextitf_SetStereoPosition 1000 ALImpl al_objitf_Destroy MO_PLAYER @@ -207,6 +210,7 @@ ALImpl al_engitf_CreateMediaPlayer 1 XA_IID_NOKIAVOLUMEEXT ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_PLAYER XA_IID_NOKIAVOLUMEEXT +allownextresult 12 ALImpl al_nokiavolumeextitf_EnableStereoPosition 1 ALImpl al_nokiavolumeextitf_SetStereoPosition 1000 ALImpl al_nokiavolumeextitf_GetStereoPosition diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common_volumeitf.cfg --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common_volumeitf.cfg Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_common_volumeitf.cfg Fri Jun 11 19:59:23 2010 -0500 @@ -148,6 +148,7 @@ ALImpl al_engitf_CreateMediaPlayer 1 XA_IID_VOLUME ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_PLAYER XA_IID_VOLUME +allownextresult 12 ALImpl al_volumeitf_EnableStereoPosition 1 ALImpl al_objitf_Destroy MO_PLAYER ALImpl al_objitf_Destroy MO_ENGINE @@ -167,6 +168,7 @@ ALImpl al_engitf_CreateMediaPlayer 1 XA_IID_VOLUME ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_PLAYER XA_IID_VOLUME +allownextresult 12 ALImpl al_volumeitf_EnableStereoPosition 1 ALImpl al_volumeitf_IsEnabledStereoPosition ALImpl al_objitf_Destroy MO_PLAYER @@ -187,6 +189,7 @@ ALImpl al_engitf_CreateMediaPlayer 1 XA_IID_VOLUME ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_PLAYER XA_IID_VOLUME +allownextresult 12 ALImpl al_volumeitf_EnableStereoPosition 1 ALImpl al_volumeitf_SetStereoPosition 1000 ALImpl al_objitf_Destroy MO_PLAYER @@ -207,6 +210,7 @@ ALImpl al_engitf_CreateMediaPlayer 1 XA_IID_VOLUME ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_PLAYER XA_IID_VOLUME +allownextresult 12 ALImpl al_volumeitf_EnableStereoPosition 1 ALImpl al_volumeitf_SetStereoPosition 1000 ALImpl al_volumeitf_GetStereoPosition diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_engine_engineitf.cfg --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_engine_engineitf.cfg Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_engine_engineitf.cfg Fri Jun 11 19:59:23 2010 -0500 @@ -72,14 +72,13 @@ [Endtest] [Test] -title 2.2 EngItf CreateRadioDvice +title 2.2 EngItf CreateRadioDevice create openmaxaltestmodule ALImpl ALImpl al_createEngine 1 1 0 0 ALImpl al_objitf_Realize 1 0 ALImpl al_objitf_GetInterface 1 5 -allownextresult 12 ALImpl al_engitf_CreateRadioDevice -//ALImpl al_objitf_Destroy 6 +ALImpl al_objitf_Destroy 6 ALImpl al_objitf_Destroy 1 delete ALImpl [Endtest] diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_mp_streaming.cfg --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_mp_streaming.cfg Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_mp_streaming.cfg Fri Jun 11 19:59:23 2010 -0500 @@ -47,7 +47,7 @@ ALImpl al_createEngine 1 1 0 0 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE -ALImpl al_SetDataLocator 1 rtsp:\/\/10.48.2.56/WMTest/192k_WMV9_VBR_CIF_WMA9_60fps.wmv +ALImpl al_SetDataLocator 1 rtspu:\/\/10.48.2.56/WMTest/192k_WMV9_VBR_CIF_WMA9_60fps.wmv ALImpl al_SetDataFormat 1 audio/3gp 17 ALImpl al_SetDataSource 1 1 1 ALImpl al_SetDataSink 3 6 1 @@ -99,7 +99,7 @@ ALImpl al_createEngine 1 1 0 0 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE -ALImpl al_SetDataLocator 1 mms:\/\/10.48.2.56/WMTest/128k_WMV9_VBR_QCIF_WMA9_30fps.wmv +ALImpl al_SetDataLocator 1 mms:\/\/10.48.2.56:443/WMTest/128k_WMV9_VBR_QCIF_WMA9_30fps.wmv ALImpl al_SetDataFormat 1 audio/3gp 17 ALImpl al_SetDataSource 1 1 1 ALImpl al_SetDataSink 3 6 1 diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/group/bld.inf --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/group/bld.inf Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/group/bld.inf Fri Jun 11 19:59:23 2010 -0500 @@ -44,6 +44,7 @@ ../conf/openmaxaltestmodule_mo_mdextractionitf.cfg /epoc32/winscw/c/testframework/openmaxaltestmodule_mo_mdextractionitf.cfg ../conf/openmaxaltestmodule_mp_mdextractionitf.cfg /epoc32/winscw/c/testframework/openmaxaltestmodule_mp_mdextractionitf.cfg ../conf/openmaxaltestmodule_radioitf.cfg /epoc32/winscw/c/testframework/openmaxaltestmodule_radioitf.cfg +../conf/openmaxaltestmodule_mp_streaming.cfg /epoc32/winscw/c/testframework/openmaxaltestmodule_mp_streaming.cfg ../data/c/omxaltestdata/test.wav /epoc32/winscw/c/testing/data/omxaltestdata/test.wav ../data/c/omxaltestdata/test.mp3 /epoc32/winscw/c/testing/data/omxaltestdata/test.mp3 ../data/c/omxaltestdata/test.3gp /epoc32/winscw/c/testing/data/omxaltestdata/test.3gp diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxalstrminfoitftests.cpp --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxalstrminfoitftests.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxalstrminfoitftests.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -100,7 +100,6 @@ { TInt status(KErrNone); XAresult res; - TInt async(0); TInt index(0); XAuint32 streamType; @@ -222,7 +221,6 @@ { TInt status(KErrNone); XAresult res; - TInt streamindex(0); XAuint32 size(0); TInt inpsize; XAboolean arr[2]; diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaltestmoduleblocks.cpp --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaltestmoduleblocks.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaltestmoduleblocks.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -937,6 +937,7 @@ /* XA_IID_OUTPUTMIX;*/ break; case 27: + m_RadioItf = XARadioItf(id); /* XA_IID_RADIO;*/ break; case 28: diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/radio/openmaxalradioitftests.cpp --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/radio/openmaxalradioitftests.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/radio/openmaxalradioitftests.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -415,29 +415,35 @@ XAuint32 event ) { - XAuint32 freq; - XAmillibel volume; - + switch (event) { case XA_RADIO_EVENT_ANTENNA_STATUS_CHANGED: + { TEventIf antennaStatusEvent( TEventIf::ESetEvent, _L("Event_XA_RADIO_EVENT_ANTENNA_STATUS_CHANGED:") ); TestModuleIf().Event( antennaStatusEvent ); + } break; case XA_RADIO_EVENT_FREQUENCY_CHANGED: + { TEventIf freqChangedEvent( TEventIf::ESetEvent, _L("Event_XA_RADIO_EVENT_FREQUENCY_CHANGED") ); TestModuleIf().Event( freqChangedEvent ); + } break; case XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED: + { TEventIf freqRangeChangedEvent( TEventIf::ESetEvent,_L("Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED")); TestModuleIf().Event( freqRangeChangedEvent ); + } break; case XA_RADIO_EVENT_SEEK_COMPLETED: + { TEventIf seekEvent( TEventIf::ESetEvent, _L("Event_XA_RADIO_EVENT_SEEK_COMPLETED") ); TestModuleIf().Event( seekEvent ); + } break; default: diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/telephony_multimedia_service_api/inc/tms.h --- a/mmmw_plat/telephony_multimedia_service_api/inc/tms.h Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/telephony_multimedia_service_api/inc/tms.h Fri Jun 11 19:59:23 2010 -0500 @@ -24,6 +24,7 @@ namespace TMS { +// FORWARD DECLARATION class TMSFormat; // Result codes @@ -69,21 +70,22 @@ // Event codes #define TMS_EVENT_STREAM_STATE_CHANGED ((gint)0x00000000) -#define TMS_EVENT_SOURCE_FILL_BUFFER ((gint)0x00000001) -#define TMS_EVENT_SOURCE_PROCESSED_BUFFER ((gint)0x00000002) -#define TMS_EVENT_SINK_PROCESS_BUFFER ((gint)0x00000003) -#define TMS_EVENT_EFFECT_VOL_CHANGED ((gint)0x00000004) -#define TMS_EVENT_EFFECT_GAIN_CHANGED ((gint)0x00000005) -#define TMS_EVENT_ROUTING_AVAIL_OUTPUTS_CHANGED ((gint)0x00000006) -#define TMS_EVENT_ROUTING_OUTPUT_CHANGED ((gint)0x00000007) -#define TMS_EVENT_ROUTING_SET_OUTPUT_COMPLETE ((gint)0x00000008) -#define TMS_EVENT_RINGTONE_OPEN_COMPLETE ((gint)0x00000009) -#define TMS_EVENT_RINGTONE_PLAY_COMPLETE ((gint)0x0000000A) -#define TMS_EVENT_RINGTONE_DEINIT_COMPLETE ((gint)0x0000000B) -#define TMS_EVENT_DTMF_TONE_STARTED ((gint)0x0000000C) -#define TMS_EVENT_DTMF_TONE_STOPPED ((gint)0x0000000D) -#define TMS_EVENT_INBAND_TONE_STARTED ((gint)0x0000000E) -#define TMS_EVENT_INBAND_TONE_STOPPED ((gint)0x0000000F) +#define TMS_EVENT_STREAM_STATE_CHANGE_ERROR ((gint)0x00000001) +#define TMS_EVENT_SOURCE_FILL_BUFFER ((gint)0x00000002) +#define TMS_EVENT_SOURCE_PROCESSED_BUFFER ((gint)0x00000003) +#define TMS_EVENT_SINK_PROCESS_BUFFER ((gint)0x00000004) +#define TMS_EVENT_EFFECT_VOL_CHANGED ((gint)0x00000005) +#define TMS_EVENT_EFFECT_GAIN_CHANGED ((gint)0x00000006) +#define TMS_EVENT_ROUTING_AVAIL_OUTPUTS_CHANGED ((gint)0x00000007) +#define TMS_EVENT_ROUTING_OUTPUT_CHANGED ((gint)0x00000008) +#define TMS_EVENT_ROUTING_SET_OUTPUT_COMPLETE ((gint)0x00000009) +#define TMS_EVENT_RINGTONE_OPEN_COMPLETE ((gint)0x0000000A) +#define TMS_EVENT_RINGTONE_PLAY_COMPLETE ((gint)0x0000000B) +#define TMS_EVENT_RINGTONE_DEINIT_COMPLETE ((gint)0x0000000C) +#define TMS_EVENT_DTMF_TONE_STARTED ((gint)0x0000000D) +#define TMS_EVENT_DTMF_TONE_STOPPED ((gint)0x0000000E) +#define TMS_EVENT_INBAND_TONE_STARTED ((gint)0x0000000F) +#define TMS_EVENT_INBAND_TONE_STOPPED ((gint)0x00000010) // Stream states typedef gint TMSStreamState; diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/telephony_multimedia_service_api/inc/tmsringtone.h --- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsringtone.h Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsringtone.h Fri Jun 11 19:59:23 2010 -0500 @@ -137,7 +137,7 @@ IMPORT_C gint Stop(); /** - * Pause ring tone playback. + * Pause video ring tone playback. * * @return * TMS_RESULT_SUCCESS if the operation was successful otherwise diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmmw_plat/telephony_multimedia_service_api/inc/tmsstream.h --- a/mmmw_plat/telephony_multimedia_service_api/inc/tmsstream.h Fri May 28 19:26:28 2010 -0500 +++ b/mmmw_plat/telephony_multimedia_service_api/inc/tmsstream.h Fri Jun 11 19:59:23 2010 -0500 @@ -429,17 +429,27 @@ * IP call: UPL: mic source, codec format and client sink * IP call: DNL: client source, codec format and speaker sink * + * @param retrytime + * Indicates (in seconds) for how long TMS should retry stream + * initialization in case of an error. When stream initialization + * fails within specified retry time, TMS will return + * TMS_EVENT_STREAM_STATE_CHANGE_ERROR. If set to 0, TMS will return + * TMS_EVENT_STREAM_STATE_CHANGE_ERROR immediately without retrying. + * If set to -1, TMS will keep retrying until user cancels by calling + * either Stop() or Deinit(). + * * @return + * Common return codes: * TMS_RESULT_SUCCESS if stream transitioned to the initialized state. * TMS_RESULT_INVALID_STATE if stream has not transitioned to the - * TMS_STREAM_UNINITIALIZED state. + * TMS_STREAM_INITIALIZED state. * TMS_RESULT_FORMAT_TYPE_UNSPECIFIED (IP call only) when stream * has no format attached to it. * TMS_RESULT_UNINITIALIZED_OBJECT when stream has no sink or source * element attached to it. * */ - IMPORT_C gint Init(); + IMPORT_C gint Init(gint retrytime = 0); /** * Trigger stream to transition to the paused state. @@ -456,10 +466,11 @@ * Note: In TMS Ver 1.0.0.0, pausing stream for CS call is not supported. * * @return - * TMS_RESULT_SUCCESS if stream successfully transitioned to the paused - * state. + * Common return codes: + * TMS_RESULT_SUCCESS if stream successfully transitioned to the + * paused state. * TMS_RESULT_INVALID_STATE if stream is not in the - * TMS_STREAM_INITIALIZED or TMS_STREAM_STARTED state. + * TMS_STREAM_INITIALIZED or TMS_STREAM_PAUSED state. * */ IMPORT_C gint Pause(); @@ -480,14 +491,24 @@ * Upon stream's successful transition to the started state, the stream will * be in the TMS_STREAM_STARTED state. * + * @param retrytime + * Indicates (in seconds) for how long TMS should attempt to start + * a stream in case of an error. When stream starting fails within + * specified retry time, TMS will return + * TMS_EVENT_STREAM_STATE_CHANGE_ERROR. If set to 0, TMS will return + * TMS_EVENT_STREAM_STATE_CHANGE_ERROR immediately without retrying. + * If set to -1, TMS will keep retrying until user cancels by calling + * either Stop() or Deinit(). + * * @return - * TMS_RESULT_SUCCESS if stream successfully transitioned to the paused - * state. + * Common return codes: + * TMS_RESULT_SUCCESS if stream successfully transitioned to the + * started state. * TMS_RESULT_INVALID_STATE if stream is not in the - * TMS_STREAM_INITIALIZED or TMS_STREAM_PAUSED state. + * TMS_STREAM_INITIALIZED or TMS_STREAM_STARTED state. * */ - IMPORT_C gint Start(); + IMPORT_C gint Start(gint retrytime = 0); /** * Trigger stream to transition to the initialized state. @@ -502,8 +523,9 @@ * be in the TMS_STREAM_INITIALIZED state. * * @return - * TMS_RESULT_SUCCESS if stream successfully transitioned to the paused - * state. + * Common return codes: + * TMS_RESULT_SUCCESS if stream successfully transitioned to the + * stopped state. * TMS_RESULT_INVALID_STATE if stream is not in the * TMS_STREAM_STARTED or TMS_STREAM_PAUSED state. * diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/radioutility/presetutility/tsrc/group/RestoreOrigCenrep.cmd --- a/mmserv/radioutility/presetutility/tsrc/group/RestoreOrigCenrep.cmd Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/radioutility/presetutility/tsrc/group/RestoreOrigCenrep.cmd Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - +@REM +@REM Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +@REM All rights reserved. +@REM This component and the accompanying materials are made available +@REM under the terms of "Eclipse Public License v1.0" +@REM which accompanies this distribution, and is available +@REM at the URL "http://www.eclipse.org/legal/epl-v10.html". +@REM +@REM Initial Contributors: +@REM Nokia Corporation - initial contribution. +@REM +@REM Contributors: +@REM +@REM Description: Wins Command file for Preset Utility +@REM +@REM @echo Original environment restoration by presetutilitytestmodule... del \epoc32\winscw\c\TestFramework\PresetUtilityTestModule.cfg del \epoc32\wins\c\TestFramework\TestFramework.ini diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/radioutility/presetutility/tsrc/group/TestEnvInit.cmd --- a/mmserv/radioutility/presetutility/tsrc/group/TestEnvInit.cmd Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/radioutility/presetutility/tsrc/group/TestEnvInit.cmd Fri Jun 11 19:59:23 2010 -0500 @@ -1,19 +1,19 @@ -@rem -@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -@rem All rights reserved. -@rem This component and the accompanying materials are made available -@rem under the terms of "Eclipse Public License v1.0" -@rem which accompanies this distribution, and is available -@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -@rem -@rem Initial Contributors: -@rem Nokia Corporation - initial contribution. -@rem -@rem Contributors: -@rem -@rem Description: -@rem - +@REM +@REM Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +@REM All rights reserved. +@REM This component and the accompanying materials are made available +@REM under the terms of "Eclipse Public License v1.0" +@REM which accompanies this distribution, and is available +@REM at the URL "http://www.eclipse.org/legal/epl-v10.html". +@REM +@REM Initial Contributors: +@REM Nokia Corporation - initial contribution. +@REM +@REM Contributors: +@REM +@REM Description: Wins Command file for Preset Utility +@REM +@REM @echo Initializing test environment for presetutilitytestmodule... copy ..\conf\PresetUtilityTestModule.cfg \epoc32\winscw\c\TestFramework\PresetUtilityTestModule.cfg copy ..\init\PresetUtilityTestModule.ini \epoc32\wins\c\TestFramework\TestFramework.ini diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/radioutility/radio_utility/inc/traceconfiguration.hrh --- a/mmserv/radioutility/radio_utility/inc/traceconfiguration.hrh Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/radioutility/radio_utility/inc/traceconfiguration.hrh Fri Jun 11 19:59:23 2010 -0500 @@ -1,13 +1,13 @@ /* -* Copyright (C) 2009 Nokia Corporation And/Or Its Subsidiary(-Ies). -* All Rights Reserved. -* This Component And The Accompanying Materials Are Made Available -* Under The Terms Of The License "Symbian Foundation License V1.0" -* Which Accompanies This Distribution, And Is Available -* At The Url "Http://Www.Symbianfoundation.Org/Legal/Sfl-V10.Html". +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: -* Nokia Corporation - Initial Contribution. +* Nokia Corporation - initial contribution. * * Contributors: * diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/radioutility/radioserver/Session/Src/traceconfiguration.hrh --- a/mmserv/radioutility/radioserver/Session/Src/traceconfiguration.hrh Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/radioutility/radioserver/Session/Src/traceconfiguration.hrh Fri Jun 11 19:59:23 2010 -0500 @@ -1,13 +1,13 @@ /* -* Copyright (C) 2009 Nokia Corporation And/Or Its Subsidiary(-Ies). -* All Rights Reserved. -* This Component And The Accompanying Materials Are Made Available -* Under The Terms Of The License "Symbian Foundation License V1.0" -* Which Accompanies This Distribution, And Is Available -* At The Url "Http://Www.Symbianfoundation.Org/Legal/Sfl-V10.Html". +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: -* Nokia Corporation - Initial Contribution. +* Nokia Corporation - initial contribution. * * Contributors: * diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/thumbnailengine/TneAPIInc/HXTneserver.h --- a/mmserv/thumbnailengine/TneAPIInc/HXTneserver.h Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/thumbnailengine/TneAPIInc/HXTneserver.h Fri Jun 11 19:59:23 2010 -0500 @@ -55,7 +55,7 @@ /////////////////Session class/////////////////////////// -class CTneSession : public CSession2, public MHXThumbnailUtilityImplObserver +class CTneSession : public CSession2,public CActive, public MHXThumbnailUtilityImplObserver { public: @@ -72,15 +72,20 @@ void PacketReady(TInt aError, void *pData, TUint32 aDataSize); void EndOfPackets(); + // CActive methods + virtual void RunL(); + virtual void DoCancel(); + protected: - void CompleteRequest(TInt aError); // Completes the Rmessage corresponding to Getthumb + void CompleteRequest(const RMessage2& aMessage, TInt aError); // Completes the RMessage corresponding to Getthumb void FetchBasicMetaData(); // Extract metadata from Util void DoGetThumb(); // Calls Notification of Thumbpending to client on Clients request to Get thumb TBool IsGoodFrame(TUint8* aYUVDataPtr); // checks on the value of each frame wrt width and height void StopServer(); void NotifyIfGetThumbPending(TInt aError, TUint8 *&pYUVBuffer); // Notifies client of thumb pending + void NotifyIfGetMetaDataPending(TInt aError); // Notifies client of metadata pending TInt ReOpenFile(RFile &aFileHandle); // Called in case the clip is required to be open not from 0 index but from middle of clip TInt DoOpenFile(RFile &aFileHandle, TUint uStartTime); TInt GetStartingTime(TUint &uStartingTime); @@ -116,21 +121,25 @@ // Concatenated YUV data for decoded frame TUint8* iYUVBuffer; TUint8** iClientYUVBufferPtrPtr; - TBool m_bOpenFileLPending; + TBool iReOpenFileLPending; TBool iGetThumbPending; TBool iCloseHandle; TBool ibOpenFilePending; TInt iThumbIndex; - RMessage2 iClientRequest; - RMessage2 iCancelRequest; + RMessage2 iClientRequest; // This message will handle Open related request. + RMessage2 iCancelRequest; // This message will handle Cancel request + RMessage2 iMetaDataRequest; // This message will handle MetaData Request + RMessage2 iThumbnailRequest;// This message will handle thumbnail message + // helix thumbnail utility CHXThumbnailUtility* iUtil; EThumbnailUtilState m_State; RFile iFileHandle; TBool m_bMetaDataReady; + TUint iPosition; }; diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/thumbnailengine/TneAPISrc/HXTneserver.cpp --- a/mmserv/thumbnailengine/TneAPISrc/HXTneserver.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/thumbnailengine/TneAPISrc/HXTneserver.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -94,7 +94,7 @@ { cleanup =CTrapCleanup::New(); pA = new CActiveScheduler; - pS = new CTneServer(EPriorityStandard); + pS = new CTneServer(EPriorityHigh); } @@ -162,7 +162,7 @@ ////////////////////////ServerSession////////////////////////////// -CTneSession::CTneSession(): +CTneSession::CTneSession():CActive(EPriorityStandard), iWidth(0), iHeight(0) , iDuration(0) , @@ -173,24 +173,29 @@ iFs(NULL), iYUVBuffer(NULL), iClientYUVBufferPtrPtr(NULL), - m_bOpenFileLPending(EFalse), + iReOpenFileLPending(EFalse), iGetThumbPending(EFalse), iCloseHandle(EFalse), ibOpenFilePending(EFalse), iThumbIndex(0), iUtil(NULL), m_State( ENotReady), - m_bMetaDataReady(EFalse) - { - FLOG(_L("CTneSession::CTneSession()in this=%x"), this); - FLOG(_L("CTneSession::CTneSession()out this=%x"), this); - } + m_bMetaDataReady(EFalse), + iPosition(0) +{ + CActiveScheduler::Add(this); + FLOG(_L("CTneSession::CTneSession()in this=%x"), this); + FLOG(_L("CTneSession::CTneSession()out this=%x"), this); +} CTneSession::~CTneSession() { - FLOG(_L("CTneSession::~CTneSession()in this=%x"), this); + FLOG(_L("CTneSession::~CTneSession()in this=%x"), this); + + Cancel(); + if(iYUVBuffer) { User::Free(iYUVBuffer); @@ -212,7 +217,9 @@ delete iFs; iFs = NULL; } - CompleteRequest(KErrCancel); + CompleteRequest(iClientRequest,KErrCancel); + CompleteRequest(iMetaDataRequest,KErrCancel); + CompleteRequest(iThumbnailRequest,KErrCancel); CompleteCancelRequest(); CActiveScheduler::Stop(); @@ -237,7 +244,6 @@ RFile* pFileHandle; TFileName *pFileName; TInt aPosition; - TNEMetaData* pMetaData; TNEThumbRequest *pThumbRequestData; RFile64 aFilehandle; @@ -247,24 +253,23 @@ { case EOpenFileRFmsg: m_State = EStartGettingMetadata; - bCompleteRequest = ETrue; + bCompleteRequest = EFalse; + CompleteRequest(iClientRequest,KErrNotReady); // Any previous pending request iClientRequest = aMessage; pFileHandle = ( RFile* ) aMessage.Ptr0(); // Handle to read Message data aPosition = (TInt ) aMessage.Ptr1(); lError = iFileHandle.Duplicate(*pFileHandle); + iPosition = aPosition; + if (lError == KErrNone) { iCloseHandle = ETrue; - lError = DoOpenFile(iFileHandle, aPosition); + iStatus = KRequestPending; + SetActive(); + TRequestStatus* pStatus = &iStatus; + User::RequestComplete(pStatus, KErrNone); } - - if( m_State == EStartGettingThumbNailWithIndex) - { - lError = ReOpenFile(iFileHandle); - } - - CompleteCancelRequest(); // it will check also if cancel needs to be done. break; @@ -272,51 +277,41 @@ case EOpenFIleNamemsg: iFs = NULL; m_State = EStartGettingMetadata; + CompleteRequest(iClientRequest,KErrNotReady); // Any previous pending request iClientRequest = aMessage; pFileName = (TFileName* ) aMessage.Ptr0(); aPosition = (TInt ) aMessage.Ptr1(); - - iFs = new RFs; - if(iFs == NULL) - { - lError = KErrNoMemory; - bCompleteRequest = ETrue; - } - else if ( (lError = iFs->Connect())!= KErrNone) - { - bCompleteRequest = ETrue; - } - else if ((lError = aFilehandle.Open(*iFs,*pFileName, EFileShareReadersOnly | EFileStream | EFileRead))!= KErrNone) - { - bCompleteRequest = ETrue; - } - else if ((lError = iFileHandle.Duplicate(aFilehandle))!= KErrNone) - { - bCompleteRequest = ETrue; - aFilehandle.Close(); + + iFs = new RFs; + if(iFs == NULL) + { + lError = KErrNoMemory; + bCompleteRequest = ETrue; + } + else if ( (lError = iFs->Connect())!= KErrNone) + { + bCompleteRequest = ETrue; + } + else if ((lError = aFilehandle.Open(*iFs,*pFileName, EFileShareReadersOnly | EFileStream | EFileRead))!= KErrNone) + { + bCompleteRequest = ETrue; + } + else if ((lError = iFileHandle.Duplicate(aFilehandle))!= KErrNone) + { + bCompleteRequest = ETrue; + aFilehandle.Close(); + } + else + { + bCompleteRequest = EFalse; + aFilehandle.Close(); + iStatus = KRequestPending; + iCloseHandle = ETrue; + SetActive(); + TRequestStatus* pStatus = &iStatus; + User::RequestComplete(pStatus, KErrNone); + } - } - else if ( (lError = DoOpenFile(iFileHandle, aPosition)) != KErrNone ) - { - bCompleteRequest = ETrue; - aFilehandle.Close(); - iCloseHandle = ETrue; - } - else - { - bCompleteRequest = ETrue; - aFilehandle.Close(); - iCloseHandle = ETrue; - } - - - if( m_State == EStartGettingThumbNailWithIndex) - { - lError = ReOpenFile(iFileHandle); - } - - CompleteCancelRequest(); // it will check also if cancel needs to be done. - if (lError != KErrNone) { bCompleteRequest = ETrue; @@ -324,18 +319,16 @@ break; case EGetMetaDatamsg: - iClientRequest = aMessage; - pMetaData = ( TNEMetaData* ) aMessage.Ptr0(); - pMetaData->iWidth = iWidth; - pMetaData->iHeight = iHeight; - pMetaData->iFrameCount = iFrameCount; - bCompleteRequest = ETrue; - + + CompleteRequest(iMetaDataRequest,KErrNotReady); // Any previous pending request + iMetaDataRequest = aMessage; + NotifyIfGetMetaDataPending(m_LastError); break; case EGetThumbmsg: - iClientRequest = aMessage; + CompleteRequest(iThumbnailRequest,KErrNotReady); // Any previous pending request + iThumbnailRequest = aMessage; pThumbRequestData = ( TNEThumbRequest * ) aMessage.Ptr0(); // store thumb request parameters iClientYUVBufferPtrPtr = &(pThumbRequestData->iYUVBuffer); @@ -350,11 +343,26 @@ m_State = EStartGettingThumbNailWithIndex; if (!ibOpenFilePending) { - lError = ReOpenFile(iFileHandle); - } + lError = ReOpenFile(iFileHandle); + if(lError) + { + m_LastError = lError; + CompleteRequest(iThumbnailRequest,m_LastError); + } + } + else + { // Previous thumbnail generation is in progress so cancel it + if(iUtil) + { + iUtil->CancelThumb(); + } + // Once control returns and if m_State is EStartGettingThumbNailWithIndex call ReOpenFile + iReOpenFileLPending = ETrue; + } } break; case ECancelThumbmsg: + FLOG(_L("CTneSession::DispatchMessageL cancellation ++")); iGetThumbPending = EFalse; iCancelRequest = aMessage; m_State = ECancelling; @@ -364,12 +372,15 @@ } // cancel any pending getthumb or openfile request. lError = KErrCancel; - CompleteRequest(lError); + CompleteRequest(iClientRequest,lError); + CompleteRequest(iThumbnailRequest,lError); if (!ibOpenFilePending) { CompleteCancelRequest(); } + FLOG(_L("CTneSession::DispatchMessageL cancellation --")); + break; default: @@ -377,12 +388,12 @@ return; } - - if (bCompleteRequest) - { - CompleteRequest(lError); - } - + + // If any error occured during file opening + if (bCompleteRequest) + { + CompleteRequest(iClientRequest,lError); + } FLOG(_L("CTneSession::DispatchMessageL out type=%d"), aMessage.Function()); } @@ -425,10 +436,18 @@ delete iUtil; iUtil = NULL; } - - lError = DoOpenFile(aFileHandle, uStartingTime); - } - + + iPosition = uStartingTime; + + if(!IsActive()) + { + iStatus = KRequestPending; + SetActive(); + TRequestStatus* pStatus = &iStatus; + User::RequestComplete(pStatus, KErrNone); + } + } + return lError; } @@ -561,13 +580,14 @@ // it will be completed after the DoOpenFile() returns. if (aError != KErrNone) { - CompleteRequest(aError); + CompleteRequest(iClientRequest,aError); } } FLOG(_L("CTneSession::MetaDataReady out aError=%d"), aError); - m_bMetaDataReady = ETrue; - + m_bMetaDataReady = ETrue; + + NotifyIfGetMetaDataPending(m_LastError); } @@ -583,6 +603,12 @@ if (m_State == ECancelling) { FLOG(_L("CTneSession::PacketReady no op")); + // Calling cancel thumbnail + if(iUtil) + { + iUtil->CancelThumb(); + } + return; } if(aDataSize < (iWidth*iHeight*3/2 )) // check to avoid getting very low size @@ -838,11 +864,11 @@ -void CTneSession::CompleteRequest(TInt aError) +void CTneSession::CompleteRequest(const RMessage2& aMessage, TInt aError) { - if(!iClientRequest.IsNull()) + if(!aMessage.IsNull()) { - iClientRequest.Complete(aError); + aMessage.Complete(aError); } } @@ -852,18 +878,33 @@ // ownership of pBitMap will be passed to Observer void CTneSession::NotifyIfGetThumbPending(TInt aError, TUint8 *&pYUVBuffer) { - if (iGetThumbPending && !iClientRequest.IsNull()) + if (iGetThumbPending && !iThumbnailRequest.IsNull()) { iGetThumbPending = EFalse; *iClientYUVBufferPtrPtr = pYUVBuffer; - iClientRequest.Complete(aError); + iThumbnailRequest.Complete(aError); } } +void CTneSession::NotifyIfGetMetaDataPending(TInt aError) +{ + if (m_bMetaDataReady && !iMetaDataRequest.IsNull()) + { + TNEMetaData* pMetaData; + pMetaData = ( TNEMetaData* ) iMetaDataRequest.Ptr0(); + pMetaData->iWidth = iWidth; + pMetaData->iHeight = iHeight; + pMetaData->iFrameCount = iFrameCount; + iMetaDataRequest.Complete(aError); + } + +} + void CTneSession::CompleteCancelRequest() { - + FLOG(_L("CTneSession::CompleteCancelRequest ++")); + if (!iCancelRequest.IsNull()) { @@ -871,7 +912,63 @@ { delete iUtil; iUtil = NULL; - } - iCancelRequest.Complete(KErrNone); - } + } + iCancelRequest.Complete(KErrNone); + FLOG(_L("CTneSession::CompleteCancelRequest message sent ")); + } + FLOG(_L("CTneSession::CompleteCancelRequest --")); + } +// Open the file +void CTneSession::RunL() +{ + TInt lError = KErrNone; + m_bDone = EFalse; + m_uPacketsReceived = 0; + FLOG(_L("CTneSession::RunL ++")); + + lError = DoOpenFile(iFileHandle, iPosition); + + if(lError) + { + if(iUtil) + { + iUtil->CancelThumb(); + delete iUtil; + iUtil = NULL; + } + } + + CompleteRequest(iClientRequest,lError); // Complete client request + ibOpenFilePending = EFalse; + // If any cancel call is pending + CompleteCancelRequest(); + + // This mean App has requested thumbnail based on index when last file opening was still in progress + if(iReOpenFileLPending) + { + lError = ReOpenFile(iFileHandle); + // If some error sent notification to client + if(lError) + { + m_LastError = lError; + CompleteRequest(iThumbnailRequest,m_LastError); + } + iReOpenFileLPending = EFalse; + } + FLOG(_L("CTneSession::RunL -- ")); +} + +// Cancel file open and pending thumbnail +void CTneSession::DoCancel() +{ + CompleteRequest(iClientRequest,KErrCancel); // Complete any request + CompleteRequest(iMetaDataRequest,KErrCancel); // Complete any request + CompleteRequest(iThumbnailRequest,KErrCancel); // Complete any request + ibOpenFilePending = EFalse; + iReOpenFileLPending = EFalse; + iGetThumbPending = EFalse; + // If any cancel call is pending + CompleteCancelRequest(); + +} diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/inc/tmsclientsinkimpl.h --- a/mmserv/tms/inc/tmsclientsinkimpl.h Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/inc/tmsclientsinkimpl.h Fri Jun 11 19:59:23 2010 -0500 @@ -24,7 +24,7 @@ namespace TMS { // FORWARD DECLARATIONS -class TMSCallProxy; +class TMSGlobalContext; // TMSClientSinkImpl class class TMSClientSinkImpl : public TMSClientSink @@ -32,7 +32,7 @@ public: virtual ~TMSClientSinkImpl(); static gint Create(TMSSink*& tmssink); - gint SetProxy(TMSCallProxy* aProxy, gpointer queuehandler); + gint SetProxy(TMSGlobalContext* context, gpointer queuehandler); private: TMSClientSinkImpl(); diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/inc/tmsclientsourceimpl.h --- a/mmserv/tms/inc/tmsclientsourceimpl.h Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/inc/tmsclientsourceimpl.h Fri Jun 11 19:59:23 2010 -0500 @@ -24,6 +24,7 @@ namespace TMS { // FORWARD DECLARATIONS +class TMSGlobalContext; class TMSCallProxy; // TMSClientSourceImpl class @@ -32,7 +33,7 @@ public: virtual ~TMSClientSourceImpl(); static gint Create(TMSSource*& tmssource); - gint SetProxy(TMSCallProxy* aProxy, gint strmid, gpointer queuehandler); + gint SetProxy(TMSGlobalContext* context, gpointer queuehandler); private: TMSClientSourceImpl(); diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/inc/tmsqueuehandler.h --- a/mmserv/tms/inc/tmsqueuehandler.h Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/inc/tmsqueuehandler.h Fri Jun 11 19:59:23 2010 -0500 @@ -27,7 +27,7 @@ namespace TMS { // FORWARD DECLARATIONS -class TMSBuffer; //TMSDataBuffer +class TMSBuffer; class TMSGlobalContext; /** @@ -73,24 +73,28 @@ */ TRequestStatus* Status(); + /* + * Add and remove observer to buffer events + */ gint AddObserver(MQueueHandlerObserver& obsvr, gint aClientId); gint RemoveObserver(MQueueHandlerObserver& obsvr); private: /** - * constructor + * Constructors */ TMSQueueHandler(RMsgQueue* aMsgQueue, TMSGlobalContext* glblCtx); void ConstructL(); - // from CActive + // From CActive void DoCancel(); void RunL(); TInt RunError(TInt aError); + // For buffer processing upon handler events void DoFillBuffer(gint aBufLen, gint aStatus, gboolean flag, guint32 key); void DoEmptyBuffer(gint aBufLen, gint aStatus, gboolean flag, guint32 key); gint FindStreamInList(); @@ -99,7 +103,6 @@ TMSStreamState ConvertToStreamState(gint request); private: - // data RPointerArray iObserversList; // (not owned) MQueueHandlerObserver* iObserver; //not owned @@ -109,7 +112,7 @@ RChunk iChunk; TPtr8 iChunkDataPtr; TMSBuffer* iBuffer; - TMSGlobalContext *iTMSGlobalContext; + TMSGlobalContext* iTMSGlobalContext; }; } //namespace TMS diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/inc/tmsutility.h --- a/mmserv/tms/inc/tmsutility.h Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/inc/tmsutility.h Fri Jun 11 19:59:23 2010 -0500 @@ -15,8 +15,8 @@ * */ -#ifndef __TMSUTILITY_H__ -#define __TMSUTILITY_H__ +#ifndef TMSUTILITY_H +#define TMSUTILITY_H #include #include @@ -40,7 +40,9 @@ #define TRACE_PRN_N(str) RDebug::Print(str) #define TRACE_PRN_N1(str, val1) RDebug::Print(str, val1) #define TRACE_PRN_N2(str, val1, val2) RDebug::Print(str, val1, val2) + #else + #define TRACE_PRN_FN_ENT #define TRACE_PRN_FN_EXT #define TRACE_PRN_IF_ERR(err) @@ -50,11 +52,11 @@ #define TRACE_PRN_N(str) #define TRACE_PRN_N1(str, val1) #define TRACE_PRN_N2(str, val1, val2) + #endif //_DEBUG - // MACRO DEFINITIONS -#define RET_ERR_IF_ERR(err) if ( err != 0) return err; +#define RET_ERR_IF_ERR(err) if (err != 0) return err; #define RET_REASON_IF_ERR(s) if(s!=0) return s #define TMSRESULT(result) TMSUtility::TMSResult(result) @@ -82,5 +84,5 @@ } //namespace TMS -#endif //__TMSUTILITY_H__ +#endif //TMSUTILITY_H diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsapi/bwins/tmsapi.def --- a/mmserv/tms/tmsapi/bwins/tmsapi.def Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsapi/bwins/tmsapi.def Fri Jun 11 19:59:23 2010 -0500 @@ -23,56 +23,56 @@ ?GetType@TMSGainEffect@TMS@@UAEHAAH@Z @ 22 NONAME ; int TMS::TMSGainEffect::GetType(int &) ?GetCNG@TMSILBCFormat@TMS@@QAEHAAH@Z @ 23 NONAME ; int TMS::TMSILBCFormat::GetCNG(int &) ?AddObserver@TMSStream@TMS@@QAEHAAVTMSStreamObserver@2@PAX@Z @ 24 NONAME ; int TMS::TMSStream::AddObserver(class TMS::TMSStreamObserver &, void *) - ??0TMSG729Format@TMS@@IAE@XZ @ 25 NONAME ; TMS::TMSG729Format::TMSG729Format(void) - ?RemoveObserver@TMSVolumeEffect@TMS@@QAEHAAVTMSEffectObserver@2@@Z @ 26 NONAME ; int TMS::TMSVolumeEffect::RemoveObserver(class TMS::TMSEffectObserver &) - ?GetType@TMSGlobalVolEffect@TMS@@UAEHAAH@Z @ 27 NONAME ; int TMS::TMSGlobalVolEffect::GetType(int &) - ??1TMSSpeakerSink@TMS@@UAE@XZ @ 28 NONAME ; TMS::TMSSpeakerSink::~TMSSpeakerSink(void) - ?GetPreviousOutput@TMSGlobalRouting@TMS@@QAEHAAH@Z @ 29 NONAME ; int TMS::TMSGlobalRouting::GetPreviousOutput(int &) - ?GetMaxLevel@TMSVolumeEffect@TMS@@QAEHAAI@Z @ 30 NONAME ; int TMS::TMSVolumeEffect::GetMaxLevel(unsigned int &) - ?SetPlc@TMSG711Format@TMS@@QAEHH@Z @ 31 NONAME ; int TMS::TMSG711Format::SetPlc(int) - ?GetStreamType@TMSStream@TMS@@QAEHXZ @ 32 NONAME ; int TMS::TMSStream::GetStreamType(void) - ?AddSource@TMSStream@TMS@@QAEHPAVTMSSource@2@@Z @ 33 NONAME ; int TMS::TMSStream::AddSource(class TMS::TMSSource *) - ??0TMSAMRFormat@TMS@@IAE@XZ @ 34 NONAME ; TMS::TMSAMRFormat::TMSAMRFormat(void) - ??1TMSDTMF@TMS@@UAE@XZ @ 35 NONAME ; TMS::TMSDTMF::~TMSDTMF(void) - ?AddObserver@TMSRingTone@TMS@@QAEHAAVTMSRingToneObserver@2@PAX@Z @ 36 NONAME ; int TMS::TMSRingTone::AddObserver(class TMS::TMSRingToneObserver &, void *) - ?AddObserver@TMSDTMF@TMS@@QAEHAAVTMSDTMFObserver@2@PAX@Z @ 37 NONAME ; int TMS::TMSDTMF::AddObserver(class TMS::TMSDTMFObserver &, void *) - ??0TMSGlobalVolEffect@TMS@@IAE@XZ @ 38 NONAME ; TMS::TMSGlobalVolEffect::TMSGlobalVolEffect(void) - ??0TMSInbandTone@TMS@@IAE@XZ @ 39 NONAME ; TMS::TMSInbandTone::TMSInbandTone(void) - ?GetType@TMSModemSource@TMS@@UAEHAAH@Z @ 40 NONAME ; int TMS::TMSModemSource::GetType(int &) - ??0TMSVolumeEffect@TMS@@IAE@XZ @ 41 NONAME ; TMS::TMSVolumeEffect::TMSVolumeEffect(void) - ??1TMSG711Format@TMS@@UAE@XZ @ 42 NONAME ; TMS::TMSG711Format::~TMSG711Format(void) - ??1TMSGlobalVolEffect@TMS@@UAE@XZ @ 43 NONAME ; TMS::TMSGlobalVolEffect::~TMSGlobalVolEffect(void) - ?GetType@TMSClientSink@TMS@@UAEHAAH@Z @ 44 NONAME ; int TMS::TMSClientSink::GetType(int &) - ?AddObserver@TMSVolumeEffect@TMS@@QAEHAAVTMSEffectObserver@2@PAX@Z @ 45 NONAME ; int TMS::TMSVolumeEffect::AddObserver(class TMS::TMSEffectObserver &, void *) - ?SetMode@TMSG711Format@TMS@@QAEHH@Z @ 46 NONAME ; int TMS::TMSG711Format::SetMode(int) - ?Play@TMSRingTone@TMS@@QAEHXZ @ 47 NONAME ; int TMS::TMSRingTone::Play(void) - ?RemoveObserver@TMSClientSink@TMS@@QAEHAAVTMSClientSinkObserver@2@@Z @ 48 NONAME ; int TMS::TMSClientSink::RemoveObserver(class TMS::TMSClientSinkObserver &) - ?GetVADMode@TMSG711Format@TMS@@QAEHAAH@Z @ 49 NONAME ; int TMS::TMSG711Format::GetVADMode(int &) - ??1TMSGlobalRouting@TMS@@UAE@XZ @ 50 NONAME ; TMS::TMSGlobalRouting::~TMSGlobalRouting(void) - ??1TMSCall@TMS@@UAE@XZ @ 51 NONAME ; TMS::TMSCall::~TMSCall(void) - ??1TMSILBCFormat@TMS@@UAE@XZ @ 52 NONAME ; TMS::TMSILBCFormat::~TMSILBCFormat(void) - ??0TMSGainEffect@TMS@@IAE@XZ @ 53 NONAME ; TMS::TMSGainEffect::TMSGainEffect(void) - ?GetMaxLevel@TMSGlobalVolEffect@TMS@@QAEHAAI@Z @ 54 NONAME ; int TMS::TMSGlobalVolEffect::GetMaxLevel(unsigned int &) - ??1TMSFormat@TMS@@UAE@XZ @ 55 NONAME ; TMS::TMSFormat::~TMSFormat(void) - ??1TMSModemSource@TMS@@UAE@XZ @ 56 NONAME ; TMS::TMSModemSource::~TMSModemSource(void) - ?GetBitRate@TMSFormat@TMS@@QAEHAAI@Z @ 57 NONAME ; int TMS::TMSFormat::GetBitRate(unsigned int &) - ?GetLevel@TMSGlobalGainEffect@TMS@@QAEHAAI@Z @ 58 NONAME ; int TMS::TMSGlobalGainEffect::GetLevel(unsigned int &) - ?AddObserver@TMSGlobalGainEffect@TMS@@QAEHAAVTMSEffectObserver@2@PAX@Z @ 59 NONAME ; int TMS::TMSGlobalGainEffect::AddObserver(class TMS::TMSEffectObserver &, void *) - ?RemoveObserver@TMSDTMF@TMS@@QAEHAAVTMSDTMFObserver@2@@Z @ 60 NONAME ; int TMS::TMSDTMF::RemoveObserver(class TMS::TMSDTMFObserver &) - ??1TMSVolumeEffect@TMS@@UAE@XZ @ 61 NONAME ; TMS::TMSVolumeEffect::~TMSVolumeEffect(void) - ?Start@TMSDTMF@TMS@@QAEHXZ @ 62 NONAME ; int TMS::TMSDTMF::Start(void) - ??0TMSStream@TMS@@IAE@XZ @ 63 NONAME ; TMS::TMSStream::TMSStream(void) - ?GetVADMode@TMSILBCFormat@TMS@@QAEHAAH@Z @ 64 NONAME ; int TMS::TMSILBCFormat::GetVADMode(int &) - ?GetCallContextId@TMSCall@TMS@@QAEHAAI@Z @ 65 NONAME ; int TMS::TMSCall::GetCallContextId(unsigned int &) - ?RemoveObserver@TMSClientSource@TMS@@QAEHAAVTMSClientSourceObserver@2@@Z @ 66 NONAME ; int TMS::TMSClientSource::RemoveObserver(class TMS::TMSClientSourceObserver &) - ??0TMSSpeakerSink@TMS@@IAE@XZ @ 67 NONAME ; TMS::TMSSpeakerSink::TMSSpeakerSink(void) - ?ProcessBuffer@TMSClientSource@TMS@@QAEHPAVTMSBuffer@2@@Z @ 68 NONAME ; int TMS::TMSClientSource::ProcessBuffer(class TMS::TMSBuffer *) - ?Stop@TMSDTMF@TMS@@QAEHXZ @ 69 NONAME ; int TMS::TMSDTMF::Stop(void) - ??1TMSRingTone@TMS@@UAE@XZ @ 70 NONAME ; TMS::TMSRingTone::~TMSRingTone(void) - ?SetMode@TMSILBCFormat@TMS@@QAEHH@Z @ 71 NONAME ; int TMS::TMSILBCFormat::SetMode(int) - ?GetEnqueueMode@TMSClientSource@TMS@@QAEHAAH@Z @ 72 NONAME ; int TMS::TMSClientSource::GetEnqueueMode(int &) - ??1TMSModemSink@TMS@@UAE@XZ @ 73 NONAME ; TMS::TMSModemSink::~TMSModemSink(void) - ?Init@TMSStream@TMS@@QAEHXZ @ 74 NONAME ; int TMS::TMSStream::Init(void) + ?Init@TMSStream@TMS@@QAEHH@Z @ 25 NONAME ; int TMS::TMSStream::Init(int) + ??0TMSG729Format@TMS@@IAE@XZ @ 26 NONAME ; TMS::TMSG729Format::TMSG729Format(void) + ?RemoveObserver@TMSVolumeEffect@TMS@@QAEHAAVTMSEffectObserver@2@@Z @ 27 NONAME ; int TMS::TMSVolumeEffect::RemoveObserver(class TMS::TMSEffectObserver &) + ?GetType@TMSGlobalVolEffect@TMS@@UAEHAAH@Z @ 28 NONAME ; int TMS::TMSGlobalVolEffect::GetType(int &) + ??1TMSSpeakerSink@TMS@@UAE@XZ @ 29 NONAME ; TMS::TMSSpeakerSink::~TMSSpeakerSink(void) + ?GetPreviousOutput@TMSGlobalRouting@TMS@@QAEHAAH@Z @ 30 NONAME ; int TMS::TMSGlobalRouting::GetPreviousOutput(int &) + ?GetMaxLevel@TMSVolumeEffect@TMS@@QAEHAAI@Z @ 31 NONAME ; int TMS::TMSVolumeEffect::GetMaxLevel(unsigned int &) + ?SetPlc@TMSG711Format@TMS@@QAEHH@Z @ 32 NONAME ; int TMS::TMSG711Format::SetPlc(int) + ?GetStreamType@TMSStream@TMS@@QAEHXZ @ 33 NONAME ; int TMS::TMSStream::GetStreamType(void) + ?AddSource@TMSStream@TMS@@QAEHPAVTMSSource@2@@Z @ 34 NONAME ; int TMS::TMSStream::AddSource(class TMS::TMSSource *) + ??0TMSAMRFormat@TMS@@IAE@XZ @ 35 NONAME ; TMS::TMSAMRFormat::TMSAMRFormat(void) + ??1TMSDTMF@TMS@@UAE@XZ @ 36 NONAME ; TMS::TMSDTMF::~TMSDTMF(void) + ?AddObserver@TMSRingTone@TMS@@QAEHAAVTMSRingToneObserver@2@PAX@Z @ 37 NONAME ; int TMS::TMSRingTone::AddObserver(class TMS::TMSRingToneObserver &, void *) + ?AddObserver@TMSDTMF@TMS@@QAEHAAVTMSDTMFObserver@2@PAX@Z @ 38 NONAME ; int TMS::TMSDTMF::AddObserver(class TMS::TMSDTMFObserver &, void *) + ??0TMSGlobalVolEffect@TMS@@IAE@XZ @ 39 NONAME ; TMS::TMSGlobalVolEffect::TMSGlobalVolEffect(void) + ??0TMSInbandTone@TMS@@IAE@XZ @ 40 NONAME ; TMS::TMSInbandTone::TMSInbandTone(void) + ?GetType@TMSModemSource@TMS@@UAEHAAH@Z @ 41 NONAME ; int TMS::TMSModemSource::GetType(int &) + ??0TMSVolumeEffect@TMS@@IAE@XZ @ 42 NONAME ; TMS::TMSVolumeEffect::TMSVolumeEffect(void) + ??1TMSG711Format@TMS@@UAE@XZ @ 43 NONAME ; TMS::TMSG711Format::~TMSG711Format(void) + ??1TMSGlobalVolEffect@TMS@@UAE@XZ @ 44 NONAME ; TMS::TMSGlobalVolEffect::~TMSGlobalVolEffect(void) + ?GetType@TMSClientSink@TMS@@UAEHAAH@Z @ 45 NONAME ; int TMS::TMSClientSink::GetType(int &) + ?AddObserver@TMSVolumeEffect@TMS@@QAEHAAVTMSEffectObserver@2@PAX@Z @ 46 NONAME ; int TMS::TMSVolumeEffect::AddObserver(class TMS::TMSEffectObserver &, void *) + ?SetMode@TMSG711Format@TMS@@QAEHH@Z @ 47 NONAME ; int TMS::TMSG711Format::SetMode(int) + ?Play@TMSRingTone@TMS@@QAEHXZ @ 48 NONAME ; int TMS::TMSRingTone::Play(void) + ?RemoveObserver@TMSClientSink@TMS@@QAEHAAVTMSClientSinkObserver@2@@Z @ 49 NONAME ; int TMS::TMSClientSink::RemoveObserver(class TMS::TMSClientSinkObserver &) + ?GetVADMode@TMSG711Format@TMS@@QAEHAAH@Z @ 50 NONAME ; int TMS::TMSG711Format::GetVADMode(int &) + ??1TMSGlobalRouting@TMS@@UAE@XZ @ 51 NONAME ; TMS::TMSGlobalRouting::~TMSGlobalRouting(void) + ??1TMSCall@TMS@@UAE@XZ @ 52 NONAME ; TMS::TMSCall::~TMSCall(void) + ??1TMSILBCFormat@TMS@@UAE@XZ @ 53 NONAME ; TMS::TMSILBCFormat::~TMSILBCFormat(void) + ??0TMSGainEffect@TMS@@IAE@XZ @ 54 NONAME ; TMS::TMSGainEffect::TMSGainEffect(void) + ?GetMaxLevel@TMSGlobalVolEffect@TMS@@QAEHAAI@Z @ 55 NONAME ; int TMS::TMSGlobalVolEffect::GetMaxLevel(unsigned int &) + ??1TMSFormat@TMS@@UAE@XZ @ 56 NONAME ; TMS::TMSFormat::~TMSFormat(void) + ??1TMSModemSource@TMS@@UAE@XZ @ 57 NONAME ; TMS::TMSModemSource::~TMSModemSource(void) + ?GetBitRate@TMSFormat@TMS@@QAEHAAI@Z @ 58 NONAME ; int TMS::TMSFormat::GetBitRate(unsigned int &) + ?GetLevel@TMSGlobalGainEffect@TMS@@QAEHAAI@Z @ 59 NONAME ; int TMS::TMSGlobalGainEffect::GetLevel(unsigned int &) + ?AddObserver@TMSGlobalGainEffect@TMS@@QAEHAAVTMSEffectObserver@2@PAX@Z @ 60 NONAME ; int TMS::TMSGlobalGainEffect::AddObserver(class TMS::TMSEffectObserver &, void *) + ?RemoveObserver@TMSDTMF@TMS@@QAEHAAVTMSDTMFObserver@2@@Z @ 61 NONAME ; int TMS::TMSDTMF::RemoveObserver(class TMS::TMSDTMFObserver &) + ??1TMSVolumeEffect@TMS@@UAE@XZ @ 62 NONAME ; TMS::TMSVolumeEffect::~TMSVolumeEffect(void) + ?Start@TMSDTMF@TMS@@QAEHXZ @ 63 NONAME ; int TMS::TMSDTMF::Start(void) + ??0TMSStream@TMS@@IAE@XZ @ 64 NONAME ; TMS::TMSStream::TMSStream(void) + ?GetVADMode@TMSILBCFormat@TMS@@QAEHAAH@Z @ 65 NONAME ; int TMS::TMSILBCFormat::GetVADMode(int &) + ?GetCallContextId@TMSCall@TMS@@QAEHAAI@Z @ 66 NONAME ; int TMS::TMSCall::GetCallContextId(unsigned int &) + ?RemoveObserver@TMSClientSource@TMS@@QAEHAAVTMSClientSourceObserver@2@@Z @ 67 NONAME ; int TMS::TMSClientSource::RemoveObserver(class TMS::TMSClientSourceObserver &) + ??0TMSSpeakerSink@TMS@@IAE@XZ @ 68 NONAME ; TMS::TMSSpeakerSink::TMSSpeakerSink(void) + ?ProcessBuffer@TMSClientSource@TMS@@QAEHPAVTMSBuffer@2@@Z @ 69 NONAME ; int TMS::TMSClientSource::ProcessBuffer(class TMS::TMSBuffer *) + ?Stop@TMSDTMF@TMS@@QAEHXZ @ 70 NONAME ; int TMS::TMSDTMF::Stop(void) + ??1TMSRingTone@TMS@@UAE@XZ @ 71 NONAME ; TMS::TMSRingTone::~TMSRingTone(void) + ?SetMode@TMSILBCFormat@TMS@@QAEHH@Z @ 72 NONAME ; int TMS::TMSILBCFormat::SetMode(int) + ?GetEnqueueMode@TMSClientSource@TMS@@QAEHAAH@Z @ 73 NONAME ; int TMS::TMSClientSource::GetEnqueueMode(int &) + ??1TMSModemSink@TMS@@UAE@XZ @ 74 NONAME ; TMS::TMSModemSink::~TMSModemSink(void) ?Flush@TMSClientSource@TMS@@QAEHXZ @ 75 NONAME ; int TMS::TMSClientSource::Flush(void) ?GetType@TMSMicSource@TMS@@UAEHAAH@Z @ 76 NONAME ; int TMS::TMSMicSource::GetType(int &) ?GetMaxLevel@TMSGainEffect@TMS@@QAEHAAI@Z @ 77 NONAME ; int TMS::TMSGainEffect::GetMaxLevel(unsigned int &) @@ -81,57 +81,57 @@ ?AddObserver@TMSGlobalVolEffect@TMS@@QAEHAAVTMSEffectObserver@2@PAX@Z @ 80 NONAME ; int TMS::TMSGlobalVolEffect::AddObserver(class TMS::TMSEffectObserver &, void *) ?GetType@TMSSpeakerSink@TMS@@UAEHAAH@Z @ 81 NONAME ; int TMS::TMSSpeakerSink::GetType(int &) ??1TMSStream@TMS@@QAE@XZ @ 82 NONAME ; TMS::TMSStream::~TMSStream(void) - ?Start@TMSStream@TMS@@QAEHXZ @ 83 NONAME ; int TMS::TMSStream::Start(void) - ?AddObserver@TMSClientSource@TMS@@QAEHAAVTMSClientSourceObserver@2@PAX@Z @ 84 NONAME ; int TMS::TMSClientSource::AddObserver(class TMS::TMSClientSourceObserver &, void *) - ?AddObserver@TMSGlobalRouting@TMS@@QAEHAAVTMSGlobalRoutingObserver@2@PAX@Z @ 85 NONAME ; int TMS::TMSGlobalRouting::AddObserver(class TMS::TMSGlobalRoutingObserver &, void *) - ?RemoveObserver@TMSGainEffect@TMS@@QAEHAAVTMSEffectObserver@2@@Z @ 86 NONAME ; int TMS::TMSGainEffect::RemoveObserver(class TMS::TMSEffectObserver &) - ??0TMSModemSource@TMS@@IAE@XZ @ 87 NONAME ; TMS::TMSModemSource::TMSModemSource(void) - ??1TMSAMRFormat@TMS@@UAE@XZ @ 88 NONAME ; TMS::TMSAMRFormat::~TMSAMRFormat(void) - ??0TMSFormat@TMS@@IAE@XZ @ 89 NONAME ; TMS::TMSFormat::TMSFormat(void) - ?SetLevel@TMSVolumeEffect@TMS@@QAEHI@Z @ 90 NONAME ; int TMS::TMSVolumeEffect::SetLevel(unsigned int) - ??1TMSClientSink@TMS@@UAE@XZ @ 91 NONAME ; TMS::TMSClientSink::~TMSClientSink(void) - ??0TMSDTMF@TMS@@IAE@XZ @ 92 NONAME ; TMS::TMSDTMF::TMSDTMF(void) - ?ContinueDTMFStringSending@TMSDTMF@TMS@@QAEHH@Z @ 93 NONAME ; int TMS::TMSDTMF::ContinueDTMFStringSending(int) - ?SetOutput@TMSGlobalRouting@TMS@@QAEHH@Z @ 94 NONAME ; int TMS::TMSGlobalRouting::SetOutput(int) - ?GetType@TMSVolumeEffect@TMS@@UAEHAAH@Z @ 95 NONAME ; int TMS::TMSVolumeEffect::GetType(int &) - ?BufferFilled@TMSClientSource@TMS@@QAEHAAVTMSBuffer@2@@Z @ 96 NONAME ; int TMS::TMSClientSource::BufferFilled(class TMS::TMSBuffer &) - ?RemoveObserver@TMSGlobalRouting@TMS@@QAEHAAVTMSGlobalRoutingObserver@2@@Z @ 97 NONAME ; int TMS::TMSGlobalRouting::RemoveObserver(class TMS::TMSGlobalRoutingObserver &) - ?Pause@TMSStream@TMS@@QAEHXZ @ 98 NONAME ; int TMS::TMSStream::Pause(void) - ?SetBitRate@TMSFormat@TMS@@QAEHI@Z @ 99 NONAME ; int TMS::TMSFormat::SetBitRate(unsigned int) - ?SetLevel@TMSGlobalGainEffect@TMS@@QAEHI@Z @ 100 NONAME ; int TMS::TMSGlobalGainEffect::SetLevel(unsigned int) - ??0TMSGlobalRouting@TMS@@IAE@XZ @ 101 NONAME ; TMS::TMSGlobalRouting::TMSGlobalRouting(void) - ?SetTone@TMSDTMF@TMS@@QAEHPAU_GString@@@Z @ 102 NONAME ; int TMS::TMSDTMF::SetTone(struct _GString *) - ?RemoveObserver@TMSRingTone@TMS@@QAEHAAVTMSRingToneObserver@2@@Z @ 103 NONAME ; int TMS::TMSRingTone::RemoveObserver(class TMS::TMSRingToneObserver &) - ?GetLevel@TMSGainEffect@TMS@@QAEHAAI@Z @ 104 NONAME ; int TMS::TMSGainEffect::GetLevel(unsigned int &) - ??0TMSPCMFormat@TMS@@IAE@XZ @ 105 NONAME ; TMS::TMSPCMFormat::TMSPCMFormat(void) - ??1TMSG729Format@TMS@@UAE@XZ @ 106 NONAME ; TMS::TMSG729Format::~TMSG729Format(void) - ?SetLevel@TMSGainEffect@TMS@@QAEHI@Z @ 107 NONAME ; int TMS::TMSGainEffect::SetLevel(unsigned int) - ?AddObserver@TMSGainEffect@TMS@@QAEHAAVTMSEffectObserver@2@PAX@Z @ 108 NONAME ; int TMS::TMSGainEffect::AddObserver(class TMS::TMSEffectObserver &, void *) - ?SetVADMode@TMSG729Format@TMS@@QAEHH@Z @ 109 NONAME ; int TMS::TMSG729Format::SetVADMode(int) - ??0TMSCall@TMS@@IAE@XZ @ 110 NONAME ; TMS::TMSCall::TMSCall(void) - ?GetVADMode@TMSG729Format@TMS@@QAEHAAH@Z @ 111 NONAME ; int TMS::TMSG729Format::GetVADMode(int &) - ?GetOutput@TMSGlobalRouting@TMS@@QAEHAAH@Z @ 112 NONAME ; int TMS::TMSGlobalRouting::GetOutput(int &) - ?SetVADMode@TMSG711Format@TMS@@QAEHH@Z @ 113 NONAME ; int TMS::TMSG711Format::SetVADMode(int) - ??1TMSInbandTone@TMS@@UAE@XZ @ 114 NONAME ; TMS::TMSInbandTone::~TMSInbandTone(void) - ??0TMSG711Format@TMS@@IAE@XZ @ 115 NONAME ; TMS::TMSG711Format::TMSG711Format(void) - ?GetState@TMSStream@TMS@@QAEHXZ @ 116 NONAME ; int TMS::TMSStream::GetState(void) - ?GetStreamId@TMSStream@TMS@@QAEHXZ @ 117 NONAME ; int TMS::TMSStream::GetStreamId(void) - ?AddSink@TMSStream@TMS@@QAEHPAVTMSSink@2@@Z @ 118 NONAME ; int TMS::TMSStream::AddSink(class TMS::TMSSink *) - ?ResetFormat@TMSStream@TMS@@QAEHPAVTMSFormat@2@@Z @ 119 NONAME ; int TMS::TMSStream::ResetFormat(class TMS::TMSFormat *) - ??1TMSGlobalGainEffect@TMS@@UAE@XZ @ 120 NONAME ; TMS::TMSGlobalGainEffect::~TMSGlobalGainEffect(void) - ?RemoveEffect@TMSStream@TMS@@QAEHPAVTMSEffect@2@@Z @ 121 NONAME ; int TMS::TMSStream::RemoveEffect(class TMS::TMSEffect *) - ??0TMSILBCFormat@TMS@@IAE@XZ @ 122 NONAME ; TMS::TMSILBCFormat::TMSILBCFormat(void) - ?GetPlc@TMSG711Format@TMS@@QAEHAAH@Z @ 123 NONAME ; int TMS::TMSG711Format::GetPlc(int &) - ?SetFormat@TMSStream@TMS@@QAEHPAVTMSFormat@2@@Z @ 124 NONAME ; int TMS::TMSStream::SetFormat(class TMS::TMSFormat *) - ?GetLevel@TMSVolumeEffect@TMS@@QAEHAAI@Z @ 125 NONAME ; int TMS::TMSVolumeEffect::GetLevel(unsigned int &) - ?GetType@TMSGlobalGainEffect@TMS@@UAEHAAH@Z @ 126 NONAME ; int TMS::TMSGlobalGainEffect::GetType(int &) - ?GetCallType@TMSCall@TMS@@QAEHXZ @ 127 NONAME ; int TMS::TMSCall::GetCallType(void) - ?GetMaxLevel@TMSGlobalGainEffect@TMS@@QAEHAAI@Z @ 128 NONAME ; int TMS::TMSGlobalGainEffect::GetMaxLevel(unsigned int &) - ?GetType@TMSFormat@TMS@@UAEHAAH@Z @ 129 NONAME ; int TMS::TMSFormat::GetType(int &) - ?RemoveObserver@TMSInbandTone@TMS@@QAEHAAVTMSInbandToneObserver@2@@Z @ 130 NONAME ; int TMS::TMSInbandTone::RemoveObserver(class TMS::TMSInbandToneObserver &) - ??1TMSGainEffect@TMS@@UAE@XZ @ 131 NONAME ; TMS::TMSGainEffect::~TMSGainEffect(void) - ?SetCNG@TMSG711Format@TMS@@QAEHH@Z @ 132 NONAME ; int TMS::TMSG711Format::SetCNG(int) - ??0TMSClientSource@TMS@@IAE@XZ @ 133 NONAME ; TMS::TMSClientSource::TMSClientSource(void) + ?AddObserver@TMSClientSource@TMS@@QAEHAAVTMSClientSourceObserver@2@PAX@Z @ 83 NONAME ; int TMS::TMSClientSource::AddObserver(class TMS::TMSClientSourceObserver &, void *) + ?AddObserver@TMSGlobalRouting@TMS@@QAEHAAVTMSGlobalRoutingObserver@2@PAX@Z @ 84 NONAME ; int TMS::TMSGlobalRouting::AddObserver(class TMS::TMSGlobalRoutingObserver &, void *) + ?RemoveObserver@TMSGainEffect@TMS@@QAEHAAVTMSEffectObserver@2@@Z @ 85 NONAME ; int TMS::TMSGainEffect::RemoveObserver(class TMS::TMSEffectObserver &) + ??0TMSModemSource@TMS@@IAE@XZ @ 86 NONAME ; TMS::TMSModemSource::TMSModemSource(void) + ??1TMSAMRFormat@TMS@@UAE@XZ @ 87 NONAME ; TMS::TMSAMRFormat::~TMSAMRFormat(void) + ??0TMSFormat@TMS@@IAE@XZ @ 88 NONAME ; TMS::TMSFormat::TMSFormat(void) + ?SetLevel@TMSVolumeEffect@TMS@@QAEHI@Z @ 89 NONAME ; int TMS::TMSVolumeEffect::SetLevel(unsigned int) + ??1TMSClientSink@TMS@@UAE@XZ @ 90 NONAME ; TMS::TMSClientSink::~TMSClientSink(void) + ??0TMSDTMF@TMS@@IAE@XZ @ 91 NONAME ; TMS::TMSDTMF::TMSDTMF(void) + ?ContinueDTMFStringSending@TMSDTMF@TMS@@QAEHH@Z @ 92 NONAME ; int TMS::TMSDTMF::ContinueDTMFStringSending(int) + ?SetOutput@TMSGlobalRouting@TMS@@QAEHH@Z @ 93 NONAME ; int TMS::TMSGlobalRouting::SetOutput(int) + ?GetType@TMSVolumeEffect@TMS@@UAEHAAH@Z @ 94 NONAME ; int TMS::TMSVolumeEffect::GetType(int &) + ?BufferFilled@TMSClientSource@TMS@@QAEHAAVTMSBuffer@2@@Z @ 95 NONAME ; int TMS::TMSClientSource::BufferFilled(class TMS::TMSBuffer &) + ?RemoveObserver@TMSGlobalRouting@TMS@@QAEHAAVTMSGlobalRoutingObserver@2@@Z @ 96 NONAME ; int TMS::TMSGlobalRouting::RemoveObserver(class TMS::TMSGlobalRoutingObserver &) + ?Pause@TMSStream@TMS@@QAEHXZ @ 97 NONAME ; int TMS::TMSStream::Pause(void) + ?SetBitRate@TMSFormat@TMS@@QAEHI@Z @ 98 NONAME ; int TMS::TMSFormat::SetBitRate(unsigned int) + ?SetLevel@TMSGlobalGainEffect@TMS@@QAEHI@Z @ 99 NONAME ; int TMS::TMSGlobalGainEffect::SetLevel(unsigned int) + ??0TMSGlobalRouting@TMS@@IAE@XZ @ 100 NONAME ; TMS::TMSGlobalRouting::TMSGlobalRouting(void) + ?SetTone@TMSDTMF@TMS@@QAEHPAU_GString@@@Z @ 101 NONAME ; int TMS::TMSDTMF::SetTone(struct _GString *) + ?RemoveObserver@TMSRingTone@TMS@@QAEHAAVTMSRingToneObserver@2@@Z @ 102 NONAME ; int TMS::TMSRingTone::RemoveObserver(class TMS::TMSRingToneObserver &) + ?GetLevel@TMSGainEffect@TMS@@QAEHAAI@Z @ 103 NONAME ; int TMS::TMSGainEffect::GetLevel(unsigned int &) + ??0TMSPCMFormat@TMS@@IAE@XZ @ 104 NONAME ; TMS::TMSPCMFormat::TMSPCMFormat(void) + ??1TMSG729Format@TMS@@UAE@XZ @ 105 NONAME ; TMS::TMSG729Format::~TMSG729Format(void) + ?SetLevel@TMSGainEffect@TMS@@QAEHI@Z @ 106 NONAME ; int TMS::TMSGainEffect::SetLevel(unsigned int) + ?AddObserver@TMSGainEffect@TMS@@QAEHAAVTMSEffectObserver@2@PAX@Z @ 107 NONAME ; int TMS::TMSGainEffect::AddObserver(class TMS::TMSEffectObserver &, void *) + ?SetVADMode@TMSG729Format@TMS@@QAEHH@Z @ 108 NONAME ; int TMS::TMSG729Format::SetVADMode(int) + ??0TMSCall@TMS@@IAE@XZ @ 109 NONAME ; TMS::TMSCall::TMSCall(void) + ?GetVADMode@TMSG729Format@TMS@@QAEHAAH@Z @ 110 NONAME ; int TMS::TMSG729Format::GetVADMode(int &) + ?GetOutput@TMSGlobalRouting@TMS@@QAEHAAH@Z @ 111 NONAME ; int TMS::TMSGlobalRouting::GetOutput(int &) + ?SetVADMode@TMSG711Format@TMS@@QAEHH@Z @ 112 NONAME ; int TMS::TMSG711Format::SetVADMode(int) + ??1TMSInbandTone@TMS@@UAE@XZ @ 113 NONAME ; TMS::TMSInbandTone::~TMSInbandTone(void) + ??0TMSG711Format@TMS@@IAE@XZ @ 114 NONAME ; TMS::TMSG711Format::TMSG711Format(void) + ?GetState@TMSStream@TMS@@QAEHXZ @ 115 NONAME ; int TMS::TMSStream::GetState(void) + ?GetStreamId@TMSStream@TMS@@QAEHXZ @ 116 NONAME ; int TMS::TMSStream::GetStreamId(void) + ?AddSink@TMSStream@TMS@@QAEHPAVTMSSink@2@@Z @ 117 NONAME ; int TMS::TMSStream::AddSink(class TMS::TMSSink *) + ?ResetFormat@TMSStream@TMS@@QAEHPAVTMSFormat@2@@Z @ 118 NONAME ; int TMS::TMSStream::ResetFormat(class TMS::TMSFormat *) + ??1TMSGlobalGainEffect@TMS@@UAE@XZ @ 119 NONAME ; TMS::TMSGlobalGainEffect::~TMSGlobalGainEffect(void) + ?RemoveEffect@TMSStream@TMS@@QAEHPAVTMSEffect@2@@Z @ 120 NONAME ; int TMS::TMSStream::RemoveEffect(class TMS::TMSEffect *) + ??0TMSILBCFormat@TMS@@IAE@XZ @ 121 NONAME ; TMS::TMSILBCFormat::TMSILBCFormat(void) + ?GetPlc@TMSG711Format@TMS@@QAEHAAH@Z @ 122 NONAME ; int TMS::TMSG711Format::GetPlc(int &) + ?SetFormat@TMSStream@TMS@@QAEHPAVTMSFormat@2@@Z @ 123 NONAME ; int TMS::TMSStream::SetFormat(class TMS::TMSFormat *) + ?GetLevel@TMSVolumeEffect@TMS@@QAEHAAI@Z @ 124 NONAME ; int TMS::TMSVolumeEffect::GetLevel(unsigned int &) + ?GetType@TMSGlobalGainEffect@TMS@@UAEHAAH@Z @ 125 NONAME ; int TMS::TMSGlobalGainEffect::GetType(int &) + ?GetCallType@TMSCall@TMS@@QAEHXZ @ 126 NONAME ; int TMS::TMSCall::GetCallType(void) + ?GetMaxLevel@TMSGlobalGainEffect@TMS@@QAEHAAI@Z @ 127 NONAME ; int TMS::TMSGlobalGainEffect::GetMaxLevel(unsigned int &) + ?GetType@TMSFormat@TMS@@UAEHAAH@Z @ 128 NONAME ; int TMS::TMSFormat::GetType(int &) + ?RemoveObserver@TMSInbandTone@TMS@@QAEHAAVTMSInbandToneObserver@2@@Z @ 129 NONAME ; int TMS::TMSInbandTone::RemoveObserver(class TMS::TMSInbandToneObserver &) + ??1TMSGainEffect@TMS@@UAE@XZ @ 130 NONAME ; TMS::TMSGainEffect::~TMSGainEffect(void) + ?SetCNG@TMSG711Format@TMS@@QAEHH@Z @ 131 NONAME ; int TMS::TMSG711Format::SetCNG(int) + ??0TMSClientSource@TMS@@IAE@XZ @ 132 NONAME ; TMS::TMSClientSource::TMSClientSource(void) + ?Start@TMSStream@TMS@@QAEHH@Z @ 133 NONAME ; int TMS::TMSStream::Start(int) ?GetAvailableOutputs@TMSGlobalRouting@TMS@@QAEHAAV?$vector@IV?$allocator@I@std@@@std@@@Z @ 134 NONAME ; int TMS::TMSGlobalRouting::GetAvailableOutputs(class std::vector > &) ?Deinit@TMSRingTone@TMS@@QAEHXZ @ 135 NONAME ; int TMS::TMSRingTone::Deinit(void) ?AddObserver@TMSClientSink@TMS@@QAEHAAVTMSClientSinkObserver@2@PAX@Z @ 136 NONAME ; int TMS::TMSClientSink::AddObserver(class TMS::TMSClientSinkObserver &, void *) diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsapi/eabi/tmsapi.def --- a/mmserv/tms/tmsapi/eabi/tmsapi.def Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsapi/eabi/tmsapi.def Fri Jun 11 19:59:23 2010 -0500 @@ -200,10 +200,10 @@ _ZN3TMS9TMSStream12RemoveSourceEPNS_9TMSSourceE @ 199 NONAME _ZN3TMS9TMSStream13GetStreamTypeEv @ 200 NONAME _ZN3TMS9TMSStream14RemoveObserverERNS_17TMSStreamObserverE @ 201 NONAME - _ZN3TMS9TMSStream4InitEv @ 202 NONAME + _ZN3TMS9TMSStream4InitEi @ 202 NONAME _ZN3TMS9TMSStream4StopEv @ 203 NONAME _ZN3TMS9TMSStream5PauseEv @ 204 NONAME - _ZN3TMS9TMSStream5StartEv @ 205 NONAME + _ZN3TMS9TMSStream5StartEi @ 205 NONAME _ZN3TMS9TMSStream6DeinitEv @ 206 NONAME _ZN3TMS9TMSStream7AddSinkEPNS_7TMSSinkE @ 207 NONAME _ZN3TMS9TMSStream8GetStateEv @ 208 NONAME diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsapi/src/tmsstream.cpp --- a/mmserv/tms/tmsapi/src/tmsstream.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsapi/src/tmsstream.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -161,12 +161,12 @@ return status; } -EXPORT_C gint TMSStream::Init() +EXPORT_C gint TMSStream::Init(gint retrytime) { gint status(TMS_RESULT_UNINITIALIZED_OBJECT); if (iBody) { - status = iBody->Init(0); + status = iBody->Init(retrytime); } return status; } @@ -181,12 +181,12 @@ return status; } -EXPORT_C gint TMSStream::Start() +EXPORT_C gint TMSStream::Start(gint retrytime) { gint status(TMS_RESULT_UNINITIALIZED_OBJECT); if (iBody) { - status = iBody->Start(0); + status = iBody->Start(retrytime); } return status; } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsimpl/inc/tmsclientsinkbodyimpl.h --- a/mmserv/tms/tmsimpl/inc/tmsclientsinkbodyimpl.h Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsimpl/inc/tmsclientsinkbodyimpl.h Fri Jun 11 19:59:23 2010 -0500 @@ -27,6 +27,7 @@ // FORWARD DECLARATIONS class TMSClientSinkObserver; class TMSBuffer; +class TMSGlobalContext; class TMSCallProxy; // TMSClientSinkBodyImpl class @@ -35,7 +36,6 @@ { public: static gint Create(TMSClientSinkBody*& bodyimpl); - // From TMSClientSinkBody begins virtual ~TMSClientSinkBodyImpl(); @@ -49,13 +49,10 @@ virtual gint GetType(TMSSinkType& sinktype); - // From TMSClientSinkBody ends - // From MQueueHandlerObserver starts virtual void QueueEvent(TInt aEventType, TInt aError, void* user_data); - // From MQueueHandlerObserver ends - void SetProxy(TMSCallProxy* aProxy, gpointer queuehandler); + void SetProxy(TMSGlobalContext* context, gpointer queuehandler); private: TMSClientSinkBodyImpl(); @@ -64,6 +61,7 @@ private: TMSClientSinkObserver* iObserver; gpointer iUserData; + TMSGlobalContext* iContext; TMSCallProxy* iProxy; }; diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsimpl/inc/tmsclientsourcebodyimpl.h --- a/mmserv/tms/tmsimpl/inc/tmsclientsourcebodyimpl.h Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsimpl/inc/tmsclientsourcebodyimpl.h Fri Jun 11 19:59:23 2010 -0500 @@ -27,6 +27,7 @@ // FORWARD DECLARATIONS class TMSClientSourceObserver; class TMSBuffer; +class TMSGlobalContext; class TMSCallProxy; // TMSClientSourceBodyImpl class @@ -35,13 +36,11 @@ { public: static gint Create(TMSClientSourceBody*& bodyimpl); - // From TMSClientSourceBody begins virtual ~TMSClientSourceBodyImpl(); virtual gint AddObserver(TMSClientSourceObserver& obsrvr, gpointer user_data); - virtual gint RemoveObserver(TMSClientSourceObserver& obsrvr); // In pull mode, client calls this.??? How to identify last buffer. @@ -60,13 +59,10 @@ virtual gint GetType(TMSSourceType& sourcetype); - // From TMSClientSourceBody ends - - // From MQueueHandlerObserver starts + // From MQueueHandlerObserver virtual void QueueEvent(TInt aEventType, TInt aError, void* user_data); - // From MQueueHandlerObserver ends - void SetProxy(TMSCallProxy* aProxy, gint strmid, gpointer queuehandler); + void SetProxy(TMSGlobalContext* context, gpointer queuehandler); private: TMSClientSourceBodyImpl(); @@ -75,9 +71,9 @@ private: TMSClientSourceObserver* iObserver; gpointer iUserData; + TMSGlobalContext* iContext; TMSCallProxy* iProxy; gboolean iQueueMode; - gint iStreamId; }; } //namespace TMS diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsimpl/src/tmsclientsinkbodyimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsclientsinkbodyimpl.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsclientsinkbodyimpl.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -18,6 +18,7 @@ #include #include #include "tmscallproxy.h" +#include "tmsglobalcontext.h" #include "tmsmembuffer.h" #include "tmsqueuehandler.h" #include "tmsclientsinkbodyimpl.h" @@ -90,14 +91,11 @@ // Push mode gint TMSClientSinkBodyImpl::BufferProcessed(TMSBuffer* buffer) { - // TODO send stream attributes here gint ret(TMS_RESULT_SUCCESS); - if (iProxy) { - //TODO: must use strm_id instead of 1 - ret = iProxy->BufferEmptied(TMS_CALL_IP, TMS_STREAM_UPLINK, 1, - *buffer); + ret = iProxy->BufferEmptied(iContext->CallType, iContext->StreamType, + iContext->StreamId, *buffer); } else { @@ -113,13 +111,14 @@ return ret; } -void TMSClientSinkBodyImpl::SetProxy(TMSCallProxy* aProxy, +void TMSClientSinkBodyImpl::SetProxy(TMSGlobalContext* context, gpointer queuehandler) { - iProxy = aProxy; + iProxy = context->CallProxy; + iContext = context; if (queuehandler) { - static_cast(queuehandler)->AddObserver(*this, + static_cast (queuehandler)->AddObserver(*this, TMS_SINK_CLIENT); } } @@ -132,7 +131,7 @@ switch (aEventType) { case TMS_EVENT_SINK_PROCESS_BUFFER: - iObserver->ProcessBuffer(static_cast(user_data)); + iObserver->ProcessBuffer(static_cast (user_data)); break; default: break; diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsimpl/src/tmsclientsinkimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsclientsinkimpl.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsclientsinkimpl.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -16,6 +16,7 @@ */ #include "tmsutility.h" +#include "tmsglobalcontext.h" #include "tmsclientsinkimpl.h" #include "tmsclientsinkbodyimpl.h" @@ -68,12 +69,13 @@ return ret; } -gint TMSClientSinkImpl::SetProxy(TMSCallProxy* aProxy, gpointer queuehandler) +gint TMSClientSinkImpl::SetProxy(TMSGlobalContext* context, + gpointer queuehandler) { gint ret = TMS_RESULT_SUCCESS; if (this->iBody) { - static_cast(this->iBody)->SetProxy(aProxy, + static_cast(this->iBody)->SetProxy(context, queuehandler); } else diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsimpl/src/tmsclientsourcebodyimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsclientsourcebodyimpl.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsclientsourcebodyimpl.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -18,6 +18,7 @@ #include #include #include "tmscallproxy.h" +#include "tmsglobalcontext.h" #include "tmsmembuffer.h" #include "tmsqueuehandler.h" #include "tmsclientsourcebodyimpl.h" @@ -74,21 +75,6 @@ return ret; } -/** - * Remove a stream observer from this stream. - * - * This function can be called at any time. It is recommended to remove - * observer after calling Deinit() on stream. Else observer may receive - * a callback that is alread dispatched. - * - * @param obsrvr - * The listener to remove. - * - * @return - * TMS_RESULT_SUCCESS if the obsrvr is removed successfully from list. - * TMS_RESULT_DOES_NOT_EXIST if obsrvr is not already in the list. - * - */ gint TMSClientSourceBodyImpl::RemoveObserver(TMSClientSourceObserver& obsrvr) { gint ret(TMS_RESULT_SUCCESS); @@ -111,8 +97,8 @@ { // TODO send stream attributes here gint ret(TMS_RESULT_SUCCESS); - ret = iProxy->BufferFilled(TMS_CALL_IP, TMS_STREAM_DOWNLINK, iStreamId, - buffer); + ret = iProxy->BufferFilled(iContext->CallType, iContext->StreamType, + iContext->StreamId, buffer); return ret; } @@ -154,13 +140,16 @@ return ret; } -void TMSClientSourceBodyImpl::SetProxy(TMSCallProxy* aProxy, gint strmid, +void TMSClientSourceBodyImpl::SetProxy(TMSGlobalContext* context, gpointer queuehandler) { - iProxy = aProxy; - iStreamId = strmid; - static_cast(queuehandler)->AddObserver(*this, - TMS_SOURCE_CLIENT); + iProxy = context->CallProxy; + iContext = context; + if (queuehandler) + { + static_cast(queuehandler)->AddObserver(*this, + TMS_SOURCE_CLIENT); + } } void TMSClientSourceBodyImpl::QueueEvent(TInt aEventType, TInt aError, diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsimpl/src/tmsclientsourceimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsclientsourceimpl.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsclientsourceimpl.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -68,12 +68,12 @@ return ret; } -gint TMSClientSourceImpl::SetProxy(TMSCallProxy* aProxy, gint strmid, +gint TMSClientSourceImpl::SetProxy(TMSGlobalContext* context, gpointer queuehandler) { gint ret = TMS_RESULT_SUCCESS; - static_cast(this->iBody)->SetProxy(aProxy, - strmid, queuehandler); + static_cast(this->iBody)->SetProxy(context, + queuehandler); return ret; } diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsimpl/src/tmsqueuehandler.cpp --- a/mmserv/tms/tmsimpl/src/tmsqueuehandler.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsqueuehandler.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -316,10 +316,8 @@ err = TMS_RESULT_DOES_NOT_EXIST; } } - else - { - // TODO handle error here - } + + // TODO: handle error here } // ----------------------------------------------------------------------------- @@ -376,10 +374,8 @@ err = TMS_RESULT_DOES_NOT_EXIST; } } - else - { - //iObserver->Event(MVoIPUplinkObserver::KUplinkError, aStatus); - } + //TODO: Handle error here + //iObserver->Event(MVoIPUplinkObserver::KUplinkError, aStatus); } // ----------------------------------------------------------------------------- diff -r 2ed61feeead6 -r 6f7ceef7b1d1 mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp Fri May 28 19:26:28 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp Fri Jun 11 19:59:23 2010 -0500 @@ -374,7 +374,7 @@ switch (effecttype) { case TMS_EFFECT_GAIN: - static_cast(iEffectsList[i])->SetProxy( + static_cast (iEffectsList[i])->SetProxy( iContext.CallProxy, iMsgQHandler); break; case TMS_EFFECT_VOLUME: @@ -396,23 +396,23 @@ switch (fmttype) { case TMS_FORMAT_PCM: - static_cast(iFormat)->SetProxy(&iContext, + static_cast (iFormat)->SetProxy(&iContext, iMsgQHandler); break; case TMS_FORMAT_AMR: - static_cast(iFormat)->SetProxy(&iContext, + static_cast (iFormat)->SetProxy(&iContext, iMsgQHandler); break; case TMS_FORMAT_G711: - static_cast(iFormat)->SetProxy(&iContext, + static_cast (iFormat)->SetProxy(&iContext, iMsgQHandler); break; case TMS_FORMAT_G729: - static_cast(iFormat)->SetProxy(&iContext, + static_cast (iFormat)->SetProxy(&iContext, iMsgQHandler); break; case TMS_FORMAT_ILBC: - static_cast(iFormat)->SetProxy(&iContext, + static_cast (iFormat)->SetProxy(&iContext, iMsgQHandler); break; default: @@ -430,8 +430,8 @@ switch (sinkType) { case TMS_SINK_CLIENT: - static_cast(iSink)->SetProxy( - iContext.CallProxy, iMsgQHandler); + static_cast (iSink)->SetProxy(&iContext, + iMsgQHandler); break; case TMS_SINK_MODEM: case TMS_SINK_SPEAKER: @@ -455,9 +455,8 @@ switch (sourceType) { case TMS_SOURCE_CLIENT: - static_cast(iSource)->SetProxy( - iContext.CallProxy, iContext.StreamId, - iMsgQHandler); + static_cast (iSource)->SetProxy( + &iContext, iMsgQHandler); break; case TMS_SOURCE_MODEM: case TMS_SOURCE_MIC: @@ -737,8 +736,7 @@ { if (aError != TMS_RESULT_SUCCESS) { - //event.type = TMS_EVENT_STREAM_STATE_CHANGE_ERROR; - event.type = TMS_EVENT_STREAM_STATE_CHANGED; + event.type = TMS_EVENT_STREAM_STATE_CHANGE_ERROR; } else {