|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * The header file for tone previewing. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef MSGAUDIOPPREVIEW_H |
|
20 #define MSGAUDIOPPREVIEW_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <DrmAudioSamplePlayer.h> |
|
24 #include <mdaaudiotoneplayer.h> |
|
25 #include <videoplayer.h> |
|
26 #include <centralrepository.h> |
|
27 #include <apgcli.h> // for RApaLsSession |
|
28 #include <e32property.h> |
|
29 #include <QObject> |
|
30 |
|
31 class C3DRingingToneInterface; |
|
32 class RWindow; |
|
33 |
|
34 /** |
|
35 * CMFPreviewHandlerBase |
|
36 * |
|
37 * Base class for CMFAudioPreviewHandler. |
|
38 */ |
|
39 class CMFPreviewHandlerBase: public QObject, public CBase |
|
40 |
|
41 { |
|
42 Q_OBJECT |
|
43 public: |
|
44 |
|
45 enum TMediaFileType |
|
46 { |
|
47 EMediaFileTypeAudio = 0, EMediaFileTypeVideo |
|
48 }; |
|
49 enum TPlayerStatus |
|
50 { |
|
51 EPlayerNotCreated, |
|
52 EPlayerInitializing, |
|
53 EPlayerReady, |
|
54 EPlayerPlaying, |
|
55 EPlayerInitialized, |
|
56 EPlayerPlayingWith3DEffect |
|
57 }; |
|
58 |
|
59 // these must match with the ones in Profile Engine |
|
60 enum TRingingTypes |
|
61 { |
|
62 ERingingTypeRinging = 0, |
|
63 ERingingTypeAscending, |
|
64 ERingingTypeRingOnce, |
|
65 ERingingTypeBeepOnce, |
|
66 ERingingTypeSilent |
|
67 }; |
|
68 |
|
69 enum TFLAllowScreenSaver |
|
70 { |
|
71 EFLScreenSaverAllowed = 0, EFLScreenSaverNotAllowed |
|
72 }; |
|
73 |
|
74 protected: |
|
75 |
|
76 virtual ~CMFPreviewHandlerBase(); |
|
77 |
|
78 protected: |
|
79 |
|
80 /** |
|
81 * C++ default constructor. |
|
82 */ |
|
83 CMFPreviewHandlerBase(QObject *parent); |
|
84 |
|
85 /** |
|
86 * By default Symbian OS constructor is private. |
|
87 */ |
|
88 void ConstructL(); |
|
89 |
|
90 public: |
|
91 void SetAttr(const QString &file); |
|
92 TInt Attr(TInt aAttr); |
|
93 virtual void Play() = 0; |
|
94 virtual void Stop() = 0; |
|
95 virtual TBool IsPlaying() = 0; |
|
96 QString normalizeSeperator(const QString &path); |
|
97 protected: |
|
98 TInt ConvertVolume(TInt aVolume); |
|
99 void ReadActiveProfileL(); |
|
100 TInt GetDataType(const TDesC& aFileName, TDataType& aDataType); |
|
101 void ReadDefaultToneL(); |
|
102 |
|
103 void DisableBackLight(); |
|
104 |
|
105 static TInt DoResetInactivityTimer(TAny* aObject); |
|
106 protected: |
|
107 TInt RingingVolume(); |
|
108 TInt RingingType(); |
|
109 TInt Vibra(); |
|
110 TInt Echo3D(); |
|
111 TInt Effect3D(); |
|
112 |
|
113 protected: |
|
114 static TInt ConvertVolume(TInt aVolume, TInt aMaxVolume); |
|
115 |
|
116 protected: |
|
117 TInt iRingingVolume; |
|
118 TInt iRingingType; |
|
119 TInt iVibra; |
|
120 TInt i3DEffect; |
|
121 TInt i3DEcho; |
|
122 TInt iMediaType; |
|
123 TInt iFileSize; |
|
124 HBufC* iFullName; |
|
125 |
|
126 TBool iActiveProfileRead; |
|
127 TInt iActiveProfileRingingVolume; |
|
128 TInt iActiveProfileRingingType; |
|
129 TInt iActiveProfileVibra; |
|
130 TInt iActiveProfile3DEffect; |
|
131 TInt iActiveProfile3DEcho; |
|
132 |
|
133 TInt iPlayerStatus; |
|
134 |
|
135 // handle to window |
|
136 RWindow* iWindow; // does not own |
|
137 |
|
138 // for getting file MIME types |
|
139 RApaLsSession iApaSession; |
|
140 |
|
141 // for setting screensaver on/off |
|
142 RProperty iProperty; |
|
143 |
|
144 // default ringing tone |
|
145 TFileName iDefaultTone; |
|
146 |
|
147 /** |
|
148 * Timer for resetting the user inactivity timeout |
|
149 */ |
|
150 CPeriodic* iBacklightTimer; |
|
151 }; |
|
152 |
|
153 // CLASS DECLARATION |
|
154 /** |
|
155 * This class is used for previewing the tones. |
|
156 * |
|
157 */ |
|
158 |
|
159 class MsgAudioPreview: public CMFPreviewHandlerBase, |
|
160 public MDrmAudioPlayerCallback, |
|
161 public MMdaAudioToneObserver |
|
162 |
|
163 { |
|
164 Q_OBJECT |
|
165 public: |
|
166 MsgAudioPreview(QObject *parent); |
|
167 virtual ~MsgAudioPreview(); |
|
168 signals: |
|
169 // void notifyPreviewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId); |
|
170 |
|
171 public: |
|
172 void Play(); |
|
173 void Stop(); |
|
174 TBool IsPlaying(); |
|
175 |
|
176 private: |
|
177 void Cancel(); |
|
178 void SetAudioRingingType(TInt aRingingType); |
|
179 void SetToneRingingType(TInt aRingingType); |
|
180 TInt ConvertVolume(TInt aVolume); |
|
181 void PlayL(); |
|
182 |
|
183 private: |
|
184 // from MMdaAudioToneObserver |
|
185 virtual void MatoPrepareComplete(TInt aError); |
|
186 virtual void MatoPlayComplete(TInt aError); |
|
187 |
|
188 private: |
|
189 // from MDrmAudioPlayerCallback |
|
190 void MdapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); |
|
191 void MdapcPlayComplete(TInt aError); |
|
192 |
|
193 private: |
|
194 // audio player |
|
195 CDrmPlayerUtility* iAudioPlayer; |
|
196 |
|
197 /// Audioplayer status |
|
198 TPlayerStatus iAudioPlayerStatus; |
|
199 |
|
200 /// toneplayer |
|
201 CMdaAudioToneUtility* iTonePlayer; |
|
202 |
|
203 /// Toneplayer status |
|
204 TPlayerStatus iTonePlayerStatus; |
|
205 |
|
206 // plugin for playing 3D effects |
|
207 C3DRingingToneInterface* i3dRingingTonePlugin; |
|
208 |
|
209 }; |
|
210 |
|
211 #endif /* MSGAUDIOPPREVIEW_H */ |