mpx/playbackframework/playbackengine/inc/mpxplaybackpluginhandler.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     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 "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:  Plugin handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXPLAYBACKPLUGINHANDLER_H
       
    21 #define CMPXPLAYBACKPLUGINHANDLER_H
       
    22 
       
    23 #include <mpxplaybackframeworkdefs.h>
       
    24 #include <mpxpluginhandlerbase.h>
       
    25 
       
    26 class CMPXPluginMonitor;
       
    27 class CMPXPlaybackPlugin;
       
    28 class MMPXPlaybackPluginObserver;
       
    29 
       
    30 
       
    31 /**
       
    32 *   Processes plug-ins
       
    33 */
       
    34 class CMPXPlaybackPluginHandler : public CMPXPluginHandlerBase
       
    35     {
       
    36 public:
       
    37     /**
       
    38     *  Two-phased constructor.
       
    39     *
       
    40     *  @param aPluginMonitor plugin monitor
       
    41     *  @param aPluginObserver Observer
       
    42     *  @param aObserver plugin handler observer
       
    43     *  @return Constructed object
       
    44     */
       
    45     static CMPXPlaybackPluginHandler* NewL(CMPXPluginMonitor& aPluginMonitor,
       
    46                                            MMPXPlaybackPluginObserver& aPluginObserver,
       
    47                                            MMPXPluginHandlerObserver& aObserver);
       
    48 
       
    49     /**
       
    50     *  Destructor
       
    51     */
       
    52     ~CMPXPlaybackPluginHandler();
       
    53 
       
    54 public:
       
    55     /**
       
    56     * Set a new observer
       
    57     *
       
    58     * @param aObs observer
       
    59     */
       
    60     inline void SetObserver(MMPXPlaybackPluginObserver& aObs);
       
    61 
       
    62     /**
       
    63     *  Returns currently loaded plug-in, or NULL if none
       
    64     *
       
    65     *  @return plugin object interface
       
    66     */
       
    67     inline CMPXPlaybackPlugin* Plugin();
       
    68 
       
    69     /**
       
    70     *  Returns currently loaded plug-in UID, or KNullUId if none loaded
       
    71     *
       
    72     *  @return UID of the plugin
       
    73     */
       
    74     inline TUid PluginUid() const;
       
    75 
       
    76     /**
       
    77     *  Returns currently loaded plug-in type
       
    78     *
       
    79     *  @return plugin type
       
    80     */
       
    81     inline TMPXPlaybackPlayerType PluginType() const;
       
    82 
       
    83     /**
       
    84     *  Returns display name for custom type for current plug-in; standard types
       
    85     *  should be recognized by client and localized - calling this method would
       
    86     *  then not be required. See MMPXPlayerManager
       
    87     *
       
    88     *  @return player name
       
    89     */
       
    90     inline const TDesC& PlayerName() const;
       
    91 
       
    92     /**
       
    93     *  Is a plug-in currently loaded
       
    94     *
       
    95     *  @return ETrue if a play-in is loaded
       
    96     */
       
    97     inline TBool PlayerFound() const;
       
    98 
       
    99     /**
       
   100     *  Currently selected sub player. or KErrNotFound if none
       
   101     *
       
   102     *  @return index of subplayer
       
   103     */
       
   104     inline TInt SubPlayer() const;
       
   105 
       
   106     /**
       
   107     *  Returns plug-in with UID aUid, or leaves with KErrNotFound if not there.
       
   108     *  Plug-in loaded until Unload called
       
   109     *
       
   110     *  @param UID of the plugin
       
   111     *  @return plugin object interface
       
   112     */
       
   113     CMPXPlaybackPlugin* CreatePlayerPluginL(const TUid& aUid);
       
   114 
       
   115     /**
       
   116     * @see CMPXPluginHandlerBase
       
   117     */
       
   118     TBool IsPluginLoaded(const TUid& aPluginUid);
       
   119 
       
   120     /**
       
   121     * @see CMPXPluginHandlerBase
       
   122     */
       
   123     void LoadPluginL(const TUid& aPluginUid);
       
   124 
       
   125     /**
       
   126     * @see CMPXPluginHandlerBase
       
   127     */
       
   128     void UnloadPlugin(const TUid& aPluginUid);
       
   129 
       
   130     /**
       
   131     *  Returns display name for custom types; standard types should be
       
   132     *  recognized by client and localized - calling this method would then not
       
   133     *  be required. See MMPXPlayerManager
       
   134     *
       
   135     *  @param aType player type
       
   136     *  @return player name
       
   137     */
       
   138     IMPORT_C const TDesC& PlayerName(TMPXPlaybackPlayerType aType) const;
       
   139 
       
   140 
       
   141     /**
       
   142     *  All the UIDs of the plug-ins in the system of a specific type.
       
   143     *  See MMPXPlayerManager
       
   144     *
       
   145     *  @param aPlayers array of UIDs of all players of type aType
       
   146     *  @param aType player type
       
   147     */
       
   148     IMPORT_C void GetPlayerListL(RArray<TUid>& aPlayers,
       
   149                                 TMPXPlaybackPlayerType aType);
       
   150 
       
   151     /**
       
   152     *  Only plug-ins of a specific type will be considered for selection.
       
   153     *  See MMPXPlayerManager
       
   154     *
       
   155     *  @param aType player type
       
   156     */
       
   157     IMPORT_C void SelectPlayersL(TMPXPlaybackPlayerType aType);
       
   158 
       
   159     /**
       
   160     *  selects plug-in appropriate for a Uri; may already be loaded or not
       
   161     *  @param aUri URI of the song
       
   162     *  @param aDataType data type
       
   163     */
       
   164     void SelectPlayerL(const TDesC& aUri,const TDesC8& aDataType);
       
   165 
       
   166     /**
       
   167     *  selects plug-in appropriate for a file; may already be loaded or not
       
   168     *
       
   169     *  @param aFile file handle
       
   170     */
       
   171     void SelectPlayerL(RFile& aFile);
       
   172 
       
   173     /**
       
   174     *  Only this plug-in will be used, if possible. See MMPXPlayerManager
       
   175     *
       
   176     *  @param aPlayerUid UID of players
       
   177     */
       
   178     IMPORT_C void SelectPlayerL(TUid aPlayerUid);
       
   179 
       
   180     /**
       
   181     *  Only this plug-in will be used, and only this sub player, if possible.
       
   182     *  See MMPXPlayerManager
       
   183     *
       
   184     *  @param aPlayerUid UID of players
       
   185     *  @param aSubPlayerIndex index to the subplayer
       
   186     */
       
   187     IMPORT_C void SelectSubPlayerL(TUid aPlayerUid,TInt aSubPlayerIndex);
       
   188 
       
   189     /**
       
   190     *  Back to default slection criteria, i.e. type=EPbLocal, no sub player
       
   191     *  selected
       
   192     */
       
   193     IMPORT_C void ClearSelectPlayersL();
       
   194 
       
   195     /**
       
   196     *  Retreives the current selection: KNullUid and KErrNotFound are possible
       
   197     *  return values for aPlayer and aSubPlayerIndex respectively if none are
       
   198     *  explicitly selected
       
   199     *
       
   200     *  @param aType player type
       
   201     *  @param aPlayer UID
       
   202     *  @param aSubPlayerIndex index of sub player
       
   203     *  @param aSubPlayerName Friendly name of the sub player
       
   204     */
       
   205     IMPORT_C void GetSelection(TMPXPlaybackPlayerType& aType,
       
   206                                TUid& aPlayer,
       
   207                                TInt& aSubPlayerIndex,
       
   208                                TPtrC& aSubPlayerName);
       
   209 
       
   210     /**
       
   211     *  Return a list of interfaces supported by plugins.
       
   212     *
       
   213     *  @return an array of interfaces. Client is responsible
       
   214     *          for the memory management of this array and its
       
   215     *          items.
       
   216     */
       
   217     IMPORT_C CDesCArray* SupportedInterfacesL();
       
   218     
       
   219     /**
       
   220     *  Return a list of interfaces supported by a plugin.
       
   221     *
       
   222     *  @param aUid plugin id
       
   223     *  @return an array of interfaces. Client is responsible
       
   224     *          for the memory management of this array and its
       
   225     *          items.
       
   226     */
       
   227     IMPORT_C CDesCArray* SupportedInterfacesL(const TUid& aUid);    
       
   228     
       
   229 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   230     /**
       
   231     *  selects plug-in appropriate for a file; may already be loaded or not
       
   232     *
       
   233     *  @param aFile file handle
       
   234     */
       
   235     void SelectPlayer64L(RFile64& aFile);
       
   236 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   237     
       
   238 protected:
       
   239     
       
   240     /**
       
   241     * From Base CMPXPluginHandlerBase
       
   242     * Constructs the collection plugin info
       
   243     */
       
   244     CMPXPluginInfo* ConstructPluginInfoLC( const CImplementationInformation& aData  );
       
   245     
       
   246 private:
       
   247 
       
   248     /**
       
   249     *  2nd phase contructor
       
   250     */
       
   251     void ConstructL();
       
   252 
       
   253     /**
       
   254     *  C++ constructor
       
   255     *
       
   256     *  @param aPluginMonitor plugin monitor
       
   257     *  @param aPluginObserver plugin observer
       
   258     *  @param aObserver handler observer
       
   259     */
       
   260     CMPXPlaybackPluginHandler(CMPXPluginMonitor& aPluginMonitor,
       
   261                               MMPXPlaybackPluginObserver& aPluginObserver,
       
   262                               MMPXPluginHandlerObserver& aObserver);
       
   263 
       
   264 private:
       
   265 
       
   266     /**
       
   267     * From Base CMPXPluginHandlerBase
       
   268     *  Resolves a plugin
       
   269     */
       
   270     void ResolvePluginL();
       
   271 
       
   272     /**
       
   273     *  Unloads the plugin at a specified index.
       
   274     *  @param aIndex index of the plugin in iLoadedPlugins
       
   275     */
       
   276     void UnloadPlugin(TInt aIndex);
       
   277 
       
   278 private:
       
   279     MMPXPlaybackPluginObserver* iPluginObserver;  // Not owned.
       
   280     //
       
   281     // Loaded. The index must correspond in these arrays
       
   282     //
       
   283     RPointerArray<CMPXPlaybackPlugin> iLoadedPlugins;
       
   284     RArray<TUid> iLoadedPluginsUids;
       
   285 
       
   286     // Chosen
       
   287     //
       
   288     CMPXPlaybackPlugin* iPlugin;
       
   289     TUid iPluginUid;
       
   290     TMPXPlaybackPlayerType iPluginType;
       
   291     HBufC* iDisplayName;
       
   292     //
       
   293     // Desired
       
   294     //
       
   295     TInt iSelectedSubPlayerIndex;
       
   296     };
       
   297 
       
   298 #include "mpxplaybackpluginhandler.inl"
       
   299 
       
   300 #endif // CMPXPLAYBACKPLUGINHANDLER_H