|
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 playing sounds |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMMAAUDIOPLAYER_H |
|
19 #define CMMAAUDIOPLAYER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include "cmmammfplayerbase.h" |
|
23 #include <jutils.h> |
|
24 |
|
25 |
|
26 _LIT(KMMAAudioPlayer, "AudioPlayer"); |
|
27 |
|
28 /** |
|
29 Mixin class for playback complete notifications. |
|
30 */ |
|
31 class MPlaybackCompletedCallback |
|
32 { |
|
33 public: |
|
34 virtual void HandlePlaybackCompleteL() = 0; |
|
35 virtual void ErrorPlaybackComplete(TInt aError) = 0; |
|
36 }; |
|
37 |
|
38 /** |
|
39 Active object used for give MMF server time to complete its playback |
|
40 */ |
|
41 class CPlaybackCompletedCallback : public CTimer |
|
42 { |
|
43 public:// Constructor and destructor |
|
44 static CPlaybackCompletedCallback* NewL(MPlaybackCompletedCallback& aObs); |
|
45 ~CPlaybackCompletedCallback(); |
|
46 |
|
47 public: // new methods |
|
48 void Callback(); |
|
49 |
|
50 public: // From CTimer |
|
51 void RunL(); |
|
52 TInt RunError(TInt aError); |
|
53 |
|
54 private: // Constructor |
|
55 CPlaybackCompletedCallback(MPlaybackCompletedCallback& aObs); |
|
56 |
|
57 private: // Data |
|
58 MPlaybackCompletedCallback& iObs; |
|
59 }; |
|
60 |
|
61 // CLASS DECLARATION |
|
62 /** |
|
63 * This class is used for playing sounds |
|
64 * |
|
65 */ |
|
66 |
|
67 NONSHARABLE_CLASS(CMMAAudioPlayer): public CMMAMMFPlayerBase, |
|
68 public MPlaybackCompletedCallback |
|
69 |
|
70 { |
|
71 public: // Construction |
|
72 /** |
|
73 * Creates new player. |
|
74 */ |
|
75 static CMMAAudioPlayer* NewLC( |
|
76 CMMAMMFResolver* aResolver); |
|
77 |
|
78 // Destructor |
|
79 ~CMMAAudioPlayer(); |
|
80 |
|
81 protected: |
|
82 // C++ constructor |
|
83 CMMAAudioPlayer(CMMAMMFResolver* aResolver); |
|
84 void ConstructL(); |
|
85 |
|
86 protected: // New methods |
|
87 IMPORT_C virtual void PrefetchDataL(const TDesC8& aData); |
|
88 IMPORT_C virtual void PrefetchFileL(); |
|
89 IMPORT_C virtual void PlayCompleteL(TInt aError); |
|
90 |
|
91 public: // from CMMAPlayer |
|
92 void RealizeL(); |
|
93 void PrefetchL(); |
|
94 |
|
95 const TDesC& Type(); |
|
96 |
|
97 public: // from CMMAPlayer/MMMASourceStreamListener |
|
98 void ReadCompletedL(TInt aStatus, const TDesC8& aData); |
|
99 |
|
100 public: // from MMMFControllerEventMonitorObserver |
|
101 void HandleEvent(const class TMMFEvent& aEvent); |
|
102 |
|
103 public: // from MPlaybackCompletedCallback |
|
104 IMPORT_C void HandlePlaybackCompleteL(); |
|
105 IMPORT_C void ErrorPlaybackComplete(TInt aError); |
|
106 |
|
107 private: // data |
|
108 // Owned playback callback active object |
|
109 CPlaybackCompletedCallback* iPlaybackCompleted; |
|
110 }; |
|
111 |
|
112 #endif // CMMAAUDIOPLAYER_H |