112 { |
112 { |
113 aFile.Close(); |
113 aFile.Close(); |
114 } |
114 } |
115 |
115 |
116 TInt err = aFile.Open( iFs, aUri, EFileRead | EFileShareReadersOrWriters ); |
116 TInt err = aFile.Open( iFs, aUri, EFileRead | EFileShareReadersOrWriters ); |
117 HandleOpenFileHandleL( err ); |
117 |
|
118 // |
|
119 // Check if RFile64 is needed |
|
120 // |
|
121 if ( err == KErrTooBig ) |
|
122 { |
|
123 User::Leave( KErrTooBig ); |
|
124 } |
|
125 else if ( err != KErrNone ) |
|
126 { |
|
127 CheckForStreamingUrlL( aUri ); |
|
128 } |
118 } |
129 } |
119 |
130 |
120 // ---------------------------------------------------------------------------- |
131 // ---------------------------------------------------------------------------- |
121 // Initializes a clip for playback from a file name |
132 // Initializes a clip for playback from a file name |
122 // ---------------------------------------------------------------------------- |
133 // ---------------------------------------------------------------------------- |
123 // |
134 // |
124 void CMPXVideoHelixPlayback::InitialiseL( const TDesC& aSong ) |
135 void CMPXVideoHelixPlayback::InitialiseL( const TDesC& aSong ) |
125 { |
136 { |
126 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL()"), |
137 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL()"), |
127 _L("aSong %S"), &aSong ); |
138 _L("aSong %S"), &aSong ); |
|
139 |
|
140 InitialiseWithPositionL( aSong ); |
|
141 } |
|
142 |
|
143 |
|
144 // ---------------------------------------------------------------------------- |
|
145 // Initializes a clip for playback from a file name with position |
|
146 // ---------------------------------------------------------------------------- |
|
147 // |
|
148 void CMPXVideoHelixPlayback::InitialiseWithPositionL( const TDesC& aSong, TInt aPosition ) |
|
149 { |
|
150 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL()"), |
|
151 _L("aSong %S, aPosition %d"), &aSong, aPosition ); |
128 |
152 |
129 RFile fileHandle; |
153 RFile fileHandle; |
130 |
154 |
131 CleanupClosePushL( fileHandle ); |
155 CleanupClosePushL( fileHandle ); |
132 |
156 |
133 MPX_TRAPD( err, OpenFileHandleL( aSong, fileHandle )); |
157 MPX_TRAPD( err, OpenFileHandleL( aSong, fileHandle )); |
134 |
158 |
135 if ( err == KErrNone ) |
159 if ( err == KErrNone ) |
136 { |
160 { |
137 iVideoPlaybackCtlr->OpenFileL( aSong, fileHandle ); |
161 iVideoPlaybackCtlr->OpenFileL( aSong, fileHandle, aPosition ); |
138 } |
162 } |
139 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
163 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
140 else if ( err == KErrTooBig ) |
164 else if ( err == KErrTooBig ) |
141 { |
165 { |
142 // |
166 // |
143 // use RFile64 handle |
167 // use RFile64 handle |
144 // |
168 // |
145 RFile64 fileHandle64; |
169 RFile64 fileHandle64; |
146 CleanupClosePushL( fileHandle64 ); |
170 CleanupClosePushL( fileHandle64 ); |
147 |
171 |
148 MPX_TRAPD( err, OpenFileHandle64L( aSong, fileHandle64 )); |
172 MPX_TRAPD( err, OpenFileHandle64L( aSong, fileHandle64 )); |
149 |
173 |
150 if ( err != KErrNone ) |
174 if ( err != KErrNone ) |
151 { |
175 { |
152 // Handle error |
176 // Handle error |
153 iVideoPlaybackCtlr->HandleError( err ); |
177 iVideoPlaybackCtlr->HandleError( err ); |
154 } |
178 } |
155 else |
179 else |
156 { |
180 { |
157 iVideoPlaybackCtlr->OpenFile64L( aSong, fileHandle64 ); |
181 iVideoPlaybackCtlr->OpenFile64L( aSong, fileHandle64, aPosition ); |
158 } |
182 } |
159 |
183 |
160 CleanupStack::PopAndDestroy(); // fileHandle64 |
184 CleanupStack::PopAndDestroy(); // fileHandle64 |
161 } |
185 } |
162 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
186 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
163 else |
187 else |
164 { |
188 { |
165 // Handle error |
189 // Handle error |
166 iVideoPlaybackCtlr->HandleError( err ); |
190 iVideoPlaybackCtlr->HandleError( err ); |
167 } |
191 } |
168 |
192 |
169 CleanupStack::PopAndDestroy(); // fileHandle |
193 CleanupStack::PopAndDestroy(); // fileHandle |
170 } |
194 } |
171 |
195 |
172 // ---------------------------------------------------------------------------- |
196 // ---------------------------------------------------------------------------- |
173 // Initializes a clip for playback from a file handle |
197 // Initializes a clip for playback from a file handle |
174 // ---------------------------------------------------------------------------- |
198 // ---------------------------------------------------------------------------- |
175 // |
199 // |
176 void CMPXVideoHelixPlayback::InitialiseL( RFile& aSong ) |
200 void CMPXVideoHelixPlayback::InitialiseL( RFile& aSong ) |
177 { |
201 { |
178 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL( RFile )")); |
202 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL( RFile )")); |
|
203 |
|
204 InitialiseWithPositionL( aSong ); |
|
205 } |
|
206 |
|
207 // ---------------------------------------------------------------------------- |
|
208 // Initializes a clip for playback from a file handle with position |
|
209 // ---------------------------------------------------------------------------- |
|
210 // |
|
211 void CMPXVideoHelixPlayback::InitialiseWithPositionL( RFile& aSong, TInt aPosition ) |
|
212 { |
|
213 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseWithPositionL( RFile )"), |
|
214 _L("aPosition %d"), aPosition ); |
179 |
215 |
180 TFileName filename; |
216 TFileName filename; |
181 aSong.FullName( filename ); |
217 aSong.FullName( filename ); |
182 |
218 |
183 iVideoPlaybackCtlr->OpenFileL( filename, aSong ); |
219 iVideoPlaybackCtlr->OpenFileL( filename, aSong, aPosition ); |
184 } |
220 } |
185 |
221 |
186 |
222 |
187 // ---------------------------------------------------------------------------- |
223 // ---------------------------------------------------------------------------- |
188 // Initializes a clip for playback from a file name |
224 // Initializes a clip for playback from a file name |
189 // ---------------------------------------------------------------------------- |
225 // ---------------------------------------------------------------------------- |
190 // |
226 // |
191 void CMPXVideoHelixPlayback::InitStreamingL( const TDesC& aUri, |
227 void CMPXVideoHelixPlayback::InitStreamingL( const TDesC& aUri, |
192 const TDesC8& /*aType*/, |
228 const TDesC8& /*aType*/, |
193 TInt aAccessPoint ) |
229 TInt aAccessPoint, |
|
230 TInt aPosition ) |
194 { |
231 { |
195 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL()"), |
232 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL()"), |
196 _L("aUri %S, aType %d"), &aUri, aAccessPoint ); |
233 _L("aUri %S, aAccessPoint %d, aPosition %d"), &aUri, aAccessPoint, aPosition ); |
197 |
234 |
198 RFile fileHandle; |
235 RFile fileHandle; |
199 |
236 |
200 CleanupClosePushL( fileHandle ); |
237 CleanupClosePushL( fileHandle ); |
201 |
238 |
206 // Handle error |
243 // Handle error |
207 iVideoPlaybackCtlr->HandleError( err ); |
244 iVideoPlaybackCtlr->HandleError( err ); |
208 } |
245 } |
209 else |
246 else |
210 { |
247 { |
211 iVideoPlaybackCtlr->OpenFileL( aUri, fileHandle, aAccessPoint ); |
248 iVideoPlaybackCtlr->OpenFileL( aUri, fileHandle, aPosition, aAccessPoint ); |
212 } |
249 } |
213 |
250 |
214 CleanupStack::PopAndDestroy(); |
251 CleanupStack::PopAndDestroy(); |
215 } |
252 } |
216 |
253 |
217 // ---------------------------------------------------------------------------- |
254 // ---------------------------------------------------------------------------- |
218 // Initializes a clip for playback from a file handle |
255 // Initializes a clip for playback from a file handle |
219 // ---------------------------------------------------------------------------- |
256 // ---------------------------------------------------------------------------- |
220 // |
257 // |
221 void CMPXVideoHelixPlayback::InitStreamingL( RFile& aFile, TInt aAccessPoint ) |
258 void CMPXVideoHelixPlayback::InitStreamingL( RFile& aFile, TInt aAccessPoint, TInt aPosition ) |
222 { |
259 { |
223 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL( RFile )")); |
260 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL( RFile )"), |
|
261 _L("aAccessPoint = %d, aPosition = %d"), aAccessPoint, aPosition ); |
224 |
262 |
225 TFileName filename; |
263 TFileName filename; |
226 aFile.FullName( filename ); |
264 aFile.FullName( filename ); |
227 |
265 |
228 iVideoPlaybackCtlr->OpenFileL( filename, aFile, aAccessPoint ); |
266 iVideoPlaybackCtlr->OpenFileL( filename, aFile, aPosition, aAccessPoint ); |
229 } |
267 } |
230 |
268 |
231 // ---------------------------------------------------------------------------- |
269 // ---------------------------------------------------------------------------- |
232 // Executes a command on the selected song |
270 // Executes a command on the selected song |
233 // ---------------------------------------------------------------------------- |
271 // ---------------------------------------------------------------------------- |
313 void CMPXVideoHelixPlayback::CancelRequest() |
351 void CMPXVideoHelixPlayback::CancelRequest() |
314 { |
352 { |
315 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::CancelRequest()")); |
353 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::CancelRequest()")); |
316 } |
354 } |
317 |
355 |
318 // ---------------------------------------------------------------------------- |
356 // ------------------------------------------------------------------------------------------------ |
319 // Handle Open File Handle |
357 // CMPXVideoHelixPlayback::CheckForStreamingUrlL() |
320 // ---------------------------------------------------------------------------- |
358 // ------------------------------------------------------------------------------------------------ |
321 // |
359 // |
322 void CMPXVideoHelixPlayback::HandleOpenFileHandleL( TInt aError ) |
360 void CMPXVideoHelixPlayback::CheckForStreamingUrlL( const TDesC& aUri ) |
323 { |
361 { |
324 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::HandleOpenFileHandleL()")); |
362 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::CMPXVideoHelixPlayback::CheckForStreamingUrlL()")); |
325 |
363 |
326 // |
364 CMediaRecognizer* recognizer = CMediaRecognizer::NewL(); |
327 // Remap KErrNotReady to KErrNotFound, because it is referencing a drive |
365 CleanupStack::PushL( recognizer ); |
328 // that is not existent |
366 |
329 // |
367 if ( ! recognizer->IsValidStreamingPrefix( aUri ) ) |
330 if ( aError == KErrNotReady ) |
368 { |
331 { |
369 User::LeaveIfError( KErrNotFound ); |
332 aError = KErrNotFound; |
370 } |
333 } |
371 |
334 |
372 CleanupStack::PopAndDestroy( recognizer ); |
335 MPX_DEBUG(_L("CMPXVideoHelixPlayback::HandleOpenFileHandleL() Open error = %d"), aError); |
|
336 |
|
337 // |
|
338 // if aSong is an streaming link and contains one of the streaming schemas |
|
339 // eg. rtsp:// , http:// etc. then a file handle can not be opened |
|
340 // ignore KErrBadName |
|
341 // |
|
342 if ( aError != KErrBadName ) |
|
343 { |
|
344 User::LeaveIfError( aError ); |
|
345 } |
|
346 } |
373 } |
347 |
374 |
348 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
375 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
349 |
376 |
350 // ------------------------------------------------------------------------------------------------ |
377 // ------------------------------------------------------------------------------------------------ |
361 { |
388 { |
362 aFile.Close(); |
389 aFile.Close(); |
363 } |
390 } |
364 |
391 |
365 TInt err = aFile.Open( iFs, aUri, EFileRead | EFileShareReadersOrWriters ); |
392 TInt err = aFile.Open( iFs, aUri, EFileRead | EFileShareReadersOrWriters ); |
366 HandleOpenFileHandleL( err ); |
393 |
|
394 if ( err != KErrNone ) |
|
395 { |
|
396 CheckForStreamingUrlL( aUri ); |
|
397 } |
367 } |
398 } |
368 |
399 |
369 // ---------------------------------------------------------------------------- |
400 // ---------------------------------------------------------------------------- |
370 // Initializes a clip for playback from a 64-bit file handle |
401 // Initializes a clip for playback from a 64-bit file handle |
371 // ---------------------------------------------------------------------------- |
402 // ---------------------------------------------------------------------------- |
372 // |
403 // |
373 void CMPXVideoHelixPlayback::Initialise64L( RFile64& aSong ) |
404 void CMPXVideoHelixPlayback::Initialise64L( RFile64& aSong, TInt aPosition ) |
374 { |
405 { |
375 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::Initialise64L( RFile64 )")); |
406 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::Initialise64L( RFile64 )"), |
376 |
407 _L("aPosition %d"), aPosition ); |
377 TFileName filename; |
408 TFileName filename; |
378 aSong.FullName( filename ); |
409 aSong.FullName( filename ); |
379 |
410 |
380 iVideoPlaybackCtlr->OpenFile64L( filename, aSong ); |
411 iVideoPlaybackCtlr->OpenFile64L( filename, aSong, aPosition ); |
381 } |
412 } |
382 |
413 |
383 // ---------------------------------------------------------------------------- |
414 // ---------------------------------------------------------------------------- |
384 // Initializes a clip for playback from a 64-bit file handle |
415 // Initializes a clip for playback from a 64-bit file handle |
385 // ---------------------------------------------------------------------------- |
416 // ---------------------------------------------------------------------------- |
386 // |
417 // |
387 void CMPXVideoHelixPlayback::InitStreaming64L( RFile64& aFile, TInt aAccessPoint ) |
418 void CMPXVideoHelixPlayback::InitStreaming64L( RFile64& aFile, TInt aAccessPoint, TInt aPosition ) |
388 { |
419 { |
389 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreaming64L( RFile64 )")); |
420 MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreaming64L( RFile64 )"), |
|
421 _L("aAccessPoint = %d, aPosition %d"), aAccessPoint, aPosition ); |
390 |
422 |
391 TFileName filename; |
423 TFileName filename; |
392 aFile.FullName( filename ); |
424 aFile.FullName( filename ); |
393 |
425 |
394 iVideoPlaybackCtlr->OpenFile64L( filename, aFile, aAccessPoint ); |
426 iVideoPlaybackCtlr->OpenFile64L( filename, aFile, aPosition, aAccessPoint ); |
395 } |
427 } |
396 |
428 |
397 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
429 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
398 |
430 |
399 // End of file |
431 // End of file |