|
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: Implementation of m3u playlist plugin interface |
|
15 * |
|
16 * CMPXM3uPlaylistPlugin delegates the responsibilities for m3u playlist file |
|
17 * import and export to CMPXM3uPlaylistImporter and CMPXM3uPlaylistExporter |
|
18 * respectively. |
|
19 * |
|
20 * |
|
21 */ |
|
22 |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include <e32cmn.h> |
|
26 #include <implementationproxy.h> |
|
27 #include <mpxlog.h> |
|
28 #include <mpxmediageneraldefs.h> |
|
29 #include <mpxplaylistpluginobserver.h> |
|
30 #include "mpxm3uplaylistimporter.h" |
|
31 #include "mpxm3uplaylistexporter.h" |
|
32 #include "mpxm3uplaylistplugin.h" |
|
33 #include "mpxm3uplaylistdefs.h" |
|
34 #include "mpxm3uplaylistdefs.hrh" |
|
35 |
|
36 |
|
37 // ============================ MEMBER FUNCTIONS ============================== |
|
38 // ---------------------------------------------------------------------------- |
|
39 // Constructor. |
|
40 // ---------------------------------------------------------------------------- |
|
41 CMPXM3uPlaylistPlugin::CMPXM3uPlaylistPlugin() |
|
42 { |
|
43 } |
|
44 |
|
45 // ---------------------------------------------------------------------------- |
|
46 // 2nd phase constructor |
|
47 // ---------------------------------------------------------------------------- |
|
48 void CMPXM3uPlaylistPlugin::ConstructL() |
|
49 { |
|
50 iRequiredAttributes.AppendL(KMPXMediaGeneralUri); |
|
51 |
|
52 iOptionalAttributes.AppendL(KMPXMediaGeneralTitle); |
|
53 iOptionalAttributes.AppendL(KMPXMediaGeneralDuration); |
|
54 } |
|
55 |
|
56 // ---------------------------------------------------------------------------- |
|
57 // Two-phased constructor. |
|
58 // ---------------------------------------------------------------------------- |
|
59 CMPXM3uPlaylistPlugin* CMPXM3uPlaylistPlugin::NewL(TAny* /*aInitParams*/) |
|
60 { |
|
61 CMPXM3uPlaylistPlugin* self=new(ELeave)CMPXM3uPlaylistPlugin(); |
|
62 CleanupStack::PushL(self); |
|
63 self->ConstructL(); |
|
64 CleanupStack::Pop(self); |
|
65 return self; |
|
66 } |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // Destructor. |
|
70 // ---------------------------------------------------------------------------- |
|
71 CMPXM3uPlaylistPlugin::~CMPXM3uPlaylistPlugin() |
|
72 { |
|
73 delete iImporter; |
|
74 delete iExporter; |
|
75 iRequiredAttributes.Close(); |
|
76 iOptionalAttributes.Close(); |
|
77 } |
|
78 |
|
79 // ---------------------------------------------------------------------------- |
|
80 // Internalize a playlist |
|
81 // ---------------------------------------------------------------------------- |
|
82 void CMPXM3uPlaylistPlugin::InternalizePlaylistL( |
|
83 TRequestStatus& aStatus, |
|
84 const TDesC& aPlaylistUri) |
|
85 { |
|
86 MPX_DEBUG1("CMPXM3uPlaylistPlugin::InternalizePlaylist(aPlaylistUri)"); |
|
87 |
|
88 // instantiate a new CMPXM3uPlaylistImporter to handle this request. |
|
89 delete iImporter; |
|
90 iImporter = NULL; |
|
91 |
|
92 // processing starts as soon as object is instantiated. When request completes, |
|
93 // client is notified through MMPXPlaylistPlugibObserver interface |
|
94 iImporter = |
|
95 CMPXM3uPlaylistImporter::NewL( |
|
96 iFs, iObserver, aPlaylistUri, *iTopCharacterSet, *iAvailableCharacterSet, aStatus ); |
|
97 } |
|
98 |
|
99 // ---------------------------------------------------------------------------- |
|
100 // Externalize a playlist |
|
101 // ---------------------------------------------------------------------------- |
|
102 void CMPXM3uPlaylistPlugin::ExternalizePlaylistL( |
|
103 TRequestStatus& aStatus, |
|
104 const CMPXMedia& aPlaylist, |
|
105 const TDesC& aFilePath) |
|
106 { |
|
107 MPX_DEBUG1("CMPXM3uPlaylistPlugin::ExternalizePlaylistL"); |
|
108 |
|
109 // instantiate a new CMPXM3uPlaylistExporter to handle this request |
|
110 delete iExporter; |
|
111 iExporter = NULL; |
|
112 |
|
113 // processing starts as soon as object is instantiated. When request completes, |
|
114 // client is notified through MMPXPlaylistPlugibObserver interface |
|
115 iExporter = |
|
116 CMPXM3uPlaylistExporter::NewL( |
|
117 iFs, iObserver, aPlaylist, aFilePath, aStatus ); |
|
118 } |
|
119 |
|
120 // ---------------------------------------------------------------------------- |
|
121 // Required attributes for the medias in the playlist in order to |
|
122 // externalize them to a playlist. |
|
123 // ---------------------------------------------------------------------------- |
|
124 const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::RequiredAttributes() const |
|
125 { |
|
126 return iRequiredAttributes.Array(); |
|
127 } |
|
128 |
|
129 // ---------------------------------------------------------------------------- |
|
130 // Optional attributes for the medias in the playlist for externalizing |
|
131 // them to a playlist |
|
132 // ---------------------------------------------------------------------------- |
|
133 const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::OptionalAttributes() const |
|
134 { |
|
135 return iOptionalAttributes.Array(); |
|
136 } |
|
137 |
|
138 // ---------------------------------------------------------------------------- |
|
139 // Returns the file extension the plugin handles |
|
140 // ---------------------------------------------------------------------------- |
|
141 const TDesC& CMPXM3uPlaylistPlugin::FileExtension() const |
|
142 { |
|
143 return KMPXM3UExtension(); |
|
144 } |
|
145 |
|
146 // ---------------------------------------------------------------------------- |
|
147 // cancel a client request |
|
148 // ---------------------------------------------------------------------------- |
|
149 void CMPXM3uPlaylistPlugin::Cancel() |
|
150 { |
|
151 if ( iImporter ) |
|
152 { |
|
153 iImporter->Cancel(); |
|
154 } |
|
155 |
|
156 if ( iExporter ) |
|
157 { |
|
158 iExporter->Cancel(); |
|
159 } |
|
160 } |
|
161 |
|
162 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
163 // ---------------------------------------------------------------------------- |
|
164 // The list of implementations |
|
165 // ---------------------------------------------------------------------------- |
|
166 const TImplementationProxy ImplementationTable[] = |
|
167 { IMPLEMENTATION_PROXY_ENTRY(KMPXM3uPlaylistImplUid, CMPXM3uPlaylistPlugin::NewL) }; |
|
168 |
|
169 // ---------------------------------------------------------------------------- |
|
170 // The proxy of implementations |
|
171 // ---------------------------------------------------------------------------- |
|
172 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
173 { |
|
174 aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy); |
|
175 return ImplementationTable; |
|
176 } |
|
177 |
|
178 // End of file |