os/mm/mmdevicefw/mdf/src/openmax/omxinputport.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 <omxprocessingunit.h>
    17 #include <omxinputport.h>
    18 #include <mdf/mdfpuconfig.h>
    19 #include "omxcomponentbody.h"
    20 #include "omxinputportbody.h"
    21 
    22 _LIT(KOmxInputPort, "OmxInputPort");
    23 
    24 /**
    25 Constructor.
    26 */
    27 EXPORT_C COmxInputPort::COmxInputPort()
    28 	{
    29 	}
    30 
    31 /**
    32 Destructor.
    33 */
    34 EXPORT_C COmxInputPort::~COmxInputPort()
    35 	{
    36 	delete iBody;
    37 	}
    38 	
    39 /**
    40 Class constructor.
    41 */
    42 EXPORT_C void COmxInputPort::ConstructL(TInt aIndex, COmxProcessingUnit* aComponent)
    43 	{
    44 	__ASSERT_ALWAYS(!iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
    45 	iBody = CBody::NewL(aIndex, aComponent, this);
    46 	}
    47 
    48 	
    49 /**
    50 Synchronous function used to configure the OpenMAX Input Port.
    51 @param  aConfiguration
    52 		Holds the configuration parameters for the OpenMAX Input Port.
    53 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
    54 	    nother of the system-wide error codes.
    55 */
    56 EXPORT_C TInt COmxInputPort::MipConfigure(const TPuConfig& aConfig)
    57 	{
    58 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
    59 	return iBody->MipConfigure(aConfig);	
    60 	}	
    61 	
    62 
    63 /**
    64 Synchronous method which gets a configuration structure for the OpenMAX Input Port
    65 @param  aConfig
    66 		The reference to the structure that is to contain the configuration information.
    67 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
    68 	    another of the system-wide error codes.	
    69 */
    70 EXPORT_C TInt COmxInputPort::MipGetConfig(TPuConfig& aConfig)
    71 	{
    72 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
    73 	return iBody->MipGetConfig(aConfig);	
    74 	}	
    75 
    76 
    77 /**
    78 Synchronous function used to initialise the OpenMAX Input Port.
    79 */
    80 EXPORT_C void COmxInputPort::MipInitialize()
    81 	{	
    82 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
    83 	iBody->MipInitialize();
    84 	}
    85 
    86 
    87 /**
    88 Synchronous function used to instruct the OpenMAX Input Port to create a buffer. 
    89 @param  aBufferSize
    90 		The size of the buffer to be created.
    91 @return A pointer to the new created buffer.
    92 */
    93 EXPORT_C CMMFBuffer* COmxInputPort::MipCreateBuffer(TInt aBufferSize)
    94 	{
    95 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
    96 	return iBody->MipCreateBuffer(aBufferSize);
    97 	}
    98 
    99 
   100 /**
   101 Synchronous function used to instruct the OpenMAX Input Port to use the buffer 
   102 passed in the function's argument. 
   103 @param  aBuffer
   104 		The buffer to be used by the Input Port.
   105 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
   106 	    another of the system-wide error codes.
   107 */
   108 EXPORT_C TInt COmxInputPort::MipUseBuffer(CMMFBuffer& aBuffer)
   109 	{
   110 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   111 	return iBody->MipUseBuffer(aBuffer);		
   112 	}
   113 
   114 
   115 /**
   116 Synchronous function used to instruct the OpenMAX Input Port to free the buffer given
   117 passed in the function's argument. 
   118 @param  aBuffer
   119 		The buffer to be freed
   120 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
   121 	    another of the system-wide error codes.
   122 */	
   123 EXPORT_C TInt COmxInputPort::MipFreeBuffer(CMMFBuffer* aBuffer)
   124 	{
   125 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   126 	return iBody->MipFreeBuffer(aBuffer);		
   127 	}
   128 
   129 
   130 /**
   131 Synchronous function used to request the set up of a tunnel between this OpenMAX Input Port
   132 and an OpenMAX Output Port.
   133 @param  aOutputPortToBeConnectedTo
   134 		Reference to the Output Port to be connected to.
   135 @param  aTunnelFlags
   136 		Control flags for tunneling
   137 @param  aSupplierType
   138 		Specifies the supplier of the buffers for the tunnel.
   139 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
   140 	    another of the system-wide error codes.
   141 */
   142 EXPORT_C TInt COmxInputPort::MipTunnelRequest(const MMdfOutputPort& aOutputPortToBeConnectedTo,
   143 		TTunnelFlags& aTunnelFlags, TSupplierType& aSupplierType) 
   144 	{
   145 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   146 	return iBody->MipTunnelRequest(aOutputPortToBeConnectedTo, aTunnelFlags, aSupplierType);
   147 	}
   148 	
   149 
   150 /**
   151 Asynchronous function used to write data to the OpenMAX Input Port.
   152 @param  aBuffer
   153 		Reference to the buffer containing data.
   154 */		 
   155 EXPORT_C void COmxInputPort::MipWriteData(CMMFBuffer& aInputBuffer)
   156 	{
   157 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   158 	iBody->MipWriteData(aInputBuffer);	
   159 	}
   160 
   161 
   162 /**
   163 Asynchronous function used to disconnect a tunnelled port, and thus stop the data processing.
   164 */
   165 EXPORT_C void COmxInputPort::MipDisconnectTunnel()
   166 	{
   167 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   168 	iBody->MipDisconnectTunnel();
   169 	}
   170 
   171 /**
   172 Asynchronous function used to restart the data processing of a tunnelled port.
   173 */		 
   174 EXPORT_C void COmxInputPort::MipRestartTunnel()
   175 	{
   176 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   177 	iBody->MipRestartTunnel();
   178 	}		
   179 
   180 	
   181 /**
   182 Synchronous function used to find out if an OpenMAX Input Port is tunnelled or not.
   183 @return ETrue if the Input Port is tunnelled, EFalse otherwise.
   184 */		
   185 EXPORT_C TBool COmxInputPort::MipIsTunnelled() const
   186 	{
   187 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   188 	return iBody->MipIsTunnelled();
   189 	}
   190 
   191 
   192 /**
   193 Synchronous function used to get the OpenMAX Input Port index
   194 @return The OpenMAX Input Port index.
   195 */
   196 EXPORT_C TInt COmxInputPort::MipIndex() const
   197 	{
   198 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   199 	return iBody->MipIndex();
   200 	}
   201 	
   202 	 
   203 /**
   204 Synchronous function used to get the size of the buffer(s) used by the OpenMAX Input Port.
   205 @param The OpenMAX Input Port's buffer size.
   206 */		 
   207 EXPORT_C TUint32 COmxInputPort::MipBufferSize() const
   208 	{
   209 	return iBody->MipBufferSize();
   210 	}
   211 
   212 
   213 /**
   214 Synchronous function used to set the observer for the OpenMAX Input Port. 
   215 @param  aOutputPortObserver
   216 		The observer of the OpenMAX Input Port.
   217 */
   218 EXPORT_C void COmxInputPort::MipSetObserver(const MMdfInputPortObserver& aOutputPortObserver)
   219 	{
   220 	iBody->MipSetObserver(aOutputPortObserver);
   221 	}
   222 
   223 /**
   224 Request extension feature. This is intended to provide additional features. 
   225 @param  aUid
   226 	    Used to indicate which interface is required. 
   227 @return Standard error code. KErrNotSupported is used to indicate that the particular
   228 	    plugin is not used.
   229 */
   230 EXPORT_C TInt COmxInputPort::MipCreateCustomInterface(TUid aUid)
   231 	{
   232 	return iBody->MipCreateCustomInterface(aUid);	
   233 	}
   234 		 	 
   235 /**
   236 Return previously created extension.
   237 This returns a custom interface. This should only be used if CreateCustomInterface() has already
   238 been called for the same UID value. This means that any construction for that interface
   239 has already been called, and thus this call cannot fail.
   240 @param aUid
   241 	   Used to indicate which interface is required. 
   242 @return The requested interface, or NULL if not known.
   243 @see MipCreateCustomInterface()
   244 */
   245 EXPORT_C TAny* COmxInputPort::MipCustomInterface(TUid aUid)
   246 	{
   247 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   248 	return MipCustomInterface(aUid);
   249 	}
   250 	
   251 /**
   252 Synchronous function used to return the observer for the OpenMAx Input Port.
   253 @return Pointer to this class obsever
   254 */	
   255 EXPORT_C MMdfInputPortObserver* COmxInputPort::Observer() const
   256 	{
   257 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   258 	return iBody->Observer();
   259 	}
   260 
   261 /**
   262 Synchronous function used to return the OpenMAX Processing Unit this Input Port
   263 belongs to. 
   264 @return Pointer to the OpenMAX Processing Unit this Input Port belongs to. 
   265 */	
   266 EXPORT_C COmxProcessingUnit* COmxInputPort::Component() const
   267 	{
   268 	__ASSERT_ALWAYS(iBody, User::Panic(KOmxInputPort, EBodyNotCreated));
   269 	return iBody->Component();
   270 	}