|
1 /* |
|
2 * Copyright (c) 2002-2007 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: This class is used for playing video. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <mmf/server/mmffile.h> |
|
20 #include <jdebug.h> |
|
21 |
|
22 #include "cmmavideoplayer.h" |
|
23 #include "mmmadisplay.h" |
|
24 #include "cmmaeventsource.h" |
|
25 #include "cmmasurfacewindow.h" |
|
26 |
|
27 // CONSTANTS |
|
28 const TInt KErrorMessageSize = 32; |
|
29 _LIT(KVideoControlName, "VideoControl"); |
|
30 _LIT(KAccMonError, "Accessory monitor Error: %d"); |
|
31 |
|
32 CMMAVideoPlayer* CMMAVideoPlayer::NewLC( |
|
33 CMMAMMFResolver* aResolver) |
|
34 { |
|
35 CMMAVideoPlayer* self = |
|
36 new(ELeave) CMMAVideoPlayer(aResolver); |
|
37 CleanupStack::PushL(self); |
|
38 self->ConstructL(); |
|
39 return self; |
|
40 } |
|
41 |
|
42 CMMAVideoPlayer::~CMMAVideoPlayer() |
|
43 { |
|
44 DEBUG("MMA::CMMAVideoPlayer::~CMMAVideoPlayer"); |
|
45 |
|
46 // Window is not able to send any |
|
47 // callback requests to UI from now. |
|
48 if (iSurfaceWindow) |
|
49 { |
|
50 iSurfaceWindow->SetDisplay(NULL); |
|
51 } |
|
52 |
|
53 if (iDisplay && iDisplay->HasContainer()) |
|
54 { |
|
55 // Window will delete itself |
|
56 // after all pending events are processed |
|
57 // (lazy delete) |
|
58 iDisplay->UIGetCallback( |
|
59 *iSurfaceWindow, CMMASurfaceWindow::EDestroyWindow); |
|
60 } |
|
61 else |
|
62 { |
|
63 delete iSurfaceWindow; |
|
64 } |
|
65 |
|
66 if (iDisplay) |
|
67 { |
|
68 TRAPD(err, iDisplay->SetWindowL(NULL)); |
|
69 if (err != KErrNone) |
|
70 { |
|
71 __ASSERT_DEBUG(EFalse, User::Invariant()); |
|
72 } |
|
73 } |
|
74 |
|
75 iAccMonCapabilityArray.Close(); |
|
76 delete iAccMonitor; |
|
77 delete iEmptySnapshotImage; |
|
78 delete iActiveSchedulerWait; |
|
79 } |
|
80 |
|
81 CMMAVideoPlayer::CMMAVideoPlayer( |
|
82 CMMAMMFResolver* aResolver): |
|
83 CMMAAudioPlayer(aResolver), |
|
84 iVideoControllerCustomCommands(iController), |
|
85 iVideoPlayControllerCustomCommands(iController), |
|
86 iVideoPlaySurfaceSupportCustomCommands(iController), |
|
87 isHDMICableConnected(EFalse) |
|
88 { |
|
89 iMMASurface.iPrevSurfaceAvailable = EFalse; |
|
90 } |
|
91 |
|
92 void CMMAVideoPlayer::ConstructL() |
|
93 { |
|
94 DEBUG("MMA::CMMAVideoPlayer::ConstructL +"); |
|
95 CMMAAudioPlayer::ConstructL(); |
|
96 iActiveSchedulerWait = new(ELeave)CActiveSchedulerWait; |
|
97 iAccMonitor = CAccMonitor::NewL(); |
|
98 iAccMonCapabilityArray.Append(KAccMonAVDevice); |
|
99 iAccMonitor->StartObservingL(this, iAccMonCapabilityArray); |
|
100 DEBUG("MMA::CMMAVideoPlayer::ConstructL -"); |
|
101 } |
|
102 |
|
103 // static cleanup function |
|
104 static void PointerArrayCleanup(TAny* aArray) |
|
105 { |
|
106 static_cast<RPointerArray<CAccMonitorInfo>*>(aArray)->ResetAndDestroy(); |
|
107 } |
|
108 |
|
109 EXPORT_C void CMMAVideoPlayer::SetPlayerListenerObjectL(jobject aListenerObject, |
|
110 JNIEnv* aJni, |
|
111 MMMAEventPoster* aEventPoster) |
|
112 { |
|
113 CMMAPlayer::SetPlayerListenerObjectL(aListenerObject, |
|
114 aJni, |
|
115 aEventPoster); |
|
116 |
|
117 // this method must be called only ones |
|
118 __ASSERT_DEBUG(!iSurfaceWindow, User::Invariant()); |
|
119 |
|
120 // get audio/video cable connected status |
|
121 TBool avCableConnStatus(EFalse); |
|
122 RConnectedAccessories connectedAccessories; |
|
123 TCleanupItem arrayCleanup(PointerArrayCleanup, |
|
124 &connectedAccessories); |
|
125 CleanupStack::PushL(arrayCleanup); |
|
126 TInt accCount = |
|
127 iAccMonitor->GetConnectedAccessoriesL(connectedAccessories); |
|
128 for (TInt i = 0; i < accCount; i++) |
|
129 { |
|
130 if (KAccMonAVDevice == connectedAccessories[i]->AccDeviceType()) |
|
131 { |
|
132 avCableConnStatus = ETrue; |
|
133 break; |
|
134 } |
|
135 } |
|
136 CleanupStack::PopAndDestroy(); |
|
137 |
|
138 // create window for videoplayer |
|
139 // event poster is always CMMAEventSource type. |
|
140 iSurfaceWindow = CMMASurfaceWindow::NewL( |
|
141 static_cast< CMMAEventSource* >(iEventPoster), |
|
142 this, avCableConnStatus); |
|
143 } |
|
144 |
|
145 EXPORT_C void CMMAVideoPlayer::SetDisplayL(MMMADisplay* aDisplay) |
|
146 { |
|
147 // now it is ready to draw |
|
148 iDisplay = aDisplay; |
|
149 |
|
150 iSurfaceWindow->SetDisplay(aDisplay); |
|
151 |
|
152 iDisplay->SetWindowL(iSurfaceWindow); |
|
153 |
|
154 // if state < prefeteched then we dont know actual source size yet |
|
155 // and it will be set after prefetch |
|
156 if (iState >= EPrefetched) |
|
157 { |
|
158 SourceSizeChanged(); |
|
159 } |
|
160 } |
|
161 void CMMAVideoPlayer::RealizeL() |
|
162 { |
|
163 DEBUG("CMMAVideoPlayer::RealizeL"); |
|
164 // DataSource must have at least 1 stream or |
|
165 // we must have file to play |
|
166 if ((iSourceStreams.Count() == 0) && !iFileName) |
|
167 { |
|
168 User::Leave(KErrNotEnoughStreams); |
|
169 } |
|
170 |
|
171 // If file locator is used, then file is prefetched |
|
172 // in realized state so that FramePositioningControl |
|
173 // can acquire frame count in REALIZED state |
|
174 if (iFileName) |
|
175 { |
|
176 PrefetchFileL(); |
|
177 if (!iActiveSchedulerWait->IsStarted()) |
|
178 { |
|
179 iActiveSchedulerWait->Start(); |
|
180 } |
|
181 // If the player has not changed state during wait, |
|
182 // Then there is an error condition. |
|
183 if (iState != ERealized) |
|
184 { |
|
185 User::Leave(KErrNotSupported); |
|
186 } |
|
187 } |
|
188 else |
|
189 { |
|
190 CMMAPlayer::RealizeL(); |
|
191 } |
|
192 } |
|
193 |
|
194 void CMMAVideoPlayer::PrefetchL() |
|
195 { |
|
196 DEBUG("CMMAVideoPlayer::PrefetchL"); |
|
197 if (iFileName) |
|
198 { |
|
199 // File has already been prefetched when realizing |
|
200 |
|
201 // If initDisplayMode was called before prefetch, |
|
202 // then the display must notified about source size. |
|
203 if (iDisplay) |
|
204 { |
|
205 SourceSizeChanged(); |
|
206 } |
|
207 |
|
208 ChangeState(EPrefetched); |
|
209 PostActionCompleted(KErrNone); |
|
210 } |
|
211 else |
|
212 { |
|
213 // Using TDes -- load the whole video |
|
214 iSourceStreams[ 0 ]->ReadAllL(); |
|
215 } |
|
216 // CMMASourceStream will notify with ReadCompleted |
|
217 } |
|
218 |
|
219 EXPORT_C void CMMAVideoPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData) |
|
220 { |
|
221 DEBUG_INT("CMMAVideoPlayer::ReadCompletedL: status = %d", aStatus); |
|
222 if (aStatus < KErrNone) |
|
223 { |
|
224 PostActionCompleted(aStatus); |
|
225 } |
|
226 else |
|
227 { |
|
228 TRAPD(err, PrefetchDataL(aData)); |
|
229 if (err != KErrNone) |
|
230 { |
|
231 PostActionCompleted(err); |
|
232 } |
|
233 // action completed event will be delivered from handleEvent |
|
234 } |
|
235 } |
|
236 |
|
237 void CMMAVideoPlayer::HandleEvent(const TMMFEvent& aEvent) |
|
238 { |
|
239 DEBUG_INT("MMA:CMMAVideoPlayer::HandleEvent %d", aEvent.iEventType.iUid); |
|
240 |
|
241 // event KMMFEventCategoryPlaybackComplete is handled by both Video |
|
242 // and Audio players. first it should be handled by Video player |
|
243 if (aEvent.iEventType == KMMFEventCategoryPlaybackComplete) |
|
244 { |
|
245 iSurfaceWindow->RemoveSurface(); |
|
246 } |
|
247 |
|
248 // Start player again and ignore error |
|
249 if ((aEvent.iEventType == KMMFEventCategoryVideoPlayerGeneralError) && |
|
250 (aEvent.iErrorCode == KMMVideoBlitError)) |
|
251 { |
|
252 // incase of HDMI cable is inserted, start the player again before ignoring the error otherwise simply ignore |
|
253 if(isHDMICableConnected) |
|
254 { |
|
255 TRAPD(error, StartL(EFalse)); |
|
256 if (KErrNone != error) |
|
257 { |
|
258 DEBUG_INT("MMA:CMMAVideoPlayer::HandleEvent, StartL() error %d", |
|
259 error); |
|
260 } |
|
261 return; |
|
262 } |
|
263 else // no HDMI cable is inserted, Hence ignore the error. |
|
264 { |
|
265 return; |
|
266 } |
|
267 } |
|
268 |
|
269 // KNotCompleteVideoError can be notified when video is not complete |
|
270 // ( missing sound ) but still can be played. Because |
|
271 // CMMAAudioPlayer::HandleEvent fails with all negative error codes, |
|
272 // do not call it with KNotCompleteVideoError error when preparing. |
|
273 if ((aEvent.iErrorCode != KNotCompleteVideoError) || |
|
274 (aEvent.iEventType != KMMFEventCategoryVideoPrepareComplete)) |
|
275 { |
|
276 CMMAAudioPlayer::HandleEvent(aEvent); |
|
277 } |
|
278 |
|
279 if (aEvent.iEventType == KMMFEventCategoryVideoSurfaceCreated) |
|
280 { |
|
281 if (aEvent.iErrorCode == KErrNone) |
|
282 { |
|
283 TSurfaceId surfaceId; |
|
284 TRect cropRect; |
|
285 TVideoAspectRatio pixelAspectRatio; |
|
286 |
|
287 iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters(surfaceId, |
|
288 cropRect, |
|
289 pixelAspectRatio); |
|
290 |
|
291 if (iMMASurface.iPrevSurfaceAvailable) |
|
292 { |
|
293 // free Surface |
|
294 TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iMMASurface.iPrevSurfaceId); |
|
295 if (KErrNone != error) |
|
296 { |
|
297 DEBUG_INT("CMMAVideoPlayer::HandleEvent:SurfaceRemoved error, %d", aEvent.iErrorCode); |
|
298 } |
|
299 } |
|
300 iMMASurface.iPrevSurfaceId = surfaceId; |
|
301 iMMASurface.iPrevSurfaceAvailable = ETrue; |
|
302 |
|
303 iSurfaceWindow->SetSurfaceParameters(surfaceId, |
|
304 cropRect, |
|
305 pixelAspectRatio); |
|
306 |
|
307 DEBUG("CMMAVideoPlayer::HandleEvent: KMMFEventCategoryVideoSurfaceCreated, surface parameters set"); |
|
308 } |
|
309 else |
|
310 { |
|
311 DEBUG_INT("CMMAVideoPlayer::HandleEvent: error getting surface parameters, %d", aEvent.iErrorCode); |
|
312 } |
|
313 } |
|
314 else if (aEvent.iEventType == KMMFEventCategoryVideoSurfaceParametersChanged) |
|
315 { |
|
316 if (aEvent.iErrorCode == KErrNone) |
|
317 { |
|
318 TSurfaceId surfaceId; |
|
319 TRect cropRect; |
|
320 TVideoAspectRatio pixelAspectRatio; |
|
321 |
|
322 iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters(surfaceId, |
|
323 cropRect, |
|
324 pixelAspectRatio); |
|
325 |
|
326 if (iMMASurface.iPrevSurfaceAvailable) |
|
327 { |
|
328 // free Surface |
|
329 TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iMMASurface.iPrevSurfaceId); |
|
330 if (KErrNone != error) |
|
331 { |
|
332 DEBUG_INT("CMMAVideoPlayer::HandleEvent:SurfaceRemoved error, %d", aEvent.iErrorCode); |
|
333 } |
|
334 } |
|
335 iMMASurface.iPrevSurfaceAvailable = ETrue; |
|
336 iMMASurface.iPrevSurfaceId = surfaceId; |
|
337 |
|
338 iSurfaceWindow->SetChangedSurfaceParameters(surfaceId, |
|
339 cropRect, |
|
340 pixelAspectRatio); |
|
341 |
|
342 DEBUG("CMMAVideoPlayer::HandleEvent: KMMFEventCategoryVideoSurfaceParametersChanged"); |
|
343 } |
|
344 else |
|
345 { |
|
346 DEBUG_INT("CMMAVideoPlayer::HandleEvent: surface parameters changed error, %d", aEvent.iErrorCode); |
|
347 } |
|
348 } |
|
349 else if (aEvent.iEventType == KMMFEventCategoryVideoRemoveSurface) |
|
350 { |
|
351 if (aEvent.iErrorCode == KErrNone) |
|
352 { |
|
353 if (iMMASurface.iPrevSurfaceAvailable) |
|
354 { |
|
355 // free Surface |
|
356 TInt error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved(iMMASurface.iPrevSurfaceId); |
|
357 if (KErrNone != error) |
|
358 { |
|
359 DEBUG_INT("CMMAVideoPlayer::HandleEvent:SurfaceRemoved error, %d", aEvent.iErrorCode); |
|
360 } |
|
361 iMMASurface.iPrevSurfaceAvailable = EFalse; |
|
362 } |
|
363 } |
|
364 else |
|
365 { |
|
366 DEBUG_INT("CMMAVideoPlayer::HandleEvent:KMMFEventCategoryVideoRemoveSurface error, %d", aEvent.iErrorCode); |
|
367 } |
|
368 } |
|
369 // video opened, preparing |
|
370 else if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete) |
|
371 { |
|
372 if (aEvent.iErrorCode == KErrNone) |
|
373 { |
|
374 TInt error = iVideoPlaySurfaceSupportCustomCommands.UseSurfaces(); |
|
375 DEBUG_INT("MMA::CMMAVideoPlayer::HandleEvent::After UseSurfaces(), error = %d", error); |
|
376 TInt prepareError(iVideoPlayControllerCustomCommands.Prepare()); |
|
377 if (prepareError != KErrNone) |
|
378 { |
|
379 // opening failed, notifying java |
|
380 PostActionCompleted(prepareError); |
|
381 } |
|
382 } |
|
383 else |
|
384 { |
|
385 // opening failed, notifying java |
|
386 PostActionCompleted(aEvent.iErrorCode); |
|
387 } |
|
388 } |
|
389 // final state of prefetch ( prepare completed ) |
|
390 else if (aEvent.iEventType == KMMFEventCategoryVideoPrepareComplete) |
|
391 { |
|
392 // This callback must be handled differently depending on whether |
|
393 // player is created for a file locator or for a stream. When file |
|
394 // locator is used, this callback is made in realized state. For |
|
395 // stream it is made in prefetched state. |
|
396 PrepareDisplay(); |
|
397 if (iFileName) |
|
398 { |
|
399 DEBUG("CMMAVideoPlayer::HandleEvent: Using filename, change state to REALIZED"); |
|
400 |
|
401 // If there is an error condition, then the player state is not |
|
402 // changed, which indicates the error condition to StartL when |
|
403 // the ActiveSchedulerWait returns. KNotCompleteVideoError is not |
|
404 // considered as an error condition, instead it indicates that some |
|
405 // elements of the media cannot be played (e.g. video OR audio) |
|
406 if (aEvent.iErrorCode == KErrNone || |
|
407 aEvent.iErrorCode == KNotCompleteVideoError) |
|
408 { |
|
409 ChangeState(ERealized); |
|
410 } |
|
411 __ASSERT_DEBUG(iActiveSchedulerWait->IsStarted(), User::Invariant()); |
|
412 iActiveSchedulerWait->AsyncStop(); |
|
413 } |
|
414 else |
|
415 { |
|
416 DEBUG("CMMAVideoPlayer::HandleEvent: Not using filename, change state to PREFETCHED"); |
|
417 CompletePrefetch(aEvent.iErrorCode); |
|
418 } |
|
419 } |
|
420 else // in case of any other event |
|
421 { |
|
422 if (aEvent.iErrorCode != KErrNone) |
|
423 { |
|
424 PostActionCompleted(aEvent.iErrorCode); //some other error |
|
425 } |
|
426 } |
|
427 } |
|
428 |
|
429 void CMMAVideoPlayer::CompletePrefetch(TInt aError) |
|
430 { |
|
431 DEBUG_INT("CMMAVideoPlayer::CompletePrefetch + error = %d",aError); |
|
432 // Post KNotCompleteVideoError as KErrNone to the Java side, because |
|
433 // video can be played. |
|
434 if (aError == KNotCompleteVideoError) |
|
435 { |
|
436 DEBUG("CMMAVideoPlayer::CompletePrefetch KNotCompleteVideoError "); |
|
437 // release java |
|
438 PostActionCompleted(KErrNone); |
|
439 } |
|
440 else |
|
441 { |
|
442 DEBUG("CMMAVideoPlayer::CompletePrefetch CompleteVideoError "); |
|
443 // release java |
|
444 PostActionCompleted(aError); |
|
445 } |
|
446 |
|
447 if (aError == KErrNone || aError == KNotCompleteVideoError) |
|
448 { |
|
449 ChangeState(EPrefetched); |
|
450 } |
|
451 DEBUG("CMMAVideoPlayer::CompletePrefetch - "); |
|
452 } |
|
453 |
|
454 void CMMAVideoPlayer::PrepareDisplay() |
|
455 { |
|
456 DEBUG("CMMAVideoPlayer::PrepareDisplay +"); |
|
457 // construction should have leaved if iSurfaceWindow does not exist |
|
458 __ASSERT_DEBUG(iSurfaceWindow, |
|
459 User::Panic(_L("CMMVideoPlayer::iSurfaceWindow is null"), |
|
460 KErrArgument)); |
|
461 |
|
462 //First place where we are certain that source size can be fetched |
|
463 TSize sourceSize; |
|
464 |
|
465 TInt err = iVideoControllerCustomCommands.GetVideoFrameSize(sourceSize); |
|
466 |
|
467 DEBUG_INT("MID::CMMAVideoPlayer::PrepareDisplay: GetVideoFrameSize err = %d", err); |
|
468 |
|
469 // Still we did not get the size of video |
|
470 if ((err != KErrNone) || |
|
471 (sourceSize.iWidth <= 0) || |
|
472 (sourceSize.iHeight <= 0)) |
|
473 { |
|
474 DEBUG("MID::CMMAVideoPlayer::PrepareDisplay: No sourcesize found, using SurfaceWindow size"); |
|
475 // setting size to window size (client rect) |
|
476 sourceSize = iSurfaceWindow->WindowSize(); |
|
477 } |
|
478 |
|
479 // If 1x1 was got (the default size of form), it must be replaced |
|
480 // with a valid size as controller will not accept 1x1. |
|
481 if ((sourceSize.iWidth < KMMAVideoMinDimension) || |
|
482 (sourceSize.iHeight < KMMAVideoMinDimension)) |
|
483 { |
|
484 DEBUG("MID::CMMAVideoPlayer::PrepareDisplay: Unacceptable source size, using failsafe"); |
|
485 // This is a special case and ought to be used only in |
|
486 // the rare case that real size is not got from stream. |
|
487 sourceSize = TSize(KMMAVideoMinDimension, KMMAVideoMinDimension); |
|
488 } |
|
489 |
|
490 iSourceSize = sourceSize; |
|
491 |
|
492 // If init has been already done |
|
493 if (iDisplay) |
|
494 { |
|
495 DEBUG("MID::CMMAVideoPlayer::PrepareDisplay: display exists, changing source size"); |
|
496 SourceSizeChanged(); |
|
497 } |
|
498 |
|
499 // Setting (in)visible if something has changed the DSA state |
|
500 // (e.g. prepare). If initDisplayMode is not called, this will always |
|
501 // set visibility to false. |
|
502 iSurfaceWindow->SetVisible(iSurfaceWindow->IsVisible(), EFalse); |
|
503 DEBUG("CMMAVideoPlayer::PrepareDisplay -"); |
|
504 } |
|
505 |
|
506 EXPORT_C const TDesC& CMMAVideoPlayer::Type() |
|
507 { |
|
508 return KMMAVideoPlayer; |
|
509 } |
|
510 |
|
511 EXPORT_C TSize CMMAVideoPlayer::SourceSize() |
|
512 { |
|
513 return iSourceSize; |
|
514 } |
|
515 |
|
516 EXPORT_C MMMASnapshot::TEncoding CMMAVideoPlayer::TakeSnapshotL(TRequestStatus* aStatus, |
|
517 const TSize& /*aSize*/, |
|
518 const CMMAImageSettings& /*aSettings*/) |
|
519 { |
|
520 if (iEmptySnapshotImage) |
|
521 { |
|
522 // Ealier snapshot was not got with SnapshotBitmap method. |
|
523 User::Leave(KErrInUse); |
|
524 } |
|
525 // frame can't be got from video player, but TCK requires that it should |
|
526 // be available. So returning empty image |
|
527 iEmptySnapshotImage = new(ELeave) CFbsBitmap(); |
|
528 User::LeaveIfError(iEmptySnapshotImage->Create(TSize(1, 1), |
|
529 EColor4K)); |
|
530 |
|
531 |
|
532 User::RequestComplete(aStatus, KErrNone); |
|
533 |
|
534 // Return raw bitmap encoding and thus SnapshotEncoded() should not |
|
535 // get called later on. |
|
536 return EBitmap; |
|
537 } |
|
538 |
|
539 EXPORT_C CFbsBitmap* CMMAVideoPlayer::SnapshotBitmap() |
|
540 { |
|
541 // snapshot is not supported, returning empty image |
|
542 CFbsBitmap* image = iEmptySnapshotImage; |
|
543 |
|
544 // ownership is transferred to caller |
|
545 iEmptySnapshotImage = NULL; |
|
546 return image; |
|
547 } |
|
548 |
|
549 EXPORT_C HBufC8* CMMAVideoPlayer::SnapshotEncoded() |
|
550 { |
|
551 // This method should never be called. |
|
552 // Asserted in debug build to be sure. |
|
553 __ASSERT_DEBUG(EFalse, User::Invariant()); |
|
554 |
|
555 return NULL; |
|
556 } |
|
557 |
|
558 EXPORT_C void CMMAVideoPlayer::NotifyWithStringEvent( |
|
559 CMMAPlayerEvent::TEventType aEventType, |
|
560 const TDesC& aStringEventData) |
|
561 { |
|
562 PostStringEvent(aEventType, aStringEventData); |
|
563 } |
|
564 |
|
565 EXPORT_C MMMASnapshot* CMMAVideoPlayer::SnapshoterL() |
|
566 { |
|
567 return this; |
|
568 } |
|
569 |
|
570 void CMMAVideoPlayer::SourceSizeChanged() |
|
571 { |
|
572 iDisplay->SourceSizeChanged(iSourceSize); |
|
573 NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName); |
|
574 } |
|
575 |
|
576 void CMMAVideoPlayer::ConnectedL(CAccMonitorInfo* aAccessoryInfo) |
|
577 { |
|
578 TAccMonCapability deviceType = aAccessoryInfo->AccDeviceType() ; |
|
579 DEBUG_INT("MID::CMMAVideoPlayer::ConnectedL %d", deviceType); |
|
580 if (iSurfaceWindow && (deviceType == KAccMonAVDevice)) |
|
581 { |
|
582 isHDMICableConnected = ETrue; |
|
583 iSurfaceWindow->SetAVCableConnStatus(ETrue); |
|
584 } |
|
585 } |
|
586 |
|
587 void CMMAVideoPlayer::DisconnectedL(CAccMonitorInfo* aAccessoryInfo) |
|
588 { |
|
589 TAccMonCapability deviceType = aAccessoryInfo->AccDeviceType() ; |
|
590 DEBUG_INT("MID::CMMAVideoPlayer::DisconnectedL %d", deviceType); |
|
591 if (iSurfaceWindow && (deviceType == KAccMonAVDevice)) |
|
592 { |
|
593 isHDMICableConnected = EFalse; |
|
594 iSurfaceWindow->SetAVCableConnStatus(EFalse); |
|
595 } |
|
596 } |
|
597 |
|
598 void CMMAVideoPlayer::AccMonitorObserverError(TInt aError) |
|
599 { |
|
600 DEBUG_INT("MMA::CMMAVideoPlayer::AccMonitorObserverError %d", aError); |
|
601 TBuf<KErrorMessageSize> errorMessage; |
|
602 errorMessage.Format(KAccMonError, aError); |
|
603 PostStringEvent(CMMAPlayerEvent::EError, errorMessage); |
|
604 } |
|
605 |
|
606 // END OF FILE |