1 /* |
|
2 * Copyright (c) 2002 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 * Creates a video player and starts video preview |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __CFLDVIDEOPLAYER_H__ |
|
22 #define __CFLDVIDEOPLAYER_H__ |
|
23 |
|
24 // INTERNAL INCLUDES |
|
25 #include "CFLDPlayerBase.h" |
|
26 |
|
27 // EXTERNAL INCLUDES |
|
28 #include <e32property.h> |
|
29 #include <videoplayer.h> // For MVideoPlayerUtilityObserver |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class RWindow; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Creates a video player and starts video preview |
|
38 * |
|
39 * @lib filelist.lib |
|
40 * @since 3.1 |
|
41 */ |
|
42 NONSHARABLE_CLASS( CFLDVideoPlayer ) |
|
43 : public CFLDPlayerBase, |
|
44 public MVideoPlayerUtilityObserver |
|
45 { |
|
46 |
|
47 private: // Enumerations |
|
48 |
|
49 // These match with the ones in Profile Engine |
|
50 enum TRingingTypes |
|
51 { |
|
52 ERingingTypeRinging = 0, |
|
53 ERingingTypeAscending, |
|
54 ERingingTypeRingOnce, |
|
55 ERingingTypeBeepOnce, |
|
56 ERingingTypeSilent |
|
57 }; |
|
58 |
|
59 enum TVideoPlayerStatus |
|
60 { |
|
61 EVideoPlayerNotCreated = 0, |
|
62 EVideoPlayerInitializing, |
|
63 EVideoPlayerInitialized, |
|
64 EVideoPlayerReady, |
|
65 EVideoPlayerPlaying |
|
66 }; |
|
67 |
|
68 enum TFLAllowScreenSaver |
|
69 { |
|
70 EFLScreenSaverAllowed = 0, |
|
71 EFLScreenSaverNotAllowed |
|
72 }; |
|
73 |
|
74 public: // Constructors and destructors |
|
75 |
|
76 /** |
|
77 * Two-phase static constructor |
|
78 * @param aShowErrorMsgs Show an error note if the file format is not supported |
|
79 * @return A pointer to a fully constructed CFLDVideoPlayer instance |
|
80 */ |
|
81 static CFLDVideoPlayer* NewL( TBool aShowErrorMsgs = ETrue ); |
|
82 |
|
83 /** |
|
84 * Destructor |
|
85 */ |
|
86 virtual ~CFLDVideoPlayer(); |
|
87 |
|
88 private: // Constructors and destructors |
|
89 |
|
90 /** |
|
91 * Constructor |
|
92 * @param aShowErrorMsgs Show an error note if the file format is not supported |
|
93 */ |
|
94 CFLDVideoPlayer( TBool aShowErrorMsgs); |
|
95 |
|
96 /** |
|
97 * Second phase constructor |
|
98 */ |
|
99 void ConstructL(); |
|
100 |
|
101 public: // From MFLDFileProcessor |
|
102 |
|
103 /** |
|
104 * Derived from MFLDFileProcessor. Starts playing the sound file |
|
105 */ |
|
106 void ProcessFileL( const TDesC& aFileName, RWindow* aWindow ); |
|
107 |
|
108 /** |
|
109 * Derived from MFLDFileProcessor. Stops playing the file. |
|
110 */ |
|
111 void Cancel(); |
|
112 |
|
113 private: // From MVidePlayerUtilityObserver |
|
114 void MvpuoOpenComplete(TInt aError); |
|
115 void MvpuoFrameReady(CFbsBitmap& aFrame,TInt aError); |
|
116 void MvpuoPlayComplete(TInt aError); |
|
117 void MvpuoEvent(const TMMFEvent& aEvent); |
|
118 void MvpuoPrepareComplete(TInt aError); |
|
119 |
|
120 private: // New methods |
|
121 |
|
122 /** When videoplayer is ready, set its ringing type |
|
123 * @param aRingingType The ringing type (see enum TRingingTypes) |
|
124 */ |
|
125 void DoSetRingingType( TInt aRingingType ); |
|
126 |
|
127 /** |
|
128 * Converts volume from 1 to 10 to audio driver understandable value. |
|
129 * @param aVolume Volume level to be converted. |
|
130 * @return Returns converted volume level |
|
131 */ |
|
132 TInt ConvertVolume( TInt aVolume ); |
|
133 |
|
134 /** |
|
135 * Callback function for ascending ringing type |
|
136 * @param aObj Pointer to callback instance |
|
137 */ |
|
138 static TInt VolumeRampTimerCallback( TAny* aObj ); |
|
139 /** |
|
140 * Performs volume ramping |
|
141 */ |
|
142 TInt DoVolumeRamp(); |
|
143 /** |
|
144 * Performs video scaling and cropping |
|
145 * @param aDisplayWindow Reference to window handle |
|
146 */ |
|
147 void AdjustToWindow( RWindow& aDisplayWindow ); |
|
148 /** |
|
149 * Returns video frame size |
|
150 * @return size of the video frame |
|
151 */ |
|
152 TSize VideoFrameSize() const; |
|
153 |
|
154 /** |
|
155 * Callback function to do inactivity timer resetting. |
|
156 */ |
|
157 static TInt DoResetInactivityTimer( TAny* aObject ); |
|
158 |
|
159 private: // Data |
|
160 |
|
161 /// Own: video player |
|
162 CVideoPlayerUtility* iVideoPlayer; |
|
163 /// Own: Ascending volume timer |
|
164 CPeriodic* iVolumeRampTimer; |
|
165 /// Ref: handle to window |
|
166 RWindow* iWindow; |
|
167 /// Player state |
|
168 TVideoPlayerStatus iVideoPlayerStatus; |
|
169 /// Ascending volume |
|
170 TInt iRampedVolume; |
|
171 |
|
172 /** |
|
173 * Pub&Sub property. |
|
174 * For setting the state of the screen saver. |
|
175 */ |
|
176 RProperty iPropScreenSaver; |
|
177 |
|
178 /** |
|
179 * Timer for resetting the user inactivity timeout |
|
180 */ |
|
181 CPeriodic* iBacklightTimer; |
|
182 |
|
183 }; |
|
184 |
|
185 #endif // __CFLDVIDEOPLAYER_H__ |
|
186 |
|
187 // End of File |
|