0
|
1 |
// Copyright (c) 2005-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 |
// Part of the MVS Agents for TechView
|
|
15 |
//
|
|
16 |
|
|
17 |
#ifdef SYMBIAN_BUILD_GCE
|
|
18 |
#include <videoplayer2.h>
|
|
19 |
#include <surfaceeventhandler.h>
|
|
20 |
#endif
|
|
21 |
|
|
22 |
#include "videoplayagent.h"
|
|
23 |
|
|
24 |
/**
|
|
25 |
Constructs and initialises a new instance of the MVS video play agent
|
|
26 |
|
|
27 |
This function leaves if the video play agent object cannot be created.
|
|
28 |
|
|
29 |
@param aObserver
|
|
30 |
A client class to receive notifications from the video player.
|
|
31 |
|
|
32 |
@return A pointer to the new video play agent object.
|
|
33 |
*/
|
|
34 |
EXPORT_C CMVSVideoPlayAgent* CMVSVideoPlayAgent::NewL(MMVSClientObserver& aObserver)
|
|
35 |
{
|
|
36 |
CMVSVideoPlayAgent* self = new(ELeave) CMVSVideoPlayAgent(aObserver);
|
|
37 |
CleanupStack::PushL(self);
|
|
38 |
self->ConstructL();
|
|
39 |
CleanupStack::Pop(self);
|
|
40 |
return self;
|
|
41 |
}
|
|
42 |
|
|
43 |
void CMVSVideoPlayAgent::ConstructL()
|
|
44 |
{
|
|
45 |
User::LeaveIfError(iFileLogger.Connect());
|
|
46 |
iFileLogger.CreateLog(_L("LogMVSappUi"),_L("LogFile.txt"),EFileLoggingModeAppend);
|
|
47 |
}
|
|
48 |
|
|
49 |
|
|
50 |
/**
|
|
51 |
Destructor. Closes any open video clips and frees any resources held by the Video Player.
|
|
52 |
*/
|
|
53 |
EXPORT_C CMVSVideoPlayAgent::~CMVSVideoPlayAgent()
|
|
54 |
{
|
|
55 |
#ifdef SYMBIAN_BUILD_GCE
|
|
56 |
delete iVideoPlayer2;
|
|
57 |
iVideoPlayer2 = NULL;
|
|
58 |
#endif // SYMBIAN_BUILD_GCE
|
|
59 |
|
|
60 |
delete iVideoPlayer;
|
|
61 |
iVideoPlayer = NULL;
|
|
62 |
|
|
63 |
if(iFileLogger.Handle())
|
|
64 |
{
|
|
65 |
iFileLogger.CloseLog();
|
|
66 |
iFileLogger.Close();
|
|
67 |
}
|
|
68 |
|
|
69 |
iFileName.Close();
|
|
70 |
}
|
|
71 |
|
|
72 |
|
|
73 |
CMVSVideoPlayAgent::CMVSVideoPlayAgent(MMVSClientObserver& aObserver)
|
|
74 |
: iObserver(aObserver),
|
|
75 |
iControllerUid(KNullUid)
|
|
76 |
{
|
|
77 |
}
|
|
78 |
|
|
79 |
/**
|
|
80 |
Check if CVideoPlayerUtility2 is used for current video playback.
|
|
81 |
|
|
82 |
@return ETrue if CVideoPlayerUtility2 is used for video playback. EFalse if
|
|
83 |
CVideoPlayerUtility is used.
|
|
84 |
*/
|
|
85 |
EXPORT_C TBool CMVSVideoPlayAgent::SupportVideoPlayerUtility2() const
|
|
86 |
{
|
|
87 |
if (iCurrentVideoPlayer == NULL)
|
|
88 |
{
|
|
89 |
return EFalse;
|
|
90 |
}
|
|
91 |
|
|
92 |
if (iCurrentVideoPlayer == iVideoPlayer)
|
|
93 |
{
|
|
94 |
return EFalse;
|
|
95 |
}
|
|
96 |
|
|
97 |
return ETrue;
|
|
98 |
}
|
|
99 |
|
|
100 |
/**
|
|
101 |
Set the auto scale on the current video player for the specified window.
|
|
102 |
|
|
103 |
@see CVideoPlayerUtility
|
|
104 |
*/
|
|
105 |
#ifdef SYMBIAN_BUILD_GCE
|
|
106 |
EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(RWindow& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
|
|
107 |
{
|
|
108 |
iVideoPlayer2->SetAutoScaleL(aWindow, aScaleType, aHorizPos, aVertPos);
|
|
109 |
#else
|
|
110 |
EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(RWindow& aWindow, TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
|
|
111 |
{
|
|
112 |
User::Leave(KErrNotSupported);
|
|
113 |
#endif
|
|
114 |
}
|
|
115 |
|
|
116 |
/**
|
|
117 |
Set the auto scale on the current video player.
|
|
118 |
|
|
119 |
@see CVideoPlayerUtility
|
|
120 |
*/
|
|
121 |
EXPORT_C void CMVSVideoPlayAgent::SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
|
|
122 |
{
|
|
123 |
#ifdef SYMBIAN_BUILD_GCE
|
|
124 |
iCurrentVideoPlayer->SetAutoScaleL(aScaleType, aHorizPos, aVertPos);
|
|
125 |
#else
|
|
126 |
// Remove warnings
|
|
127 |
aScaleType = aScaleType;
|
|
128 |
aHorizPos = aHorizPos;
|
|
129 |
aVertPos = aVertPos;
|
|
130 |
User::Leave(KErrNotSupported);
|
|
131 |
#endif
|
|
132 |
}
|
|
133 |
|
|
134 |
/**
|
|
135 |
Video output settings, pre initialisation of all the required settings to play a
|
|
136 |
video clip
|
|
137 |
|
|
138 |
This function leaves if the video player utility object cannot be created.
|
|
139 |
|
|
140 |
@param aObserver
|
|
141 |
A client class to receive notifications from the video player.
|
|
142 |
@param aPriority
|
|
143 |
This client's relative priority. This is a value between EMdaPriorityMin and
|
|
144 |
EMdaPriorityMax and represents a relative priority. A higher value indicates
|
|
145 |
a more important request.
|
|
146 |
@param aPref
|
|
147 |
The required behaviour if a higher priority client takes over the sound output device.
|
|
148 |
One of the values defined by TMdaPriorityPreference.
|
|
149 |
@param aWs
|
|
150 |
The window server session id.
|
|
151 |
@param aScreenDevice
|
|
152 |
The software device screen.
|
|
153 |
@param aWindow
|
|
154 |
The display window.
|
|
155 |
@param aScreenRect
|
|
156 |
The dimensions of the display window.
|
|
157 |
@param aClipRect
|
|
158 |
The area of the video clip to display in the window.
|
|
159 |
*/
|
|
160 |
EXPORT_C void CMVSVideoPlayAgent::SetVideoOutputL(RWsSession& aWs,
|
|
161 |
CWsScreenDevice& aScreenDevice,
|
|
162 |
RWindow& aWindow,
|
|
163 |
TRect& aScreenRect,
|
|
164 |
TRect& aClipRect)
|
|
165 |
{
|
|
166 |
iFileLogger.Write(_L("SettingVideoOutput"));
|
|
167 |
|
|
168 |
#ifdef SYMBIAN_BUILD_GCE
|
|
169 |
// if CVideoPlayerUtility2 is available, instantiate both CVideoPlayerUtility2 &
|
|
170 |
// CVideoPlayerUtility, as it is not clear whether the controller used for a
|
|
171 |
// particular media file also supports the CVideoPlayerUtility2 API until OpenFileL
|
|
172 |
// is called.
|
|
173 |
if (iVideoPlayer2)
|
|
174 |
{
|
|
175 |
delete iVideoPlayer2;
|
|
176 |
iVideoPlayer2 = NULL;
|
|
177 |
}
|
|
178 |
|
|
179 |
iVideoPlayer2 = CVideoPlayerUtility2::NewL(*this,
|
|
180 |
EMdaPriorityNormal,
|
|
181 |
EMdaPriorityPreferenceNone);
|
|
182 |
#endif // SYMBIAN_BUILD_GCE
|
|
183 |
|
|
184 |
if (iVideoPlayer)
|
|
185 |
{
|
|
186 |
delete iVideoPlayer;
|
|
187 |
iVideoPlayer = NULL;
|
|
188 |
}
|
|
189 |
iVideoPlayer = CVideoPlayerUtility::NewL(*this,
|
|
190 |
EMdaPriorityNormal,
|
|
191 |
EMdaPriorityPreferenceNone,
|
|
192 |
aWs,
|
|
193 |
aScreenDevice,
|
|
194 |
aWindow,
|
|
195 |
aScreenRect,
|
|
196 |
aClipRect);
|
|
197 |
}
|
|
198 |
|
|
199 |
/**
|
|
200 |
Adds a new window for displaying the video picture. This is only applicable if
|
|
201 |
CVideoPlayerUtility2 is used.
|
|
202 |
|
|
203 |
This function leaves if the video player utility object failed to add display window or
|
|
204 |
if this function is called when CVideoPlayerUtility2 is not being used.
|
|
205 |
|
|
206 |
@param aObserver
|
|
207 |
A client class to receive notifications from the video player.
|
|
208 |
@param aPriority
|
|
209 |
This client's relative priority. This is a value between EMdaPriorityMin and
|
|
210 |
EMdaPriorityMax and represents a relative priority. A higher value indicates
|
|
211 |
a more important request.
|
|
212 |
@param aPref
|
|
213 |
The required behaviour if a higher priority client takes over the sound output device.
|
|
214 |
One of the values defined by TMdaPriorityPreference.
|
|
215 |
@param aWs
|
|
216 |
The window server session id.
|
|
217 |
@param aScreenDevice
|
|
218 |
The software device screen.
|
|
219 |
@param aWindow
|
|
220 |
The display window.
|
|
221 |
@param aScreenRect
|
|
222 |
The dimensions of the display window.
|
|
223 |
@param aClipRect
|
|
224 |
The area of the video clip to display in the window.
|
|
225 |
@leave KErrNotSupported if CVideoPlayerUtility2 is not the current video utility in use
|
|
226 |
@see CVideoPlayerUtility2::AddDisplayWindowL
|
|
227 |
*/
|
|
228 |
#ifdef SYMBIAN_BUILD_GCE
|
|
229 |
EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& aWs,
|
|
230 |
CWsScreenDevice& aScreenDevice,
|
|
231 |
RWindow& aWindow,
|
|
232 |
const TRect& aScreenRect,
|
|
233 |
const TRect& aClipRect)
|
|
234 |
#else
|
|
235 |
EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& /* aWs */,
|
|
236 |
CWsScreenDevice& /* aScreenDevice */,
|
|
237 |
RWindow& /* aWindow */,
|
|
238 |
const TRect& /* aScreenRect */,
|
|
239 |
const TRect& /* aClipRect */)
|
|
240 |
#endif // SYMBIAN_BUILD_GCE
|
|
241 |
{
|
|
242 |
#ifdef SYMBIAN_BUILD_GCE
|
|
243 |
if (SupportVideoPlayerUtility2())
|
|
244 |
{
|
|
245 |
iVideoPlayer2->AddDisplayWindowL(aWs,
|
|
246 |
aScreenDevice,
|
|
247 |
aWindow,
|
|
248 |
aScreenRect,
|
|
249 |
aClipRect);
|
|
250 |
iWindow = &aWindow;
|
|
251 |
|
|
252 |
#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
|
|
253 |
if (iEnableSubtitlesOnAdd)
|
|
254 |
{
|
|
255 |
iVideoPlayer2->EnableSubtitlesL();
|
|
256 |
iEnableSubtitlesOnAdd = EFalse;
|
|
257 |
}
|
|
258 |
#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
|
|
259 |
|
|
260 |
return;
|
|
261 |
}
|
|
262 |
#endif // SYMBIAN_BUILD_GCE
|
|
263 |
User::Leave(KErrNotSupported);
|
|
264 |
}
|
|
265 |
|
|
266 |
#ifdef SYMBIAN_BUILD_GCE
|
|
267 |
EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& aWs,
|
|
268 |
CWsScreenDevice& aScreenDevice,
|
|
269 |
RWindow& aWindow)
|
|
270 |
#else
|
|
271 |
EXPORT_C void CMVSVideoPlayAgent::AddDisplayWindowL(RWsSession& /* aWs */,
|
|
272 |
CWsScreenDevice& /* aScreenDevice */,
|
|
273 |
RWindow& /* aWindow */)
|
|
274 |
#endif // SYMBIAN_BUILD_GCE
|
|
275 |
{
|
|
276 |
#ifdef SYMBIAN_BUILD_GCE
|
|
277 |
if (SupportVideoPlayerUtility2())
|
|
278 |
{
|
|
279 |
iVideoPlayer2->AddDisplayWindowL(aWs,
|
|
280 |
aScreenDevice,
|
|
281 |
aWindow);
|
|
282 |
iWindow = &aWindow;
|
|
283 |
|
|
284 |
#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
|
|
285 |
if (iEnableSubtitlesOnAdd)
|
|
286 |
{
|
|
287 |
iVideoPlayer2->EnableSubtitlesL();
|
|
288 |
iEnableSubtitlesOnAdd = EFalse;
|
|
289 |
}
|
|
290 |
#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
|
|
291 |
return;
|
|
292 |
}
|
|
293 |
#endif // SYMBIAN_BUILD_GCE
|
|
294 |
User::Leave(KErrNotSupported);
|
|
295 |
}
|
|
296 |
|
|
297 |
EXPORT_C void CMVSVideoPlayAgent::AddDisplayL(RWsSession& aWs, TInt aDisplay, MMMFSurfaceEventHandler& aEventHandler)
|
|
298 |
{
|
|
299 |
if (!SupportVideoPlayerUtility2())
|
|
300 |
{
|
|
301 |
User::Leave(KErrNotSupported);
|
|
302 |
}
|
|
303 |
|
|
304 |
iVideoPlayer2->AddDisplayL(aWs, aDisplay, aEventHandler);
|
|
305 |
}
|
|
306 |
|
|
307 |
/**
|
|
308 |
Removes a window that is currently being used to display the video picture.
|
|
309 |
|
|
310 |
This function should only be called if CVideoPlayerUtility2 is currently being used for display
|
|
311 |
of video.
|
|
312 |
|
|
313 |
@param aWindow
|
|
314 |
The window to be removed
|
|
315 |
@leave KErrNotSupported if CVideoPlayerUtility2 is not the current video player utility.
|
|
316 |
@see CVideoPlayerUtility2::RemoveDisplayWindow
|
|
317 |
*/
|
|
318 |
EXPORT_C void CMVSVideoPlayAgent::RemoveDisplayWindowL(RWindow& aWindow)
|
|
319 |
{
|
|
320 |
#ifdef SYMBIAN_BUILD_GCE
|
|
321 |
if (SupportVideoPlayerUtility2())
|
|
322 |
{
|
|
323 |
iVideoPlayer2->RemoveDisplayWindow(aWindow);
|
|
324 |
iWindow = NULL;
|
|
325 |
return;
|
|
326 |
}
|
|
327 |
#endif // SYMBIAN_BUILD_GCE
|
|
328 |
// Remove compiler warning
|
|
329 |
aWindow = aWindow;
|
|
330 |
User::Leave(KErrNotSupported);
|
|
331 |
}
|
|
332 |
|
|
333 |
EXPORT_C void CMVSVideoPlayAgent::RemoveDisplay(TInt aDisplay)
|
|
334 |
{
|
|
335 |
if (!SupportVideoPlayerUtility2())
|
|
336 |
{
|
|
337 |
User::Leave(KErrNotSupported);
|
|
338 |
}
|
|
339 |
|
|
340 |
iVideoPlayer2->RemoveDisplay(aDisplay);
|
|
341 |
}
|
|
342 |
|
|
343 |
/**
|
|
344 |
Opens a video clip from a file.
|
|
345 |
|
|
346 |
This function opens a video clip from a file,this function searches through a list of all available
|
|
347 |
plugins and attempts to use each one until successful or the end of the list is reached.
|
|
348 |
|
|
349 |
Once the opening of the video clip is complete, successfully or otherwise, the callback function
|
|
350 |
CMVSVideoPlayAgent::MvpuoOpenComplete() is called.
|
|
351 |
|
|
352 |
This function leaves if errors are encountered opening the specified video clip file, or in initialising a
|
|
353 |
specified/unspecified controller plugin.
|
|
354 |
|
|
355 |
This function can leave with one of the specified error codes.
|
|
356 |
|
|
357 |
@param aFileName
|
|
358 |
The full path name of the file containing the video data.
|
|
359 |
*/
|
|
360 |
EXPORT_C void CMVSVideoPlayAgent::OpenFileL(const TDesC& aFileName)
|
|
361 |
{
|
|
362 |
OpenFileL(aFileName, KNullUid);
|
|
363 |
}
|
|
364 |
|
|
365 |
EXPORT_C void CMVSVideoPlayAgent::OpenFileL(const TDesC& aFileName, TUid aControllerUid)
|
|
366 |
{
|
|
367 |
iFileLogger.Write(_L("Opening a File For CMVSVideoPlayAgent "));
|
|
368 |
|
|
369 |
// remembers the file name & the controller Uid used for opening file
|
|
370 |
iFileName.Close();
|
|
371 |
iFileName.CreateL(aFileName);
|
|
372 |
iControllerUid = aControllerUid;
|
|
373 |
|
|
374 |
__ASSERT_DEBUG(iVideoPlayer, User::Leave(KErrNotReady));
|
|
375 |
iVideoPlayer->Close();
|
|
376 |
|
|
377 |
#ifdef SYMBIAN_BUILD_GCE
|
|
378 |
__ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady));
|
|
379 |
iVideoPlayer2->Close();
|
|
380 |
|
|
381 |
// First attempt is always to open a file with CVideoPlayerUtility2 if GCE
|
|
382 |
// is enabled
|
|
383 |
iVideoPlayer2->OpenFileL(aFileName, aControllerUid);
|
|
384 |
iCurrentVideoPlayer = iVideoPlayer2;
|
|
385 |
#else
|
|
386 |
iVideoPlayer->OpenFileL(aFileName, aControllerUid);
|
|
387 |
iCurrentVideoPlayer = iVideoPlayer;
|
|
388 |
#endif // SYMBIAN_BUILD_GCE
|
|
389 |
|
|
390 |
// Now that we have selected the video player, we can issue the request for notification.
|
|
391 |
if (iRequestNotify)
|
|
392 |
{
|
|
393 |
RegisterForNotification();
|
|
394 |
}
|
|
395 |
}
|
|
396 |
|
|
397 |
EXPORT_C void CMVSVideoPlayAgent::OpenFileL(TMMSource& /*aSource*/)
|
|
398 |
{
|
|
399 |
}
|
|
400 |
|
|
401 |
EXPORT_C void CMVSVideoPlayAgent::OpenDesL(const TDesC8& /*aDescriptor*/)
|
|
402 |
{
|
|
403 |
}
|
|
404 |
|
|
405 |
void CMVSVideoPlayAgent::MvpuoOpenComplete(TInt aError)
|
|
406 |
{
|
|
407 |
iFileLogger.Write(_L("CMVSVideoPlayAgent:MvpuoOpenComplete"));
|
|
408 |
if(aError == KErrNone)
|
|
409 |
{
|
|
410 |
iState = EVideoOpening;
|
|
411 |
iFileLogger.Write(_L("MvpuoOpenComplete:VideoOpening"));
|
|
412 |
iObserver.UpdateStateChange(iState, KErrNone);
|
|
413 |
|
|
414 |
iCurrentVideoPlayer->Prepare();
|
|
415 |
}
|
|
416 |
#ifdef SYMBIAN_BUILD_GCE
|
|
417 |
else if (iCurrentVideoPlayer == iVideoPlayer2 && aError == KErrNotSupported)
|
|
418 |
{
|
|
419 |
// if the controller cannot support GS, try use CVideoPlayerUtility instead
|
|
420 |
TRAPD(err, iVideoPlayer->OpenFileL(iFileName, iControllerUid));
|
|
421 |
|
|
422 |
if (err != KErrNone)
|
|
423 |
{
|
|
424 |
iState = ENotReady; //init failed so from opening to NotReady
|
|
425 |
iFileLogger.Write(_L("MvpuoOpenComplete:From Opening to NotReady"));
|
|
426 |
iObserver.UpdateStateChange(iState, err);
|
|
427 |
}
|
|
428 |
|
|
429 |
iCurrentVideoPlayer = iVideoPlayer;
|
|
430 |
|
|
431 |
// We are switching to a different controller. Cancel the notification request on one
|
|
432 |
// controller and reissue it on the other.
|
|
433 |
if (iRequestNotify)
|
|
434 |
{
|
|
435 |
iVideoPlayer2->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
|
|
436 |
RegisterForNotification();
|
|
437 |
}
|
|
438 |
}
|
|
439 |
#endif // SYMBIAN_BUILD_GCE
|
|
440 |
else
|
|
441 |
{
|
|
442 |
iState = ENotReady; //init failed so from opening to NotReady
|
|
443 |
iFileLogger.Write(_L("MvpuoOpenComplete:From Opening to NotReady"));
|
|
444 |
iObserver.UpdateStateChange(iState, aError);
|
|
445 |
}
|
|
446 |
}
|
|
447 |
|
|
448 |
void CMVSVideoPlayAgent::MvpuoPrepareComplete(TInt aError)
|
|
449 |
{
|
|
450 |
iFileLogger.Write(_L("CMVSVideoPlayAgent:MvpuoPrepareComplete"));
|
|
451 |
if(aError == KErrNone)
|
|
452 |
{
|
|
453 |
iState = EVideoOpened;
|
|
454 |
iFileLogger.Write(_L("MvpuoPrepareComplete:Video Opened"));
|
|
455 |
}
|
|
456 |
else
|
|
457 |
{
|
|
458 |
iState = ENotReady; //prepare failed so from preparing to NotReady
|
|
459 |
iFileLogger.Write(_L("MvpuoPrepareComplete failed : from preparing to NotReady")) ;
|
|
460 |
}
|
|
461 |
iObserver.UpdateStateChange(iState, aError);
|
|
462 |
}
|
|
463 |
|
|
464 |
void CMVSVideoPlayAgent::MvpuoPlayComplete(TInt aError)
|
|
465 |
{
|
|
466 |
if(aError == KErrNone)
|
|
467 |
{
|
|
468 |
iState = EVideoOpened;
|
|
469 |
iFileLogger.Write(_L("MvpuoPlayComplete:Video Opened"));
|
|
470 |
}
|
|
471 |
else
|
|
472 |
{
|
|
473 |
iState = ENotReady; //playcomplete failed so from playcomplete to NotReady
|
|
474 |
iFileLogger.Write(_L("MvpuoPlayComplete failed : from playcomplete to NotReady")) ;
|
|
475 |
}
|
|
476 |
iObserver.UpdateStateChange(iState, aError);
|
|
477 |
}
|
|
478 |
|
|
479 |
void CMVSVideoPlayAgent::MvpuoFrameReady(class CFbsBitmap&, TInt)
|
|
480 |
{
|
|
481 |
}
|
|
482 |
|
|
483 |
void CMVSVideoPlayAgent::MvpuoEvent(const TMMFEvent& /*aEvent*/)
|
|
484 |
{
|
|
485 |
}
|
|
486 |
|
|
487 |
void CMVSVideoPlayAgent::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData)
|
|
488 |
{
|
|
489 |
if(aNotificationEventId == KMMFEventCategoryAudioResourceAvailable)
|
|
490 |
{
|
|
491 |
iObserver.MvsResourceNotification(aNotificationData);
|
|
492 |
}
|
|
493 |
}
|
|
494 |
|
|
495 |
EXPORT_C void CMVSVideoPlayAgent::Prepare()
|
|
496 |
{
|
|
497 |
iCurrentVideoPlayer->Prepare();
|
|
498 |
}
|
|
499 |
|
|
500 |
|
|
501 |
/**
|
|
502 |
Closes the video clip.
|
|
503 |
Updates the state to ENotReady after closing
|
|
504 |
*/
|
|
505 |
EXPORT_C void CMVSVideoPlayAgent::Close()
|
|
506 |
{
|
|
507 |
iFileLogger.Write(_L("CMVSVideoPlayAgent Closed"));
|
|
508 |
|
|
509 |
#ifdef SYMBIAN_BUILD_GCE
|
|
510 |
if (SupportVideoPlayerUtility2())
|
|
511 |
{
|
|
512 |
// Can't leave at this point, this will just remove the leave scan warning
|
|
513 |
TRAP_IGNORE(RemoveDisplayWindowL(*iWindow));
|
|
514 |
iVideoPlayer2->Close();
|
|
515 |
}
|
|
516 |
#endif // SYMBIAN_BUILD_GCE
|
|
517 |
iVideoPlayer->Close();
|
|
518 |
|
|
519 |
iObserver.UpdateStateChange(ENotReady, KErrNone);
|
|
520 |
iCurrentVideoPlayer = NULL;
|
|
521 |
}
|
|
522 |
|
|
523 |
|
|
524 |
/**
|
|
525 |
Begins playback of the initialised video sample at the current volume and priority levels.
|
|
526 |
|
|
527 |
When playing of the video sample is complete, successfully or otherwise, the callback function
|
|
528 |
CMVSVideoPlayAgent::MvpuoPlayComplete() is called.Updates the current state to EVideoPlaying,
|
|
529 |
and once playing is over it updates the state to EVideoOpen.
|
|
530 |
*/
|
|
531 |
EXPORT_C void CMVSVideoPlayAgent::Play()
|
|
532 |
{
|
|
533 |
iCurrentVideoPlayer->Play();
|
|
534 |
|
|
535 |
iState = EVideoPlaying;
|
|
536 |
iObserver.UpdateStateChange(iState, KErrNone);
|
|
537 |
}
|
|
538 |
|
|
539 |
|
|
540 |
/**
|
|
541 |
Begins playback of the initialised video sample at the specified start and end points.
|
|
542 |
|
|
543 |
When playing of the video sample is complete, successfully or otherwise, the callback function
|
|
544 |
CMVSVideoPlayAgent::MvpuoPlayComplete() is called.Updates the current state to EVideoPlaying,
|
|
545 |
and once playing is over it updates the state to EVideoOpen.
|
|
546 |
|
|
547 |
@param aStartTime
|
|
548 |
The point at which to start playback.
|
|
549 |
@param aEndTime
|
|
550 |
The point at which to terminate playback.
|
|
551 |
*/
|
|
552 |
EXPORT_C void CMVSVideoPlayAgent::Play(const TTimeIntervalMicroSeconds& aStartPoint,
|
|
553 |
const TTimeIntervalMicroSeconds& aEndPoint)
|
|
554 |
{
|
|
555 |
iCurrentVideoPlayer->Play(aStartPoint, aEndPoint);
|
|
556 |
|
|
557 |
iState = EVideoPlaying;
|
|
558 |
iObserver.UpdateStateChange(iState, KErrNone);
|
|
559 |
}
|
|
560 |
|
|
561 |
|
|
562 |
/**
|
|
563 |
Stops playback of the video sample as soon as is possible.
|
|
564 |
|
|
565 |
If the video sample is playing, playback is stopped as soon as possible and the callback function
|
|
566 |
CMVSVideoPlayAgent::MvpuoPlayComplete() is called.
|
|
567 |
|
|
568 |
If playback is already complete, this function has no effect. In addition, under these circumstances
|
|
569 |
the callback function CMVSVideoPlayAgent::MvpuoPlayComplete() is not called either.
|
|
570 |
|
|
571 |
The position is reset to the beginning of the file.
|
|
572 |
|
|
573 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
|
574 |
another of the system-wide error codes.
|
|
575 |
Also Updates the state to EVideoStopped
|
|
576 |
*/
|
|
577 |
EXPORT_C TInt CMVSVideoPlayAgent::Stop()
|
|
578 |
{
|
|
579 |
TInt err = KErrNotReady;
|
|
580 |
if (iCurrentVideoPlayer)
|
|
581 |
{
|
|
582 |
err = iCurrentVideoPlayer->Stop();
|
|
583 |
}
|
|
584 |
|
|
585 |
if (err == KErrNone)
|
|
586 |
{
|
|
587 |
iState = EVideoStopped;
|
|
588 |
iFileLogger.Write(_L("CMVSVideoPlayAgent Stopped"));
|
|
589 |
}
|
|
590 |
else
|
|
591 |
{
|
|
592 |
iState = ENotReady;
|
|
593 |
}
|
|
594 |
iObserver.UpdateStateChange(iState, err);
|
|
595 |
|
|
596 |
return err;
|
|
597 |
}
|
|
598 |
|
|
599 |
|
|
600 |
/**
|
|
601 |
Video playback is paused. The current position is maintained and playback can be
|
|
602 |
resumed by calling Play.
|
|
603 |
*/
|
|
604 |
EXPORT_C void CMVSVideoPlayAgent::PauseL()
|
|
605 |
{
|
|
606 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
607 |
|
|
608 |
TRAPD(err, iCurrentVideoPlayer->PauseL());
|
|
609 |
if(err == KErrNone)
|
|
610 |
{
|
|
611 |
iState = EVideoPaused;
|
|
612 |
iFileLogger.Write(_L("CMVSVideoPlayAgent Paused "));
|
|
613 |
}
|
|
614 |
else
|
|
615 |
{
|
|
616 |
iState = ENotReady;
|
|
617 |
iFileLogger.Write(_L("CMVSVideoPlayAgent Not Ready"));
|
|
618 |
}
|
|
619 |
iObserver.UpdateStateChange(iState, err);
|
|
620 |
}
|
|
621 |
|
|
622 |
|
|
623 |
/**
|
|
624 |
Sends custom command to the plugin controller.
|
|
625 |
Passes handle and size of the drawable window.
|
|
626 |
|
|
627 |
Sets the display window. This is used to provide the video controller with an area of
|
|
628 |
the display to render the current video frame.
|
|
629 |
|
|
630 |
@param aWs
|
|
631 |
The window server session ID.
|
|
632 |
@param aScreenDevice
|
|
633 |
The software device screen.
|
|
634 |
@param aWindowRect
|
|
635 |
The window to display.
|
|
636 |
@param aScreenRect
|
|
637 |
The dimensions of the display window.
|
|
638 |
@param aClipRect
|
|
639 |
The area of the video clip to display in the window.
|
|
640 |
*/
|
|
641 |
EXPORT_C void CMVSVideoPlayAgent::SetDisplayWindowL(RWsSession &aWs, CWsScreenDevice &aScreenDevice, RWindow &aWindow, const TRect &aWindowRect, const TRect &aClipRect)
|
|
642 |
{
|
|
643 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
644 |
|
|
645 |
iFileLogger.Write(_L("SettingDisplayWindow"));
|
|
646 |
iCurrentVideoPlayer->SetDisplayWindowL(aWs, aScreenDevice, aWindow, aWindowRect, aClipRect);
|
|
647 |
}
|
|
648 |
|
|
649 |
|
|
650 |
/**
|
|
651 |
Sets the video frame rate.
|
|
652 |
|
|
653 |
@param aFramesPerSecond
|
|
654 |
The number of frames per second to request.
|
|
655 |
*/
|
|
656 |
EXPORT_C void CMVSVideoPlayAgent::SetVideoFrameRateL(TReal32 aFramesPerSecond)
|
|
657 |
{
|
|
658 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
659 |
|
|
660 |
iFileLogger.Write(_L("SettingVedioFrameRate "));
|
|
661 |
iCurrentVideoPlayer->SetVideoFrameRateL(aFramesPerSecond);
|
|
662 |
}
|
|
663 |
|
|
664 |
|
|
665 |
/**
|
|
666 |
Sets the playback volume for the audio track of the video clip.
|
|
667 |
|
|
668 |
The volume can be changed before or during playback and is effective immediately. The volume can
|
|
669 |
be set to any value between zero (mute) and the maximum permissible volume
|
|
670 |
(determined using MaxVolume()).
|
|
671 |
|
|
672 |
To determine if the current video clip contains an audio track, use AudioEnabledL().
|
|
673 |
|
|
674 |
|
|
675 |
@param aVolume
|
|
676 |
The volume, between 0 and MaxVolume().
|
|
677 |
*/
|
|
678 |
EXPORT_C void CMVSVideoPlayAgent::SetVolumeL(TInt aVolume)
|
|
679 |
{
|
|
680 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
681 |
|
|
682 |
iFileLogger.Write(_L("Setting CMVSVideoPlayAgent's Volume "));
|
|
683 |
iCurrentVideoPlayer->SetVolumeL(aVolume);
|
|
684 |
}
|
|
685 |
|
|
686 |
|
|
687 |
/**
|
|
688 |
Sets the current playback balance for the audio track of the video clip.
|
|
689 |
|
|
690 |
The balance can be any value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight,
|
|
691 |
the default value being KMMFBalanceCenter.
|
|
692 |
|
|
693 |
@param aBalance
|
|
694 |
The balance value to set.
|
|
695 |
*/
|
|
696 |
EXPORT_C void CMVSVideoPlayAgent::SetBalanceL(TInt aBalance)
|
|
697 |
{
|
|
698 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
699 |
|
|
700 |
iFileLogger.Write(_L("Setting CMVSVideoPlayAgent's Balance"));
|
|
701 |
iCurrentVideoPlayer->SetBalanceL(aBalance);
|
|
702 |
}
|
|
703 |
|
|
704 |
|
|
705 |
/**
|
|
706 |
Sets the playback priority.
|
|
707 |
|
|
708 |
This is used to arbitrate between multiple objects simultaneously trying to accesses
|
|
709 |
the sound hardware.
|
|
710 |
|
|
711 |
@param aPriority
|
|
712 |
The priority level to apply, EMdaPriorityMin client can be interrupted by any other
|
|
713 |
client, EMdaPriorityNormal client can only be interrupted by a client with a higher
|
|
714 |
priority or EMdaPriorityMax client cannot be interrupted by other clients.
|
|
715 |
@param aPref
|
|
716 |
The time and quality preferences to apply, enumerated in TMdaPriorityPreference.
|
|
717 |
*/
|
|
718 |
EXPORT_C void CMVSVideoPlayAgent::SetPriorityL(TInt aPriority, TMdaPriorityPreference aPref)
|
|
719 |
{
|
|
720 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
721 |
|
|
722 |
iFileLogger.Write(_L("Setting Priority of CMVSVideoPlayAgent"));
|
|
723 |
iCurrentVideoPlayer->SetPriorityL(aPriority, aPref);
|
|
724 |
}
|
|
725 |
|
|
726 |
|
|
727 |
/**
|
|
728 |
Sets the position within the video clip from where to start playback.
|
|
729 |
|
|
730 |
@param aPosition
|
|
731 |
Position from start of clip in microseconds.
|
|
732 |
*/
|
|
733 |
EXPORT_C void CMVSVideoPlayAgent::SetPositionL(const TTimeIntervalMicroSeconds &aPosition)
|
|
734 |
{
|
|
735 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
736 |
|
|
737 |
iFileLogger.Write(_L("Setting Position of CMVSVideoPlayAgent"));
|
|
738 |
iCurrentVideoPlayer->SetPositionL(aPosition);
|
|
739 |
}
|
|
740 |
|
|
741 |
|
|
742 |
/**
|
|
743 |
Rotates the video image on the screen.
|
|
744 |
|
|
745 |
@param aRotation
|
|
746 |
The desired rotation to apply in 90 degree increments.
|
|
747 |
*/
|
|
748 |
EXPORT_C void CMVSVideoPlayAgent::SetRotationL(TVideoRotation aRotation)
|
|
749 |
{
|
|
750 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
751 |
|
|
752 |
iFileLogger.Write(_L("Setting Rotations of CMVSVideoPlayAgent"));
|
|
753 |
iCurrentVideoPlayer->SetRotationL(aRotation);
|
|
754 |
}
|
|
755 |
|
|
756 |
|
|
757 |
|
|
758 |
/**
|
|
759 |
Scales the video image to a specified percentage of its original size.
|
|
760 |
|
|
761 |
@param aWidthPercentage
|
|
762 |
The percentage (100 = original size) to be used to scale the width of the video image
|
|
763 |
@param aHeightPercentage
|
|
764 |
The percentage (100 = original size) to be used to scale the height of the video image.
|
|
765 |
If this is not equal to aWidthPercentage then the image may be distorted.
|
|
766 |
@param aAntiAliasFiltering
|
|
767 |
A boolean specifying if anti-aliasing should be used. True if anti-aliasing filtering
|
|
768 |
should be used. If the plugin does not support this kind of processing,
|
|
769 |
this value will be ignored.
|
|
770 |
*/
|
|
771 |
EXPORT_C void CMVSVideoPlayAgent::SetScaleFactorL(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering)
|
|
772 |
{
|
|
773 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
774 |
|
|
775 |
iFileLogger.Write(_L("Setting ScaleFactor of CMVSVideoPlayAgent"));
|
|
776 |
iCurrentVideoPlayer->SetScaleFactorL(aWidthPercentage, aHeightPercentage, aAntiAliasFiltering);
|
|
777 |
}
|
|
778 |
|
|
779 |
|
|
780 |
/**
|
|
781 |
Selects a region of the video image to be displayed.
|
|
782 |
|
|
783 |
@param aCropRegion
|
|
784 |
The dimensions of the crop region, relative to the video image.
|
|
785 |
@see GetCropRegionL
|
|
786 |
*/
|
|
787 |
EXPORT_C void CMVSVideoPlayAgent::SetCropRegionL(const TRect& aCropRegion)
|
|
788 |
{
|
|
789 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
790 |
|
|
791 |
iFileLogger.Write(_L("Setting CorpRegion of CMVSVideoPlayAgent"));
|
|
792 |
iCurrentVideoPlayer->SetCropRegionL(aCropRegion);
|
|
793 |
}
|
|
794 |
|
|
795 |
/**
|
|
796 |
Selects the video extent on the screen, relative to the window.
|
|
797 |
|
|
798 |
@param aVideoExtent
|
|
799 |
The new video extent, relative to the window
|
|
800 |
@leave KErrNotSupport if CVideoPlayerUtility is used for video playback
|
|
801 |
*/
|
|
802 |
#ifdef SYMBIAN_BUILD_GCE
|
|
803 |
EXPORT_C void CMVSVideoPlayAgent::SetVideoExtentL(const TRect& aVideoExtent)
|
|
804 |
#else
|
|
805 |
EXPORT_C void CMVSVideoPlayAgent::SetVideoExtentL(const TRect& /* aVideoExtent */)
|
|
806 |
#endif // SYMBIAN_BUILD_GCE
|
|
807 |
{
|
|
808 |
iFileLogger.Write(_L("Setting VideoExtent of CMVSVideoPlayAgent"));
|
|
809 |
|
|
810 |
#ifdef SYMBIAN_BUILD_GCE
|
|
811 |
if(SupportVideoPlayerUtility2())
|
|
812 |
{
|
|
813 |
if (iWindow)
|
|
814 |
{
|
|
815 |
iVideoPlayer2->SetVideoExtentL(*iWindow, aVideoExtent);
|
|
816 |
}
|
|
817 |
else
|
|
818 |
{
|
|
819 |
iFileLogger.Write(_L("WARNING - Display Window has not been set. Caller should save these values to be set again later."));
|
|
820 |
}
|
|
821 |
return;
|
|
822 |
}
|
|
823 |
#endif // SYMBIAN_BUILD_GCE
|
|
824 |
|
|
825 |
User::Leave(KErrNotSupported);
|
|
826 |
}
|
|
827 |
|
|
828 |
/**
|
|
829 |
Selects the window clipping rectangle, relative to the window
|
|
830 |
|
|
831 |
@param aWindowClipRect
|
|
832 |
The new window clipping rectangle, relative to the window
|
|
833 |
@leave KErrNotSupport if CVideoPlayerUtility is used for video playback
|
|
834 |
*/
|
|
835 |
#ifdef SYMBIAN_BUILD_GCE
|
|
836 |
EXPORT_C void CMVSVideoPlayAgent::SetWindowClipRectL(const TRect& aWindowClipRect)
|
|
837 |
#else
|
|
838 |
EXPORT_C void CMVSVideoPlayAgent::SetWindowClipRectL(const TRect& /* aWindowClipRect */)
|
|
839 |
#endif // SYMBIAN_BUILD_GCE
|
|
840 |
{
|
|
841 |
iFileLogger.Write(_L("Setting WindowClippingRect of CMVSVideoPlayAgent"));
|
|
842 |
|
|
843 |
#ifdef SYMBIAN_BUILD_GCE
|
|
844 |
if (SupportVideoPlayerUtility2())
|
|
845 |
{
|
|
846 |
if (iWindow)
|
|
847 |
{
|
|
848 |
iVideoPlayer2->SetWindowClipRectL(*iWindow, aWindowClipRect);
|
|
849 |
}
|
|
850 |
else
|
|
851 |
{
|
|
852 |
iFileLogger.Write(_L("WARNING - Display Window has not been set. Caller should save these values to be set again later."));
|
|
853 |
}
|
|
854 |
return;
|
|
855 |
}
|
|
856 |
#endif // SYMBIAN_BUILD_GCE
|
|
857 |
|
|
858 |
User::Leave(KErrNotSupported);
|
|
859 |
}
|
|
860 |
|
|
861 |
|
|
862 |
/**
|
|
863 |
Gets the current frame. The current frame is requested, and will be sent to
|
|
864 |
the client asynchrynously.
|
|
865 |
|
|
866 |
@param aDisplayMode
|
|
867 |
The display mode for the retrieved frame.
|
|
868 |
*/
|
|
869 |
EXPORT_C void CMVSVideoPlayAgent::GetFrameL(TDisplayMode aDisplayMode)
|
|
870 |
{
|
|
871 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
872 |
iCurrentVideoPlayer->GetFrameL(aDisplayMode);
|
|
873 |
}
|
|
874 |
|
|
875 |
|
|
876 |
/**
|
|
877 |
Gets the current frame. The current frame is requested, and will be sent to
|
|
878 |
the client asynchrynously.
|
|
879 |
|
|
880 |
@param aDisplayMode
|
|
881 |
The display mode for the retrieved frame.
|
|
882 |
@param aIntent
|
|
883 |
The DRM Intent to pass to the controller.
|
|
884 |
*/
|
|
885 |
EXPORT_C void CMVSVideoPlayAgent::GetFrameL(TDisplayMode aDisplayMode, ContentAccess::TIntent aIntent)
|
|
886 |
{
|
|
887 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
888 |
iCurrentVideoPlayer->GetFrameL(aDisplayMode, aIntent);
|
|
889 |
}
|
|
890 |
|
|
891 |
|
|
892 |
/**
|
|
893 |
Returns the video frame rate in frames/second.
|
|
894 |
|
|
895 |
@return The video frame rate (frames/second).
|
|
896 |
*/
|
|
897 |
EXPORT_C TReal32 CMVSVideoPlayAgent::VideoFrameRateL()
|
|
898 |
{
|
|
899 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
900 |
|
|
901 |
iFileLogger.Write(_L("Getting VideoFrameRate for CMVSVideoPlayAgent"));
|
|
902 |
return iCurrentVideoPlayer->VideoFrameRateL();
|
|
903 |
}
|
|
904 |
|
|
905 |
|
|
906 |
/**
|
|
907 |
Gets the video frame size.
|
|
908 |
|
|
909 |
@param aSize
|
|
910 |
The video frame size
|
|
911 |
*/
|
|
912 |
EXPORT_C void CMVSVideoPlayAgent::VideoFrameSizeL(TSize &aSize)
|
|
913 |
{
|
|
914 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
915 |
|
|
916 |
iFileLogger.Write(_L("Getting VideoFrameFrameSize for CMVSVideoPlayAgent"));
|
|
917 |
iCurrentVideoPlayer->VideoFrameSizeL(aSize);
|
|
918 |
}
|
|
919 |
|
|
920 |
|
|
921 |
/**
|
|
922 |
Returns the video format's MIME type.
|
|
923 |
|
|
924 |
@return The video clip's MIME type.
|
|
925 |
*/
|
|
926 |
EXPORT_C const TDesC8& CMVSVideoPlayAgent::VideoFormatMimeType()
|
|
927 |
{
|
|
928 |
if (iCurrentVideoPlayer)
|
|
929 |
{
|
|
930 |
return iCurrentVideoPlayer->VideoFormatMimeType();
|
|
931 |
}
|
|
932 |
else
|
|
933 |
{
|
|
934 |
return KNullDesC8;
|
|
935 |
}
|
|
936 |
}
|
|
937 |
|
|
938 |
|
|
939 |
/**
|
|
940 |
Returns the video bit rate.
|
|
941 |
|
|
942 |
@return The video bit rate in bits/second.
|
|
943 |
*/
|
|
944 |
EXPORT_C TInt CMVSVideoPlayAgent::VideoBitRateL()
|
|
945 |
{
|
|
946 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
947 |
|
|
948 |
iFileLogger.Write(_L("Getting VideoBitRate for CMVSVideoPlayAgent"));
|
|
949 |
return iCurrentVideoPlayer->VideoBitRateL();
|
|
950 |
}
|
|
951 |
|
|
952 |
|
|
953 |
/**
|
|
954 |
Returns the audio bit rate in bits/second.
|
|
955 |
|
|
956 |
@return The audio bit rate (bits/second).
|
|
957 |
*/
|
|
958 |
EXPORT_C TInt CMVSVideoPlayAgent::AudioBitRateL()
|
|
959 |
{
|
|
960 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
961 |
|
|
962 |
iFileLogger.Write(_L("Getting AudioBitRate for CMVSVideoPlayAgent"));
|
|
963 |
return iCurrentVideoPlayer->AudioBitRateL();
|
|
964 |
}
|
|
965 |
|
|
966 |
|
|
967 |
/**
|
|
968 |
Returns the codec used for the audio component of the video clip.
|
|
969 |
|
|
970 |
@return The four character code representing the audio codec.
|
|
971 |
*/
|
|
972 |
EXPORT_C TFourCC CMVSVideoPlayAgent::AudioTypeL()
|
|
973 |
{
|
|
974 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
975 |
|
|
976 |
iFileLogger.Write(_L("Getting AudioType for CMVSVideoPlayAgent"));
|
|
977 |
return iCurrentVideoPlayer->AudioTypeL();
|
|
978 |
}
|
|
979 |
|
|
980 |
|
|
981 |
/**
|
|
982 |
Returns whether the current clip has an audio stream.
|
|
983 |
|
|
984 |
@return Boolean indication the presence of an audio stream. ETrue if an audio track is present,
|
|
985 |
otherwise EFalse.
|
|
986 |
*/
|
|
987 |
EXPORT_C TBool CMVSVideoPlayAgent::AudioEnabledL()
|
|
988 |
{
|
|
989 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
990 |
|
|
991 |
iFileLogger.Write(_L("CMVSVideoPlayAgent's Audio Enabled"));
|
|
992 |
return iCurrentVideoPlayer->AudioEnabledL();
|
|
993 |
}
|
|
994 |
|
|
995 |
|
|
996 |
/**
|
|
997 |
Returns the current playback position.
|
|
998 |
|
|
999 |
@return The current position from the start of the clip in microseconds.
|
|
1000 |
*/
|
|
1001 |
EXPORT_C TTimeIntervalMicroSeconds CMVSVideoPlayAgent::PositionL()
|
|
1002 |
{
|
|
1003 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
1004 |
return iCurrentVideoPlayer->PositionL();
|
|
1005 |
}
|
|
1006 |
|
|
1007 |
|
|
1008 |
/**
|
|
1009 |
Returns the duration of video clip in mircoseconds.
|
|
1010 |
|
|
1011 |
@return The duration of clip in microseconds.
|
|
1012 |
*/
|
|
1013 |
EXPORT_C TTimeIntervalMicroSeconds CMVSVideoPlayAgent::DurationL()
|
|
1014 |
{
|
|
1015 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
1016 |
return iCurrentVideoPlayer->DurationL();
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
|
|
1020 |
/**
|
|
1021 |
Returns the current playback volume for the audio track of the video clip.
|
|
1022 |
|
|
1023 |
@return A value between 0 (mute) and the maximum volume returned by MaxVolume().
|
|
1024 |
*/
|
|
1025 |
EXPORT_C TInt CMVSVideoPlayAgent::Volume()
|
|
1026 |
{
|
|
1027 |
return iCurrentVideoPlayer->Volume();
|
|
1028 |
}
|
|
1029 |
|
|
1030 |
|
|
1031 |
/**
|
|
1032 |
Get the current playback priority. This is used to arbitrate between simultaneous accesses of
|
|
1033 |
the sound hardware.
|
|
1034 |
|
|
1035 |
@param aPriority
|
|
1036 |
On return, contains the priority level, EMdaPriorityMin client can be interrupted by any
|
|
1037 |
other client, EMdaPriorityNormal client can only be interrupted by a client with a higher
|
|
1038 |
priority or EMdaPriorityMax client cannot be interrupted by other clients.
|
|
1039 |
@param aPref
|
|
1040 |
On return, contains the time and quality preferences, enumerated in TMdaPriorityPreference.
|
|
1041 |
*/
|
|
1042 |
EXPORT_C void CMVSVideoPlayAgent::PriorityL(TInt &aPriority, TMdaPriorityPreference &aPref)
|
|
1043 |
{
|
|
1044 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
1045 |
iCurrentVideoPlayer->PriorityL(aPriority, aPref);
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
|
|
1049 |
/**
|
|
1050 |
Returns the current balance setting for the audio track of the video clip.
|
|
1051 |
|
|
1052 |
@return A balance value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight.
|
|
1053 |
*/
|
|
1054 |
EXPORT_C TInt CMVSVideoPlayAgent::Balance()
|
|
1055 |
{
|
|
1056 |
return iCurrentVideoPlayer->Balance();
|
|
1057 |
}
|
|
1058 |
|
|
1059 |
|
|
1060 |
/**
|
|
1061 |
Query the rotation that is currently applied to the video image.
|
|
1062 |
|
|
1063 |
@return The applied rotation
|
|
1064 |
|
|
1065 |
@see SetRotationL
|
|
1066 |
*/
|
|
1067 |
EXPORT_C TVideoRotation CMVSVideoPlayAgent::RotationL()
|
|
1068 |
{
|
|
1069 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
1070 |
return iCurrentVideoPlayer->RotationL();
|
|
1071 |
}
|
|
1072 |
|
|
1073 |
|
|
1074 |
/**
|
|
1075 |
Gets the scale factor currently applied to the video image.
|
|
1076 |
|
|
1077 |
@param aWidthPercentage
|
|
1078 |
On function return, contains the current scaling percentage applied to the width of the
|
|
1079 |
video image (100 = original size).
|
|
1080 |
@param aHeightPercentage
|
|
1081 |
On function return, contains the current scaling percentage applied to the height of the
|
|
1082 |
of the video image (100 = original size).
|
|
1083 |
@param aAntiAliasFiltering
|
|
1084 |
The boolean specifying if anit-aliasing is being used.
|
|
1085 |
@see SetScaleFactorL
|
|
1086 |
*/
|
|
1087 |
EXPORT_C void CMVSVideoPlayAgent::GetScaleFactorL(TReal32 &aWidthPercentage, TReal32 &aHeightPercentage, TBool &aAntiAliasFiltering)
|
|
1088 |
{
|
|
1089 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
1090 |
iCurrentVideoPlayer->GetScaleFactorL(aWidthPercentage,
|
|
1091 |
aHeightPercentage,
|
|
1092 |
aAntiAliasFiltering);
|
|
1093 |
}
|
|
1094 |
|
|
1095 |
|
|
1096 |
/**
|
|
1097 |
Gets the crop region currently applied to the image.
|
|
1098 |
|
|
1099 |
@param aCropRegion
|
|
1100 |
The dimensions of the crop region, relative to the video image. If no
|
|
1101 |
crop region has been applied, the full dimensions of the video image will
|
|
1102 |
be returned.
|
|
1103 |
|
|
1104 |
@see SetCropRegionL
|
|
1105 |
*/
|
|
1106 |
EXPORT_C void CMVSVideoPlayAgent::GetCropRegionL(TRect &aCropRegion)
|
|
1107 |
{
|
|
1108 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
1109 |
iCurrentVideoPlayer->GetCropRegionL(aCropRegion);
|
|
1110 |
}
|
|
1111 |
|
|
1112 |
|
|
1113 |
/**
|
|
1114 |
Returns the number of meta data entries associated with this clip.
|
|
1115 |
|
|
1116 |
@return The number of meta data entries.
|
|
1117 |
*/
|
|
1118 |
EXPORT_C TInt CMVSVideoPlayAgent::NumberOfMetaDataEntriesL()
|
|
1119 |
{
|
|
1120 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
1121 |
return iCurrentVideoPlayer->NumberOfMetaDataEntriesL();
|
|
1122 |
}
|
|
1123 |
|
|
1124 |
|
|
1125 |
/**
|
|
1126 |
Returns an array containing the MetaDataEntry for the given audio clip
|
|
1127 |
|
|
1128 |
@param aMetaData
|
|
1129 |
The meta data Array
|
|
1130 |
|
|
1131 |
@leave Leaves with KErrNotFound if the meta data entry does not exist or
|
|
1132 |
KErrNotSupported if the controller does not support meta data
|
|
1133 |
information for this format. Other errors indicate more general system
|
|
1134 |
failure.
|
|
1135 |
*/
|
|
1136 |
EXPORT_C void CMVSVideoPlayAgent::GetMetaDataArrayL(RPointerArray<CMMFMetaDataEntry>& aMetaData)
|
|
1137 |
{
|
|
1138 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
1139 |
|
|
1140 |
//Reset the meta array
|
|
1141 |
aMetaData.Reset();
|
|
1142 |
TInt entries = NumberOfMetaDataEntriesL();
|
|
1143 |
|
|
1144 |
CMMFMetaDataEntry* entry = NULL;
|
|
1145 |
for(TInt index= 0; index < entries; ++index)
|
|
1146 |
{
|
|
1147 |
entry = iCurrentVideoPlayer->MetaDataEntryL(index);
|
|
1148 |
aMetaData.Append(entry);
|
|
1149 |
}
|
|
1150 |
}
|
|
1151 |
|
|
1152 |
/**
|
|
1153 |
Returns the controller implementation information associated with the current controller.
|
|
1154 |
|
|
1155 |
@return The controller implementation structure
|
|
1156 |
*/
|
|
1157 |
EXPORT_C const CMMFControllerImplementationInformation& CMVSVideoPlayAgent::ControllerImplementationInformationL()
|
|
1158 |
{
|
|
1159 |
__ASSERT_DEBUG(iCurrentVideoPlayer, User::Leave(KErrNotReady));
|
|
1160 |
|
|
1161 |
iFileLogger.Write(_L("Getting the ControllerImplementationInformation of CMVSVideoPlayAgent")) ;
|
|
1162 |
return iCurrentVideoPlayer->ControllerImplementationInformationL();
|
|
1163 |
}
|
|
1164 |
|
|
1165 |
|
|
1166 |
/**
|
|
1167 |
Returns the current state of the CMVSAudioPlayAgent.
|
|
1168 |
|
|
1169 |
@return The current state, iState.
|
|
1170 |
*/
|
|
1171 |
EXPORT_C TMVSState CMVSVideoPlayAgent::GetState()
|
|
1172 |
{
|
|
1173 |
return iState;
|
|
1174 |
}
|
|
1175 |
|
|
1176 |
/**
|
|
1177 |
Sets the specified output screen to render the video.
|
|
1178 |
|
|
1179 |
@return KErrNone,on success else any of the system wide error code.
|
|
1180 |
*/
|
|
1181 |
EXPORT_C TInt CMVSVideoPlayAgent::SetScreenNumber(TInt aScreenNumber)
|
|
1182 |
{
|
|
1183 |
TInt err = KErrNone;
|
|
1184 |
|
|
1185 |
if (!iCurrentVideoPlayer)
|
|
1186 |
{
|
|
1187 |
err = iVideoPlayer->SetInitScreenNumber(aScreenNumber);
|
|
1188 |
}
|
|
1189 |
else
|
|
1190 |
{
|
|
1191 |
err = iCurrentVideoPlayer->SetInitScreenNumber(aScreenNumber);
|
|
1192 |
}
|
|
1193 |
|
|
1194 |
if (err == KErrNone)
|
|
1195 |
{
|
|
1196 |
iScreenNumber = aScreenNumber;
|
|
1197 |
}
|
|
1198 |
|
|
1199 |
return err;
|
|
1200 |
}
|
|
1201 |
|
|
1202 |
/**
|
|
1203 |
Registers for audio resource notification.
|
|
1204 |
|
|
1205 |
@return KErrNone,on success else any of the system wide error code.
|
|
1206 |
*/
|
|
1207 |
EXPORT_C TInt CMVSVideoPlayAgent::RegisterForNotification()
|
|
1208 |
{
|
|
1209 |
if (!iCurrentVideoPlayer)
|
|
1210 |
{
|
|
1211 |
// Set the request notify flag. When we select which video player we are using we
|
|
1212 |
// will issue the request for notification.
|
|
1213 |
iRequestNotify = ETrue;
|
|
1214 |
return KErrNone;
|
|
1215 |
}
|
|
1216 |
|
|
1217 |
return iCurrentVideoPlayer->RegisterAudioResourceNotification(*this, KMMFEventCategoryAudioResourceAvailable);
|
|
1218 |
}
|
|
1219 |
|
|
1220 |
/**
|
|
1221 |
Cancels any existing registeration to audio resource notification.
|
|
1222 |
|
|
1223 |
@return KErrNone,on success else any of the system wide error code.
|
|
1224 |
*/
|
|
1225 |
EXPORT_C TInt CMVSVideoPlayAgent::CancelNotification()
|
|
1226 |
{
|
|
1227 |
if (!iCurrentVideoPlayer)
|
|
1228 |
{
|
|
1229 |
iRequestNotify = EFalse;
|
|
1230 |
return KErrNone;
|
|
1231 |
}
|
|
1232 |
|
|
1233 |
return iCurrentVideoPlayer->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
|
|
1234 |
}
|
|
1235 |
|
|
1236 |
EXPORT_C TInt CMVSVideoPlayAgent::WillResumePlay()
|
|
1237 |
{
|
|
1238 |
if (!iCurrentVideoPlayer)
|
|
1239 |
{
|
|
1240 |
return KErrNotReady;
|
|
1241 |
}
|
|
1242 |
return iCurrentVideoPlayer->WillResumePlay();
|
|
1243 |
}
|
|
1244 |
|
|
1245 |
/**
|
|
1246 |
Returns an integer representing the maximum volume that the audio track can support.
|
|
1247 |
|
|
1248 |
This is the maximum value that can be passed to SetVolumeL(). This value is platform
|
|
1249 |
independent, but is always greater than or equal to one.
|
|
1250 |
|
|
1251 |
@return The maximum playback volume.
|
|
1252 |
*/
|
|
1253 |
EXPORT_C TInt CMVSVideoPlayAgent::MaxVolume()
|
|
1254 |
{
|
|
1255 |
if (!iCurrentVideoPlayer)
|
|
1256 |
{
|
|
1257 |
return iVideoPlayer->MaxVolume();
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
return iCurrentVideoPlayer->MaxVolume();
|
|
1261 |
}
|
|
1262 |
|
|
1263 |
#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
|
|
1264 |
EXPORT_C void CMVSVideoPlayAgent::EnableSubtitlesL()
|
|
1265 |
{
|
|
1266 |
__ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady));
|
|
1267 |
|
|
1268 |
if (iWindow)
|
|
1269 |
{
|
|
1270 |
iVideoPlayer2->EnableSubtitlesL();
|
|
1271 |
}
|
|
1272 |
else
|
|
1273 |
{
|
|
1274 |
iEnableSubtitlesOnAdd = ETrue;
|
|
1275 |
}
|
|
1276 |
}
|
|
1277 |
|
|
1278 |
EXPORT_C void CMVSVideoPlayAgent::DisableSubtitlesL()
|
|
1279 |
{
|
|
1280 |
__ASSERT_DEBUG(iVideoPlayer2, User::Leave(KErrNotReady));
|
|
1281 |
iVideoPlayer2->DisableSubtitles();
|
|
1282 |
iEnableSubtitlesOnAdd = EFalse;
|
|
1283 |
}
|
|
1284 |
|
|
1285 |
EXPORT_C TBool CMVSVideoPlayAgent::SubtitlesAvailable()
|
|
1286 |
{
|
|
1287 |
if (iVideoPlayer2)
|
|
1288 |
{
|
|
1289 |
return iVideoPlayer2->SubtitlesAvailable();
|
|
1290 |
}
|
|
1291 |
|
|
1292 |
return EFalse;
|
|
1293 |
}
|
|
1294 |
|
|
1295 |
EXPORT_C void CMVSVideoPlayAgent::RenderSubtitle(const TRect& aRect)
|
|
1296 |
{
|
|
1297 |
if (iVideoPlayer2)
|
|
1298 |
{
|
|
1299 |
iVideoPlayer2->RedrawSubtitle(*iWindow, aRect);
|
|
1300 |
}
|
|
1301 |
}
|
|
1302 |
|
|
1303 |
#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
|