author | vnuitven <> |
Mon, 06 Sep 2010 18:50:40 +0530 | |
branch | rcs |
changeset 50 | 1d8943dd8be6 |
parent 49 | 64c62431ac08 |
permissions | -rw-r--r-- |
49 | 1 |
/* |
50
1d8943dd8be6
changed copy right year to 2010 for all newly added files
vnuitven <>
parents:
49
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
49 | 3 |
* All rights reserved. |
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Provides a comfort noise generator class |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "mccmsrpsink.h" |
|
21 |
#include "mmccinterfacedef.h" |
|
22 |
#include "mccmsrpsourcesinklogs.h" |
|
23 |
#include "mccinternalevents.h" |
|
24 |
#include "mccinternaldef.h" |
|
25 |
||
26 |
// CONSTANTS |
|
27 |
||
28 |
// ============================ MEMBER FUNCTIONS =============================== |
|
29 |
||
30 |
// ----------------------------------------------------------------------------- |
|
31 |
// CMccMsrpSink::NewSinkL |
|
32 |
// ----------------------------------------------------------------------------- |
|
33 |
// |
|
34 |
MDataSink* CMccMsrpSink::NewSinkL( TUid /*aImplementationUid*/, |
|
35 |
const TDesC8& /*aInitData*/ ) |
|
36 |
{ |
|
37 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::NewSinkL" ) |
|
38 |
||
39 |
CMccMsrpSink* self = new ( ELeave ) CMccMsrpSink(); |
|
40 |
return static_cast<MDataSink*>( self ); |
|
41 |
} |
|
42 |
||
43 |
// ----------------------------------------------------------------------------- |
|
44 |
// CMccMsrpSink::ConstructSinkL |
|
45 |
// ----------------------------------------------------------------------------- |
|
46 |
// |
|
47 |
void CMccMsrpSink::ConstructSinkL( const TDesC8& /*aInitData*/ ) |
|
48 |
{ |
|
49 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::ConstructSinkL" ) |
|
50 |
iDataSender = CMccMsrpDataSender::NewL(); |
|
51 |
} |
|
52 |
||
53 |
// ----------------------------------------------------------------------------- |
|
54 |
// CMccMsrpSink::CMccMsrpSink |
|
55 |
// ----------------------------------------------------------------------------- |
|
56 |
// |
|
57 |
CMccMsrpSink::CMccMsrpSink() : CMccDataSink( KMccMsrpSinkUid ) |
|
58 |
{ |
|
59 |
} |
|
60 |
||
61 |
// ----------------------------------------------------------------------------- |
|
62 |
// CMccMsrpSink::~CMccMsrpSink |
|
63 |
// ----------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
CMccMsrpSink::~CMccMsrpSink() |
|
66 |
{ |
|
67 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::~CMccMsrpSink" ) |
|
68 |
delete iDataSender; |
|
69 |
} |
|
70 |
||
71 |
// ----------------------------------------------------------------------------- |
|
72 |
// CMccMsrpSink::SinkPrimeL |
|
73 |
// ----------------------------------------------------------------------------- |
|
74 |
// |
|
75 |
void CMccMsrpSink::SinkPrimeL() |
|
76 |
{ |
|
77 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SinkPrimeL" ) |
|
78 |
||
79 |
SendStreamEventToClient( KMccStreamPrepared ); |
|
80 |
} |
|
81 |
||
82 |
// ----------------------------------------------------------------------------- |
|
83 |
// CMccMsrpSink::SinkPlayL() |
|
84 |
// ----------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
void CMccMsrpSink::SinkPlayL() |
|
87 |
{ |
|
88 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SinkPlayL" ) |
|
89 |
||
90 |
if ( iPaused ) |
|
91 |
{ |
|
92 |
SendStreamEventToClient( KMccStreamResumed ); |
|
93 |
} |
|
94 |
else |
|
95 |
{ |
|
96 |
SendStreamEventToClient( KMccStreamStarted ); |
|
97 |
} |
|
98 |
||
99 |
iPaused = EFalse; |
|
100 |
} |
|
101 |
||
102 |
// ----------------------------------------------------------------------------- |
|
103 |
// CMccMsrpSink::SinkPauseL() |
|
104 |
// |
|
105 |
// Pauses streaming by cancelling timers |
|
106 |
// ----------------------------------------------------------------------------- |
|
107 |
// |
|
108 |
void CMccMsrpSink::SinkPauseL() |
|
109 |
{ |
|
110 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SinkPauseL" ) |
|
111 |
||
112 |
iPaused = ETrue; |
|
113 |
||
114 |
SendStreamEventToClient( KMccStreamPaused ); |
|
115 |
} |
|
116 |
||
117 |
// ----------------------------------------------------------------------------- |
|
118 |
// CMccMsrpSink::SinkStopL() |
|
119 |
// |
|
120 |
// Stops streaming |
|
121 |
// ----------------------------------------------------------------------------- |
|
122 |
// |
|
123 |
void CMccMsrpSink::SinkStopL() |
|
124 |
{ |
|
125 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SinkStopL" ) |
|
126 |
||
127 |
SendStreamEventToClient( KMccStreamStopped ); |
|
128 |
} |
|
129 |
||
130 |
// ----------------------------------------------------------------------------- |
|
131 |
// CMccMsrpSink::SinkDataTypeCode |
|
132 |
// ----------------------------------------------------------------------------- |
|
133 |
// |
|
134 |
TFourCC CMccMsrpSink::SinkDataTypeCode( TMediaId /*aMediaId*/ ) |
|
135 |
{ |
|
136 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SinkDataTypeCode" ) |
|
137 |
||
138 |
return iFourCC; |
|
139 |
} |
|
140 |
||
141 |
// ----------------------------------------------------------------------------- |
|
142 |
// CMccMsrpSink::SetSinkDataTypeCode |
|
143 |
// ----------------------------------------------------------------------------- |
|
144 |
// |
|
145 |
TInt CMccMsrpSink::SetSinkDataTypeCode( TFourCC aCodec, |
|
146 |
TMediaId /*aMediaId*/ ) |
|
147 |
{ |
|
148 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SetSinkDataTypeCode" ) |
|
149 |
||
150 |
iFourCC = aCodec; |
|
151 |
||
152 |
return KErrNone; |
|
153 |
} |
|
154 |
||
155 |
// ----------------------------------------------------------------------------- |
|
156 |
// CMccMsrpSink::BufferEmptiedL |
|
157 |
// ----------------------------------------------------------------------------- |
|
158 |
// |
|
159 |
void CMccMsrpSink::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ ) |
|
160 |
{ |
|
161 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::BufferEmptiedL" ) |
|
162 |
||
163 |
User::Leave( KErrNotSupported ); |
|
164 |
} |
|
165 |
||
166 |
// ----------------------------------------------------------------------------- |
|
167 |
// CMccMsrpSink::CanCreateSinkBuffer |
|
168 |
// ----------------------------------------------------------------------------- |
|
169 |
// |
|
170 |
TBool CMccMsrpSink::CanCreateSinkBuffer() |
|
171 |
{ |
|
172 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::CanCreateSinkBuffer" ) |
|
173 |
||
174 |
return EFalse; |
|
175 |
} |
|
176 |
||
177 |
// ----------------------------------------------------------------------------- |
|
178 |
// CMccMsrpSink::CreateSinkBufferL |
|
179 |
// ----------------------------------------------------------------------------- |
|
180 |
// |
|
181 |
CMMFBuffer* CMccMsrpSink::CreateSinkBufferL( |
|
182 |
TMediaId /*aMediaId*/, |
|
183 |
TBool& /*aReference*/ ) |
|
184 |
{ |
|
185 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::CreateSinkBufferL" ) |
|
186 |
||
187 |
User::Leave( KErrNotSupported ); |
|
188 |
||
189 |
return NULL; |
|
190 |
} |
|
191 |
||
192 |
// ----------------------------------------------------------------------------- |
|
193 |
// CMccMsrpSink::SinkThreadLogon |
|
194 |
// ----------------------------------------------------------------------------- |
|
195 |
// |
|
196 |
TInt CMccMsrpSink::SinkThreadLogon( MAsyncEventHandler& aEventHandler ) |
|
197 |
{ |
|
198 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SinkThreadLogon" ) |
|
199 |
||
200 |
iAsyncEventHandler = &aEventHandler; |
|
201 |
||
202 |
return KErrNone; |
|
203 |
} |
|
204 |
||
205 |
// ----------------------------------------------------------------------------- |
|
206 |
// CMccMsrpSink::SinkThreadLogoff |
|
207 |
// ----------------------------------------------------------------------------- |
|
208 |
// |
|
209 |
void CMccMsrpSink::SinkThreadLogoff() |
|
210 |
{ |
|
211 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SinkThreadLogoff" ) |
|
212 |
iAsyncEventHandler = NULL; |
|
213 |
} |
|
214 |
||
215 |
// ----------------------------------------------------------------------------- |
|
216 |
// CMccMsrpSink::EmptyBufferL |
|
217 |
// ----------------------------------------------------------------------------- |
|
218 |
// |
|
219 |
void CMccMsrpSink::EmptyBufferL( CMMFBuffer* aBuffer, |
|
220 |
MDataSource* aProvider, |
|
221 |
TMediaId /*aMediaId*/ ) |
|
222 |
{ |
|
223 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::EmptyBufferL" ) |
|
224 |
__ASSERT_ALWAYS( aBuffer, User::Leave( KErrArgument ) ); |
|
225 |
__ASSERT_ALWAYS( aProvider, User::Leave( KErrArgument ) ); |
|
226 |
||
227 |
CMMFDataBuffer* dataBuffer = static_cast<CMMFDataBuffer*>( aBuffer ); |
|
228 |
const TDesC8& data = dataBuffer->Data(); |
|
229 |
iDataSender->SendL( data, iMsrpSession ); |
|
230 |
aProvider->BufferEmptiedL( aBuffer ); |
|
231 |
} |
|
232 |
||
233 |
// ----------------------------------------------------------------------------- |
|
234 |
// CMccMsrpSink::BufferFilledL |
|
235 |
// ----------------------------------------------------------------------------- |
|
236 |
// |
|
237 |
void CMccMsrpSink::BufferFilledL( CMMFBuffer* /*aBuffer*/ ) |
|
238 |
{ |
|
239 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::BufferFilledL" ) |
|
240 |
||
241 |
User::Leave( KErrNotSupported ); |
|
242 |
} |
|
243 |
||
244 |
||
245 |
// ----------------------------------------------------------------------------- |
|
246 |
// CMccMsrpSink::BufferFilledL |
|
247 |
// ----------------------------------------------------------------------------- |
|
248 |
// |
|
249 |
void CMccMsrpSink::SetSessionParamsL( const TMccMsrpSessionParams& aParams ) |
|
250 |
{ |
|
251 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SetSessionParamsL IN" ) |
|
252 |
||
253 |
User::LeaveIfNull( aParams.iMsrp ); |
|
254 |
User::LeaveIfNull( aParams.iMsrpSession ); |
|
255 |
||
256 |
iMsrp = aParams.iMsrp; |
|
257 |
iMsrpSession = aParams.iMsrpSession; |
|
258 |
||
259 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SetSessionParamsL OUT" ) |
|
260 |
} |
|
261 |
||
262 |
// ----------------------------------------------------------------------------- |
|
263 |
// CMccMsrpSink::SendStreamEventToClient |
|
264 |
// ----------------------------------------------------------------------------- |
|
265 |
// |
|
266 |
void CMccMsrpSink::SendStreamEventToClient( |
|
267 |
const TMccEventType& aEventType, |
|
268 |
TInt aError ) |
|
269 |
{ |
|
270 |
__MSRPSOURCESINK_CONTROLL( "CMccMsrpSink::SendStreamEventToClient" ) |
|
271 |
||
272 |
if ( iAsyncEventHandler ) |
|
273 |
{ |
|
274 |
TMccEvent event( 0, |
|
275 |
0, |
|
276 |
0, |
|
277 |
MCC_ENDPOINT_ID( static_cast<MDataSink*>( this ) ), |
|
278 |
KMccEventCategoryStream, |
|
279 |
aEventType, |
|
280 |
aError, |
|
281 |
KNullDesC8 ); |
|
282 |
||
283 |
TMccInternalEvent internalEvent( KMccMsrpSinkUid, |
|
284 |
EMccInternalEventNone, |
|
285 |
event ); |
|
286 |
||
287 |
iAsyncEventHandler->SendEventToClient( internalEvent ); |
|
288 |
} |
|
289 |
} |
|
290 |
||
291 |
// End of file |
|
292 |