|
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 #ifndef CMMAVIDEOPLAYER_H |
|
19 #define CMMAVIDEOPLAYER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include "cmmaaudioplayer.h" |
|
23 #include "mmmaguiplayer.h" |
|
24 #include "mmmasnapshot.h" |
|
25 #include "cmmasurfacewindow.h" |
|
26 //#include <jutils.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MMAFunctionServer; |
|
30 |
|
31 // CONSTANTS |
|
32 // Error code from MMF meaning that video is missing sound, |
|
33 // but still can be played. |
|
34 const TInt KNotCompleteVideoError = -12017; |
|
35 _LIT(KMMAVideoPlayer, "VideoPlayer"); |
|
36 |
|
37 // CLASS DECLARATION |
|
38 /** |
|
39 * This class is used for playing video. |
|
40 * |
|
41 */ |
|
42 NONSHARABLE_CLASS(CMMAVideoPlayer): public CMMAAudioPlayer, |
|
43 public MMMAGuiPlayer, |
|
44 public MMMASnapshot |
|
45 { |
|
46 public: // Construction |
|
47 static CMMAVideoPlayer* NewLC( |
|
48 CMMAMMFResolver* aResolver); |
|
49 |
|
50 // Destructor |
|
51 ~CMMAVideoPlayer(); |
|
52 |
|
53 protected: |
|
54 // C++ constructor |
|
55 CMMAVideoPlayer(CMMAMMFResolver* aResolver); |
|
56 |
|
57 void ConstructL(); |
|
58 |
|
59 public: // from CMMAPlayer |
|
60 IMPORT_C void SetPlayerListenerObjectL(jobject aListenerObject, |
|
61 JNIEnv* aJni, |
|
62 MMMAEventPoster* aEventPoster); |
|
63 void RealizeL(); |
|
64 void PrefetchL(); |
|
65 |
|
66 protected: // from CMMAudioPlayer |
|
67 IMPORT_C void ReadCompletedL(TInt aStatus, const TDesC8& aData); |
|
68 void HandleEvent(const TMMFEvent& aEvent); |
|
69 IMPORT_C const TDesC& Type(); |
|
70 |
|
71 public: // From MMMAGuiPlayer |
|
72 IMPORT_C void SetDisplayL(MMMADisplay* aDisplay); |
|
73 IMPORT_C TSize SourceSize(); |
|
74 IMPORT_C void NotifyWithStringEvent(CMMAPlayerEvent::TEventType aEventType, |
|
75 const TDesC& aStringEventData); |
|
76 |
|
77 IMPORT_C MMMASnapshot* SnapshoterL(); |
|
78 |
|
79 public: // From MMMASnapshot |
|
80 IMPORT_C MMMASnapshot::TEncoding TakeSnapshotL(TRequestStatus* aStatus, |
|
81 const TSize& aSize, |
|
82 const CMMAImageSettings& aSettings); |
|
83 IMPORT_C CFbsBitmap* SnapshotBitmap(); |
|
84 IMPORT_C HBufC8* SnapshotEncoded(); |
|
85 |
|
86 protected: // New methods |
|
87 void CompletePrefetch( TInt aError ); |
|
88 void PrepareDisplay(); |
|
89 public: |
|
90 void SourceSizeChanged(); |
|
91 |
|
92 protected: // Data |
|
93 CMMASurfaceWindow* iSurfaceWindow; |
|
94 RMMFVideoControllerCustomCommands iVideoControllerCustomCommands; |
|
95 RMMFVideoPlayControllerCustomCommands iVideoPlayControllerCustomCommands; |
|
96 RMMFVideoPlaySurfaceSupportCustomCommands iVideoPlaySurfaceSupportCustomCommands; |
|
97 |
|
98 private: // Data |
|
99 // not owned |
|
100 MMMADisplay* iDisplay; |
|
101 |
|
102 TSize iSourceSize; |
|
103 |
|
104 TFileName iFileExtension; |
|
105 |
|
106 /** |
|
107 * struct to keep track of Surface |
|
108 */ |
|
109 struct MMASurface |
|
110 { |
|
111 // owned, should be freed using |
|
112 // RMMFVideoPlaySurfaceSupportCustomCommands::SurfaceRemoved(). |
|
113 TSurfaceId iPrevSurfaceId; |
|
114 TBool iPrevSurfaceAvailable; |
|
115 } iMMASurface; |
|
116 |
|
117 // owned |
|
118 CFbsBitmap* iEmptySnapshotImage; |
|
119 |
|
120 // owned |
|
121 CActiveSchedulerWait* iActiveSchedulerWait; |
|
122 }; |
|
123 |
|
124 #endif // CMMAVIDEOPLAYER_H |