diff -r c1e808730d6c -r eedf2dcd43c6 omxil/video/omxilvideoscheduler2/src/comxilvideoschedulerinputport.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omxil/video/omxilvideoscheduler2/src/comxilvideoschedulerinputport.cpp Fri May 07 16:25:23 2010 +0100 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2008 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: +* +*/ + + +/** +@file +@internalComponent +*/ + +#include "comxilvideoschedulerinputport.h" +#include "omxilvideoschedulerextensionsindexes.h" + + +COmxILVideoSchedulerInputPort* COmxILVideoSchedulerInputPort::NewL(const TOmxILCommonPortData& aCommonPortData) + { + // TODO these arrays must left empty, to be removed from the video port constructor + RArray supportedCodings; + RArray supportedColorFormats; + + CleanupClosePushL(supportedCodings); + CleanupClosePushL(supportedColorFormats); + + COmxILVideoSchedulerInputPort* self = new(ELeave) COmxILVideoSchedulerInputPort(aCommonPortData, supportedCodings, supportedColorFormats); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + CleanupStack::PopAndDestroy(2, &supportedCodings); + + return self; + } + + +COmxILVideoSchedulerInputPort::COmxILVideoSchedulerInputPort(const TOmxILCommonPortData& aCommonPortData, + const RArray& aSupportedCodings, + const RArray& aSupportedColourFormats) + : COmxILVideoPort(aCommonPortData, aSupportedCodings, aSupportedColourFormats) + { + } + +void COmxILVideoSchedulerInputPort::ConstructL() + { + // Port definition mime type. Mime type is not relevant for uncompressed video frames + iMimeTypeBuf.CreateL(KNullDesC8(), KNullDesC8().Length() + 1); + TUint8* pTUint = const_cast(iMimeTypeBuf.PtrZ()); + iParamPortDefinition.format.video.cMIMEType = reinterpret_cast(pTUint); + + iParamVideoScheDropFrame.nSize = sizeof(OMX_NOKIA_PARAM_DROPPEDFRAMEEVENT); + iParamVideoScheDropFrame.nVersion = TOmxILSpecVersion(); + iParamVideoScheDropFrame.nPortIndex = iParamPortDefinition.nPortIndex; + iParamVideoScheDropFrame.bEnabled = OMX_FALSE; + + iSupportedVideoFormats.AppendL(OMX_VIDEO_CodingUnused); + iSupportedColorFormats.AppendL(OMX_COLOR_FormatUnused); + } + +COmxILVideoSchedulerInputPort::~COmxILVideoSchedulerInputPort() + { + iMimeTypeBuf.Close(); + } + +OMX_ERRORTYPE COmxILVideoSchedulerInputPort::GetLocalOmxParamIndexes(RArray& aIndexArray) const + { + OMX_ERRORTYPE omxRetValue = COmxILVideoPort::GetLocalOmxParamIndexes(aIndexArray); + if(omxRetValue != OMX_ErrorNone) + { + return omxRetValue; + } + + TInt err = aIndexArray.InsertInOrder(OMX_NokiaIndexParamDroppedFrameEvent); + + if (err != KErrNone && err != KErrAlreadyExists) + { + return OMX_ErrorInsufficientResources; + } + + return OMX_ErrorNone; + } + +OMX_ERRORTYPE COmxILVideoSchedulerInputPort::GetLocalOmxConfigIndexes(RArray& aIndexArray) const + { + return COmxILVideoPort::GetLocalOmxConfigIndexes(aIndexArray); + } + +/** +This method provides the current values for the parameters present in the structure represented by the given index. + +@param aParamIndex The specific param index for which the current parameter values are required. + apComponentParameterStructure The pointer to the structure which will be updated to provide the current parameter values. + +@return OMX_ErrorNone if successful; + OMX_ErrorNoMore if no more formats; + OMX_ErrorUnsupportedSetting if unsupported setting is passed; +*/ +OMX_ERRORTYPE COmxILVideoSchedulerInputPort::GetParameter(OMX_INDEXTYPE aParamIndex,TAny* apComponentParameterStructure) const + { + if(aParamIndex == OMX_NokiaIndexParamDroppedFrameEvent) + { + OMX_NOKIA_PARAM_DROPPEDFRAMEEVENT* dropFrame = static_cast(apComponentParameterStructure); + *dropFrame = iParamVideoScheDropFrame; + return OMX_ErrorNone; + } + else + { + // Try the parent's indexes + return COmxILVideoPort::GetParameter(aParamIndex,apComponentParameterStructure); + } + } + +/** +This method sets the values of the parameters present in the structure represented by the given index. + +@param aParamIndex The specific param index for which the parameter values have to be set. + apComponentParameterStructure The pointer to the structure which will provide the desired parameter values to be set. + aUpdateProcessingFunction informs whether the processing function needs to be updated. + +@return OMX_ErrorNone if successful; + OMX_ErrorUnsupportedSetting if non-zero framerate value; + OMX_ErrorUnsupportedIndex if request OMX_NokiaIndexParamDroppedFrameEvent index; +*/ +OMX_ERRORTYPE COmxILVideoSchedulerInputPort::SetParameter(OMX_INDEXTYPE aParamIndex,const TAny* apComponentParameterStructure, TBool& aUpdateProcessingFunction) + { + if(aParamIndex == OMX_NokiaIndexParamDroppedFrameEvent) + { + const OMX_NOKIA_PARAM_DROPPEDFRAMEEVENT *portParameterStructure = static_cast(apComponentParameterStructure); + if (iParamVideoScheDropFrame.bEnabled != portParameterStructure->bEnabled) + { + iParamVideoScheDropFrame.bEnabled = portParameterStructure->bEnabled; + aUpdateProcessingFunction = ETrue; + } + return OMX_ErrorNone; + } + + // Try the parent's indexes + return COmxILVideoPort::SetParameter(aParamIndex, apComponentParameterStructure, aUpdateProcessingFunction); + } + + +OMX_ERRORTYPE COmxILVideoSchedulerInputPort::SetFormatInPortDefinition(const OMX_PARAM_PORTDEFINITIONTYPE& aPortDefinition, + TBool& /*aUpdateProcessingFunction*/) + { + iParamPortDefinition.format.video = aPortDefinition.format.video; + TUint8* pTUint = const_cast(iMimeTypeBuf.PtrZ()); + iParamPortDefinition.format.video.cMIMEType = reinterpret_cast(pTUint); + iParamPortDefinition.format.video.nSliceHeight = iParamPortDefinition.format.video.nFrameHeight; + iParamPortDefinition.nBufferSize = iParamPortDefinition.format.video.nStride * iParamPortDefinition.format.video.nSliceHeight; + return OMX_ErrorNone; + } + +TBool COmxILVideoSchedulerInputPort::IsTunnelledPortCompatible(const OMX_PARAM_PORTDEFINITIONTYPE& /*aPortDefinition*/) const + { + // TODO (The base class should do this checking) + return ETrue; + } + +/** Returns the number of buffers configured on this port. */ +TUint32 COmxILVideoSchedulerInputPort::BufferCount() const + { + return iParamPortDefinition.nBufferCountActual; + } + +/** +This method provides the index type represented by the given parameter name. + +@param aParameterName The name of extention parameter to be retrieved. + apIndexType The pointer which will retrieve the required index. + +@return OMX_ErrorNone if successful; + OMX_ErrorUnsupportedIndex if unsupported parameter name is passed; +*/ +OMX_ERRORTYPE COmxILVideoSchedulerInputPort::GetExtensionIndex(OMX_STRING aParameterName, OMX_INDEXTYPE* apIndexType) const + { + TPtrC8 receivedParameterName(const_cast(reinterpret_cast(aParameterName))); + + TPtrC8 parameterName(reinterpret_cast(sOmxNokiaIndexParamDroppedFrameEvent)); + + if (receivedParameterName == parameterName) + { + *apIndexType = static_cast(OMX_NokiaIndexParamDroppedFrameEvent); + return OMX_ErrorNone; + } + + *apIndexType = OMX_IndexMax; + return OMX_ErrorUnsupportedIndex; + } +