|
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: This class is used for stoptime controlling |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <logger.h> |
|
21 #include <e32std.h> |
|
22 |
|
23 #include "cmmamidistoptimecontrol.h" |
|
24 #include "cmmaplayer.h" |
|
25 |
|
26 CMMAMIDIStopTimeControl* CMMAMIDIStopTimeControl::NewL(CMMAPlayer* aPlayer) |
|
27 { |
|
28 CMMAMIDIStopTimeControl* control = |
|
29 new(ELeave) CMMAMIDIStopTimeControl(aPlayer); |
|
30 CleanupStack::PushL(control); |
|
31 // calls base class ConstructL |
|
32 control->ConstructL(); |
|
33 CleanupStack::Pop(); // control |
|
34 return control; |
|
35 } |
|
36 |
|
37 |
|
38 CMMAMIDIStopTimeControl::~CMMAMIDIStopTimeControl() |
|
39 { |
|
40 } |
|
41 |
|
42 CMMAMIDIStopTimeControl::CMMAMIDIStopTimeControl(CMMAPlayer* aPlayer) |
|
43 : CMMAStopTimeControl(aPlayer) |
|
44 { |
|
45 } |
|
46 |
|
47 |
|
48 void CMMAMIDIStopTimeControl::StopAtTimeL() |
|
49 { |
|
50 LOG(EJavaMMAPI, EInfo, "MMA:CMMAMIDIStopTimeControl::StopAtTime"); |
|
51 |
|
52 // Stop the player only when it's playing |
|
53 if (iPlayer->State() == CMMAPlayer::EStarted) |
|
54 { |
|
55 TInt64 time; |
|
56 iPlayer->GetMediaTime(&time); |
|
57 if (time >= 0 && time < iStopTime) |
|
58 { |
|
59 LOG1(EJavaMMAPI, EInfo, "MMA:CMMAMIDIStopTimeControl::StopAtTime - Called %dms too early", |
|
60 I64INT((time - iStopTime)/1000)); |
|
61 StartTimer(time); |
|
62 return; |
|
63 } |
|
64 |
|
65 TInt64 stopTime; |
|
66 |
|
67 iPlayer->StopL(EFalse); |
|
68 iPlayer->SetMediaTimeL(&iStopTime); |
|
69 iPlayer->GetMediaTime(&stopTime); |
|
70 |
|
71 // Inform the player that it's "stopped at time" |
|
72 iPlayer->PostLongEvent(CMMAPlayerEvent::EStoppedAtTime, stopTime); |
|
73 |
|
74 iStopTime = iNoTimer; // Timer is reseted |
|
75 } |
|
76 } |
|
77 |
|
78 // END OF FILE |