mpserviceplugins/m3uplaylistplugin/src/mpxm3uplaylistplugin.cpp
changeset 25 3ec52facab4d
parent 19 4e84c994a771
equal deleted inserted replaced
22:ecf06a08d4d9 25:3ec52facab4d
    31 #include "mpxm3uplaylistexporter.h"
    31 #include "mpxm3uplaylistexporter.h"
    32 #include "mpxm3uplaylistplugin.h"
    32 #include "mpxm3uplaylistplugin.h"
    33 #include "mpxm3uplaylistdefs.h"
    33 #include "mpxm3uplaylistdefs.h"
    34 #include "mpxm3uplaylistdefs.hrh"
    34 #include "mpxm3uplaylistdefs.hrh"
    35 
    35 
    36 
    36     
    37 // ============================ MEMBER FUNCTIONS ==============================
    37 // ============================ MEMBER FUNCTIONS ==============================
    38 // ----------------------------------------------------------------------------
    38 // ----------------------------------------------------------------------------
    39 // Constructor.
    39 // Constructor. 
    40 // ----------------------------------------------------------------------------
    40 // ----------------------------------------------------------------------------
    41 CMPXM3uPlaylistPlugin::CMPXM3uPlaylistPlugin()
    41 CMPXM3uPlaylistPlugin::CMPXM3uPlaylistPlugin()
    42     {
    42     {
    43     }
    43     }
    44 
    44 
    46 // 2nd phase constructor
    46 // 2nd phase constructor
    47 // ----------------------------------------------------------------------------
    47 // ----------------------------------------------------------------------------
    48 void CMPXM3uPlaylistPlugin::ConstructL()
    48 void CMPXM3uPlaylistPlugin::ConstructL()
    49     {
    49     {
    50     iRequiredAttributes.AppendL(KMPXMediaGeneralUri);
    50     iRequiredAttributes.AppendL(KMPXMediaGeneralUri);
    51 
    51     
    52     iOptionalAttributes.AppendL(KMPXMediaGeneralTitle);
    52     iOptionalAttributes.AppendL(KMPXMediaGeneralTitle);
    53     iOptionalAttributes.AppendL(KMPXMediaGeneralDuration);
    53     iOptionalAttributes.AppendL(KMPXMediaGeneralDuration);
    54     }
    54     }
    55 
    55     
    56 // ----------------------------------------------------------------------------
    56 // ----------------------------------------------------------------------------
    57 // Two-phased constructor.
    57 // Two-phased constructor. 
    58 // ----------------------------------------------------------------------------
    58 // ----------------------------------------------------------------------------
    59 CMPXM3uPlaylistPlugin* CMPXM3uPlaylistPlugin::NewL(TAny* /*aInitParams*/)
    59 CMPXM3uPlaylistPlugin* CMPXM3uPlaylistPlugin::NewL(TAny* /*aInitParams*/)
    60     {
    60     {
    61     CMPXM3uPlaylistPlugin* self=new(ELeave)CMPXM3uPlaylistPlugin();
    61     CMPXM3uPlaylistPlugin* self=new(ELeave)CMPXM3uPlaylistPlugin();
    62     CleanupStack::PushL(self);
    62     CleanupStack::PushL(self);
    64     CleanupStack::Pop(self);
    64     CleanupStack::Pop(self);
    65     return self;
    65     return self;
    66     }
    66     }
    67 
    67 
    68 // ----------------------------------------------------------------------------
    68 // ----------------------------------------------------------------------------
    69 // Destructor.
    69 // Destructor. 
    70 // ----------------------------------------------------------------------------
    70 // ----------------------------------------------------------------------------
    71 CMPXM3uPlaylistPlugin::~CMPXM3uPlaylistPlugin()
    71 CMPXM3uPlaylistPlugin::~CMPXM3uPlaylistPlugin()
    72     {
    72     {
    73     delete iImporter;
    73     delete iImporter;
    74     delete iExporter;
    74     delete iExporter;
    88     // instantiate a new CMPXM3uPlaylistImporter to handle this request.
    88     // instantiate a new CMPXM3uPlaylistImporter to handle this request.
    89     delete iImporter;
    89     delete iImporter;
    90     iImporter = NULL;
    90     iImporter = NULL;
    91 
    91 
    92     // processing starts as soon as object is instantiated. When request completes,
    92     // processing starts as soon as object is instantiated. When request completes,
    93     // client is notified through MMPXPlaylistPlugibObserver interface
    93     // client is notified through MMPXPlaylistPlugibObserver interface        
    94     iImporter =
    94     iImporter =
    95         CMPXM3uPlaylistImporter::NewL(
    95         CMPXM3uPlaylistImporter::NewL(
    96             iFs, iObserver, aPlaylistUri, *iTopCharacterSet, *iAvailableCharacterSet, aStatus );
    96             iFs, iObserver, aPlaylistUri, *iTopCharacterSet, *iAvailableCharacterSet, aStatus );
    97     }
    97     }
    98 
    98 
   102 void CMPXM3uPlaylistPlugin::ExternalizePlaylistL(
   102 void CMPXM3uPlaylistPlugin::ExternalizePlaylistL(
   103     TRequestStatus& aStatus,
   103     TRequestStatus& aStatus,
   104     const CMPXMedia& aPlaylist,
   104     const CMPXMedia& aPlaylist,
   105     const TDesC& aFilePath)
   105     const TDesC& aFilePath)
   106     {
   106     {
   107     MPX_DEBUG1("CMPXM3uPlaylistPlugin::ExternalizePlaylistL");
   107     MPX_DEBUG1("CMPXM3uPlaylistPlugin::ExternalizePlaylistL");    
   108 
   108 
   109     // instantiate a new CMPXM3uPlaylistExporter to handle this request
   109     // instantiate a new CMPXM3uPlaylistExporter to handle this request
   110     delete iExporter;
   110     delete iExporter;
   111     iExporter = NULL;
   111     iExporter = NULL;
   112 
   112     
   113     // processing starts as soon as object is instantiated. When request completes,
   113     // processing starts as soon as object is instantiated. When request completes,
   114     // client is notified through MMPXPlaylistPlugibObserver interface
   114     // client is notified through MMPXPlaylistPlugibObserver interface        
   115     iExporter =
   115     iExporter =
   116         CMPXM3uPlaylistExporter::NewL(
   116         CMPXM3uPlaylistExporter::NewL(
   117             iFs, iObserver, aPlaylist, aFilePath, aStatus );
   117             iFs, iObserver, aPlaylist, aFilePath, aStatus );
   118     }
   118     }
   119 
   119 
   121 // Required attributes for the medias in the playlist in order to
   121 // Required attributes for the medias in the playlist in order to
   122 // externalize them to a playlist.
   122 // externalize them to a playlist.
   123 // ----------------------------------------------------------------------------
   123 // ----------------------------------------------------------------------------
   124 const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::RequiredAttributes() const
   124 const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::RequiredAttributes() const
   125     {
   125     {
   126     return iRequiredAttributes.Array();
   126     return iRequiredAttributes.Array();    
   127     }
   127     }
   128 
   128 
   129 // ----------------------------------------------------------------------------
   129 // ----------------------------------------------------------------------------
   130 // Optional attributes for the medias in the playlist for externalizing
   130 // Optional attributes for the medias in the playlist for externalizing
   131 // them to a playlist
   131 // them to a playlist
   132 // ----------------------------------------------------------------------------
   132 // ----------------------------------------------------------------------------
   133 const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::OptionalAttributes() const
   133 const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::OptionalAttributes() const
   134     {
   134     {
   135     return iOptionalAttributes.Array();
   135     return iOptionalAttributes.Array();    
   136     }
   136     }
   137 
   137 
   138 // ----------------------------------------------------------------------------
   138 // ----------------------------------------------------------------------------
   139 // Returns the file extension the plugin handles
   139 // Returns the file extension the plugin handles
   140 // ----------------------------------------------------------------------------
   140 // ----------------------------------------------------------------------------
   150     {
   150     {
   151     if ( iImporter )
   151     if ( iImporter )
   152         {
   152         {
   153         iImporter->Cancel();
   153         iImporter->Cancel();
   154         }
   154         }
   155 
   155         
   156     if ( iExporter )
   156     if ( iExporter )
   157         {
   157         {
   158         iExporter->Cancel();
   158         iExporter->Cancel();
   159         }
   159         }
   160     }
   160     }
   161 
   161 
   162 // ========================== OTHER EXPORTED FUNCTIONS =========================
   162 // ========================== OTHER EXPORTED FUNCTIONS =========================
   163 // ----------------------------------------------------------------------------
   163 // ----------------------------------------------------------------------------
   164 // The list of implementations
   164 // The list of implementations
   165 // ----------------------------------------------------------------------------
   165 // ----------------------------------------------------------------------------
   166 const TImplementationProxy ImplementationTable[] =
   166 const TImplementationProxy ImplementationTable[] = 
   167     { IMPLEMENTATION_PROXY_ENTRY(KMPXM3uPlaylistImplUid, CMPXM3uPlaylistPlugin::NewL) };
   167     { IMPLEMENTATION_PROXY_ENTRY(KMPXM3uPlaylistImplUid, CMPXM3uPlaylistPlugin::NewL) };
   168 
   168 
   169 // ----------------------------------------------------------------------------
   169 // ----------------------------------------------------------------------------
   170 // The proxy of implementations
   170 // The proxy of implementations
   171 // ----------------------------------------------------------------------------
   171 // ----------------------------------------------------------------------------
   172 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
   172 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
   173     {
   173     {
   174     aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
   174     aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
   175     return ImplementationTable;
   175     return ImplementationTable;
   176     }
   176     }
   177 
   177     
   178 // End of file
   178 // End of file