|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __VIDEOPLAYER_H__ |
|
17 #define __VIDEOPLAYER_H__ |
|
18 |
|
19 #include <w32std.h> |
|
20 #include <fbs.h> |
|
21 #include <f32file.h> |
|
22 #include <mmf/common/mmfbase.h> |
|
23 #include <mmf/common/mmfcontroller.h> |
|
24 #include <mmf/common/mmfaudio.h> |
|
25 #include <mmf/common/mmfstandardcustomcommands.h> |
|
26 #include <mmf/common/mmfdrmcustomcommands.h> |
|
27 #include <mda/common/base.h> |
|
28 #include <mmf/common/mmfutilities.h> |
|
29 #include <mmf/common/mmfcontrollerframeworkbase.h> |
|
30 #include "mmf/common/mmcaf.h" |
|
31 #include <mmfclntutility.h> |
|
32 |
|
33 /** |
|
34 @publishedAll |
|
35 @released |
|
36 |
|
37 An interface to a set of video player callback functions. |
|
38 |
|
39 The class is a mixin and is intended to be inherited by the client |
|
40 class which is observing the video playing operation. The functions |
|
41 encapsulated by this class are called when specific events occur in |
|
42 the process of initialising and playing an video clip. A reference to |
|
43 this object is passed as a parameter when constructing an audio player |
|
44 utility object. |
|
45 |
|
46 @since 7.0s |
|
47 */ |
|
48 class MVideoPlayerUtilityObserver |
|
49 { |
|
50 public: |
|
51 |
|
52 /** |
|
53 Notification to the client that the opening of the video clip has completed, |
|
54 successfully, or otherwise. |
|
55 |
|
56 The status of the video sample after opening is given by aError. The following |
|
57 values imply same across all the devices. |
|
58 |
|
59 - KErrNone: the sample is ready to play; |
|
60 - KErrNotSupported: the controller plugin is not recognised or not supported; |
|
61 - KErrNotFound: the video sample cannot be found; |
|
62 - KErrNoMemory: there is insufficient memory to play this video sample. |
|
63 |
|
64 Other values are possible indicating a problem opening the video sample. These values |
|
65 are device dependent. |
|
66 |
|
67 The client must now call Prepare() on the video player utility before the |
|
68 video clip can be played or any of its properties (e.g. duration) can be |
|
69 queried. |
|
70 |
|
71 @param aError |
|
72 The status of the video player after initialisation. |
|
73 |
|
74 @since 7.0s |
|
75 */ |
|
76 virtual void MvpuoOpenComplete(TInt aError) = 0; |
|
77 |
|
78 /** |
|
79 Notification to the client that the opening of the video clip has been prepared |
|
80 successfully, or otherwise. This callback is called in response to a call to |
|
81 CVideoPlayerUtility::Prepare(). |
|
82 |
|
83 The video clip may now be played, or have any of its properties (e.g. duration) queried. |
|
84 |
|
85 @param aError |
|
86 The status of the video player after initialisation. |
|
87 This is either KErrNone if the open has completed successfully, |
|
88 or one of the system wide error codes. |
|
89 |
|
90 @since 7.0s |
|
91 */ |
|
92 virtual void MvpuoPrepareComplete(TInt aError) = 0; |
|
93 |
|
94 /** |
|
95 Notification that the frame requested by a call to GetFrameL is ready |
|
96 |
|
97 @param aFrame |
|
98 The returned frame. The bitmap will contain |
|
99 the requested frame if the the error code is KErrNone (success). |
|
100 @param aError |
|
101 The status of the frame request. |
|
102 This is either KErrNone if the frame request was successful, |
|
103 or one of the system wide error codes. |
|
104 |
|
105 @since 7.0s |
|
106 */ |
|
107 virtual void MvpuoFrameReady(CFbsBitmap& aFrame,TInt aError) = 0; |
|
108 |
|
109 /** |
|
110 Notification that video playback has completed. This is not called if |
|
111 playback is explicitly stopped (such as through the use of the Stop or |
|
112 Close commands). |
|
113 |
|
114 @param aError |
|
115 The status of playback. |
|
116 This is either KErrNone if the playback was completed successfully, |
|
117 or one of the system wide error codes. |
|
118 @since 7.0s |
|
119 */ |
|
120 virtual void MvpuoPlayComplete(TInt aError) = 0; |
|
121 |
|
122 /** |
|
123 General event notification from controller. These events are specified by |
|
124 the supplier of the controller |
|
125 |
|
126 @param aEvent |
|
127 The event sent by the controller. |
|
128 |
|
129 @since 7.0s |
|
130 */ |
|
131 virtual void MvpuoEvent(const TMMFEvent& aEvent) = 0; |
|
132 }; |
|
133 |
|
134 /** |
|
135 @publishedAll |
|
136 @released |
|
137 |
|
138 This is a mixin class that allows a client to receive notification of rebuffering |
|
139 operations occurring in the video player |
|
140 |
|
141 @since 7.0s |
|
142 */ |
|
143 class MVideoLoadingObserver |
|
144 { |
|
145 public: |
|
146 |
|
147 /** |
|
148 Notification that video clip loading/rebuffering has started |
|
149 |
|
150 @since 7.0s |
|
151 */ |
|
152 virtual void MvloLoadingStarted() = 0; |
|
153 |
|
154 /** |
|
155 Notification that video clip loading/rebuffering has completed |
|
156 |
|
157 @since 7.0s |
|
158 */ |
|
159 virtual void MvloLoadingComplete() = 0; |
|
160 }; |
|
161 |
|
162 class CMMFVideoPlayerCallback; |
|
163 class CVideoPlayerUtility2; |
|
164 class TVideoPlayRateCapabilities; |
|
165 |
|
166 /** |
|
167 @publishedAll |
|
168 @released |
|
169 |
|
170 Plays sampled video data. |
|
171 |
|
172 The class offers a simple interface to open, play and obtain information from sampled video data. |
|
173 The video data can be provided using files, descriptors or URLs. |
|
174 |
|
175 Note: |
|
176 Some video formats also allow the storing of audio data. To accommodate this, this class contains |
|
177 audio functions that can manipulate such data. |
|
178 |
|
179 While this class is abstract, NewL() constructs, initialises and returns pointers to instances of |
|
180 concrete classes derived from this abstract class. This concrete class is part of the MMF |
|
181 implementation and is private. |
|
182 |
|
183 @since 7.0s |
|
184 */ |
|
185 class CVideoPlayerUtility : public CBase, |
|
186 public MMMFClientUtility |
|
187 { |
|
188 public: |
|
189 |
|
190 ~CVideoPlayerUtility(); |
|
191 |
|
192 IMPORT_C static CVideoPlayerUtility* NewL(MVideoPlayerUtilityObserver& aObserver, |
|
193 TInt aPriority, |
|
194 TInt aPref, |
|
195 RWsSession& aWs, |
|
196 CWsScreenDevice& aScreenDevice, |
|
197 RWindowBase& aWindow, |
|
198 const TRect& aScreenRect, |
|
199 const TRect& aClipRect); |
|
200 |
|
201 IMPORT_C void OpenFileL(const TDesC& aFileName,TUid aControllerUid = KNullUid); |
|
202 IMPORT_C void OpenFileL(const RFile& aFileName, TUid aControllerUid = KNullUid); |
|
203 |
|
204 IMPORT_C void OpenFileL(const TMMSource& aSource, TUid aControllerUid = KNullUid); |
|
205 |
|
206 IMPORT_C void OpenDesL(const TDesC8& aDescriptor,TUid aControllerUid = KNullUid); |
|
207 |
|
208 IMPORT_C void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8, TUid aControllerUid = KNullUid); |
|
209 |
|
210 IMPORT_C void Prepare(); |
|
211 |
|
212 IMPORT_C void Close(); |
|
213 |
|
214 IMPORT_C void Play(); |
|
215 |
|
216 IMPORT_C void Play(const TTimeIntervalMicroSeconds& aStartPoint, const TTimeIntervalMicroSeconds& aEndPoint); |
|
217 |
|
218 IMPORT_C TInt Stop(); |
|
219 |
|
220 IMPORT_C void PauseL(); |
|
221 |
|
222 IMPORT_C void SetPriorityL(TInt aPriority, TInt aPref); |
|
223 |
|
224 IMPORT_C void PriorityL(TInt& aPriority, TMdaPriorityPreference& aPref) const; |
|
225 |
|
226 IMPORT_C void SetDisplayWindowL(RWsSession& aWs,CWsScreenDevice& aScreenDevice,RWindowBase& aWindow,const TRect& aWindowRect,const TRect& aClipRect); |
|
227 |
|
228 IMPORT_C void RegisterForVideoLoadingNotification(MVideoLoadingObserver& aCallback); |
|
229 |
|
230 IMPORT_C void GetVideoLoadingProgressL(TInt& aPercentageComplete); |
|
231 |
|
232 IMPORT_C void GetFrameL(TDisplayMode aDisplayMode); |
|
233 |
|
234 IMPORT_C void GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent); |
|
235 |
|
236 IMPORT_C void RefreshFrameL(); |
|
237 |
|
238 IMPORT_C TReal32 VideoFrameRateL() const; |
|
239 |
|
240 IMPORT_C void SetVideoFrameRateL(TReal32 aFramesPerSecond); |
|
241 |
|
242 IMPORT_C void VideoFrameSizeL(TSize& aSize) const; |
|
243 |
|
244 IMPORT_C const TDesC8& VideoFormatMimeType() const; |
|
245 |
|
246 IMPORT_C TInt VideoBitRateL() const; |
|
247 |
|
248 IMPORT_C TInt AudioBitRateL() const; |
|
249 |
|
250 IMPORT_C TFourCC AudioTypeL() const; |
|
251 |
|
252 IMPORT_C TBool AudioEnabledL() const; |
|
253 |
|
254 IMPORT_C void SetPositionL(const TTimeIntervalMicroSeconds& aPosition); |
|
255 |
|
256 IMPORT_C TTimeIntervalMicroSeconds PositionL() const; |
|
257 |
|
258 IMPORT_C TTimeIntervalMicroSeconds DurationL() const; |
|
259 |
|
260 IMPORT_C void SetVolumeL(TInt aVolume); |
|
261 |
|
262 IMPORT_C TInt Volume() const; |
|
263 |
|
264 IMPORT_C TInt MaxVolume() const; |
|
265 |
|
266 IMPORT_C void SetBalanceL(TInt aBalance); |
|
267 |
|
268 IMPORT_C TInt Balance()const; |
|
269 |
|
270 IMPORT_C void SetRotationL(TVideoRotation aRotation); |
|
271 |
|
272 IMPORT_C TVideoRotation RotationL() const; |
|
273 |
|
274 IMPORT_C void SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering); |
|
275 |
|
276 IMPORT_C void GetScaleFactorL(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const; |
|
277 |
|
278 IMPORT_C void SetCropRegionL(const TRect& aCropRegion); |
|
279 |
|
280 IMPORT_C void GetCropRegionL(TRect& aCropRegion) const; |
|
281 |
|
282 IMPORT_C TInt NumberOfMetaDataEntriesL() const; |
|
283 |
|
284 IMPORT_C CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex) const; |
|
285 |
|
286 IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); |
|
287 |
|
288 IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); |
|
289 |
|
290 IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); |
|
291 |
|
292 IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); |
|
293 |
|
294 IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); |
|
295 |
|
296 IMPORT_C MMMFDRMCustomCommand* GetDRMCustomCommand(); |
|
297 |
|
298 IMPORT_C void StopDirectScreenAccessL(); |
|
299 |
|
300 IMPORT_C void StartDirectScreenAccessL(); |
|
301 |
|
302 IMPORT_C TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8& aNotificationRegistrationData = KNullDesC8); |
|
303 |
|
304 IMPORT_C TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId); |
|
305 |
|
306 IMPORT_C TInt WillResumePlay(); |
|
307 |
|
308 IMPORT_C TInt SetInitScreenNumber(TInt aScreenNumber); |
|
309 |
|
310 IMPORT_C void SetPlayVelocityL(TInt aVelocity); |
|
311 |
|
312 IMPORT_C TInt PlayVelocityL() const; |
|
313 |
|
314 IMPORT_C void StepFrameL(TInt aStep); |
|
315 |
|
316 IMPORT_C void GetPlayRateCapabilitiesL(TVideoPlayRateCapabilities& aCapabilities) const; |
|
317 |
|
318 IMPORT_C void SetVideoEnabledL(TBool aVideoEnabled); |
|
319 |
|
320 IMPORT_C TBool VideoEnabledL() const; |
|
321 |
|
322 IMPORT_C void SetAudioEnabledL(TBool aAudioEnabled); |
|
323 |
|
324 IMPORT_C void SetAutoScaleL(TAutoScaleType aScaleType); |
|
325 |
|
326 IMPORT_C void SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos); |
|
327 |
|
328 IMPORT_C void SetExternalDisplaySwitchingL(TInt aDisplay, TBool aControl); |
|
329 |
|
330 private: |
|
331 class CBody; |
|
332 |
|
333 CBody* iBody; |
|
334 |
|
335 friend class CBody; |
|
336 friend class CVideoPlayerUtility2; |
|
337 private: |
|
338 enum TMMFVideoPlayerState |
|
339 { |
|
340 EStopped, |
|
341 EOpening, |
|
342 EPaused, |
|
343 EPlaying |
|
344 }; |
|
345 private: |
|
346 friend class CTestStepUnitMMFVidClient; |
|
347 #ifdef SYMBIAN_BUILD_GCE |
|
348 friend class CMediaClientVideoDisplayBody; |
|
349 #endif // SYMBIAN_BUILD_GCE |
|
350 public: |
|
351 class CTestView; |
|
352 friend class CTestView; |
|
353 }; |
|
354 |
|
355 |
|
356 #endif |