0
|
1 |
// Copyright (c) 2007-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 <ecom/implementationproxy.h>
|
|
17 |
#include <ecom/ecom.h>
|
|
18 |
#include <f32file.h>
|
|
19 |
#include "audiobufferprefilltestdevice.h"
|
|
20 |
#include "devsoundciutestdevices.hrh"
|
|
21 |
|
|
22 |
const TInt32 KTenSeconds = 10000000; // Ten seconds
|
|
23 |
|
|
24 |
/*
|
|
25 |
CMMFSampleBuffering Implementation
|
|
26 |
*/
|
|
27 |
CMMFSampleBuffering* CMMFSampleBuffering::NewL()
|
|
28 |
{
|
|
29 |
CMMFSampleBuffering* self = new(ELeave) CMMFSampleBuffering();
|
|
30 |
CleanupStack::PushL(self);
|
|
31 |
self->ConstructL();
|
|
32 |
CleanupStack::Pop(self);
|
|
33 |
return self;
|
|
34 |
}
|
|
35 |
|
|
36 |
CMMFSampleBuffering::CMMFSampleBuffering() : CActive(0)
|
|
37 |
{
|
|
38 |
CActiveScheduler::Add(this);
|
|
39 |
}
|
|
40 |
|
|
41 |
void CMMFSampleBuffering::ConstructL()
|
|
42 |
{
|
|
43 |
User::LeaveIfError( iTimer.CreateLocal() );
|
|
44 |
}
|
|
45 |
|
|
46 |
CMMFSampleBuffering::~CMMFSampleBuffering()
|
|
47 |
{
|
|
48 |
iTimer.Close();
|
|
49 |
Cancel();
|
|
50 |
}
|
|
51 |
|
|
52 |
//Actual implementation of method MmsbEnableSampleBufferingBeforePlayback
|
|
53 |
TInt CMMFSampleBuffering::MmsbEnableSampleBufferingBeforePlayback()
|
|
54 |
{
|
|
55 |
return KErrNone;
|
|
56 |
}
|
|
57 |
|
|
58 |
//Actual implementation of method MmsbDisableSampleBufferingBeforePlayback
|
|
59 |
TInt CMMFSampleBuffering::MmsbDisableSampleBufferingBeforePlayback()
|
|
60 |
{
|
|
61 |
return KErrNone;
|
|
62 |
}
|
|
63 |
|
|
64 |
//Actual implementation of method MmsbNotifyPlayStarted
|
|
65 |
void CMMFSampleBuffering::MmsbNotifyPlayStarted(TRequestStatus& aStatus)
|
|
66 |
{
|
|
67 |
// check not already active
|
|
68 |
ASSERT(!IsActive());
|
|
69 |
|
|
70 |
iClientStatus = &aStatus;
|
|
71 |
*iClientStatus = KRequestPending;
|
|
72 |
|
|
73 |
iTimer.After(iStatus, KTenSeconds);
|
|
74 |
|
|
75 |
SetActive();
|
|
76 |
}
|
|
77 |
|
|
78 |
//Actual implementation of method MmsbCancelNotifyPlayStarted
|
|
79 |
void CMMFSampleBuffering::MmsbCancelNotifyPlayStarted()
|
|
80 |
{
|
|
81 |
CActive::Cancel();
|
|
82 |
}
|
|
83 |
|
|
84 |
//Actual implementation of method RunL
|
|
85 |
void CMMFSampleBuffering::RunL()
|
|
86 |
{
|
|
87 |
TRequestStatus* status = iClientStatus;
|
|
88 |
User::RequestComplete(status, KErrNotSupported);
|
|
89 |
}
|
|
90 |
|
|
91 |
//Actual implementation of method DoCancel
|
|
92 |
void CMMFSampleBuffering::DoCancel()
|
|
93 |
{
|
|
94 |
iTimer.Cancel();
|
|
95 |
TRequestStatus* status = iClientStatus;
|
|
96 |
User::RequestComplete(status, KErrCancel);
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
/*
|
|
101 |
CSampleBufferingTestDevice Implementation
|
|
102 |
*/
|
|
103 |
CMMFHwDevice* CSampleBufferingTestDevice::NewL()
|
|
104 |
{
|
|
105 |
CSampleBufferingTestDevice* self=new(ELeave) CSampleBufferingTestDevice();
|
|
106 |
CleanupStack::PushL(self);
|
|
107 |
self->ConstructL();
|
|
108 |
CleanupStack::Pop(self);
|
|
109 |
return self;
|
|
110 |
}
|
|
111 |
|
|
112 |
CSampleBufferingTestDevice::~CSampleBufferingTestDevice()
|
|
113 |
{
|
|
114 |
delete iSampleBuffering;
|
|
115 |
}
|
|
116 |
|
|
117 |
CSampleBufferingTestDevice::CSampleBufferingTestDevice()
|
|
118 |
{
|
|
119 |
}
|
|
120 |
|
|
121 |
void CSampleBufferingTestDevice::ConstructL()
|
|
122 |
{
|
|
123 |
}
|
|
124 |
|
|
125 |
TInt CSampleBufferingTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
|
|
126 |
{
|
|
127 |
return 0;
|
|
128 |
}
|
|
129 |
|
|
130 |
TInt CSampleBufferingTestDevice::Stop()
|
|
131 |
{
|
|
132 |
return 0;
|
|
133 |
}
|
|
134 |
|
|
135 |
TInt CSampleBufferingTestDevice::Pause()
|
|
136 |
{
|
|
137 |
return 0;
|
|
138 |
}
|
|
139 |
|
|
140 |
TInt CSampleBufferingTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
|
|
141 |
{
|
|
142 |
return 0;
|
|
143 |
}
|
|
144 |
|
|
145 |
TAny* CSampleBufferingTestDevice::CustomInterface(TUid aInterfaceId)
|
|
146 |
{
|
|
147 |
// Just return something non-NULL to keep the
|
|
148 |
// DevSound initialisation process happy
|
|
149 |
TAny* ret = static_cast<TAny*>(this);
|
|
150 |
|
|
151 |
// Now for the CIs we want to test...
|
|
152 |
if (aInterfaceId == KUidSampleBuffering)
|
|
153 |
{
|
|
154 |
if (!iSampleBuffering)
|
|
155 |
{
|
|
156 |
TRAPD(err, iSampleBuffering = CMMFSampleBuffering::NewL());
|
|
157 |
if (err == KErrNone && iSampleBuffering)
|
|
158 |
{
|
|
159 |
MMMFSampleBuffering* ptr = this;
|
|
160 |
ret = static_cast<TAny*>(ptr);
|
|
161 |
}
|
|
162 |
else
|
|
163 |
{
|
|
164 |
ret = NULL;
|
|
165 |
}
|
|
166 |
}
|
|
167 |
}
|
|
168 |
|
|
169 |
return ret;
|
|
170 |
}
|
|
171 |
|
|
172 |
TInt CSampleBufferingTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
|
|
173 |
{
|
|
174 |
return 0;
|
|
175 |
}
|
|
176 |
|
|
177 |
TInt CSampleBufferingTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
|
|
178 |
{
|
|
179 |
return 0;
|
|
180 |
}
|
|
181 |
|
|
182 |
TInt CSampleBufferingTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
|
|
183 |
{
|
|
184 |
return 0;
|
|
185 |
}
|
|
186 |
|
|
187 |
TInt CSampleBufferingTestDevice::StopAndDeleteCodec()
|
|
188 |
{
|
|
189 |
return 0;
|
|
190 |
}
|
|
191 |
|
|
192 |
TInt CSampleBufferingTestDevice::DeleteCodec()
|
|
193 |
{
|
|
194 |
return 0;
|
|
195 |
}
|
|
196 |
|
|
197 |
CMMFSwCodec& CSampleBufferingTestDevice::Codec()
|
|
198 |
{
|
|
199 |
return *iCodec;
|
|
200 |
}
|
|
201 |
|
|
202 |
TInt CSampleBufferingTestDevice::MmsbEnableSampleBufferingBeforePlayback()
|
|
203 |
{
|
|
204 |
TInt result = KErrBadHandle;
|
|
205 |
|
|
206 |
if (iSampleBuffering)
|
|
207 |
{
|
|
208 |
result = iSampleBuffering->MmsbEnableSampleBufferingBeforePlayback();
|
|
209 |
}
|
|
210 |
|
|
211 |
return result;
|
|
212 |
}
|
|
213 |
|
|
214 |
TInt CSampleBufferingTestDevice::MmsbDisableSampleBufferingBeforePlayback()
|
|
215 |
{
|
|
216 |
TInt result = KErrBadHandle;
|
|
217 |
|
|
218 |
if (iSampleBuffering)
|
|
219 |
{
|
|
220 |
result = iSampleBuffering->MmsbDisableSampleBufferingBeforePlayback();
|
|
221 |
}
|
|
222 |
|
|
223 |
return result;
|
|
224 |
}
|
|
225 |
|
|
226 |
void CSampleBufferingTestDevice::MmsbNotifyPlayStarted(TRequestStatus& aStatus)
|
|
227 |
{
|
|
228 |
if (iSampleBuffering)
|
|
229 |
{
|
|
230 |
iSampleBuffering->MmsbNotifyPlayStarted(aStatus);
|
|
231 |
}
|
|
232 |
}
|
|
233 |
|
|
234 |
void CSampleBufferingTestDevice::MmsbCancelNotifyPlayStarted()
|
|
235 |
{
|
|
236 |
if (iSampleBuffering)
|
|
237 |
{
|
|
238 |
iSampleBuffering->MmsbCancelNotifyPlayStarted();
|
|
239 |
}
|
|
240 |
}
|