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 |
// omxoutputport.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <omxprocessingunit.h>
|
sl@0
|
19 |
#include <mdf/mdfpuconfig.h>
|
sl@0
|
20 |
#include "omxcomponentbody.h"
|
sl@0
|
21 |
#include "omxoutputportbody.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
COmxOutputPort::CBody* COmxOutputPort::CBody::NewL(TInt aIndex, COmxProcessingUnit* aComponent, COmxOutputPort* aParent)
|
sl@0
|
24 |
{
|
sl@0
|
25 |
return new (ELeave) CBody(aIndex, aComponent, aParent);
|
sl@0
|
26 |
}
|
sl@0
|
27 |
|
sl@0
|
28 |
COmxOutputPort::CBody::CBody(TInt aIndex, COmxProcessingUnit* aComponent, COmxOutputPort* aParent) :
|
sl@0
|
29 |
iPortIndex(aIndex),
|
sl@0
|
30 |
iComponent(aComponent),
|
sl@0
|
31 |
iParent(aParent)
|
sl@0
|
32 |
{
|
sl@0
|
33 |
}
|
sl@0
|
34 |
|
sl@0
|
35 |
void COmxOutputPort::CBody::MopSetObserver(const MMdfOutputPortObserver& aOutputPortObserver)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
iObserver = const_cast<MMdfOutputPortObserver*>(&aOutputPortObserver);
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
void COmxOutputPort::CBody::MipoWriteDataComplete(const MMdfInputPort* /*aInputPort*/,
|
sl@0
|
41 |
CMMFBuffer* aBuffer, TInt /*aErrorCode*/)
|
sl@0
|
42 |
{
|
sl@0
|
43 |
// the parent class read must be called in case it has been overridden in a derived class
|
sl@0
|
44 |
iParent->MopReadData(*aBuffer);
|
sl@0
|
45 |
}
|
sl@0
|
46 |
|
sl@0
|
47 |
void COmxOutputPort::CBody::MipoDisconnectTunnelComplete(const MMdfInputPort* /*aInputPort*/,
|
sl@0
|
48 |
TInt /*aErrorCode*/)
|
sl@0
|
49 |
{
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
void COmxOutputPort::CBody::MipoRestartTunnelComplete(const MMdfInputPort* /*aInputPort*/,
|
sl@0
|
53 |
TInt /*aErrorCode*/)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
}
|
sl@0
|
56 |
|
sl@0
|
57 |
TInt COmxOutputPort::CBody::FillBufferDone(OMX_HANDLETYPE /*aComponent*/, CMMFBuffer* aBuffer)
|
sl@0
|
58 |
{
|
sl@0
|
59 |
__ASSERT_ALWAYS(iObserver, User::Panic(_L("OmxOutputPort"), EObserverNotSet));
|
sl@0
|
60 |
|
sl@0
|
61 |
if (iPortConnectedTo)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
iPortConnectedTo->MipWriteData(*aBuffer);
|
sl@0
|
64 |
}
|
sl@0
|
65 |
else
|
sl@0
|
66 |
{
|
sl@0
|
67 |
if (iObserver)
|
sl@0
|
68 |
{
|
sl@0
|
69 |
iObserver->MopoReadDataComplete(iParent, aBuffer, KErrNone);
|
sl@0
|
70 |
}
|
sl@0
|
71 |
}
|
sl@0
|
72 |
return KErrNone;
|
sl@0
|
73 |
}
|
sl@0
|
74 |
|
sl@0
|
75 |
TInt COmxOutputPort::CBody::MopConfigure(const TPuConfig& /*aConfig*/)
|
sl@0
|
76 |
{
|
sl@0
|
77 |
return KErrNotSupported;
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|
sl@0
|
80 |
TInt COmxOutputPort::CBody::MopGetConfig(TPuConfig& /*aConfig*/)
|
sl@0
|
81 |
{
|
sl@0
|
82 |
return KErrNotSupported;
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
void COmxOutputPort::CBody::MopInitialize()
|
sl@0
|
86 |
{
|
sl@0
|
87 |
if (iPortConnectedTo != NULL)
|
sl@0
|
88 |
{
|
sl@0
|
89 |
iPortConnectedTo->MipSetObserver(*iParent);
|
sl@0
|
90 |
}
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
CMMFBuffer* COmxOutputPort::CBody::MopCreateBuffer(TInt aBufferSize)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
CMMFBuffer* buffer = NULL;
|
sl@0
|
96 |
TInt err = KErrNone;
|
sl@0
|
97 |
TRAP(err, buffer = Component()->OmxAllocateBufferL(iPortIndex, aBufferSize));
|
sl@0
|
98 |
return buffer;
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
TInt COmxOutputPort::CBody::MopUseBuffer(CMMFBuffer& aBuffer)
|
sl@0
|
102 |
{
|
sl@0
|
103 |
if (iPortConnectedTo)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
iPortConnectedTo->MipUseBuffer(aBuffer);
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
return Component()->OmxUseBuffer(&aBuffer, iPortIndex);
|
sl@0
|
109 |
}
|
sl@0
|
110 |
|
sl@0
|
111 |
TInt COmxOutputPort::CBody::MopFreeBuffer(CMMFBuffer* aBuffer)
|
sl@0
|
112 |
{
|
sl@0
|
113 |
return Component()->OmxFreeBuffer(aBuffer);
|
sl@0
|
114 |
}
|
sl@0
|
115 |
|
sl@0
|
116 |
TInt COmxOutputPort::CBody::MopTunnelRequest(const MMdfInputPort& aInputPortToBeConnectedTo,
|
sl@0
|
117 |
TTunnelFlags& aTunnelFlags, TSupplierType& aSupplierType)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
if ((Component()->State()!=EProcessingUnitLoaded) && (!iStopped))
|
sl@0
|
120 |
{
|
sl@0
|
121 |
// invalid state
|
sl@0
|
122 |
return EInvalidState;
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
if (iPortConnectedTo)
|
sl@0
|
126 |
{
|
sl@0
|
127 |
// the port is already connected, return an error
|
sl@0
|
128 |
return EPortAlreadyTunnelled;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
aTunnelFlags = EBufferReadOnly;
|
sl@0
|
131 |
aSupplierType = EBufferSupplyOutput;
|
sl@0
|
132 |
iPortConnectedTo = const_cast<MMdfInputPort*>(&aInputPortToBeConnectedTo);
|
sl@0
|
133 |
|
sl@0
|
134 |
|
sl@0
|
135 |
return KErrNone;
|
sl@0
|
136 |
}
|
sl@0
|
137 |
|
sl@0
|
138 |
void COmxOutputPort::CBody::MopReadData(CMMFBuffer& aBuffer)
|
sl@0
|
139 |
{
|
sl@0
|
140 |
Component()->OmxFillThisBuffer(&aBuffer, this);
|
sl@0
|
141 |
}
|
sl@0
|
142 |
|
sl@0
|
143 |
void COmxOutputPort::CBody::MopDisconnectTunnel()
|
sl@0
|
144 |
{
|
sl@0
|
145 |
if(iObserver)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
iObserver->MopoDisconnectTunnelComplete(iParent, KErrNone);
|
sl@0
|
148 |
}
|
sl@0
|
149 |
}
|
sl@0
|
150 |
|
sl@0
|
151 |
void COmxOutputPort::CBody::MopRestartTunnel()
|
sl@0
|
152 |
{
|
sl@0
|
153 |
}
|
sl@0
|
154 |
|
sl@0
|
155 |
TBool COmxOutputPort::CBody::MopIsTunnelled() const
|
sl@0
|
156 |
{
|
sl@0
|
157 |
if (!iPortConnectedTo)
|
sl@0
|
158 |
{
|
sl@0
|
159 |
return EFalse;
|
sl@0
|
160 |
}
|
sl@0
|
161 |
return ETrue;
|
sl@0
|
162 |
}
|
sl@0
|
163 |
|
sl@0
|
164 |
TInt COmxOutputPort::CBody::MopIndex() const
|
sl@0
|
165 |
{
|
sl@0
|
166 |
return iPortIndex;
|
sl@0
|
167 |
}
|
sl@0
|
168 |
|
sl@0
|
169 |
TUint32 COmxOutputPort::CBody::MopBufferSize() const
|
sl@0
|
170 |
{
|
sl@0
|
171 |
OMX_PARAM_PORTDEFINITIONTYPE portInfo;
|
sl@0
|
172 |
portInfo.nPortIndex = 1;
|
sl@0
|
173 |
Component()->OmxGetParameter(OMX_IndexParamPortDefinition, &portInfo);
|
sl@0
|
174 |
return portInfo.nBufferSize;
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
TInt COmxOutputPort::CBody::MopCreateCustomInterface(TUid /*aUid*/)
|
sl@0
|
178 |
{
|
sl@0
|
179 |
return KErrNotSupported;
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
TAny* COmxOutputPort::CBody::MopCustomInterface(TUid /*aUid*/)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
return NULL;
|
sl@0
|
185 |
}
|
sl@0
|
186 |
|
sl@0
|
187 |
MMdfOutputPortObserver* COmxOutputPort::CBody::Observer() const
|
sl@0
|
188 |
{
|
sl@0
|
189 |
return iObserver;
|
sl@0
|
190 |
}
|
sl@0
|
191 |
|
sl@0
|
192 |
COmxProcessingUnit* COmxOutputPort::CBody::Component() const
|
sl@0
|
193 |
{
|
sl@0
|
194 |
return iComponent;
|
sl@0
|
195 |
}
|