diff -r 128eb6a32b84 -r 8dfd592727cb khronosfws/openmax_al/src/common/xastreaminformationitf.c --- a/khronosfws/openmax_al/src/common/xastreaminformationitf.c Thu May 27 13:20:50 2010 +0300 +++ b/khronosfws/openmax_al/src/common/xastreaminformationitf.c Wed Jun 23 18:47:10 2010 +0300 @@ -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: Stream Information Interface Implementation + * + */ #include @@ -26,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; @@ -276,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; @@ -419,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"); -} + } -