|
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 * Implementation of SmilDefaultRenderer, |
|
16 * a renderer for not supported or corrupted media |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef DEFAULT_RENDERER_H |
|
23 #define DEFAULT_RENDERER_H |
|
24 |
|
25 // INCLUDES |
|
26 #include "SmilMediaRendererBase.h" |
|
27 |
|
28 // DATA TYPES |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MSmilFocus; |
|
32 class CGulIcon; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * CSmilDefaultRenderer provides SMIL media renderer interface. |
|
38 * This class is used by SMIL Engine for rendering unknown / |
|
39 * corrupted / DRM protected media items. |
|
40 * |
|
41 * @lib smilmediarenderer.lib |
|
42 * @since 2.0 |
|
43 */ |
|
44 NONSHARABLE_CLASS(CSmilDefaultRenderer) : public CSmilMediaRendererBase |
|
45 { |
|
46 public: // Methods |
|
47 |
|
48 // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Static constructor. |
|
52 * |
|
53 * @since 2.0 |
|
54 * |
|
55 * @param aFileHandle IN File handle to the media file |
|
56 * @param aMedia IN SMIL media object. |
|
57 * @param aDrmCommon IN DRM Common |
|
58 * @param aDrmHelper IN DRM Helper |
|
59 * @param aMediaType IN Original media item type. |
|
60 * Used to differentiate shown icon. |
|
61 * @param aDRMError IN DRM error flag. |
|
62 * Used to differentiate shown icon. |
|
63 * |
|
64 * @return Initialized default renderer object. |
|
65 */ |
|
66 static CSmilDefaultRenderer* NewL( RFile& aFileHandle, |
|
67 MSmilMedia* aMedia, |
|
68 DRMCommon& aDrmCommon, |
|
69 CDRMHelper& aDrmHelper, |
|
70 TMsgMediaType aMediaType, |
|
71 TBool aDRMError = EFalse ); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 * |
|
76 * @since 2.0 |
|
77 */ |
|
78 virtual ~CSmilDefaultRenderer(); |
|
79 |
|
80 // New methods |
|
81 |
|
82 // Methods from base classes |
|
83 |
|
84 public: // From MSmilMediaRenderer |
|
85 |
|
86 /** |
|
87 * From MSmilMediaRenderer Called by the SMIL engine to signal |
|
88 * that the engine is no more referencing renderer. |
|
89 * |
|
90 * @since 2.0 |
|
91 * |
|
92 * @return void |
|
93 */ |
|
94 void Close(); |
|
95 |
|
96 /** |
|
97 * From MSmilMediaRenderer Returns if renderer is visual |
|
98 * (i.e. draws something to the screen). |
|
99 * |
|
100 * @since 2.0 |
|
101 * |
|
102 * @return Returns ETrue since the media type is visual. |
|
103 */ |
|
104 TBool IsVisual() const; |
|
105 |
|
106 /** |
|
107 * From MSmilMediaRenderer Returns the unscalable size of the |
|
108 * visual media object. |
|
109 * |
|
110 * @since 2.0 |
|
111 * |
|
112 * @return Width in pixels. |
|
113 */ |
|
114 TInt IntrinsicWidth() const; |
|
115 |
|
116 /** |
|
117 * From MSmilMediaRenderer Returns the unscalable size of the |
|
118 * visual media object. |
|
119 * |
|
120 * @since 2.0 |
|
121 * |
|
122 * @return Height in pixels. |
|
123 */ |
|
124 TInt IntrinsicHeight() const; |
|
125 |
|
126 /** |
|
127 * From MSmilMediaRenderer Returns the duration of the media object. |
|
128 * |
|
129 * @since 2.0 |
|
130 * |
|
131 * @return Returns zero (Note! zero duration means still |
|
132 * image). |
|
133 */ |
|
134 TSmilTime IntrinsicDuration() const; |
|
135 |
|
136 /** |
|
137 * From MSmilMediaRenderer Called by the engine to signal that |
|
138 * the media is going to be played soon. |
|
139 * |
|
140 * @since 2.0 |
|
141 * |
|
142 * @return void |
|
143 */ |
|
144 void PrepareMediaL(); |
|
145 |
|
146 /** |
|
147 * From MSmilMediaRenderer Called by the engine to seek the media |
|
148 * to given position in its local timeline. |
|
149 * |
|
150 * @since 2.0 |
|
151 * |
|
152 * @param aTime IN Seek position. |
|
153 * |
|
154 * @return void |
|
155 */ |
|
156 void SeekMediaL( const TSmilTime& aTime ); |
|
157 |
|
158 /** |
|
159 * From MSmilMediaRenderer Called by the engine to start media |
|
160 * playback and to make visual media visible. |
|
161 * |
|
162 * @since 2.0 |
|
163 * |
|
164 * @return void |
|
165 */ |
|
166 void ShowMediaL(); |
|
167 |
|
168 /** |
|
169 * From MSmilMediaRenderer Called by the engine to stop media |
|
170 * playback and remove visual media from the screen. |
|
171 * |
|
172 * @since 2.0 |
|
173 * |
|
174 * @return void |
|
175 */ |
|
176 void HideMedia(); |
|
177 |
|
178 /** |
|
179 * From MSmilMediaRenderer Called by the engine to pause media playback. |
|
180 * |
|
181 * @since 2.0 |
|
182 * |
|
183 * @return void |
|
184 */ |
|
185 void FreezeMedia(); |
|
186 |
|
187 /** |
|
188 * From MSmilMediaRenderer Called by the engine to continue paused |
|
189 * media playback. |
|
190 * |
|
191 * @since 2.0 |
|
192 * |
|
193 * @return void |
|
194 */ |
|
195 void ResumeMedia(); |
|
196 |
|
197 /** |
|
198 * From MSmilMediaRenderer Called by the engine to make a media |
|
199 * renderer draw its content. |
|
200 * |
|
201 * @since 2.0 |
|
202 * |
|
203 * @param aGc IN Graphical context performing the drawing. |
|
204 * @param aRect IN Target rectangle. |
|
205 * @param aTransitionFilter IN Transition effects if present. |
|
206 * @param aFocus IN Focus indication if focussed. |
|
207 * |
|
208 * @return void |
|
209 */ |
|
210 void Draw( CGraphicsContext& aGc, |
|
211 const TRect& aRect, |
|
212 CSmilTransitionFilter* aTransitionFilter, |
|
213 const MSmilFocus* aFocus ); |
|
214 |
|
215 protected: // Methods |
|
216 |
|
217 // New Methods |
|
218 |
|
219 // Methods from base classes |
|
220 |
|
221 private: //Methods |
|
222 |
|
223 /** |
|
224 * C++ default constructor |
|
225 */ |
|
226 CSmilDefaultRenderer(); |
|
227 |
|
228 /** |
|
229 * Constructor. |
|
230 */ |
|
231 CSmilDefaultRenderer( MSmilMedia* aMedia, |
|
232 DRMCommon& aDrmCommon, |
|
233 CDRMHelper& aDrmHelper ); |
|
234 |
|
235 /** |
|
236 * By default Symbian 2nd phase constructor is private. |
|
237 */ |
|
238 void ConstructL( RFile& aFileHandle, |
|
239 TBool aDRMError, |
|
240 TMsgMediaType aMediaType ); |
|
241 |
|
242 /** |
|
243 * Calculates correct icon size. |
|
244 */ |
|
245 TSize CalculateIconFitSize( const TSize& aRegion, |
|
246 const TSize& aIcon ) const; |
|
247 |
|
248 /** |
|
249 * Calculates correct icon position. |
|
250 */ |
|
251 TPoint CalculateIconCenterPosition( const TSize& aRegion, |
|
252 const TSize& aIcon ) const; |
|
253 |
|
254 public: // Data |
|
255 |
|
256 protected: // Data |
|
257 |
|
258 private: // Data |
|
259 |
|
260 /** Specifies if renderer is visible. */ |
|
261 TBool iVisible; |
|
262 |
|
263 /** Icon to draw */ |
|
264 CGulIcon* iIcon; |
|
265 |
|
266 /** Icon rectangle inside overall renderer region. */ |
|
267 TRect iIconRect; |
|
268 }; |
|
269 |
|
270 #endif // DEFAULT_RENDERER_H |
|
271 |
|
272 // End of File |