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: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "omxcomponentbody.h" sl@0: #include "omxoutputportbody.h" sl@0: sl@0: _LIT(KOmxOutputPort, "OmxOutputPort"); sl@0: sl@0: /** sl@0: Constructor sl@0: */ sl@0: EXPORT_C COmxOutputPort::COmxOutputPort() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Destructor sl@0: */ sl@0: EXPORT_C COmxOutputPort::~COmxOutputPort() sl@0: { sl@0: delete iBody; sl@0: } sl@0: sl@0: /** sl@0: Called by an Input Port when MipWriteData() has completed. sl@0: @param aInputPort sl@0: The Input Port which sent the callback. sl@0: @param aBuffer sl@0: The data buffer which was written. sl@0: @param aErrorCode sl@0: An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C void COmxOutputPort::MipoWriteDataComplete(const MMdfInputPort* aInputPort, sl@0: CMMFBuffer* aBuffer, TInt aErrorCode) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: iBody->MipoWriteDataComplete(aInputPort, aBuffer, aErrorCode); sl@0: } sl@0: sl@0: /** sl@0: Called by an Input Port when MipDisconnectTunnel() has completed. sl@0: @param aInputPort sl@0: The Input Port which sent the callback. sl@0: @param aErrorCode sl@0: An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C void COmxOutputPort::MipoDisconnectTunnelComplete(const MMdfInputPort* aInputPort, sl@0: TInt aErrorCode) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: iBody->MipoDisconnectTunnelComplete(aInputPort, aErrorCode); sl@0: } sl@0: sl@0: /** sl@0: Called by an Input Port when MipRestartTunnel() has completed. sl@0: @param aInputPort sl@0: The Input Port which sent the callback. sl@0: @param aErrorCode sl@0: An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C void COmxOutputPort::MipoRestartTunnelComplete(const MMdfInputPort* aInputPort, sl@0: TInt aErrorCode) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: iBody->MipoRestartTunnelComplete(aInputPort, aErrorCode); sl@0: } sl@0: sl@0: /** sl@0: ConstructL. Must be used by derived class to create the component sl@0: */ sl@0: EXPORT_C void COmxOutputPort::ConstructL(TInt aIndex, COmxProcessingUnit* aComponent) sl@0: { sl@0: __ASSERT_ALWAYS(!iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: iBody = CBody::NewL(aIndex, aComponent, this); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Synchronous function used to set the observer for the OpenMAX Output Port. sl@0: @param aOutputPortObserver sl@0: The observer of the Output Port. sl@0: */ sl@0: EXPORT_C void COmxOutputPort::MopSetObserver(const MMdfOutputPortObserver& aOutputPortObserver) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: iBody->MopSetObserver(aOutputPortObserver); sl@0: } sl@0: sl@0: /** sl@0: Synchronous function used to configure the OpenMAX Output Port. sl@0: @param aConfig sl@0: Holds the configuration parameters for the Output Port. sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxOutputPort::MopConfigure(const TPuConfig& aConfig) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopConfigure(aConfig); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Synchronous method which gets a configuration structure for the Output Port sl@0: @param aConfig sl@0: The reference to the structure that is to contain the configuration information sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxOutputPort::MopGetConfig(TPuConfig& aConfig) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopGetConfig(aConfig); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Synchronous function used to initialise the OpenMAX Output Port. sl@0: */ sl@0: EXPORT_C void COmxOutputPort::MopInitialize() sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: iBody->MopInitialize(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Synchronous function used to instruct the Output Port to create a buffer. sl@0: @param aBufferSize sl@0: The size of the buffer to be created. sl@0: @return A pointer to the newly created buffer. sl@0: */ sl@0: EXPORT_C CMMFBuffer* COmxOutputPort::MopCreateBuffer(TInt aBufferSize) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopCreateBuffer(aBufferSize); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Synchronous function used to instruct the OpenMAX Output Port to use the buffer sl@0: passed in the function's argument. sl@0: @param aBuffer sl@0: The buffer to be used by the OpenMAX Output Port. sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxOutputPort::MopUseBuffer(CMMFBuffer& aBuffer) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopUseBuffer(aBuffer); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Synchronous function used to instruct the OpenMAX Output Port to free the buffer sl@0: passed in the function's argument. sl@0: @param aBuffer sl@0: The buffer to be freed sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxOutputPort::MopFreeBuffer(CMMFBuffer* aBuffer) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopFreeBuffer(aBuffer); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Synchronous function used to request the set up of a tunnel between this Output Port sl@0: and an Input Port. sl@0: @param aInputPortToBeConnectedTo sl@0: Reference to the Input Port to be connected to. sl@0: @param aTunnelFlags sl@0: Control flags for tunneling sl@0: @param aSupplierType sl@0: Specifies the supplier of the buffers for the tunnel. sl@0: @return An error code indicating if the function call was successful. KErrNone on success, otherwise sl@0: another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxOutputPort::MopTunnelRequest(const MMdfInputPort& aInputPortToBeConnectedTo, sl@0: TTunnelFlags& aTunnelFlags, TSupplierType& aSupplierType) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopTunnelRequest(aInputPortToBeConnectedTo, aTunnelFlags, aSupplierType); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Asynchronous function used to read data from the Output Port. sl@0: @param aBuffer sl@0: Reference to the buffer containing data. sl@0: */ sl@0: EXPORT_C void COmxOutputPort::MopReadData(CMMFBuffer& aBuffer) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: iBody->MopReadData(aBuffer); sl@0: } sl@0: sl@0: sl@0: // used only for tunnelling sl@0: /** sl@0: Asynchronous function used to disconnect a tunnelled port, and thus stop the data processing. sl@0: */ sl@0: EXPORT_C void COmxOutputPort::MopDisconnectTunnel() sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: iBody->MopDisconnectTunnel(); sl@0: } sl@0: sl@0: /** sl@0: Asynchronous function used to restart the data processing of a tunnelled port. sl@0: */ sl@0: EXPORT_C void COmxOutputPort::MopRestartTunnel() sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: iBody->MopRestartTunnel(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Synchronous function used to find out if an Output Port is tunnelled or not. sl@0: @return ETrue if the Input Port is tunnelled, EFalse otherwise. sl@0: */ sl@0: EXPORT_C TBool COmxOutputPort::MopIsTunnelled() const sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopIsTunnelled(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Synchronous function used to get the Output Port index sl@0: @return The Input Port index. sl@0: */ sl@0: EXPORT_C TInt COmxOutputPort::MopIndex() const sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopIndex(); sl@0: } sl@0: sl@0: /** sl@0: Synchronous function used to get the size of the buffer(s) used by the Output Port. sl@0: @param The Output Port's buffer size. sl@0: */ sl@0: EXPORT_C TUint32 COmxOutputPort::MopBufferSize() const sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopBufferSize(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: Request extension feature. This is intended to provide additional features. sl@0: @param aUid sl@0: Used to indicate which interface is required. sl@0: @return Standard error code. KErrNotSupported is used to indicate that the particular sl@0: plugin is not used. sl@0: */ sl@0: EXPORT_C TInt COmxOutputPort::MopCreateCustomInterface(TUid aUid) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopCreateCustomInterface(aUid); sl@0: } sl@0: sl@0: /** sl@0: Return previously created extension. sl@0: This returns a custom interface. This should only be used if CreateCustomInterface() has already sl@0: been called for the same UID value. This means that any construction for that interface sl@0: has already been called, and thus this call cannot fail. sl@0: @param aUid sl@0: Used to indicate which interface is required. sl@0: @return The requested interface, or NULL if not known. sl@0: @see MipCreateCustomInterface() sl@0: */ sl@0: EXPORT_C TAny* COmxOutputPort::MopCustomInterface(TUid aUid) sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->MopCustomInterface(aUid); sl@0: } sl@0: sl@0: /** sl@0: Synchronous function used to return the observer for the OpenMAx Output Port. sl@0: @return Pointer to this class obsever sl@0: */ sl@0: EXPORT_C MMdfOutputPortObserver* COmxOutputPort::Observer() const sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->Observer(); sl@0: } sl@0: sl@0: /** sl@0: Synchronous function used to return the OpenMAX Processing Unit this Output Port sl@0: belongs to. sl@0: @return Pointer to the OpenMAX Processing Unit this Output Port belongs to. sl@0: */ sl@0: EXPORT_C COmxProcessingUnit* COmxOutputPort::Component() const sl@0: { sl@0: __ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated)); sl@0: return iBody->Component(); sl@0: } sl@0: sl@0: