|
1 /* |
|
2 * Copyright (c) 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 the License "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: Interface to Browser for handling embedded video requests. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef BAVPPLUGIN_H |
|
20 #define BAVPPLUGIN_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <npupp.h> |
|
25 #include <pluginadapterinterface.h> // For base class MPluginNotifier |
|
26 #include <aknnotewrappers.h> // For displaying note |
|
27 #include <drmhelper.h> |
|
28 #include <DRMCommon.h> |
|
29 #include <cecombrowserplugininterface.h> |
|
30 #include "BavpNPObject.h" |
|
31 #include <rt_gesturehelper.h> |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CBavpView; |
|
35 class CBavpController; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /****************************************** |
|
40 This class is specific to ECom Style Plugin. |
|
41 This is used for passing plugin specific initialization information to and from |
|
42 browser. |
|
43 *******************************************/ |
|
44 IMPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf ); |
|
45 |
|
46 // CONSTANTS |
|
47 const TInt KFirstBavpImplementationValue = 0x10282811; |
|
48 const TInt KSecondBavpImplementationValue = 0x10282812; |
|
49 const TInt KThirdBavpImplementationValue = 0x10282813; |
|
50 const TInt KFourthBavpImplementationValue = 0x10282814; |
|
51 |
|
52 /** |
|
53 * CBavpPluginEcomMain |
|
54 * Used for passing plugin specific initialization information to and from browser. |
|
55 * @lib npBrowserVideoPlugin.lib |
|
56 * @since 3.2 |
|
57 */ |
|
58 class CBavpPluginEcomMain : public CEcomBrowserPluginInterface |
|
59 { |
|
60 public: // Methods from base classes |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 */ |
|
65 static CBavpPluginEcomMain* NewL( TAny* aInitParam ); |
|
66 |
|
67 /** |
|
68 * Destructor |
|
69 */ |
|
70 ~CBavpPluginEcomMain(); |
|
71 |
|
72 /** |
|
73 * Passed from the browser to the plugin and delcares what functions the browser |
|
74 * makes available |
|
75 */ |
|
76 NPNetscapeFuncs* Funcs() { return iNpf; } |
|
77 |
|
78 private: |
|
79 |
|
80 // Default constructor |
|
81 CBavpPluginEcomMain( NPNetscapeFuncs* aNpf ); |
|
82 |
|
83 // By default Symbian 2nd phase constructor is private. |
|
84 void ConstructL( NPPluginFuncs* aPluginFuncs ); |
|
85 |
|
86 // Netscape Function Pointer |
|
87 NPNetscapeFuncs* iNpf; |
|
88 }; |
|
89 |
|
90 /** |
|
91 * CBavpPlugin class |
|
92 * Interfaces to Browser, used to pass information between browser and plugin |
|
93 * @lib npBrowserVideoPlugin.lib |
|
94 * @since 3.2 |
|
95 */ |
|
96 class CBavpPlugin : public CBase, |
|
97 public MPluginNotifier |
|
98 { |
|
99 public: // Constructors and destructor |
|
100 |
|
101 /** |
|
102 * Two-phased constructor. |
|
103 */ |
|
104 static CBavpPlugin* NewL(); |
|
105 |
|
106 /** |
|
107 * Destructor. |
|
108 */ |
|
109 virtual ~CBavpPlugin(); |
|
110 |
|
111 public: // New methods |
|
112 |
|
113 /** |
|
114 * SetWindowL |
|
115 * @since 3.2 |
|
116 * @param MPluginAdapter *pluginAdapter: Pointer to Browser adapter class |
|
117 * @param const TRect& aRect: rectangle representing current UI |
|
118 * @return void |
|
119 */ |
|
120 void SetWindowL( MPluginAdapter *pluginAdapter, NPWindow* aWindow, NPP aInstance ); |
|
121 |
|
122 /** |
|
123 * OpenAndPlayFileL |
|
124 * @since 3.2 |
|
125 * @param const TDesC& aFileName: Name and path of file to be played |
|
126 * @param const HBufC* originalFileName: name of the file to be played. added for scripting. |
|
127 * @return void |
|
128 */ |
|
129 void OpenAndPlayFileL( const TDesC& aFileName, const HBufC* originalFileName ); |
|
130 |
|
131 /** |
|
132 * OpenAndPlayUrlL |
|
133 * @since 3.2 |
|
134 * @param const TDesC& aUrl: Name and path of uri to be played |
|
135 * @return void |
|
136 */ |
|
137 void OpenAndPlayUrlL( const TDesC& aUrl ); |
|
138 |
|
139 /** |
|
140 * Controller |
|
141 * @since 5.0 |
|
142 * @param void |
|
143 * @return controller |
|
144 */ |
|
145 CBavpController* Controller() { return iBavpController; } |
|
146 |
|
147 /** |
|
148 * SetNPObject |
|
149 * iNPObject is a scriptable object |
|
150 * @since 5.0 |
|
151 * @param BavpNPObject *aObj |
|
152 * @return void |
|
153 */ |
|
154 void SetNPObject( BavpNPObject* aObj ) { iNPObject = aObj; } |
|
155 |
|
156 /** |
|
157 * NPObject |
|
158 * return the scriptable object |
|
159 * @since 5.0 |
|
160 * @param void |
|
161 * @return BavpNPObject* |
|
162 */ |
|
163 BavpNPObject* NPObject() const { return iNPObject; } |
|
164 |
|
165 |
|
166 public: // New methods |
|
167 |
|
168 /** |
|
169 * SetAccessPtId |
|
170 * Set access pt id |
|
171 * @since 3.2 |
|
172 * @param TUint aAccessPtId, sets the access pt id |
|
173 * @return void |
|
174 */ |
|
175 void SetAccessPtId( TUint aAccessPtId ); |
|
176 |
|
177 /** |
|
178 * SetVolumeAndLoop |
|
179 * Set volume, loop, and infinite values |
|
180 * @since 3.2 |
|
181 * @param TInt aVolume, the volume level from web page |
|
182 * @param TInt aLoop, the loop count from web page |
|
183 * @param TInt aInfiniteFlag, not used |
|
184 * @return void |
|
185 */ |
|
186 void SetVolumeAndLoop( TInt aVolume, TInt aLoop, TInt aInfiniteFlag ); |
|
187 |
|
188 /** |
|
189 * SetRtspUri |
|
190 * Set Rtsp uri |
|
191 * @since 3.2 |
|
192 * @param TInt aVolume, the volume level from web page |
|
193 * @param TInt aLoop, the loop count from web page |
|
194 * @param TInt aInfiniteFlag, not used |
|
195 * @return void |
|
196 */ |
|
197 void SetRtspUriL( const TDesC& aRtspUri ); |
|
198 |
|
199 public: // Methods from base classes |
|
200 |
|
201 /** |
|
202 * From MPluginNotifier |
|
203 * @since 3.2 |
|
204 * @param TNotificationType aCallType: Represents a type of notification from Browser |
|
205 * @param void* aParam: Contains value corresponding to notification |
|
206 * @return TInt: Error Code |
|
207 */ |
|
208 TInt NotifyL( TNotificationType aCallType, void* aParam ); |
|
209 |
|
210 /** |
|
211 * Set the mime type |
|
212 * The mimetype is returned from headers |
|
213 * @param NPMIMEType type |
|
214 * @return void |
|
215 */ |
|
216 void SetMimeType(NPMIMEType type); |
|
217 |
|
218 NPP getNPP() {return iNPP;} |
|
219 |
|
220 NPNetscapeFuncs* getNPNFuncs(); |
|
221 |
|
222 TBool HandleGesture(void* aEvent); |
|
223 private: |
|
224 |
|
225 /** |
|
226 * C++ default constructor. |
|
227 */ |
|
228 CBavpPlugin(); |
|
229 |
|
230 /** |
|
231 * By default Symbian 2nd phase constructor is private. |
|
232 */ |
|
233 void ConstructL(); |
|
234 |
|
235 public: // Data |
|
236 |
|
237 // Initialize as false, then set it whenever error occurs |
|
238 TBool iError; |
|
239 |
|
240 private: // Data |
|
241 |
|
242 // Interface to Browser |
|
243 MPluginAdapter* iPluginAdapter; |
|
244 |
|
245 // Audio or Video controller |
|
246 CBavpController* iBavpController; |
|
247 |
|
248 // CCoeControl interface |
|
249 CBavpView* iBavpView; |
|
250 |
|
251 BavpNPObject* iNPObject; |
|
252 |
|
253 // Resource offset |
|
254 TInt iResourceOffset; |
|
255 |
|
256 // Src file scheme, which is changed by script in run time |
|
257 HBufC* iFileName; |
|
258 |
|
259 // Src RTSP scheme uri, which is used to start BavpController |
|
260 HBufC* iRtspUrl; |
|
261 |
|
262 // Access point id |
|
263 TUint iAccessPtId; |
|
264 |
|
265 // Value of the Volume embedded in the HTML file |
|
266 TInt iVolume; |
|
267 |
|
268 // Value of the Loop embedded in the HTML file |
|
269 TInt iLoop; |
|
270 |
|
271 // Flag indication if the loop is set to infinite |
|
272 TBool iInfiniteFlag; |
|
273 |
|
274 // DRM Helper instance to address the error case from the plugin level |
|
275 CDRMHelper* iDrmHelper; |
|
276 |
|
277 // Mime type. Added for scripting functionality |
|
278 HBufC8* iMimeType; |
|
279 NPP iNPP; |
|
280 //browser plugin state, used for play and resume |
|
281 TBool iPauseState; |
|
282 TBool iIsForeGround; |
|
283 TBool iPauseInBackground; |
|
284 TBool iPlayFromFile; |
|
285 }; |
|
286 |
|
287 /** |
|
288 ******************************************************************************** |
|
289 Plugin API methods. Source located in CBavpApi.cpp |
|
290 ********************************************************************************* |
|
291 */ |
|
292 |
|
293 /** |
|
294 * Create a plugin. |
|
295 */ |
|
296 |
|
297 NPError BavpNewp( NPMIMEType pluginType, NPP instance, uint16 mode, |
|
298 CDesCArray* argn, CDesCArray* argv, NPSavedData* saved ); |
|
299 |
|
300 /** |
|
301 * Wrapper the errors |
|
302 */ |
|
303 void BavpConstructL( NPP aInstance, CDesCArray* argn, CDesCArray* argv ); |
|
304 |
|
305 /** |
|
306 * Destroy a plugin. |
|
307 */ |
|
308 NPError BavpDestroy( NPP instance, NPSavedData** save ); |
|
309 |
|
310 /** |
|
311 * This is the parent window of a plugin. |
|
312 */ |
|
313 NPError BavpSetwindow( NPP instance, NPWindow* window ); |
|
314 |
|
315 /** |
|
316 * A new data stream has been created for sending data to the plugin. |
|
317 */ |
|
318 NPError BavpNewstream( NPP instance, NPMIMEType type, NPStream* stream, |
|
319 NPBool seekable, uint16* stype ); |
|
320 |
|
321 /** |
|
322 * A data stream has been terminated. |
|
323 */ |
|
324 NPError BavpDestroystream( NPP instance, NPStream* stream, NPReason reason ); |
|
325 |
|
326 /** |
|
327 * A data stream has been fully saved to a file. |
|
328 */ |
|
329 void BavpAsfile( NPP instance, NPStream* stream, const TDesC& fname ); |
|
330 |
|
331 /** |
|
332 * Return the maximum number of bytes this plugin can accept from the stream. |
|
333 */ |
|
334 int32 BavpWriteready( NPP instance, NPStream* stream ); |
|
335 |
|
336 /** |
|
337 * Receive more data - return number of bytes processed. |
|
338 */ |
|
339 int32 BavpWrite( NPP instance, NPStream* stream, |
|
340 int32 offset, int32 len, void* buffer ); |
|
341 |
|
342 /** |
|
343 * This is the URL being sensed. |
|
344 */ |
|
345 void BavpUrlnotify( NPP instance, const TDesC8& url, NPReason reason, |
|
346 void* notifyData ); |
|
347 |
|
348 /** |
|
349 * Generic hook to retrieve values/attributes from the plugin. |
|
350 */ |
|
351 NPError BavpGetvalue( NPP instance, NPPVariable variable, void *ret_value ); |
|
352 |
|
353 /** |
|
354 * Generic hook to set values/attributes within the plugin. |
|
355 */ |
|
356 NPError BavpSetvalue( NPP instance, NPNVariable variable, void *ret_value ); |
|
357 |
|
358 /** |
|
359 * Print |
|
360 */ |
|
361 void BavpPrint( NPP instance, NPPrint* platformPrint ); |
|
362 |
|
363 /** |
|
364 * Event |
|
365 */ |
|
366 int16 BavpEvent( NPP instance, void* event ); |
|
367 |
|
368 #endif // BAVPPLUGIN_H |
|
369 |
|
370 // End of File |