os/mm/mmdevicefw/mdf/src/openmax/omxoutputport.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <omxoutputport.h>
    17 #include <omxprocessingunit.h>
    18 #include <mdf/mdfpuconfig.h>
    19 #include "omxcomponentbody.h"
    20 #include "omxoutputportbody.h"
    21 
    22 _LIT(KOmxOutputPort, "OmxOutputPort");
    23 
    24 /**
    25 Constructor
    26 */
    27 EXPORT_C COmxOutputPort::COmxOutputPort()
    28 	{
    29 	}
    30 
    31 /**
    32 Destructor
    33 */	
    34 EXPORT_C COmxOutputPort::~COmxOutputPort()
    35 	{
    36 	delete iBody;
    37 	}	
    38 	
    39 /**
    40 Called by an Input Port when MipWriteData() has completed.
    41 @param  aInputPort
    42 		The Input Port which sent the callback.
    43 @param  aBuffer
    44 		The data buffer which was written.
    45 @param  aErrorCode
    46 		An error code indicating if the function call was successful. KErrNone on success, otherwise
    47 	 	another of the system-wide error codes. 
    48 */
    49 EXPORT_C void COmxOutputPort::MipoWriteDataComplete(const MMdfInputPort* aInputPort,
    50 		CMMFBuffer* aBuffer, TInt aErrorCode)
    51 	{
    52 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
    53 	iBody->MipoWriteDataComplete(aInputPort, aBuffer, aErrorCode);
    54 	}
    55 
    56 /**
    57 Called by an Input Port when MipDisconnectTunnel() has completed.
    58 @param  aInputPort
    59 		The Input Port which sent the callback.
    60 @param  aErrorCode
    61 		An error code indicating if the function call was successful. KErrNone on success, otherwise
    62 	 	another of the system-wide error codes. 
    63 */
    64 EXPORT_C void COmxOutputPort::MipoDisconnectTunnelComplete(const MMdfInputPort* aInputPort,
    65 		TInt aErrorCode)
    66 	{
    67 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
    68 	iBody->MipoDisconnectTunnelComplete(aInputPort, aErrorCode);
    69 	}	
    70 		
    71 /**
    72 Called by an Input Port when MipRestartTunnel() has completed.
    73 @param  aInputPort
    74 		The Input Port which sent the callback.
    75 @param  aErrorCode
    76 		An error code indicating if the function call was successful. KErrNone on success, otherwise
    77 	 	another of the system-wide error codes. 
    78 */
    79 EXPORT_C void COmxOutputPort::MipoRestartTunnelComplete(const MMdfInputPort* aInputPort,
    80 		TInt aErrorCode)
    81 	{
    82 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
    83 	iBody->MipoRestartTunnelComplete(aInputPort, aErrorCode);
    84 	}
    85 
    86 /**
    87 ConstructL. Must be used by derived class to create the component
    88 */
    89 EXPORT_C void COmxOutputPort::ConstructL(TInt aIndex, COmxProcessingUnit* aComponent)
    90 	{
    91 	__ASSERT_ALWAYS(!iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
    92 	iBody = CBody::NewL(aIndex, aComponent, this);
    93 	}
    94 
    95 
    96 /**
    97 Synchronous function used to set the observer for the OpenMAX Output Port. 
    98 @param  aOutputPortObserver
    99 The observer of the Output Port.
   100 */
   101 EXPORT_C void COmxOutputPort::MopSetObserver(const MMdfOutputPortObserver& aOutputPortObserver) 
   102 	{
   103 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   104 	iBody->MopSetObserver(aOutputPortObserver);
   105 	}
   106 
   107 /**
   108 Synchronous function used to configure the OpenMAX Output Port.
   109 @param  aConfig
   110 		Holds the configuration parameters for the Output Port.
   111 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
   112 	    another of the system-wide error codes.
   113 */
   114 EXPORT_C TInt COmxOutputPort::MopConfigure(const TPuConfig&  aConfig)
   115 	{
   116 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   117 	return iBody->MopConfigure(aConfig);	
   118 	}
   119 	
   120 
   121 /**
   122 Synchronous method which gets a configuration structure for the Output Port
   123 @param  aConfig
   124 		The reference to the structure that is to contain the configuration information
   125 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
   126 	    another of the system-wide error codes.	
   127 */
   128 EXPORT_C TInt COmxOutputPort::MopGetConfig(TPuConfig& aConfig)
   129 	{
   130 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   131 	return iBody->MopGetConfig(aConfig);	
   132 	}		
   133 
   134 	
   135 /**
   136 Synchronous function used to initialise the OpenMAX Output Port.
   137 */	
   138 EXPORT_C void COmxOutputPort::MopInitialize()	
   139  	{
   140 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   141  	iBody->MopInitialize();
   142  	}
   143 	
   144 
   145 /**
   146 Synchronous function used to instruct the Output Port to create a buffer. 
   147 @param  aBufferSize
   148 		The size of the buffer to be created.
   149 @return A pointer to the newly created buffer.
   150 */		
   151 EXPORT_C CMMFBuffer* COmxOutputPort::MopCreateBuffer(TInt aBufferSize)
   152 	{
   153 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   154 	return iBody->MopCreateBuffer(aBufferSize);
   155 	}
   156 
   157 
   158 /**
   159 Synchronous function used to instruct the OpenMAX Output Port to use the buffer 
   160 passed in the function's argument. 
   161 @param  aBuffer
   162 		The buffer to be used by the OpenMAX Output Port.
   163 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
   164 	    another of the system-wide error codes.
   165 */	
   166 EXPORT_C TInt COmxOutputPort::MopUseBuffer(CMMFBuffer& aBuffer)
   167 	{
   168 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   169 	return iBody->MopUseBuffer(aBuffer);	
   170 	}
   171 	
   172 
   173 /**
   174 Synchronous function used to instruct the OpenMAX Output Port to free the buffer
   175 passed in the function's argument. 
   176 @param  aBuffer
   177 		The buffer to be freed
   178 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
   179 	    another of the system-wide error codes.
   180 */
   181 EXPORT_C TInt COmxOutputPort::MopFreeBuffer(CMMFBuffer* aBuffer)
   182 	{
   183 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   184 	return iBody->MopFreeBuffer(aBuffer);	
   185 	}
   186 	 
   187 	 
   188 /**
   189 Synchronous function used to request the set up of a tunnel between this Output Port
   190 and an Input Port.
   191 @param  aInputPortToBeConnectedTo
   192 		Reference to the Input Port to be connected to.
   193 @param  aTunnelFlags
   194 		Control flags for tunneling
   195 @param  aSupplierType
   196 		Specifies the supplier of the buffers for the tunnel.
   197 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
   198 	    another of the system-wide error codes.
   199 */
   200 EXPORT_C TInt COmxOutputPort::MopTunnelRequest(const MMdfInputPort& aInputPortToBeConnectedTo,
   201 		TTunnelFlags& aTunnelFlags, TSupplierType& aSupplierType) 
   202 	{
   203 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   204 	return iBody->MopTunnelRequest(aInputPortToBeConnectedTo, aTunnelFlags, aSupplierType);
   205 	}
   206 
   207 
   208 /**
   209 Asynchronous function used to read data from the Output Port.
   210 @param  aBuffer
   211 		Reference to the buffer containing data.
   212 */
   213 EXPORT_C void COmxOutputPort::MopReadData(CMMFBuffer& aBuffer)
   214 	{
   215 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   216 	iBody->MopReadData(aBuffer);	
   217 	}
   218 
   219 
   220 // used only for tunnelling
   221 /**
   222 Asynchronous function used to disconnect a tunnelled port, and thus stop the data processing.
   223 */
   224 EXPORT_C void COmxOutputPort::MopDisconnectTunnel()
   225 	{
   226 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   227 	iBody->MopDisconnectTunnel();
   228 	}
   229 
   230 /**
   231 Asynchronous function used to restart the data processing of a tunnelled port.
   232 */
   233 EXPORT_C void COmxOutputPort::MopRestartTunnel()
   234 	{
   235 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   236 	iBody->MopRestartTunnel();
   237 	}
   238 
   239 
   240 /**
   241 Synchronous function used to find out if an Output Port is tunnelled or not.
   242 @return ETrue if the Input Port is tunnelled, EFalse otherwise.
   243 */
   244 EXPORT_C TBool COmxOutputPort::MopIsTunnelled() const
   245 	{
   246 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   247 	return iBody->MopIsTunnelled();
   248 	}
   249 
   250 
   251 /**
   252 Synchronous function used to get the Output Port index
   253 @return The Input Port index.
   254 */
   255 EXPORT_C TInt COmxOutputPort::MopIndex() const
   256 	{
   257 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   258 	return iBody->MopIndex();
   259 	}
   260 	 
   261 /**
   262 Synchronous function used to get the size of the buffer(s) used by the Output Port.
   263 @param The Output Port's buffer size.
   264 */
   265 EXPORT_C TUint32 COmxOutputPort::MopBufferSize() const
   266 	{
   267 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   268 	return iBody->MopBufferSize();
   269 	}
   270 
   271 
   272 /**
   273 Request extension feature. This is intended to provide additional features. 
   274 @param  aUid
   275 	    Used to indicate which interface is required. 
   276 @return Standard error code. KErrNotSupported is used to indicate that the particular
   277 	    plugin is not used.
   278 */
   279 EXPORT_C TInt COmxOutputPort::MopCreateCustomInterface(TUid aUid)
   280 	{
   281 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   282 	return iBody->MopCreateCustomInterface(aUid);
   283 	}
   284 
   285 /**
   286 Return previously created extension.
   287 This returns a custom interface. This should only be used if CreateCustomInterface() has already
   288 been called for the same UID value. This means that any construction for that interface
   289 has already been called, and thus this call cannot fail.
   290 @param aUid
   291 	   Used to indicate which interface is required. 
   292 @return The requested interface, or NULL if not known.
   293 @see MipCreateCustomInterface()
   294 */
   295 EXPORT_C TAny* COmxOutputPort::MopCustomInterface(TUid aUid)
   296 	{
   297 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   298 	return iBody->MopCustomInterface(aUid);	
   299 	}
   300 
   301 /**
   302 Synchronous function used to return the observer for the OpenMAx Output Port.
   303 @return Pointer to this class obsever
   304 */		
   305 EXPORT_C MMdfOutputPortObserver* COmxOutputPort::Observer() const
   306 	{
   307 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   308 	return iBody->Observer();
   309 	}
   310 	
   311 /**
   312 Synchronous function used to return the OpenMAX Processing Unit this Output Port
   313 belongs to. 
   314 @return Pointer to the OpenMAX Processing Unit this Output Port belongs to. 
   315 */
   316 EXPORT_C COmxProcessingUnit* COmxOutputPort::Component() const
   317 	{
   318 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxOutputPort, EBodyNotCreated));
   319 	return iBody->Component();
   320 	}
   321 	
   322