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