|
1 /* |
|
2 * Copyright (c) 2003-2006 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 * SMIL Player media renderer for playing audio files |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CSMILAUDIORENDERER_H |
|
22 #define CSMILAUDIORENDERER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <mdaaudiosampleplayer.h> |
|
26 #include <f32file.h> |
|
27 #include "SmilMediaRendererBase.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CMdaAudioPlayerUtility; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * SMIL Player media renderer for playing audio files |
|
36 * |
|
37 * @lib smilmediarenderer.lib |
|
38 * @since 2.0 |
|
39 */ |
|
40 NONSHARABLE_CLASS(CSmilAudioRenderer) : public CSmilMediaRendererBase, |
|
41 public MMdaAudioPlayerCallback |
|
42 { |
|
43 |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Factory method that creates this object. |
|
48 * |
|
49 * @param aFileHandle IN Handle to the media file |
|
50 * @param aMedia IN SMIL engine side object representing |
|
51 * this media file |
|
52 * @param aDrmCommon IN DRM Common |
|
53 * @param aDrmHelper IN DRM Helper |
|
54 * @param aPlayPreview IN Indicates whether only preview should be played. |
|
55 Default is EFalse. |
|
56 * |
|
57 * @return pointer to instance |
|
58 */ |
|
59 static CSmilAudioRenderer* NewL( RFile& aFileHandle, |
|
60 MSmilMedia* aMedia, |
|
61 DRMCommon& aDrmCommon, |
|
62 CDRMHelper& aDrmHelper ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CSmilAudioRenderer(); |
|
68 |
|
69 public: // Functions from base classes |
|
70 |
|
71 /** |
|
72 * From MSmilMediaRenderer Returns the duration of the media object. |
|
73 * |
|
74 * @since 2.0 |
|
75 * |
|
76 * @return Returns duration of audio clip. |
|
77 */ |
|
78 TSmilTime IntrinsicDuration() const; |
|
79 |
|
80 /** |
|
81 * From MSmilMediaRenderer Called by the engine to signal that |
|
82 * the media is going to be played soon. |
|
83 * |
|
84 * @since 2.0 |
|
85 * |
|
86 * @return void |
|
87 */ |
|
88 void PrepareMediaL(); |
|
89 |
|
90 /** |
|
91 * From MSmilMediaRenderer Called by the engine to seek the media |
|
92 * to given position in its local timeline. |
|
93 * |
|
94 * @since 2.0 |
|
95 * |
|
96 * @param aTime IN Seek position. |
|
97 * |
|
98 * @return void |
|
99 */ |
|
100 void SeekMediaL( const TSmilTime& aTime ); |
|
101 |
|
102 /** |
|
103 * From MSmilMediaRenderer Called by the engine to start media |
|
104 * playback and to make visual media visible. |
|
105 * |
|
106 * @since 2.0 |
|
107 * |
|
108 * @return void |
|
109 */ |
|
110 void ShowMediaL(); |
|
111 |
|
112 /** |
|
113 * From MSmilMediaRenderer Called by the engine to stop media |
|
114 * playback and remove visual media from the screen. |
|
115 * |
|
116 * @since 2.0 |
|
117 * |
|
118 * @return void |
|
119 */ |
|
120 void HideMedia(); |
|
121 |
|
122 /** |
|
123 * From MSmilMediaRenderer Called by the engine to pause media playback. |
|
124 * |
|
125 * @since 2.0 |
|
126 * |
|
127 * @return void |
|
128 */ |
|
129 void FreezeMedia(); |
|
130 |
|
131 /** |
|
132 * From MSmilMediaRenderer Called by the engine to continue paused |
|
133 * media playback. |
|
134 * |
|
135 * @since 2.0 |
|
136 * |
|
137 * @return void |
|
138 */ |
|
139 void ResumeMedia(); |
|
140 |
|
141 /** |
|
142 * From MSmilMediaRenderer Set volume of the audio media. |
|
143 * |
|
144 * @since 2.0 |
|
145 * |
|
146 * @param aVolume IN A percentage value from maximum value that |
|
147 * the volume should be set. |
|
148 * @return void |
|
149 */ |
|
150 void SetVolume( TInt aVolume ); |
|
151 |
|
152 /** |
|
153 * From MMdaAudioPlayerCallback Called when audio clip initialization completes. |
|
154 * |
|
155 * @since 2.0 |
|
156 * |
|
157 * @param aError IN Resulting error code. |
|
158 * @param aDuration IN Audio clip duration. |
|
159 * |
|
160 * @return void |
|
161 */ |
|
162 void MapcInitComplete( TInt aError, |
|
163 const TTimeIntervalMicroSeconds& aDuration ); |
|
164 |
|
165 /** |
|
166 * From MMdaAudioPlayerCallback Called when audio clip playback completes. |
|
167 * |
|
168 * @since 2.0 |
|
169 * |
|
170 * @param aError IN Resulting error code. |
|
171 * |
|
172 * @return void |
|
173 */ |
|
174 void MapcPlayComplete( TInt aError ); |
|
175 |
|
176 private: |
|
177 |
|
178 /** |
|
179 * C++ default constructor. |
|
180 */ |
|
181 CSmilAudioRenderer(); |
|
182 |
|
183 /** |
|
184 * Constructor. |
|
185 */ |
|
186 CSmilAudioRenderer( MSmilMedia* aMedia, |
|
187 DRMCommon& aDrmCommon, |
|
188 CDRMHelper& aDrmHelper ); |
|
189 |
|
190 /** |
|
191 * 2nd phase constructor |
|
192 */ |
|
193 void ConstructL( RFile& aFileHandle ); |
|
194 |
|
195 |
|
196 private: // Data |
|
197 |
|
198 // Internal states. |
|
199 enum TState |
|
200 { |
|
201 ENotReady = 0, |
|
202 EOpening, |
|
203 EOpen, |
|
204 EPlaying, |
|
205 EPaused, |
|
206 EHidden |
|
207 }; |
|
208 |
|
209 // Duration. |
|
210 TSmilTime iIntrinsicDuration; |
|
211 |
|
212 // Audio player utility. |
|
213 CMdaAudioPlayerUtility* iAudioPlayer; |
|
214 |
|
215 // Internal state. |
|
216 TInt iState; |
|
217 |
|
218 // Operation result. |
|
219 TInt iError; |
|
220 |
|
221 // Indicates renderer end. |
|
222 TBool iRendererAtEnd; |
|
223 |
|
224 // Handle to media file. |
|
225 // Duplicate made because of late preparation |
|
226 RFile iMediaFile; |
|
227 }; |
|
228 |
|
229 #endif // CSMILAUDIORENDERER_H |