author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:33:18 +0100 | |
branch | RCL_3 |
changeset 26 | 2455ef1f5bbc |
parent 14 | 04becd199f91 |
permissions | -rw-r--r-- |
14
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: This class is used for stoptime controlling |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
// INCLUDE FILES |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <jdebug.h> |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <e32std.h> |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include "cmmamidistoptimecontrol.h" |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include "cmmaplayer.h" |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
CMMAMIDIStopTimeControl* CMMAMIDIStopTimeControl::NewL(CMMAPlayer* aPlayer) |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
{ |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
CMMAMIDIStopTimeControl* control = |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
new(ELeave) CMMAMIDIStopTimeControl(aPlayer); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
CleanupStack::PushL(control); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
// calls base class ConstructL |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
control->ConstructL(); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
CleanupStack::Pop(); // control |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
return control; |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
} |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
CMMAMIDIStopTimeControl::~CMMAMIDIStopTimeControl() |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
{ |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
} |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
CMMAMIDIStopTimeControl::CMMAMIDIStopTimeControl(CMMAPlayer* aPlayer) |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
: CMMAStopTimeControl(aPlayer) |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
{ |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
} |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
void CMMAMIDIStopTimeControl::StopAtTimeL() |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
{ |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
DEBUG("MMA:CMMAMIDIStopTimeControl::StopAtTime"); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
// Stop the player only when it's playing |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
if (iPlayer->State() == CMMAPlayer::EStarted) |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
{ |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
TInt64 time; |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
iPlayer->GetMediaTime(&time); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
if (time >= 0 && time < iStopTime) |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
{ |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
DEBUG_INT("MMA:CMMAMIDIStopTimeControl::StopAtTime - Called %dms too early", |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
I64INT((time - iStopTime)/1000)); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
StartTimer(time); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
return; |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
} |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
TInt64 stopTime; |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
iPlayer->StopL(EFalse); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
iPlayer->SetMediaTimeL(&iStopTime); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
iPlayer->GetMediaTime(&stopTime); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
71 |
// Inform the player that it's "stopped at time" |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
iPlayer->PostLongEvent(CMMAPlayerEvent::EStoppedAtTime, stopTime); |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
iStopTime = iNoTimer; // Timer is reseted |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
75 |
} |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
76 |
} |
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
|
04becd199f91
Revision: v2.1.22
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
// END OF FILE |