os/mm/mmdevicefw/mdf/src/openmax/omxinputportbody.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
// omxinputport.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <omxprocessingunit.h>
sl@0
    19
#include <omxinputport.h>
sl@0
    20
#include <mdf/mdfpuconfig.h>
sl@0
    21
#include "omxcomponentbody.h"
sl@0
    22
#include "omxinputportbody.h"
sl@0
    23
sl@0
    24
_LIT(KOmxInputPort, "OmxInputPortBody");
sl@0
    25
sl@0
    26
COmxInputPort::CBody* COmxInputPort::CBody::NewL(TInt aIndex, COmxProcessingUnit* aComponent, COmxInputPort* aParent)
sl@0
    27
	{
sl@0
    28
	return new (ELeave) CBody(aIndex, aComponent, aParent);	
sl@0
    29
	}  
sl@0
    30
sl@0
    31
COmxInputPort::CBody::CBody(TInt aIndex, COmxProcessingUnit* aComponent, COmxInputPort* aParent) :
sl@0
    32
	iPortIndex(aIndex),
sl@0
    33
	iComponent(aComponent),	
sl@0
    34
	iParent(aParent)
sl@0
    35
	{
sl@0
    36
	}
sl@0
    37
	
sl@0
    38
TInt COmxInputPort::CBody::MipConfigure(const TPuConfig& /*aConfig*/)
sl@0
    39
	{
sl@0
    40
	return KErrNotSupported;	
sl@0
    41
	}	
sl@0
    42
	
sl@0
    43
TInt COmxInputPort::CBody::MipGetConfig(TPuConfig& /*aConfig*/)
sl@0
    44
	{
sl@0
    45
	return KErrNotSupported;	
sl@0
    46
	}	
sl@0
    47
sl@0
    48
void COmxInputPort::CBody::MipInitialize()
sl@0
    49
	{	
sl@0
    50
	}
sl@0
    51
sl@0
    52
CMMFBuffer* COmxInputPort::CBody::MipCreateBuffer(TInt aBufferSize)
sl@0
    53
	{
sl@0
    54
	CMMFBuffer* buffer = NULL;
sl@0
    55
	TInt err = KErrNone;
sl@0
    56
	TRAP(err, buffer = Component()->OmxAllocateBufferL(iPortIndex, aBufferSize));	
sl@0
    57
	return buffer;
sl@0
    58
	}
sl@0
    59
sl@0
    60
TInt COmxInputPort::CBody::MipUseBuffer(CMMFBuffer& aBuffer)
sl@0
    61
	{
sl@0
    62
	return Component()->OmxUseBuffer(&aBuffer, iPortIndex);		
sl@0
    63
	}
sl@0
    64
sl@0
    65
TInt COmxInputPort::CBody::MipFreeBuffer(CMMFBuffer* aBuffer)
sl@0
    66
	{
sl@0
    67
	return Component()->OmxFreeBuffer(aBuffer);		
sl@0
    68
	}
sl@0
    69
sl@0
    70
TInt COmxInputPort::CBody::MipTunnelRequest(const MMdfOutputPort& /*aOutputPortToBeConnectedTo*/,
sl@0
    71
		TTunnelFlags& /*aTunnelFlags*/, TSupplierType& /*aSupplierType*/) 
sl@0
    72
	{
sl@0
    73
	return KErrNotSupported;
sl@0
    74
	}
sl@0
    75
	
sl@0
    76
void COmxInputPort::CBody::MipWriteData(CMMFBuffer& aInputBuffer)
sl@0
    77
	{
sl@0
    78
	Component()->OmxEmptyThisBuffer(&aInputBuffer, this);	
sl@0
    79
	}
sl@0
    80
sl@0
    81
void COmxInputPort::CBody::MipDisconnectTunnel()
sl@0
    82
	{
sl@0
    83
	// here, as this can reasonably be called by the device adapter
sl@0
    84
	// during unloading of a PU which has been loaded but never initialised,
sl@0
    85
	// we use a conditional instead of an ASSERT	
sl@0
    86
	if(iObserver) 
sl@0
    87
		{
sl@0
    88
		iObserver->MipoDisconnectTunnelComplete(iParent, KErrNone);
sl@0
    89
		}
sl@0
    90
	}
sl@0
    91
sl@0
    92
void COmxInputPort::CBody::MipRestartTunnel()
sl@0
    93
	{
sl@0
    94
	__ASSERT_ALWAYS(iObserver, User::Panic(KOmxInputPort, EObserverNotSet));
sl@0
    95
sl@0
    96
	iObserver->MipoRestartTunnelComplete(iParent, KErrNone);
sl@0
    97
	}		
sl@0
    98
sl@0
    99
TBool COmxInputPort::CBody::MipIsTunnelled() const
sl@0
   100
	{
sl@0
   101
	if (!iConnectedPort)
sl@0
   102
		{
sl@0
   103
		return EFalse;
sl@0
   104
		}		
sl@0
   105
	return ETrue;
sl@0
   106
	}
sl@0
   107
sl@0
   108
TInt COmxInputPort::CBody::MipIndex() const
sl@0
   109
	{
sl@0
   110
	return iPortIndex;
sl@0
   111
	}
sl@0
   112
	
sl@0
   113
TUint32 COmxInputPort::CBody::MipBufferSize() const
sl@0
   114
	{
sl@0
   115
	OMX_PARAM_PORTDEFINITIONTYPE portInfo;
sl@0
   116
	portInfo.nPortIndex = 0;
sl@0
   117
	Component()->OmxGetParameter(OMX_IndexParamPortDefinition, &portInfo);	
sl@0
   118
	return portInfo.nBufferSize;
sl@0
   119
	}
sl@0
   120
sl@0
   121
void COmxInputPort::CBody::MipSetObserver(const MMdfInputPortObserver& aOutputPortObserver)
sl@0
   122
	{
sl@0
   123
	iObserver = const_cast<MMdfInputPortObserver*>(&aOutputPortObserver);
sl@0
   124
	}
sl@0
   125
sl@0
   126
TInt COmxInputPort::CBody::EmptyBufferDone(OMX_HANDLETYPE /*aComponent*/, const CMMFBuffer* aBuffer)
sl@0
   127
	{
sl@0
   128
	__ASSERT_ALWAYS(iObserver, User::Panic(KOmxInputPort, EObserverNotSet));
sl@0
   129
sl@0
   130
	iObserver->MipoWriteDataComplete(iParent, const_cast<CMMFBuffer*>(aBuffer),KErrNone);
sl@0
   131
	return KErrNone;
sl@0
   132
	}
sl@0
   133
sl@0
   134
TInt COmxInputPort::CBody::MipCreateCustomInterface(TUid /*aUid*/)
sl@0
   135
	{
sl@0
   136
	return KErrNotSupported;	
sl@0
   137
	}
sl@0
   138
		 
sl@0
   139
TAny* COmxInputPort::CBody::MipCustomInterface(TUid /*aUid*/)
sl@0
   140
	{
sl@0
   141
	return NULL;
sl@0
   142
	}
sl@0
   143
	
sl@0
   144
MMdfInputPortObserver* COmxInputPort::CBody::Observer() const
sl@0
   145
	{
sl@0
   146
	return iObserver;
sl@0
   147
	}
sl@0
   148
sl@0
   149
COmxProcessingUnit* COmxInputPort::CBody::Component() const
sl@0
   150
	{
sl@0
   151
	return iComponent;
sl@0
   152
	}