23
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Test Harness for VideoPlaybackControls
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// Version : %version: 16 %
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <coeaui.h>
|
|
23 |
#include <aknutils.h>
|
|
24 |
#include <aknsutils.h>
|
|
25 |
#include <aknviewappui.h>
|
|
26 |
#include <aknsdrawutils.h>
|
|
27 |
#include <aknsbasicbackgroundcontrolcontext.h>
|
|
28 |
|
|
29 |
#include "mpxvideoplaybackviewfiledetails.h"
|
|
30 |
#include "videoplaybackcontrolstest.h"
|
|
31 |
#include "mpxvpbc_stub.h"
|
|
32 |
#include "mpxvideoplaybackcontrolscontroller.h"
|
|
33 |
#include "mpxhelixplaybackplugindefs.h"
|
|
34 |
#include "mpxvpbuih_stub.h"
|
|
35 |
#include "mpxcommonvideoplaybackview.hrh"
|
|
36 |
#include "mpxvideo_debug.h"
|
|
37 |
|
|
38 |
// CONSTANTS
|
|
39 |
|
|
40 |
_LIT( KFileTitle, "asdfasdfasdfasdfasdfasd asdfasdfasdfasdfasdfasd" );
|
|
41 |
|
|
42 |
const TInt KMaxFileTitleLength = 2048;
|
|
43 |
|
|
44 |
|
|
45 |
// ============================ MEMBER FUNCTIONS ===================================================
|
|
46 |
|
|
47 |
// -------------------------------------------------------------------------------------------------
|
|
48 |
// CMPXVideoPlaybackContainer::CMPXVideoPlaybackContainer
|
|
49 |
// C++ default constructor can NOT contain any code, that
|
|
50 |
// might leave.
|
|
51 |
// -------------------------------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
|
|
54 |
CMPXVideoPlaybackContainer::CMPXVideoPlaybackContainer()
|
|
55 |
{
|
|
56 |
}
|
|
57 |
|
|
58 |
// -------------------------------------------------------------------------------------------------
|
|
59 |
// CMPXVideoPlaybackContainer::ConstructL()
|
|
60 |
// Symbian 2nd phase constructor can leave.
|
|
61 |
// -------------------------------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
void CMPXVideoPlaybackContainer::ConstructL( const TDesC& aFileName )
|
|
64 |
{
|
|
65 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::ConstructL()"));
|
|
66 |
|
|
67 |
iFileDetails = CMPXVideoPlaybackViewFileDetails::NewL();
|
|
68 |
iFileDetails->iClipName = HBufC::NewL( aFileName.Length() );
|
|
69 |
iFileDetails->iClipName->Des().Copy( aFileName );
|
|
70 |
|
|
71 |
CreateWindowL();
|
|
72 |
|
|
73 |
iUserInputHandler = CMPXVideoPlaybackUserInputHandler::NewL( this );
|
|
74 |
|
|
75 |
SetFocus( ETrue );
|
|
76 |
|
|
77 |
MakeVisible( ETrue );
|
|
78 |
|
|
79 |
ActivateL();
|
|
80 |
}
|
|
81 |
|
|
82 |
// -------------------------------------------------------------------------------------------------
|
|
83 |
// CMPXVideoPlaybackContainer::NewL()
|
|
84 |
// Two-phased constructor.
|
|
85 |
// -------------------------------------------------------------------------------------------------
|
|
86 |
//
|
|
87 |
CMPXVideoPlaybackContainer* CMPXVideoPlaybackContainer::NewL( const TDesC& aFileName )
|
|
88 |
{
|
|
89 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::NewL( %S )"),&aFileName);
|
|
90 |
|
|
91 |
CMPXVideoPlaybackContainer* self = new (ELeave) CMPXVideoPlaybackContainer();
|
|
92 |
|
|
93 |
|
|
94 |
CleanupStack::PushL( self );
|
|
95 |
self->ConstructL( aFileName );
|
|
96 |
CleanupStack::Pop();
|
|
97 |
|
|
98 |
return self;
|
|
99 |
}
|
|
100 |
|
|
101 |
//
|
|
102 |
// -------------------------------------------------------------------------------------------------
|
|
103 |
// CMPXVideoPlaybackContainer::~CMPXVideoPlaybackContainer()
|
|
104 |
// Destructor.
|
|
105 |
// -------------------------------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
CMPXVideoPlaybackContainer::~CMPXVideoPlaybackContainer()
|
|
108 |
{
|
|
109 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::~CMPXVideoPlaybackContainer()"));
|
|
110 |
|
|
111 |
if ( iFileDetails )
|
|
112 |
{
|
|
113 |
delete iFileDetails;
|
|
114 |
iFileDetails = NULL;
|
|
115 |
}
|
|
116 |
|
|
117 |
if ( iUserInputHandler )
|
|
118 |
{
|
|
119 |
delete iUserInputHandler;
|
|
120 |
iUserInputHandler = NULL;
|
|
121 |
}
|
|
122 |
|
|
123 |
CloseWindow();
|
|
124 |
}
|
|
125 |
|
|
126 |
// -------------------------------------------------------------------------------------------------
|
|
127 |
// CMPXVideoPlaybackContainer::CountComponentControls
|
|
128 |
// -------------------------------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
TInt CMPXVideoPlaybackContainer::CountComponentControls() const
|
|
131 |
{
|
|
132 |
return 0;
|
|
133 |
}
|
|
134 |
|
|
135 |
// -------------------------------------------------------------------------------------------------
|
|
136 |
// CMPXVideoPlaybackContainer::Draw
|
|
137 |
// -------------------------------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
void CMPXVideoPlaybackContainer::Draw(const TRect& aRect) const
|
|
140 |
{
|
|
141 |
CWindowGc& gc = SystemGc();
|
|
142 |
|
|
143 |
gc.SetPenStyle( CGraphicsContext::ENullPen );
|
|
144 |
gc.SetBrushColor( KRgbBlack );
|
|
145 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
|
|
146 |
gc.DrawRect( aRect );
|
|
147 |
}
|
|
148 |
|
|
149 |
//
|
|
150 |
// -------------------------------------------------------------------------------------------------
|
|
151 |
// CMPXVideoPlaybackContainer::HandleCommandL()
|
|
152 |
// -------------------------------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
void CMPXVideoPlaybackContainer::HandleCommandL( TInt aCommand, TInt aValue )
|
|
155 |
{
|
|
156 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::HandleCommandL(aCommand=%d,aValue=%d)"),aCommand,aValue);
|
|
157 |
|
|
158 |
iCommand = aCommand;
|
|
159 |
iValue = aValue;
|
|
160 |
}
|
|
161 |
|
|
162 |
//
|
|
163 |
// -------------------------------------------------------------------------------------------------
|
|
164 |
// CMPXVideoPlaybackContainer::ExpectedResultL()
|
|
165 |
// -------------------------------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CMPXVideoPlaybackContainer::ExpectedResultL( TInt aCommand, TInt aValue )
|
|
168 |
{
|
|
169 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::ExpectedResultL(aCommand=%d,aValue=%d)"),aCommand,aValue);
|
|
170 |
|
|
171 |
if ( aCommand == iCommand )
|
|
172 |
{
|
|
173 |
if ( iValue != aValue )
|
|
174 |
{
|
|
175 |
if ( aCommand == EMPXPbvCmdSetVolume )
|
|
176 |
{
|
|
177 |
if ( Abs( iValue - aValue ) > 6 )
|
|
178 |
{
|
|
179 |
User::Leave( KErrGeneral );
|
|
180 |
}
|
|
181 |
}
|
|
182 |
else
|
|
183 |
{
|
|
184 |
User::Leave( KErrGeneral );
|
|
185 |
}
|
|
186 |
}
|
|
187 |
}
|
|
188 |
else
|
|
189 |
{
|
|
190 |
|
|
191 |
User::Leave( KErrGeneral );
|
|
192 |
}
|
|
193 |
}
|
|
194 |
|
|
195 |
//
|
|
196 |
// -------------------------------------------------------------------------------------------------
|
|
197 |
// CMPXVideoPlaybackContainer::SetController()
|
|
198 |
// -------------------------------------------------------------------------------------------------
|
|
199 |
//
|
|
200 |
void CMPXVideoPlaybackContainer::SetController(
|
|
201 |
CMPXVideoPlaybackControlsController* aControlsController )
|
|
202 |
{
|
|
203 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::SetController()"));
|
|
204 |
|
|
205 |
iControlsController = aControlsController;
|
|
206 |
}
|
|
207 |
|
|
208 |
//
|
|
209 |
// -------------------------------------------------------------------------------------------------
|
|
210 |
// CMPXVideoPlaybackContainer::AddFileDetailsL()
|
|
211 |
// -------------------------------------------------------------------------------------------------
|
|
212 |
//
|
|
213 |
void CMPXVideoPlaybackContainer::AddFileDetailsL( TBool aHasVideoTrack )
|
|
214 |
{
|
|
215 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::AddFileDetailsL() "));
|
|
216 |
|
|
217 |
iFileDetails->iAudioEnabled = ETrue;
|
|
218 |
iFileDetails->iVideoEnabled = aHasVideoTrack;
|
|
219 |
iFileDetails->iSeekable = ETrue;
|
|
220 |
|
|
221 |
iFileDetails->iTitle = _L("Test Title").Alloc();
|
|
222 |
|
|
223 |
if ( iFileDetails->iVideoEnabled )
|
|
224 |
{
|
|
225 |
iFileDetails->iVideoHeight = 176;
|
|
226 |
iFileDetails->iVideoWidth = 144;
|
|
227 |
|
|
228 |
iFileDetails->iBitRate = 8000;
|
|
229 |
iFileDetails->iMimeType = _L("video/3gp").Alloc();
|
|
230 |
}
|
|
231 |
|
|
232 |
if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
|
|
233 |
{
|
|
234 |
iFileDetails->iSeekable = EFalse;
|
|
235 |
}
|
|
236 |
|
|
237 |
iControlsController->AddFileDetailsL( iFileDetails );
|
|
238 |
}
|
|
239 |
|
|
240 |
//
|
|
241 |
// -------------------------------------------------------------------------------------------------
|
|
242 |
// CMPXVideoPlaybackContainer::AddFileDetailsL()
|
|
243 |
// -------------------------------------------------------------------------------------------------
|
|
244 |
//
|
|
245 |
CMPXVideoPlaybackViewFileDetails*
|
|
246 |
CMPXVideoPlaybackContainer::FileDetails( TInt aMode )
|
|
247 |
{
|
|
248 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::AddFileDetailsL() "));
|
|
249 |
|
|
250 |
iFileDetails->iPlaybackMode = (TMPXVideoMode)aMode;
|
|
251 |
|
|
252 |
return iFileDetails;
|
|
253 |
}
|
|
254 |
|
|
255 |
// -------------------------------------------------------------------------------------------------
|
|
256 |
// From CCoeControl
|
|
257 |
// Handles key events.
|
|
258 |
// -------------------------------------------------------------------------------------------------
|
|
259 |
//
|
|
260 |
TKeyResponse CMPXVideoPlaybackContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
|
261 |
TEventCode aType )
|
|
262 |
{
|
|
263 |
iKeyResponse = EKeyWasNotConsumed;
|
|
264 |
|
|
265 |
iUserInputHandler->ProcessKeyEventL( aKeyEvent, aType );
|
|
266 |
|
|
267 |
return iKeyResponse;
|
|
268 |
}
|
|
269 |
|
|
270 |
// -------------------------------------------------------------------------------------------------
|
|
271 |
// CMPXVideoPlaybackContainer::DoHandleKeyEventL()
|
|
272 |
// -------------------------------------------------------------------------------------------------
|
|
273 |
//
|
|
274 |
void CMPXVideoPlaybackContainer::DoHandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
|
|
275 |
{
|
|
276 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::DoHandleKeyEventL()"));
|
|
277 |
|
|
278 |
switch ( aKeyEvent.iScanCode )
|
|
279 |
{
|
|
280 |
case EStdKeyDevice3: // rocker middle key
|
|
281 |
case EStdKeyEnter: // enter key on a qwerty key board
|
|
282 |
{
|
|
283 |
HandleCommandL(EMPXPbvCmdPlayPause);
|
|
284 |
iKeyResponse = EKeyWasConsumed;
|
|
285 |
break;
|
|
286 |
}
|
|
287 |
case EStdKeyUpArrow: // rocker up key
|
|
288 |
{
|
|
289 |
HandleCommandL(EMPXPbvCmdIncreaseVolume);
|
|
290 |
iKeyResponse = EKeyWasConsumed;
|
|
291 |
break;
|
|
292 |
}
|
|
293 |
case EStdKeyDownArrow: // rocker down key
|
|
294 |
{
|
|
295 |
HandleCommandL( EMPXPbvCmdDecreaseVolume );
|
|
296 |
iKeyResponse = EKeyWasConsumed;
|
|
297 |
break;
|
|
298 |
}
|
|
299 |
case EStdKeyLeftArrow: // rocker left key
|
|
300 |
{
|
|
301 |
if (aType == EEventKeyDown)
|
|
302 |
{
|
|
303 |
HandleCommandL(EMPXPbvCmdSeekBackward);
|
|
304 |
}
|
|
305 |
else if (aType == EEventKeyUp)
|
|
306 |
{
|
|
307 |
HandleCommandL(EMPXPbvCmdEndSeek);
|
|
308 |
}
|
|
309 |
|
|
310 |
iKeyResponse = EKeyWasConsumed;
|
|
311 |
break;
|
|
312 |
}
|
|
313 |
case EStdKeyRightArrow: // rocker right key
|
|
314 |
{
|
|
315 |
if (aType == EEventKeyDown)
|
|
316 |
{
|
|
317 |
HandleCommandL(EMPXPbvCmdSeekForward);
|
|
318 |
}
|
|
319 |
else if (aType == EEventKeyUp)
|
|
320 |
{
|
|
321 |
HandleCommandL(EMPXPbvCmdEndSeek);
|
|
322 |
}
|
|
323 |
|
|
324 |
iKeyResponse = EKeyWasConsumed;
|
|
325 |
break;
|
|
326 |
}
|
|
327 |
case EStdKeyYes: // green/send key
|
|
328 |
{
|
|
329 |
// in playback view we dont want to take any action
|
|
330 |
// just consume the key
|
|
331 |
iKeyResponse = EKeyWasConsumed;
|
|
332 |
break;
|
|
333 |
}
|
|
334 |
default:
|
|
335 |
{
|
|
336 |
break;
|
|
337 |
}
|
|
338 |
}
|
|
339 |
}
|
|
340 |
|
|
341 |
// -------------------------------------------------------------------------------------------------
|
|
342 |
// CMPXVideoPlaybackContainer::UserInputHandler()
|
|
343 |
// -------------------------------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackContainer::UserInputHandler()
|
|
346 |
{
|
|
347 |
return iUserInputHandler;
|
|
348 |
}
|
|
349 |
|
|
350 |
|
|
351 |
// -------------------------------------------------------------------------------------------------
|
|
352 |
// CMPXVideoPlaybackContainer::AddLongFileDetailsL()
|
|
353 |
// -------------------------------------------------------------------------------------------------
|
|
354 |
//
|
|
355 |
void CMPXVideoPlaybackContainer::AddLongFileDetailsL( TBool aHasVideoTrack )
|
|
356 |
{
|
|
357 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::AddFileDetailsL() "));
|
|
358 |
|
|
359 |
iFileDetails->iAudioEnabled = ETrue;
|
|
360 |
iFileDetails->iVideoEnabled = aHasVideoTrack;
|
|
361 |
iFileDetails->iSeekable = ETrue;
|
|
362 |
|
|
363 |
HBufC* temp = HBufC::NewLC(KMaxFileTitleLength);
|
|
364 |
TPtr fileTitlePtr = temp->Des();
|
|
365 |
|
|
366 |
const int loop = 10;
|
|
367 |
for ( int i=0; i<loop; i++ )
|
|
368 |
{
|
|
369 |
fileTitlePtr.Append( KFileTitle() );
|
|
370 |
}
|
|
371 |
iFileDetails->iTitle = fileTitlePtr.Alloc();
|
|
372 |
CleanupStack::PopAndDestroy(); //temp
|
|
373 |
|
|
374 |
if ( iFileDetails->iVideoEnabled )
|
|
375 |
{
|
|
376 |
iFileDetails->iVideoHeight = 176;
|
|
377 |
iFileDetails->iVideoWidth = 144;
|
|
378 |
|
|
379 |
iFileDetails->iBitRate = 8000;
|
|
380 |
iFileDetails->iMimeType = _L("video/3gp").Alloc();
|
|
381 |
}
|
|
382 |
|
|
383 |
if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
|
|
384 |
{
|
|
385 |
iFileDetails->iSeekable = EFalse;
|
|
386 |
}
|
|
387 |
|
|
388 |
iControlsController->AddFileDetailsL( iFileDetails );
|
|
389 |
}
|
|
390 |
|
|
391 |
|
|
392 |
void CMPXVideoPlaybackContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent )
|
|
393 |
{
|
|
394 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackContainer::HandlePointerEventL()"));
|
|
395 |
|
|
396 |
MPX_DEBUG(_L(" iType = %d, iPosition = (%d,%d)"),
|
|
397 |
aPointerEvent.iType, aPointerEvent.iPosition.iX, aPointerEvent.iPosition.iY );
|
|
398 |
}
|
|
399 |
|
|
400 |
// -------------------------------------------------------------------------------------------------
|
|
401 |
// CMPXVideoPlaybackContainer::AddSameARFileDetailsL()
|
|
402 |
// -------------------------------------------------------------------------------------------------
|
|
403 |
//
|
|
404 |
void CMPXVideoPlaybackContainer::AddSameARFileDetailsL( TBool aHasVideoTrack )
|
|
405 |
{
|
|
406 |
MPX_ENTER_EXIT( _L( "CMPXVideoPlaybackContainer::AddSameARFileDetailsL() ") );
|
|
407 |
|
|
408 |
iFileDetails->iAudioEnabled = ETrue;
|
|
409 |
iFileDetails->iVideoEnabled = aHasVideoTrack;
|
|
410 |
iFileDetails->iSeekable = ETrue;
|
|
411 |
|
|
412 |
if ( iFileDetails->iVideoEnabled )
|
|
413 |
{
|
|
414 |
iFileDetails->iVideoHeight = this->Rect().Height();
|
|
415 |
iFileDetails->iVideoWidth = this->Rect().Width();
|
|
416 |
|
|
417 |
iFileDetails->iBitRate = 8000;
|
|
418 |
iFileDetails->iMimeType = _L("video/3gp").Alloc();
|
|
419 |
}
|
|
420 |
|
|
421 |
if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
|
|
422 |
{
|
|
423 |
iFileDetails->iSeekable = EFalse;
|
|
424 |
}
|
|
425 |
|
|
426 |
iControlsController->AddFileDetailsL( iFileDetails );
|
|
427 |
}
|
|
428 |
|
|
429 |
//
|
|
430 |
// -------------------------------------------------------------------------------------------------
|
|
431 |
// CMPXVideoPlaybackContainer::AddEmptyTitleFileDetailsL()
|
|
432 |
// -------------------------------------------------------------------------------------------------
|
|
433 |
//
|
|
434 |
void CMPXVideoPlaybackContainer::AddEmptyTitleFileDetailsL( TBool aHasVideoTrack )
|
|
435 |
{
|
|
436 |
MPX_DEBUG(_L("CMPXVideoPlaybackContainer::AddEmptyTitleFileDetailsL() "));
|
|
437 |
|
|
438 |
iFileDetails->iAudioEnabled = ETrue;
|
|
439 |
iFileDetails->iVideoEnabled = aHasVideoTrack;
|
|
440 |
iFileDetails->iSeekable = ETrue;
|
|
441 |
|
|
442 |
if ( iFileDetails->iVideoEnabled )
|
|
443 |
{
|
|
444 |
iFileDetails->iVideoHeight = 176;
|
|
445 |
iFileDetails->iVideoWidth = 144;
|
|
446 |
|
|
447 |
iFileDetails->iBitRate = 8000;
|
|
448 |
iFileDetails->iMimeType = _L("video/3gp").Alloc();
|
|
449 |
}
|
|
450 |
|
|
451 |
if ( iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
|
|
452 |
{
|
|
453 |
iFileDetails->iSeekable = EFalse;
|
|
454 |
}
|
|
455 |
|
|
456 |
iControlsController->AddFileDetailsL( iFileDetails );
|
|
457 |
}
|
|
458 |
|
|
459 |
// End of File
|