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