|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "mcefilesource.h" |
|
22 #include "mcecomfilesource.h" |
|
23 #include "mceevents.h" |
|
24 #include "mceserial.h" |
|
25 |
|
26 #ifdef MCE_COMMON_SERVER_SIDE |
|
27 |
|
28 #include <mmccinterface.h> |
|
29 #include <utf.h> |
|
30 #include "mcesdpsession.h" |
|
31 #include "mcemediamanager.h" |
|
32 |
|
33 #endif//MCE_COMMON_SERVER_SIDE |
|
34 |
|
35 |
|
36 // ============================ MEMBER FUNCTIONS =============================== |
|
37 |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CMceComFileSource::NewL |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CMceComFileSource* CMceComFileSource::NewL() |
|
44 { |
|
45 CMceComFileSource* self = NewLC(); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CMceComFileSource::NewLC |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 CMceComFileSource* CMceComFileSource::NewLC() |
|
56 { |
|
57 CMceComFileSource* self = new (ELeave) CMceComFileSource(); |
|
58 CleanupStack::PushL( self ); |
|
59 return self; |
|
60 } |
|
61 |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CMceComFileSource::~CMceComFileSource |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CMceComFileSource::~CMceComFileSource() |
|
68 { |
|
69 delete iSettings; |
|
70 } |
|
71 |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CMceComFileSource::CMceComFileSource |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 CMceComFileSource::CMceComFileSource() |
|
78 :CMceComMediaSource( KMceFileSource ), |
|
79 iInitialInfoRetrieved( EFalse ) |
|
80 { |
|
81 } |
|
82 |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CMceComFileSource::InternalizeFlatL |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CMceComFileSource::InternalizeFlatL( RReadStream& aReadStream ) |
|
89 { |
|
90 CMceComMediaSource::InternalizeFlatL( aReadStream ); |
|
91 |
|
92 iFastForward = aReadStream.ReadUint8L(); |
|
93 iFastRewind = aReadStream.ReadUint8L(); |
|
94 |
|
95 TPckgBuf<TTimeIntervalMicroSeconds> positionBuf; |
|
96 MceSerial::DecodeL( positionBuf, aReadStream ); |
|
97 iPosition = positionBuf(); |
|
98 |
|
99 TPckgBuf<TMceFileInfo> fileBuf; |
|
100 MceSerial::DecodeL( fileBuf, aReadStream ); |
|
101 iFileInfo = fileBuf(); |
|
102 |
|
103 TPckgBuf<TMceTranscodeInfo> tcBuf; |
|
104 MceSerial::DecodeL( tcBuf, aReadStream ); |
|
105 iTranscodeInfo = tcBuf(); |
|
106 |
|
107 iInitialInfoRetrieved = static_cast<TBool>( aReadStream.ReadUint8L() ); |
|
108 |
|
109 } |
|
110 |
|
111 |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CMceComFileSource::ExternalizeFlatL |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 void CMceComFileSource::ExternalizeFlatL( RWriteStream& aWriteStream ) |
|
118 { |
|
119 CMceComMediaSource::ExternalizeFlatL( aWriteStream ); |
|
120 |
|
121 aWriteStream.WriteUint8L( iFastForward ); |
|
122 aWriteStream.WriteUint8L( iFastRewind ); |
|
123 |
|
124 TPckgBuf<TTimeIntervalMicroSeconds> positionBuf( iPosition ); |
|
125 MceSerial::EncodeL( positionBuf, aWriteStream ); |
|
126 |
|
127 TPckgBuf<TMceFileInfo> fileBuf( iFileInfo ); |
|
128 MceSerial::EncodeL( fileBuf, aWriteStream ); |
|
129 |
|
130 TPckgBuf<TMceTranscodeInfo> tcBuf( iTranscodeInfo ); |
|
131 MceSerial::EncodeL( tcBuf, aWriteStream ); |
|
132 |
|
133 aWriteStream.WriteUint8L( iInitialInfoRetrieved ); |
|
134 |
|
135 |
|
136 } |
|
137 |
|
138 |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // CMceComFileSource::CloneL |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 CMceComMediaSource* CMceComFileSource::CloneL() |
|
145 { |
|
146 CMceComFileSource* copy = new (ELeave) CMceComFileSource(); |
|
147 Mem::Copy( copy, this, sizeof(CMceComFileSource) ); |
|
148 copy->Zero(); |
|
149 copy->iSettings = NULL; |
|
150 return copy; |
|
151 |
|
152 } |
|
153 |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CMceComFileSource::EventReceivedL |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 TInt CMceComFileSource::EventReceivedL( TMceComEvent& aEvent ) |
|
160 { |
|
161 |
|
162 TInt status = CMceComMediaSource::EventReceivedL( aEvent ); |
|
163 |
|
164 if ( status != KMceEventNotConsumed ) |
|
165 { |
|
166 return status; |
|
167 } |
|
168 |
|
169 if ( aEvent.Id().IsSourceId() ) |
|
170 { |
|
171 status = aEvent.Handler().HandleL( *this, aEvent ); |
|
172 } |
|
173 else |
|
174 { |
|
175 status = KMceEventNotConsumed; |
|
176 } |
|
177 |
|
178 return status; |
|
179 |
|
180 } |
|
181 |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CMceComFileSource::UpdateL |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 void CMceComFileSource::UpdateL( CMceComMediaSource& aUpdate ) |
|
188 { |
|
189 CMceComMediaSource::UpdateL( aUpdate ); |
|
190 CMceComFileSource& update = static_cast<CMceComFileSource&>( aUpdate ); |
|
191 |
|
192 iFastForward = update.iFastForward; |
|
193 iFastRewind = update.iFastRewind; |
|
194 iPosition = update.iPosition; |
|
195 iFileInfo = update.iFileInfo; |
|
196 iTranscodeInfo = update.iTranscodeInfo; |
|
197 |
|
198 } |
|
199 |
|
200 |
|
201 #ifdef MCE_COMMON_SERVER_SIDE |
|
202 |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // CMceComFileSource::MccType |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 const TUid CMceComFileSource::MccType() |
|
209 { |
|
210 return KUidMccFileSource; |
|
211 } |
|
212 |
|
213 // ----------------------------------------------------------------------------- |
|
214 // CMceComFileSource::InitParamL |
|
215 // ----------------------------------------------------------------------------- |
|
216 // |
|
217 const TDesC8& CMceComFileSource::InitParamL( const CMceComCodec& /*aCodec*/ ) |
|
218 { |
|
219 delete iSettings; |
|
220 iSettings = NULL; |
|
221 |
|
222 TPckgBuf<TFileName> settings( iFileInfo.iFileName ); |
|
223 iSettings = settings.AllocL(); |
|
224 |
|
225 return *iSettings; |
|
226 |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // CMceComFileSource::InitializedL |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 void CMceComFileSource::InitializedL() |
|
234 { |
|
235 if ( MediaStream() && MediaStream()->Session() && |
|
236 &MediaStream()->Session()->SdpSession() ) |
|
237 { |
|
238 MediaStream()->Session()->SdpSession().Manager().UpdateConfigKeyL( *this ); |
|
239 } |
|
240 } |
|
241 |
|
242 #endif//MCE_COMMON_SERVER_SIDE |
|
243 |
|
244 |
|
245 |
|
246 |