|
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: Definition of the ClientFileSource class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CCLIENTFILESOURCE_H |
|
20 #define C_CCLIENTFILESOURCE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <FileSource.h> |
|
24 #include <mmfcontrollerframework.h> |
|
25 |
|
26 #include "SourceBase.h" |
|
27 #include "AsyncAO.h" |
|
28 #include "FileDataSourceCommon.h" |
|
29 |
|
30 class MCustomCommand; |
|
31 |
|
32 namespace multimedia |
|
33 { |
|
34 class CEventNotifier; |
|
35 |
|
36 |
|
37 /** |
|
38 * Implements the ClientSide Source for the File Source. |
|
39 * Provides functionality to the Clients to query attributes |
|
40 * from the ServerSide source |
|
41 * @lib EnhancedMediaClient.lib |
|
42 * @since S60 v3.2 |
|
43 */ |
|
44 class CClientFileSource : public CSourceBase, |
|
45 public MFileSource, |
|
46 public MAsyncAOObserver |
|
47 { |
|
48 public: |
|
49 /** |
|
50 * Function to Create the Object. |
|
51 */ |
|
52 CClientFileSource(); |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 ~CClientFileSource(); |
|
57 |
|
58 /** |
|
59 * Post Contructor. This is to Support the new type of Construction |
|
60 * of the Object. Notice there is no Two phased Constructor in this class |
|
61 */ |
|
62 TInt PostConstructor(); |
|
63 |
|
64 // From MControl begins |
|
65 /** |
|
66 * From MControl. |
|
67 * Adds the Observer to this Object |
|
68 * @since S60 v3.2 |
|
69 * @param aObserver Client which set the Observer. |
|
70 */ |
|
71 TInt AddObserver( MControlObserver& aObserver ); |
|
72 /** |
|
73 * From MControl. |
|
74 * Removes the Observer to this Object |
|
75 * @since S60 v3.2 |
|
76 * @param aObserver Client which set the Observer. |
|
77 */ |
|
78 TInt RemoveObserver( MControlObserver& aObserver ); |
|
79 /** |
|
80 * From MControl. |
|
81 * Returns the Type of this Object. |
|
82 * request and that it is now outstanding |
|
83 * @since S60 v3.2 |
|
84 */ |
|
85 TUid Type(); |
|
86 /** |
|
87 * From MControl. |
|
88 * Returns the Control Type of this Object. |
|
89 * |
|
90 * @since S60 v3.2 |
|
91 */ |
|
92 TControlType ControlType(); |
|
93 // From MControl ends |
|
94 |
|
95 // From MSourceControl begins |
|
96 /** |
|
97 * From MSourceControl. |
|
98 * Returns the Size in Bytes of the Source. |
|
99 * Since this is File Source, the size represents |
|
100 * the file size which will be passed by the Client |
|
101 * to the Source |
|
102 * @since S60 v3.2 |
|
103 * @param aSize Size returned by the Source. |
|
104 */ |
|
105 TInt GetSize( TUint& aSize ); |
|
106 /** |
|
107 * From MSourceControl. |
|
108 * Returns the Mime Type of the Data for which |
|
109 * the Source is initialized. |
|
110 * @since S60 v3.2 |
|
111 * @param aMimeType MimeType returned by the Source. |
|
112 */ |
|
113 TInt GetMimeType( TDes8& aMimeType ); |
|
114 /** |
|
115 * From MSourceControl. |
|
116 * Closes the Source. |
|
117 * |
|
118 * @since S60 v3.2 |
|
119 */ |
|
120 TInt Close(); |
|
121 // From MSourceControl ends |
|
122 |
|
123 // From MFileSource begins |
|
124 /** |
|
125 * From MFileSource. |
|
126 * Opens the Source with the mimetype and HeaderData |
|
127 * |
|
128 * @since S60 v3.2 |
|
129 * @param aFileName FileName to be Opened by the Source |
|
130 * @param aMimeType MimeType used to Configure the Source. |
|
131 */ |
|
132 TInt Open(TDesC& aFileName, TDesC8& aMimeType ); |
|
133 /** |
|
134 * From MFileSource. |
|
135 * Returns the BitRate of the Source |
|
136 * the Source is initialized. |
|
137 * |
|
138 * @since S60 v3.2 |
|
139 * @param aRate Returns the BitRate of the Source. |
|
140 */ |
|
141 TInt GetBitRate( TUint& aRate ); |
|
142 /** |
|
143 * From MFileSource. |
|
144 * Returns the FileName associated with the Source |
|
145 * This value is set by the Client when it calls Open(). |
|
146 * |
|
147 * @since S60 v3.2 |
|
148 * @param aFileName FileName to be Opened by the Source |
|
149 */ |
|
150 TInt GetFileName(TPtr& aFileName); |
|
151 // From MFileSource ends |
|
152 |
|
153 // From CSourceBase begins |
|
154 /** |
|
155 * From CSourceBase. |
|
156 * Callback from the StreamControl when the Source is Created |
|
157 * |
|
158 * @since S60 v3.2 |
|
159 * @param aCustomCommand Custom Command handle to send message to the Source |
|
160 * @param aSourceHandle Handle Identifying the Source |
|
161 */ |
|
162 void ServerSourceCreated( MCustomCommand& aCustomCommand, |
|
163 TMMFMessageDestination& aSourceHandle ); |
|
164 /** |
|
165 * From CSourceBase. |
|
166 * Callback from the StreamControl when the ServerSource is Deleted |
|
167 * |
|
168 * @since S60 v3.2 |
|
169 */ |
|
170 void ServerSourceDeleted(); |
|
171 /** |
|
172 * From CSourceBase. |
|
173 * Returns the Content Protection information to the Stream Control |
|
174 * Currently returns KErrNotSupported |
|
175 * @since S60 v3.2 |
|
176 */ |
|
177 TBool IsEncrypted(); |
|
178 /** |
|
179 * From CSourceBase. |
|
180 * Returns the SourceUID |
|
181 * |
|
182 * @since S60 v3.2 |
|
183 */ |
|
184 TUid GetSourceUid(); |
|
185 /** |
|
186 * From CSourceBase. |
|
187 * Returns the Header Data passed when the Client calls Open |
|
188 * Currently return KErrNotSupported |
|
189 * @since S60 v3.2 |
|
190 */ |
|
191 TInt GetHeaderData(TPtr& aPtr); |
|
192 // From CSourceBase ends |
|
193 |
|
194 // From MAsyncAOObserver begins |
|
195 /** |
|
196 * From MAsyncAOObserver. |
|
197 * Callback from the Source for the Events from the Source Side |
|
198 * @since S60 v3.2 |
|
199 * @param aError Error Code from the ServerSide Source. |
|
200 */ |
|
201 void Event( TInt aError ); |
|
202 // From MAsyncAOObserver ends |
|
203 private: |
|
204 void DoBitRateChanged( TUint aBitRate ); |
|
205 private: |
|
206 // Variable to Hold the Mime Type sent by the Client |
|
207 HBufC8* iMimeType; |
|
208 // Variable to Hold the FileName sent by the Client |
|
209 HBufC* iFileName; |
|
210 // BitRate from the Source Side |
|
211 TUint iBitRate; |
|
212 // FileSize from the Source Side |
|
213 TUint iFileSize; |
|
214 // Variable to determine if the ServerSource exists |
|
215 TBool iServerSourceExists; |
|
216 // Handle to send messages to the Server Side Source |
|
217 MCustomCommand* iCustomCommand; |
|
218 // Handle Identifying the Server Side Source |
|
219 TMMFMessageDestination iSourceHandle; |
|
220 // Server Side Source State |
|
221 CMultimediaDataSource::TState iState; |
|
222 // Event Notifier that notifies the Client |
|
223 CEventNotifier* iEventNotifier; |
|
224 // Active Object to get Events from the Server Side Source |
|
225 CAsyncAO* iAsyncEventAO; |
|
226 // Event Package sent to the Server Side. |
|
227 TFileDataSourceEventPckgBuf iEventPckg; |
|
228 }; |
|
229 } // namespace multimedia |
|
230 |
|
231 #endif // C_CCLIENTFILESOURCE_H |
|
232 |
|
233 // End of file |