sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // omxinputport.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "omxcomponentbody.h" sl@0: #include "omxinputportbody.h" sl@0: sl@0: _LIT(KOmxInputPort, "OmxInputPortBody"); sl@0: sl@0: COmxInputPort::CBody* COmxInputPort::CBody::NewL(TInt aIndex, COmxProcessingUnit* aComponent, COmxInputPort* aParent) sl@0: { sl@0: return new (ELeave) CBody(aIndex, aComponent, aParent); sl@0: } sl@0: sl@0: COmxInputPort::CBody::CBody(TInt aIndex, COmxProcessingUnit* aComponent, COmxInputPort* aParent) : sl@0: iPortIndex(aIndex), sl@0: iComponent(aComponent), sl@0: iParent(aParent) sl@0: { sl@0: } sl@0: sl@0: TInt COmxInputPort::CBody::MipConfigure(const TPuConfig& /*aConfig*/) sl@0: { sl@0: return KErrNotSupported; sl@0: } sl@0: sl@0: TInt COmxInputPort::CBody::MipGetConfig(TPuConfig& /*aConfig*/) sl@0: { sl@0: return KErrNotSupported; sl@0: } sl@0: sl@0: void COmxInputPort::CBody::MipInitialize() sl@0: { sl@0: } sl@0: sl@0: CMMFBuffer* COmxInputPort::CBody::MipCreateBuffer(TInt aBufferSize) sl@0: { sl@0: CMMFBuffer* buffer = NULL; sl@0: TInt err = KErrNone; sl@0: TRAP(err, buffer = Component()->OmxAllocateBufferL(iPortIndex, aBufferSize)); sl@0: return buffer; sl@0: } sl@0: sl@0: TInt COmxInputPort::CBody::MipUseBuffer(CMMFBuffer& aBuffer) sl@0: { sl@0: return Component()->OmxUseBuffer(&aBuffer, iPortIndex); sl@0: } sl@0: sl@0: TInt COmxInputPort::CBody::MipFreeBuffer(CMMFBuffer* aBuffer) sl@0: { sl@0: return Component()->OmxFreeBuffer(aBuffer); sl@0: } sl@0: sl@0: TInt COmxInputPort::CBody::MipTunnelRequest(const MMdfOutputPort& /*aOutputPortToBeConnectedTo*/, sl@0: TTunnelFlags& /*aTunnelFlags*/, TSupplierType& /*aSupplierType*/) sl@0: { sl@0: return KErrNotSupported; sl@0: } sl@0: sl@0: void COmxInputPort::CBody::MipWriteData(CMMFBuffer& aInputBuffer) sl@0: { sl@0: Component()->OmxEmptyThisBuffer(&aInputBuffer, this); sl@0: } sl@0: sl@0: void COmxInputPort::CBody::MipDisconnectTunnel() sl@0: { sl@0: // here, as this can reasonably be called by the device adapter sl@0: // during unloading of a PU which has been loaded but never initialised, sl@0: // we use a conditional instead of an ASSERT sl@0: if(iObserver) sl@0: { sl@0: iObserver->MipoDisconnectTunnelComplete(iParent, KErrNone); sl@0: } sl@0: } sl@0: sl@0: void COmxInputPort::CBody::MipRestartTunnel() sl@0: { sl@0: __ASSERT_ALWAYS(iObserver, User::Panic(KOmxInputPort, EObserverNotSet)); sl@0: sl@0: iObserver->MipoRestartTunnelComplete(iParent, KErrNone); sl@0: } sl@0: sl@0: TBool COmxInputPort::CBody::MipIsTunnelled() const sl@0: { sl@0: if (!iConnectedPort) sl@0: { sl@0: return EFalse; sl@0: } sl@0: return ETrue; sl@0: } sl@0: sl@0: TInt COmxInputPort::CBody::MipIndex() const sl@0: { sl@0: return iPortIndex; sl@0: } sl@0: sl@0: TUint32 COmxInputPort::CBody::MipBufferSize() const sl@0: { sl@0: OMX_PARAM_PORTDEFINITIONTYPE portInfo; sl@0: portInfo.nPortIndex = 0; sl@0: Component()->OmxGetParameter(OMX_IndexParamPortDefinition, &portInfo); sl@0: return portInfo.nBufferSize; sl@0: } sl@0: sl@0: void COmxInputPort::CBody::MipSetObserver(const MMdfInputPortObserver& aOutputPortObserver) sl@0: { sl@0: iObserver = const_cast(&aOutputPortObserver); sl@0: } sl@0: sl@0: TInt COmxInputPort::CBody::EmptyBufferDone(OMX_HANDLETYPE /*aComponent*/, const CMMFBuffer* aBuffer) sl@0: { sl@0: __ASSERT_ALWAYS(iObserver, User::Panic(KOmxInputPort, EObserverNotSet)); sl@0: sl@0: iObserver->MipoWriteDataComplete(iParent, const_cast(aBuffer),KErrNone); sl@0: return KErrNone; sl@0: } sl@0: sl@0: TInt COmxInputPort::CBody::MipCreateCustomInterface(TUid /*aUid*/) sl@0: { sl@0: return KErrNotSupported; sl@0: } sl@0: sl@0: TAny* COmxInputPort::CBody::MipCustomInterface(TUid /*aUid*/) sl@0: { sl@0: return NULL; sl@0: } sl@0: sl@0: MMdfInputPortObserver* COmxInputPort::CBody::Observer() const sl@0: { sl@0: return iObserver; sl@0: } sl@0: sl@0: COmxProcessingUnit* COmxInputPort::CBody::Component() const sl@0: { sl@0: return iComponent; sl@0: }