|
1 /* |
|
2 * Copyright (c) 2002-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 * Factory class that creates SMIL Player media renderers |
|
16 * accoring to the MIME type of the media file. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef SMILPLAYERMEDIAFACTORY_H |
|
23 #define SMILPLAYERMEDIAFACTORY_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <smiltextbuf.h> |
|
27 #include <smilmediafactoryinterface.h> |
|
28 #include "SmilImageRenderer.h" |
|
29 #include "SmilMediaRendererBase.h" |
|
30 |
|
31 typedef CArrayPtrFlat<CSmilMediaRendererBase> CRendererArray; |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class MMediaFactoryFileInfo; |
|
35 class DRMCommon; |
|
36 class CDRMHelper; |
|
37 class CMsgMediaResolver; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * Factory class that creates SMIL Player media renderers |
|
43 * accoring to the MIME type of the media file |
|
44 * |
|
45 * @lib smilmediarenderer.lib |
|
46 * @since 2.0 |
|
47 */ |
|
48 class CSmilPlayerMediaFactory : public CBase, |
|
49 public MSmilMediaFactory |
|
50 { |
|
51 public: // Constructors and destructor |
|
52 |
|
53 |
|
54 /** |
|
55 * Factory method that creates this object. |
|
56 * |
|
57 * @param aCoeEnv IN Control environment |
|
58 * @param aGc IN Graphical context used to draw |
|
59 * |
|
60 * @param aFileInfo IN Indicates whether only preview should be played. |
|
61 Default is EFalse. |
|
62 * |
|
63 * @return pointer to instance |
|
64 */ |
|
65 IMPORT_C static CSmilPlayerMediaFactory* NewL( CCoeEnv& aCoeEnv, |
|
66 CGraphicsContext* aGc, |
|
67 MMediaFactoryFileInfo* aFileInfo ); |
|
68 |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 virtual ~CSmilPlayerMediaFactory(); |
|
73 |
|
74 public: // Functions from base classes |
|
75 |
|
76 /** |
|
77 * From MSmilMediaRenderer |
|
78 * See smilmediafactoryinterface.h for further information |
|
79 */ |
|
80 void SetBaseUrlL( const TDesC& aBaseUrl ); |
|
81 |
|
82 /** |
|
83 * From MSmilMediaRenderer |
|
84 * See smilmediafactoryinterface.h for further information |
|
85 */ |
|
86 void RequestMediaL( const TDesC& aUrl, MSmilMedia* aMedia ); |
|
87 |
|
88 /** |
|
89 * From MSmilMediaRenderer |
|
90 * See smilmediafactoryinterface.h for further information |
|
91 */ |
|
92 void PrefetchMediaL( const TDesC& aUrl ); |
|
93 |
|
94 /** |
|
95 * From MSmilMediaRenderer |
|
96 * See smilmediafactoryinterface.h for further information |
|
97 */ |
|
98 TMediaFactoryError CreateRendererL( const TDesC& aUrl, |
|
99 MSmilMedia* aMedia, |
|
100 MSmilMediaRenderer*& aRender ); |
|
101 |
|
102 /** |
|
103 * From MSmilMediaRenderer |
|
104 * See smilmediafactoryinterface.h for further information |
|
105 */ |
|
106 TPrefetchStatus PrefetchStatus( const TDesC& aUrl, |
|
107 TInt& aDown, |
|
108 TInt& aSize ); |
|
109 |
|
110 /** |
|
111 * From MSmilMediaRenderer |
|
112 * See smilmediafactoryinterface.h for further information |
|
113 */ |
|
114 void RendererDeleted( MSmilMediaRenderer* aRenderer ); |
|
115 |
|
116 /** |
|
117 * From MSmilMediaRenderer |
|
118 * See smilmediafactoryinterface.h for further information |
|
119 */ |
|
120 void PresentationReady(); |
|
121 |
|
122 /** |
|
123 * From MSmilMediaRenderer |
|
124 * See smilmediafactoryinterface.h for further information |
|
125 */ |
|
126 void PresentationEnd(); |
|
127 |
|
128 /** |
|
129 * From MSmilMediaRenderer |
|
130 * See smilmediafactoryinterface.h for further information |
|
131 */ |
|
132 TBool QueryContentType( const TDesC& aMimeType ) const; |
|
133 |
|
134 public: // New functions |
|
135 |
|
136 /** |
|
137 * Returns all renderers in the presentation. |
|
138 * |
|
139 * @since 3.1 |
|
140 * |
|
141 * @return Renderer array |
|
142 */ |
|
143 IMPORT_C CRendererArray* GetRenderers(); |
|
144 |
|
145 private: |
|
146 |
|
147 /** |
|
148 * C++ default constructor. |
|
149 */ |
|
150 CSmilPlayerMediaFactory(); |
|
151 |
|
152 /** |
|
153 * Constructor. |
|
154 */ |
|
155 CSmilPlayerMediaFactory( CCoeEnv& aCoeEnv, |
|
156 CGraphicsContext* aGc , |
|
157 MMediaFactoryFileInfo* aFileInfo ); |
|
158 |
|
159 /** |
|
160 * 2nd phase constructor |
|
161 */ |
|
162 void ConstructL(); |
|
163 |
|
164 /** |
|
165 * InstantiateRendererL |
|
166 */ |
|
167 MSmilMediaRenderer* InstantiateRendererL( TMsgMediaType aMediaType, |
|
168 RFile& aFileHandle, |
|
169 MSmilMedia* aMedia, |
|
170 TUint aCharSet ); |
|
171 |
|
172 /** |
|
173 * ResolveErrorL |
|
174 */ |
|
175 void ResolveErrorL( TMsgMediaType aMediaType, |
|
176 RFile& aFileHandle, |
|
177 TInt aErrorCode, |
|
178 MSmilMedia* aMedia, |
|
179 MSmilMediaRenderer*& aRenderer ) const; |
|
180 |
|
181 /** |
|
182 * PlaybackAllowedL |
|
183 */ |
|
184 TBool PlaybackAllowedL( const TDesC8& aMimeType, RFile& aFileHandle ) const; |
|
185 |
|
186 private: //data |
|
187 |
|
188 // Control environment |
|
189 CCoeEnv& iCoeEnv; |
|
190 |
|
191 // Graphical context. Used to format all text. |
|
192 CGraphicsContext* iGc; |
|
193 |
|
194 // File info |
|
195 MMediaFactoryFileInfo* iFileInfo; |
|
196 |
|
197 // Base url used for resolving relative URLs. |
|
198 RSmilTextBuf iBaseUrl; |
|
199 |
|
200 // Renderer array |
|
201 CRendererArray* iRendererArray; |
|
202 |
|
203 // Flag indicating whether non-drm music playing should be allowed. |
|
204 TBool iProhibitNonDrmMusic; |
|
205 |
|
206 // DRM common |
|
207 DRMCommon* iDrmCommon; |
|
208 |
|
209 // DRM Helper |
|
210 CDRMHelper* iDrmHelper; |
|
211 |
|
212 // Contains prohibit mime types. |
|
213 HBufC* iProhibitMimeTypeBuffer; |
|
214 |
|
215 // Resolves media type for mime type. |
|
216 CMsgMediaResolver* iMediaResolver; |
|
217 }; |
|
218 |
|
219 #endif // SMILPLAYERMEDIAFACTORY_H |