|
1 /* |
|
2 * Copyright (c) 2004-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CDATASOURCEPROXY_H |
|
20 #define CDATASOURCEPROXY_H |
|
21 NONSHARABLE_CLASS( CPVCameraSourceNodeProxy ) : public CBase, |
|
22 public MAsyncEventHandler, |
|
23 public MVTVideoSink |
|
24 { |
|
25 public: //From MAsyncEventHandler |
|
26 /** |
|
27 * Send event to client. |
|
28 * @param aEvent |
|
29 */ |
|
30 virtual TInt SendEventToClient(const TMMFEvent &aEvent); |
|
31 public: //From MVTVideoSink |
|
32 |
|
33 /** |
|
34 * Method called by a data source to pass back an filled buffer to the sink. |
|
35 * |
|
36 * This is a pure virtual function that each derived class must implement. |
|
37 * This method is used as the callback when the data sink actively requests a supplier ie a data source |
|
38 * to fill a buffer by calling the data sources FillBufferL. |
|
39 * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied |
|
40 * |
|
41 * @param "aBuffer" |
|
42 * The buffer that has been filled by a data source and is now available for processing |
|
43 */ |
|
44 void BufferFilledL(CMMFBuffer* aBuffer); |
|
45 |
|
46 public: //New |
|
47 /** |
|
48 * Constructor. |
|
49 */ |
|
50 CPVCameraSourceNodeProxy(); |
|
51 |
|
52 /** |
|
53 * Set consumer object. |
|
54 * @param aConsumer new object |
|
55 */ |
|
56 void SetConsumer(MPVDataSinkBase* aConsumer); |
|
57 private: |
|
58 MPVDataSinkBase* iConsumer; |
|
59 }; |
|
60 |
|
61 NONSHARABLE_CLASS( CVideoSourceProxy ) : public CBase, |
|
62 public MPVDataSource, |
|
63 public MPVVideoInput |
|
64 { |
|
65 public: //From MPVPluginBase |
|
66 |
|
67 /** |
|
68 * This API returns multimedias type supported by the data source/sink - |
|
69 * Audio, Video, Data etc. Each supported type is indicated by a MIME type structure. |
|
70 * @return Multimedia types supported by the data source/sink. The reference |
|
71 * is valid until the MPVPluginBase derived object is destroyed. |
|
72 **/ |
|
73 virtual const RArray<TPVMIMEType *>& GetMultimediaTypesL() const; |
|
74 |
|
75 /** |
|
76 * This API is to allow for extensibility of the plugin interface. |
|
77 * It allows a caller to ask for all UUIDs associated with a particular MIME type. |
|
78 * If interfaces of the requested MIME type are found within the plugin, they are added |
|
79 * to the UUIDs array. |
|
80 * |
|
81 * Also added to the UUIDs array will be all interfaces which have the requested MIME |
|
82 * type as a base MIME type. This functionality can be turned off. |
|
83 * |
|
84 * @param aMimeType The MIME type of the desired interfaces |
|
85 * @param aUuids An array to hold the discovered UUIDs |
|
86 * @param aExactUuidsOnly Turns on/off the retrival of UUIDs with aMimeType as a base type |
|
87 **/ |
|
88 virtual void QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly = false ); |
|
89 |
|
90 /** |
|
91 * This API is to allow for extensibility of the plugin interface. |
|
92 * It allows a caller to ask for an instance of a particular interface object to be returned. |
|
93 * The mechanism is analogous to the COM IUnknown method. The interfaces are identified with |
|
94 * an interface ID that is a UUID as in DCE and a pointer to the interface object is |
|
95 * returned if it is supported. Otherwise the returned pointer is NULL. |
|
96 * @param aUuid The UUID of the desired interface |
|
97 * @param aInterfacePtr The output pointer to the desired interface |
|
98 **/ |
|
99 virtual void QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr ); |
|
100 |
|
101 /** |
|
102 * This API is used to provide a timebase for plugins that deal with synchronized media data |
|
103 **/ |
|
104 virtual void SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase); |
|
105 public: //From MPVDataSourceBase |
|
106 |
|
107 /** |
|
108 * Method called by a MDataSink to request the data source to fill aBuffer with data. |
|
109 * |
|
110 * This is a pure virtual function that each derived class must implement. |
|
111 * This method is used when a data source is passively waiting for requests from a consumer ie a data sink |
|
112 * to fill a buffer. The data source must call the BufferFilledL member on aConsumer when it has filled |
|
113 * the buffer with data - the data source can either make this callback synchronously or asynchronously. |
|
114 * |
|
115 * @param "aBuffer" |
|
116 * The buffer that needs filling with data |
|
117 * |
|
118 * @param "aConsumer" |
|
119 * The data sink that consumes the data. The data source needs this to make the BufferFilledL |
|
120 * callback on aConsumer when the data source has completed filling the aBuffer. |
|
121 * |
|
122 * @param "aMediaId" |
|
123 * This identifies the type of media eg audio or video and the stream id. |
|
124 * This parameter is required in cases where the source can supply data |
|
125 * of more than one media type and/or multiple strams of data eg a multimedia file |
|
126 */ |
|
127 virtual void FillBufferL(CMMFBuffer* aBuffer, MPVDataSinkBase* aConsumer, TMediaId /*aMediaId*/); |
|
128 |
|
129 /** |
|
130 * Returns a buffer created by the data source. |
|
131 * |
|
132 * This is a pure virtual function that each derived class must implement. |
|
133 * |
|
134 * @param "aMediaId" |
|
135 * This identifies the type of media eg audio or video and the stream id. |
|
136 * This parameter is required in cases where the source can supply data |
|
137 * of more than one media type and/or multiple strams of data eg a multimedia file |
|
138 * |
|
139 * @param "aReference" |
|
140 * This must be written to by the method to indicate whether the created buffer is |
|
141 * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source |
|
142 * and should be used in preference to the sink buffer provided the sink buffer |
|
143 * is also not a reference buffer |
|
144 * . |
|
145 * @return The created buffer |
|
146 */ |
|
147 virtual CMMFBuffer *CreateSourceBufferL(TMediaId aMediaId, TBool &aReference); |
|
148 |
|
149 /** |
|
150 * Returns a buffer created by the data source. |
|
151 * |
|
152 * This is a virtual function that a derived class can implement. |
|
153 * This can be used in preference to the above CreateSourceBufferL method in cases where |
|
154 * the source buffer creation has a dependancy on the sink buffer |
|
155 * |
|
156 * @param "aMediaId" |
|
157 * This identifies the type of media eg audio or video and the stream id. |
|
158 * This parameter is required in cases where the source can supply data |
|
159 * of more than one media type and/or multiple strams of data eg a multimedia file |
|
160 * |
|
161 * @param "aSinkBuffer" |
|
162 * The sink buffer the nature of which may influence the creation of the source buffer |
|
163 * |
|
164 * @param "aReference" |
|
165 * This must be written to by the method to indicate whether the created buffer is |
|
166 * a 'reference' buffer. A 'reference' buffer is a buffer that is owned by the source |
|
167 * and should be used in preference to the sink buffer provided the sink buffer is not a reference buffer |
|
168 * . |
|
169 * @return The created buffer |
|
170 */ |
|
171 virtual CMMFBuffer *CreateSourceBufferL(TMediaId aMediaId, CMMFBuffer &aSinkBuffer, TBool &aReference); |
|
172 |
|
173 /** |
|
174 * Method to 'logon' the data source to the same thread that source will be supplying data in. |
|
175 * |
|
176 * This method may be required as the thread that the data source was created in is not always |
|
177 * the same thread that the data transfer will take place in. Therefore any thread specific |
|
178 * initialisation needs to be performed in the SourceThreadLogon rather than in the creation |
|
179 * of the data source. |
|
180 * |
|
181 * This is a virtual function that a derrived data source can implement if any thread specific |
|
182 * initialisation is required and/or the data source can create any asynchronous events. |
|
183 * |
|
184 * |
|
185 * @param "aEventHandler" |
|
186 * This is an MAsyncEventHandler to handle asynchronous events that occur during the |
|
187 * transfer of multimedia data. The event handler must be in the same thread as the data transfer |
|
188 * thread - hence the reason it is passed in the SourceThreadLogon as opposed to say the constructor. |
|
189 * |
|
190 * |
|
191 * @return KErrNone if successful, otherwise a system wide error code. |
|
192 */ |
|
193 virtual TInt SourceThreadLogon( MAsyncEventHandler& aEventHandler ); |
|
194 |
|
195 /** |
|
196 * Method to 'logoff' the data source from the same thread that source supplies data in. |
|
197 * |
|
198 * This method may be required as the thread that the data source is deleted in may not be |
|
199 * the same thread that the data transfer took place in. Therefore any thread specific |
|
200 * releasing of resources needs to be performed in the SourceThreadLogoff rather than in the destructor |
|
201 * |
|
202 * This is a virtual function that a derrived data source can implement if any thread specific |
|
203 * releasing of resources is required. |
|
204 */ |
|
205 virtual void SourceThreadLogoff(); |
|
206 |
|
207 /** |
|
208 * Method to 'prime' the data source. |
|
209 * |
|
210 * This is a virtual function that a derrived data source can implement if |
|
211 * any data source specific 'priming' is required |
|
212 */ |
|
213 virtual TInt SourcePrimeL(); |
|
214 |
|
215 /** |
|
216 * Method to 'play' the data source. |
|
217 * |
|
218 * This is a virtual function that a derrived data source can implement if |
|
219 * any data source specific action is required prior to 'playing'ie the start of data transfer |
|
220 */ |
|
221 virtual TInt SourcePlayL(); |
|
222 |
|
223 /** |
|
224 * Method to 'pause' the data source. |
|
225 * |
|
226 * This is a virtual function that a derrived data source can implement if |
|
227 * any data source specific action is required to 'pause' |
|
228 */ |
|
229 virtual TInt SourcePauseL(); |
|
230 |
|
231 /** |
|
232 * Method to 'stop' the data source. |
|
233 * |
|
234 * This is a virtual function that a derrived data source can implement if |
|
235 * any data source specific action is required to 'stop' |
|
236 */ |
|
237 virtual TInt SourceStopL(); |
|
238 |
|
239 /** |
|
240 * Method called by a data sink to pass back an emptied buffer to the source |
|
241 * |
|
242 * This is a pure virtual function that each derived class must implement. |
|
243 * This method is used as the callback when the data source actively requests a consumer ie a data sink |
|
244 * to empty a buffer by calling the data sinks EmptyBufferL. |
|
245 * When the data source gets this callback it knows that the buffer has been emptied and can be reused |
|
246 * |
|
247 * @param "aBuffer" |
|
248 * The buffer that has been emptied by a data sink and is now available for reuse |
|
249 */ |
|
250 virtual void BufferEmptiedL(CMMFBuffer* aBuffer); |
|
251 |
|
252 /** |
|
253 * Method to indicate whether the data source can create a buffer. |
|
254 * |
|
255 * This is a pure virtual function that each derived class must implement. |
|
256 * |
|
257 * @return ETrue if the data source can create a buffer else EFalse |
|
258 */ |
|
259 virtual TBool CanCreateSourceBuffer(); |
|
260 public: //From MPVVideoInput |
|
261 |
|
262 /** |
|
263 * Set the video frame format. This must be from the list of supported formats. |
|
264 * @param "aFormat" The mime string describing the video frame format. |
|
265 * @exception Can leave with one of the system wide error codes |
|
266 */ |
|
267 virtual void SetFormatL(const TDesC8& aFormat); |
|
268 |
|
269 /** |
|
270 * Set the video frame rate. This must be within the range of supported frame rates |
|
271 * for the current frame size. |
|
272 * @param "aFrameRate" The video frame rate to set. |
|
273 * @exception Can leave with one of the system wide error codes |
|
274 */ |
|
275 virtual void SetFrameRateL(TReal32 aFrameRate); |
|
276 |
|
277 /** |
|
278 * Set the video frame size. |
|
279 * @param "aSize" The video frame size, in pixels |
|
280 * @exception Can leave with one of the system wide error codes |
|
281 */ |
|
282 virtual void SetVideoFrameSizeL(const TSize& aSize); |
|
283 |
|
284 /** |
|
285 * Get the video frame size. |
|
286 * @param "aSize" The video frame size, in pixels |
|
287 * @exception Can leave with one of the system wide error codes |
|
288 */ |
|
289 virtual void GetVideoFrameSizeL(TSize& aSize) const; |
|
290 public: //new |
|
291 /** |
|
292 * Constructor. |
|
293 */ |
|
294 CVideoSourceProxy(MVTVideoSource* aVideoSource); |
|
295 /** |
|
296 * ConstructL. |
|
297 */ |
|
298 void ConstructL( ); |
|
299 |
|
300 /** |
|
301 * NewL. |
|
302 */ |
|
303 static CVideoSourceProxy* NewL(MVTVideoSource* aVideoSource); |
|
304 |
|
305 /** |
|
306 * Get member variant. |
|
307 * @return memeber variant:iVideoSource |
|
308 */ |
|
309 MVTVideoSource* VideoSource() { return iVideoSource; } |
|
310 private: |
|
311 MVTVideoSource* iVideoSource; |
|
312 CPVCameraSourceNodeProxy* iCameraSourceNodeProxy; |
|
313 }; |
|
314 |
|
315 NONSHARABLE_CLASS( CAudioSourceProxy ) : public CBase, |
|
316 public MVTAudioSource |
|
317 { |
|
318 public: |
|
319 MPVDataSource* iAudioSource; |
|
320 }; |
|
321 #endif |
|
322 // End of File |