--- 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 <assert.h>
@@ -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("-<XAStreamInformationItfImpl_QueryMediaContainerInformation");
return XA_RESULT_PARAMETER_INVALID;
- }
+ }
-
- if(impl->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_QueryMediaContainerInformation");
return ret;
-}
+ }
XAresult XAStreamInformationItfImpl_QueryStreamType(
- XAStreamInformationItf self,
- XAuint32 streamIndex,
- XAuint32 *domain)
-{
+ XAStreamInformationItf self, XAuint32 streamIndex, XAuint32 *domain)
+ {
XAresult ret = XA_RESULT_SUCCESS;
XAStreamInformationItfImpl* impl = GetImpl(self);
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("-<XAStreamInformationItfImpl_QueryStreamType");
return XA_RESULT_PARAMETER_INVALID;
- }
- if(impl->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("-<XAStreamInformationItfImpl_QueryStreamType");
+ }
+
+ ret = XAStreamInformationItfAdaptMMF_QueryStreamType(impl->adapCtx,
+ streamIndex, domain);
+
+ XAAdaptationBase_ThreadExit(impl->adapCtx);
+ ;
+ }DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamType");
return ret;
-}
+ }
XAresult XAStreamInformationItfImpl_QueryStreamInformation(
- XAStreamInformationItf self,
- XAuint32 streamIndex,
- void * info)
-{
+ XAStreamInformationItf self, XAuint32 streamIndex, void * info)
+ {
XAresult ret = XA_RESULT_SUCCESS;
XAStreamInformationItfImpl* impl = GetImpl(self);
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("-<XAStreamInformationItfImpl_QueryStreamInformation");
return XA_RESULT_PARAMETER_INVALID;
- }
+ }
- if(impl->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_QueryStreamInformation");
return ret;
-}
+ }
XAresult XAStreamInformationItfImpl_QueryStreamName(
- XAStreamInformationItf self,
- XAuint32 streamIndex,
- XAuint16 * pNameSize,
- XAchar * pName)
-{
+ XAStreamInformationItf self, XAuint32 streamIndex,
+ XAuint16 * pNameSize, XAchar * pName)
+ {
XAresult ret = XA_RESULT_SUCCESS;
XAStreamInformationItfImpl* impl = GetImpl(self);
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("-<XAStreamInformationItfImpl_QueryStreamName");
return XA_RESULT_PARAMETER_INVALID;
- }
+ }
- if(impl->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("-<XAStreamInformationItfImpl_QueryStreamName");
+ }
+
+ ret = XAStreamInformationItfAdaptMMF_QueryStreamName(impl->adapCtx,
+ streamIndex, pNameSize, pName);
+
+ XAAdaptationBase_ThreadExit(impl->adapCtx);
+ ;
+ }DEBUG_API("-<XAStreamInformationItfImpl_QueryStreamName");
return ret;
-}
+ }
XAresult XAStreamInformationItfImpl_RegisterStreamChangeCallback(
- XAStreamInformationItf self,
- xaStreamEventChangeCallback callback,
- void * pContext)
-{
+ XAStreamInformationItf self, xaStreamEventChangeCallback callback,
+ void * pContext)
+ {
XAresult ret = XA_RESULT_SUCCESS;
XAStreamInformationItfImpl* impl = GetImpl(self);
DEBUG_API("->XAStreamInformationItfImpl_RegisterStreamChangeCallback");
- if(!impl)
- {
+ if (!impl)
+ {
/* invalid parameter */
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
return XA_RESULT_PARAMETER_INVALID;
- }
+ }
/* callback may be NULL (to remove callback) */
impl->callback = callback;
@@ -276,116 +250,105 @@
DEBUG_API("-<XAStreamInformationItfImpl_RegisterStreamChangeCallback");
return ret;
-}
+ }
XAresult XAStreamInformationItfImpl_QueryActiveStreams(
- XAStreamInformationItf self,
- XAuint32 *numStreams,
- XAboolean *activeStreams)
-{
+ XAStreamInformationItf self, XAuint32 *numStreams,
+ XAboolean *activeStreams)
+ {
XAresult ret = XA_RESULT_SUCCESS;
XAStreamInformationItfImpl* impl = GetImpl(self);
DEBUG_API("->XAStreamInformationItfImpl_QueryActiveStreams");
- if(!impl || !numStreams)
- {
+ if (!impl || !numStreams || !impl->adapCtx)
+ {
/* invalid parameter */
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
DEBUG_API("-<XAStreamInformationItfImpl_QueryActiveStreams");
return XA_RESULT_PARAMETER_INVALID;
- }
+ }
- if(impl->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_QueryActiveStreams");
return ret;
-}
+ }
XAresult XAStreamInformationItfImpl_SetActiveStream(
- XAStreamInformationItf self,
- XAuint32 streamNum,
- XAboolean active,
- XAboolean commitNow)
-{
+ XAStreamInformationItf self, XAuint32 streamNum, XAboolean active,
+ XAboolean commitNow)
+ {
XAresult ret = XA_RESULT_SUCCESS;
XAStreamInformationItfImpl* impl = GetImpl(self);
DEBUG_API("->XAStreamInformationItfImpl_SetActiveStream");
- if(!impl)
- {
+ if (!impl || !impl->adapCtx)
+ {
/* invalid parameter */
DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
DEBUG_API("-<XAStreamInformationItfImpl_SetActiveStream");
return XA_RESULT_PARAMETER_INVALID;
- }
+ }
- if(impl->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_SetActiveStream");
return ret;
-}
+ }
/**
* XAStreamInformationItfImpl -specific methods
@@ -395,22 +358,31 @@
* XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create()
* Description: Allocate and initialize PlayItfImpl
**/
-XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create( XAAdaptationBaseCtx *adapCtx )
-{
+XAStreamInformationItfImpl* XAStreamInformationItfImpl_Create(
+ XAAdaptationBaseCtx *adapCtx)
+ {
XAStreamInformationItfImpl *self;
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");
-}
+ }
-