williamr@2
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __MMF_SERVER_FORMAT_H__
|
williamr@2
|
17 |
#define __MMF_SERVER_FORMAT_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <mmf/server/mmfdatasink.h>
|
williamr@2
|
20 |
#include <mmf/server/mmfdatasource.h>
|
williamr@2
|
21 |
#include <ecom/ecom.h>
|
williamr@2
|
22 |
#include <mmfplugininterfaceuids.hrh>
|
williamr@2
|
23 |
|
williamr@2
|
24 |
const TUint KMMFFormatDefaultFrameSize = 0x1000; //4K
|
williamr@2
|
25 |
|
williamr@2
|
26 |
/**
|
williamr@2
|
27 |
@publishedAll
|
williamr@2
|
28 |
@released
|
williamr@2
|
29 |
|
williamr@2
|
30 |
Base class from which source formats can be derived from. The intended usage is for controllers that can support more
|
williamr@2
|
31 |
than one type of format. The class is an MDataSource as far as the data path is concerned but is an MDataSink to the clip
|
williamr@2
|
32 |
that is the source of the actual data.
|
williamr@2
|
33 |
|
williamr@2
|
34 |
All CMMFFormatDecode plugin DLLs must include interface_uid = KMmfUidPluginInterfaceFormatDecode in their .rss files.
|
williamr@2
|
35 |
*/
|
williamr@2
|
36 |
class CMMFFormatDecode : public CBase, public MDataSource, public MDataSink
|
williamr@2
|
37 |
{
|
williamr@2
|
38 |
public:
|
williamr@2
|
39 |
// ECOM creation.
|
williamr@2
|
40 |
IMPORT_C static CMMFFormatDecode* NewL( TUid aUid, MDataSource* aSource );
|
williamr@2
|
41 |
|
williamr@2
|
42 |
IMPORT_C static CMMFFormatDecode* NewL( const TDesC& aFileName, MDataSource* aSource, const TDesC& aPreferredSupplier ) ;
|
williamr@2
|
43 |
IMPORT_C static CMMFFormatDecode* NewL( const TDesC8& aSourceHeader, MDataSource* aSource, const TDesC& aPreferredSupplier ) ;
|
williamr@2
|
44 |
IMPORT_C static CMMFFormatDecode* NewL( MDataSource* aSource, const TDesC& aPreferredSupplier ) ;
|
williamr@2
|
45 |
|
williamr@2
|
46 |
IMPORT_C static CMMFFormatDecode* NewL( const TDesC& aFileName, MDataSource* aSource, const TDesC& aPreferredSupplier, TBool& aSupportsCustomInterfaces ) ;
|
williamr@2
|
47 |
IMPORT_C static CMMFFormatDecode* NewL( const TDesC8& aSourceHeader, MDataSource* aSource, const TDesC& aPreferredSupplier, TBool& aSupportsCustomInterfaces ) ;
|
williamr@2
|
48 |
IMPORT_C static CMMFFormatDecode* NewL( MDataSource* aSource, const TDesC& aPreferredSupplier, TBool& aSupportsCustomInterfaces ) ;
|
williamr@2
|
49 |
|
williamr@2
|
50 |
/**
|
williamr@2
|
51 |
Destructor.
|
williamr@2
|
52 |
*/
|
williamr@2
|
53 |
virtual ~CMMFFormatDecode() {REComSession::DestroyedImplementation(iDtor_ID_Key);};
|
williamr@2
|
54 |
|
williamr@2
|
55 |
/**
|
williamr@2
|
56 |
Returns the ECom plugin UID of this format.
|
williamr@2
|
57 |
|
williamr@2
|
58 |
@return The plugin UID.
|
williamr@2
|
59 |
*/
|
williamr@2
|
60 |
TUid ImplementationUid() const {return iImplementationUid;}
|
williamr@2
|
61 |
|
williamr@2
|
62 |
/**
|
williamr@2
|
63 |
Gets the number of streams of the specified media type.
|
williamr@2
|
64 |
|
williamr@2
|
65 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
66 |
|
williamr@2
|
67 |
@param aMediaType
|
williamr@2
|
68 |
The UID of the media type, for example KUidMediaTypeAudio or KUidMediaTypeVideo.
|
williamr@2
|
69 |
|
williamr@2
|
70 |
@return The number of streams of multimedia data in the format for the specified media type.
|
williamr@2
|
71 |
For example, for a WAV or mp3 audio file this procedure would return 1 for a media
|
williamr@2
|
72 |
type of audio and 0 for a media type of video. More complex multimedia formats (for
|
williamr@2
|
73 |
example AVI and mp4) can support multiple streams of both video and audio.
|
williamr@2
|
74 |
*/
|
williamr@2
|
75 |
virtual TUint Streams(TUid aMediaType) const = 0;
|
williamr@2
|
76 |
|
williamr@2
|
77 |
/**
|
williamr@2
|
78 |
Returns the time interval for one frame for the specified media type.
|
williamr@2
|
79 |
|
williamr@2
|
80 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
81 |
|
williamr@2
|
82 |
In the case of video, a frame would usually be one frame of video. In the case of
|
williamr@2
|
83 |
audio, a frame may correspond to a frame of audio, if the particular audio data type
|
williamr@2
|
84 |
is framed eg mp3. There are two definitions of a frame. A format frame, which may
|
williamr@2
|
85 |
consist of several frames of a particular framed audio data type. This may be the case,
|
williamr@2
|
86 |
for example for GSM610 (a low quality audio data type used in telephony) where a frame
|
williamr@2
|
87 |
is only 65 bytes large. In this case a format frame consists of several GSM610 data type
|
williamr@2
|
88 |
frames as passing the data out 65 bytes at a time would be inefficient. In the case of
|
williamr@2
|
89 |
non-framed data such as pcm, a frame can be an arbitrary size determined by the format plugin.
|
williamr@2
|
90 |
|
williamr@2
|
91 |
@param aMediaType
|
williamr@2
|
92 |
The media type id.
|
williamr@2
|
93 |
|
williamr@2
|
94 |
@return The frame time interval
|
williamr@2
|
95 |
*/
|
williamr@2
|
96 |
virtual TTimeIntervalMicroSeconds FrameTimeInterval(TMediaId aMediaType) const = 0;
|
williamr@2
|
97 |
|
williamr@2
|
98 |
|
williamr@2
|
99 |
/**
|
williamr@2
|
100 |
Returns the duration of the clip for the specified media type.
|
williamr@2
|
101 |
|
williamr@2
|
102 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
103 |
|
williamr@2
|
104 |
@param aMediaType
|
williamr@2
|
105 |
The media type ID.
|
williamr@2
|
106 |
|
williamr@2
|
107 |
@return The duration of the clip.
|
williamr@2
|
108 |
*/
|
williamr@2
|
109 |
virtual TTimeIntervalMicroSeconds Duration(TMediaId aMediaType) const = 0;
|
williamr@2
|
110 |
|
williamr@2
|
111 |
/**
|
williamr@2
|
112 |
Request from CMMFDataPath to fill the specified buffer.
|
williamr@2
|
113 |
The CMMFFormat needs to break this down into one or more reads from the clip
|
williamr@2
|
114 |
(from MDataSource - CMMFFormatDecode is a MDataSource to a CMMFDataPath consumer).
|
williamr@2
|
115 |
|
williamr@2
|
116 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
117 |
|
williamr@2
|
118 |
This method is the means by which data is obtained from the data source. aBuffer is
|
williamr@2
|
119 |
the buffer that needs filling from the source data stream as identified by aMediaId. The
|
williamr@2
|
120 |
format should read the frame number of the buffer via the buffer's CMMFBuffer::FrameNumber()
|
williamr@2
|
121 |
method. From this the format should be able to determine the actual position of the data on
|
williamr@2
|
122 |
the data source. The technique here depends on the nature of the format. For a linear audio
|
williamr@2
|
123 |
format, the position can be obtained by a simple calculation of the frame size, the header size
|
williamr@2
|
124 |
and where appropriate the datatype.
|
williamr@2
|
125 |
|
williamr@2
|
126 |
For non-linear formats either an index table of frame number and location will need to be
|
williamr@2
|
127 |
created in the NewL() or some form of approximating algorithm will be required. Some formats have
|
williamr@2
|
128 |
an index table as part of the format e.g. AVI. If no random access is required then no index table
|
williamr@2
|
129 |
is required, the format can keep track of the current read position and increment it on each access,
|
williamr@2
|
130 |
and reset it if the frame number is reset to 0 or 1. Given that for non-linear i.e. variable bit rate
|
williamr@2
|
131 |
formats, the size of the data read may vary from frame to frame, then the format should either set
|
williamr@2
|
132 |
the request size of the buffer for the required frame or call the source's ReadBufferL() (either
|
williamr@2
|
133 |
CMMFClip::ReadBufferL(), CMMFDescriptor ::ReadBufferL() or CMMFFile::ReadBufferL()) function that
|
williamr@2
|
134 |
takes the aLength parameter.
|
williamr@2
|
135 |
|
williamr@2
|
136 |
It is the responsibility of the format decode to determine the size and position of the source data
|
williamr@2
|
137 |
for each frame. For linear audio formats, the format decode should fill the buffer up to its maximum
|
williamr@2
|
138 |
length. For multimedia formats e.g. mp4, AVI etc, the format decode is effectively acting as a demultiplexor,
|
williamr@2
|
139 |
and must obtain the appropriate data from the source depending on the aMediaId.
|
williamr@2
|
140 |
|
williamr@2
|
141 |
@param aBuffer
|
williamr@2
|
142 |
The buffer to fill.
|
williamr@2
|
143 |
@param aConsumer
|
williamr@2
|
144 |
The consumer.
|
williamr@2
|
145 |
@param aMediaId
|
williamr@2
|
146 |
The media type ID.
|
williamr@2
|
147 |
*/
|
williamr@2
|
148 |
virtual void FillBufferL(CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId)=0;
|
williamr@2
|
149 |
|
williamr@2
|
150 |
/**
|
williamr@2
|
151 |
@internalAll
|
williamr@2
|
152 |
|
williamr@2
|
153 |
Indicates data has been added to the file.
|
williamr@2
|
154 |
|
williamr@2
|
155 |
@param aBuffer
|
williamr@2
|
156 |
The emptied buffer.
|
williamr@2
|
157 |
*/
|
williamr@2
|
158 |
inline virtual void BufferEmptiedL(CMMFBuffer* aBuffer);
|
williamr@2
|
159 |
|
williamr@2
|
160 |
/**
|
williamr@2
|
161 |
Tests whether a source buffer can be created.
|
williamr@2
|
162 |
|
williamr@2
|
163 |
The format knows what type of source buffer it requires so default returns ETrue.
|
williamr@2
|
164 |
It doesn't usually need to set the size of this buffer.
|
williamr@2
|
165 |
|
williamr@2
|
166 |
@return A boolean indicating whether a buffer can be created. ETrue if the buffer can be created,
|
williamr@2
|
167 |
EFalse otherwise.
|
williamr@2
|
168 |
*/
|
williamr@2
|
169 |
virtual TBool CanCreateSourceBuffer() {return ETrue;}
|
williamr@2
|
170 |
|
williamr@2
|
171 |
/**
|
williamr@2
|
172 |
Creates a source buffer.
|
williamr@2
|
173 |
|
williamr@2
|
174 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
175 |
|
williamr@2
|
176 |
This function should create a buffer of length 0, the maximum length should be equal to the maximum
|
williamr@2
|
177 |
possible frame size. In the case of non framed data it should be set to an arbitrary size, which is
|
williamr@2
|
178 |
effectively a trade off between being too small which will affect performance as more source reads
|
williamr@2
|
179 |
are required, and being too large which will give very coarse positioning granularity. For pcm data,
|
williamr@2
|
180 |
a buffer size of 4K is a good compromise. The same compromise also applies when deciding to put multiple
|
williamr@2
|
181 |
audio frames into one format frame. The sink buffer size may also effect the format buffer size and
|
williamr@2
|
182 |
the controller may use this to suggest a buffer size to the format by calling the format's SuggestSourceBufferSize()
|
williamr@2
|
183 |
method. Alternatively the MDataSource::CreateSourceBufferL() function that takes the additional aSinkBuffer
|
williamr@2
|
184 |
parameter may also be used when deciding the source buffer maximum size of the created source buffer.
|
williamr@2
|
185 |
|
williamr@2
|
186 |
@param aMediaId
|
williamr@2
|
187 |
The media type ID.
|
williamr@2
|
188 |
@param aReference
|
williamr@2
|
189 |
If ETrue the MDataSource owns the buffer. If EFalse, then the caller owns the buffer. This
|
williamr@2
|
190 |
should normally be set to EFalse as format plugins do not create the reference buffer.
|
williamr@2
|
191 |
|
williamr@2
|
192 |
@return The created source buffer.
|
williamr@2
|
193 |
*/
|
williamr@2
|
194 |
virtual CMMFBuffer* CreateSourceBufferL(TMediaId aMediaId, TBool &aReference)=0;
|
williamr@2
|
195 |
|
williamr@2
|
196 |
/**
|
williamr@2
|
197 |
Returns the source data type code for the specified media type ID.
|
williamr@2
|
198 |
|
williamr@2
|
199 |
Used by the CMMFDataPath for codec matching.
|
williamr@2
|
200 |
|
williamr@2
|
201 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
202 |
|
williamr@2
|
203 |
@param aMediaId
|
williamr@2
|
204 |
The media type ID.
|
williamr@2
|
205 |
|
williamr@2
|
206 |
@return The source data type code.
|
williamr@2
|
207 |
*/
|
williamr@2
|
208 |
virtual TFourCC SourceDataTypeCode(TMediaId aMediaId)=0;
|
williamr@2
|
209 |
|
williamr@2
|
210 |
/**
|
williamr@2
|
211 |
@internalAll
|
williamr@2
|
212 |
|
williamr@2
|
213 |
Adds a buffer to a clip.
|
williamr@2
|
214 |
|
williamr@2
|
215 |
@param aBuffer
|
williamr@2
|
216 |
The buffer to which the clip is added.
|
williamr@2
|
217 |
@param aSupplier
|
williamr@2
|
218 |
The data source.
|
williamr@2
|
219 |
@param aMediaId
|
williamr@2
|
220 |
The Media ID.
|
williamr@2
|
221 |
*/
|
williamr@2
|
222 |
inline virtual void EmptyBufferL(CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId aMediaId);
|
williamr@2
|
223 |
|
williamr@2
|
224 |
/**
|
williamr@2
|
225 |
Indicates the data source has filled the buffer.
|
williamr@2
|
226 |
|
williamr@2
|
227 |
Called by the CMMFFormat's MDataSource when it has filled the buffer.
|
williamr@2
|
228 |
The default implementation below would need overriding in cases where multiple
|
williamr@2
|
229 |
clip reads were required to fill the buffer from the data path.
|
williamr@2
|
230 |
|
williamr@2
|
231 |
@param aBuffer
|
williamr@2
|
232 |
The buffer to which the clip is added.
|
williamr@2
|
233 |
*/
|
williamr@2
|
234 |
virtual void BufferFilledL(CMMFBuffer* aBuffer) {iDataPath->BufferFilledL(aBuffer);}
|
williamr@2
|
235 |
|
williamr@2
|
236 |
/**
|
williamr@2
|
237 |
Tests whether a sink buffer can be created.
|
williamr@2
|
238 |
|
williamr@2
|
239 |
Format would normally pass its own buffer onto the CMMFClip, so
|
williamr@2
|
240 |
this may not be required. The default returns EFalse.
|
williamr@2
|
241 |
|
williamr@2
|
242 |
@return A boolean indicating if the sink buffer can be created. ETrue if buffer can be created, EFalse otherwise.
|
williamr@2
|
243 |
*/
|
williamr@2
|
244 |
virtual TBool CanCreateSinkBuffer() {return EFalse;}
|
williamr@2
|
245 |
|
williamr@2
|
246 |
/**
|
williamr@2
|
247 |
Creates a sink buffer for the specified media ID. The default version returns NULL.
|
williamr@2
|
248 |
|
williamr@2
|
249 |
@param aMediaId
|
williamr@2
|
250 |
The media type ID.
|
williamr@2
|
251 |
@param aReference
|
williamr@2
|
252 |
If ETrue the MDataSink owns the buffer.
|
williamr@2
|
253 |
If EFalse, then the caller owns the buffer.
|
williamr@2
|
254 |
@return The CMMFBuffer sink buffer.
|
williamr@2
|
255 |
*/
|
williamr@2
|
256 |
inline virtual CMMFBuffer* CreateSinkBufferL(TMediaId aMediaId, TBool &aReference);
|
williamr@2
|
257 |
|
williamr@2
|
258 |
/**
|
williamr@2
|
259 |
Returns the sink data type code for the specified media type ID.
|
williamr@2
|
260 |
This would be the same as the source data type four CC although
|
williamr@2
|
261 |
the clip is not going to need this info.
|
williamr@2
|
262 |
|
williamr@2
|
263 |
@param aMediaId
|
williamr@2
|
264 |
The media type id.
|
williamr@2
|
265 |
|
williamr@2
|
266 |
@return The sink data type code.
|
williamr@2
|
267 |
*/
|
williamr@2
|
268 |
inline virtual TFourCC SinkDataTypeCode(TMediaId aMediaId);
|
williamr@2
|
269 |
|
williamr@2
|
270 |
/**
|
williamr@2
|
271 |
Gets the number of meta data entries.
|
williamr@2
|
272 |
|
williamr@2
|
273 |
Meta Data support. The decode format is only capable of reading meta data entries from the clip.
|
williamr@2
|
274 |
|
williamr@2
|
275 |
This is an optional method, used to return the number of meta data entries present in the format.
|
williamr@2
|
276 |
A meta data entry is a format-specific field such as authorship, copyright, security details etc.
|
williamr@2
|
277 |
The function is optional as many formats do not provide support for such additional meta data fields.
|
williamr@2
|
278 |
|
williamr@2
|
279 |
The default leaves with KErrNotSupported.
|
williamr@2
|
280 |
|
williamr@2
|
281 |
@param aNumberOfEntries
|
williamr@2
|
282 |
A reference to the number of meta data entries supported by the format. On return, contains
|
williamr@2
|
283 |
the number of meta data entries.
|
williamr@2
|
284 |
*/
|
williamr@2
|
285 |
inline virtual void GetNumberOfMetaDataEntriesL(TInt& aNumberOfEntries);
|
williamr@2
|
286 |
|
williamr@2
|
287 |
/**
|
williamr@2
|
288 |
Returns the specified meta data entry.
|
williamr@2
|
289 |
|
williamr@2
|
290 |
This method is optional as many formats do not provide support for such additional meta data fields.
|
williamr@2
|
291 |
|
williamr@2
|
292 |
The default leaves with KErrNotSupported.
|
williamr@2
|
293 |
|
williamr@2
|
294 |
@param aIndex
|
williamr@2
|
295 |
The zero based meta data entry index to retrieve.
|
williamr@2
|
296 |
|
williamr@2
|
297 |
@return The meta data entry.
|
williamr@2
|
298 |
*/
|
williamr@2
|
299 |
inline virtual CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex);
|
williamr@2
|
300 |
|
williamr@2
|
301 |
//audio format methods
|
williamr@2
|
302 |
|
williamr@2
|
303 |
/**
|
williamr@2
|
304 |
Sets the number of channels.
|
williamr@2
|
305 |
|
williamr@2
|
306 |
The default returns KErrNotSupported.
|
williamr@2
|
307 |
|
williamr@2
|
308 |
There would normally be no need to override this function as the format decode plugin can normally
|
williamr@2
|
309 |
determine for itself the number of channels. It is only necessary to override this in cases where the
|
williamr@2
|
310 |
format decode plugin cannot determine for itself the number of channels. This function should not be
|
williamr@2
|
311 |
used if the audio clip already exists; that is, in the "Open and Append" scenario, when the function's
|
williamr@2
|
312 |
behaviour is undefined.
|
williamr@2
|
313 |
|
williamr@2
|
314 |
@param aChannels
|
williamr@2
|
315 |
The number of channels.
|
williamr@2
|
316 |
|
williamr@2
|
317 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
318 |
another of the system-wide error codes.
|
williamr@2
|
319 |
*/
|
williamr@2
|
320 |
inline virtual TInt SetNumChannels(TUint aChannels);
|
williamr@2
|
321 |
|
williamr@2
|
322 |
/**
|
williamr@2
|
323 |
Sets the sample rate.
|
williamr@2
|
324 |
|
williamr@2
|
325 |
The default implementation returns KErrNotSupported.
|
williamr@2
|
326 |
|
williamr@2
|
327 |
There would normally be no need to override this function as the format decode can normally determine
|
williamr@2
|
328 |
the sample rate for itself. It is only necessary to override this in cases where the format decode plugin
|
williamr@2
|
329 |
cannot determine for itself the sample rate.
|
williamr@2
|
330 |
|
williamr@2
|
331 |
@param aSampleRate
|
williamr@2
|
332 |
The sample rate.
|
williamr@2
|
333 |
|
williamr@2
|
334 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
335 |
another of the system-wide error codes.
|
williamr@2
|
336 |
*/
|
williamr@2
|
337 |
inline virtual TInt SetSampleRate(TUint aSampleRate);
|
williamr@2
|
338 |
|
williamr@2
|
339 |
/**
|
williamr@2
|
340 |
Sets the bit rate.
|
williamr@2
|
341 |
|
williamr@2
|
342 |
The default implementation returns KErrNotSupported.
|
williamr@2
|
343 |
|
williamr@2
|
344 |
This method is mainly provided for variable bit rate formats, such as mp3, where the bit rate can
|
williamr@2
|
345 |
not be directly calculated from the sample rate. There would normally be no need to override this
|
williamr@2
|
346 |
function as the format decode can normally determine the sample rate for itself. It is only necessary
|
williamr@2
|
347 |
to override this in cases where the format decode plugin cannot determine for itself the sample rate.
|
williamr@2
|
348 |
|
williamr@2
|
349 |
@param aBitRate
|
williamr@2
|
350 |
The bit rate in bits per second.
|
williamr@2
|
351 |
|
williamr@2
|
352 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
353 |
another of the system-wide error codes.
|
williamr@2
|
354 |
*/
|
williamr@2
|
355 |
inline virtual TInt SetBitRate(TUint aBitRate);
|
williamr@2
|
356 |
|
williamr@2
|
357 |
/**
|
williamr@2
|
358 |
Returns the number of channels.
|
williamr@2
|
359 |
|
williamr@2
|
360 |
The default implementation returns 0.
|
williamr@2
|
361 |
|
williamr@2
|
362 |
@return The number of channels.
|
williamr@2
|
363 |
*/
|
williamr@2
|
364 |
virtual TUint NumChannels() {return 0;}
|
williamr@2
|
365 |
|
williamr@2
|
366 |
/**
|
williamr@2
|
367 |
Gets the sample rate.
|
williamr@2
|
368 |
|
williamr@2
|
369 |
The default implementation returns 0.
|
williamr@2
|
370 |
|
williamr@2
|
371 |
@return The sample rate.
|
williamr@2
|
372 |
*/
|
williamr@2
|
373 |
virtual TUint SampleRate() {return 0;}
|
williamr@2
|
374 |
|
williamr@2
|
375 |
/**
|
williamr@2
|
376 |
Gets the bit rate.
|
williamr@2
|
377 |
|
williamr@2
|
378 |
The default implementation returns 0.
|
williamr@2
|
379 |
|
williamr@2
|
380 |
This method is mainly provided for variable bit rate formats, such as mp3, where the bit rate
|
williamr@2
|
381 |
can not be directly calculated from the sample rate. This function needs overriding for any format
|
williamr@2
|
382 |
decode that supports audio.
|
williamr@2
|
383 |
|
williamr@2
|
384 |
@return The bit rate.
|
williamr@2
|
385 |
*/
|
williamr@2
|
386 |
virtual TUint BitRate() {return 0;}
|
williamr@2
|
387 |
|
williamr@2
|
388 |
/**
|
williamr@2
|
389 |
Gets the supported sample rates.
|
williamr@2
|
390 |
|
williamr@2
|
391 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
392 |
|
williamr@2
|
393 |
This should return an array of sample rates supported by the format where applicable. Note
|
williamr@2
|
394 |
that this refers to the possible sample rates supported by the format, not the actual sample rate,
|
williamr@2
|
395 |
which will be one of the supported sample rates. The implementation of this function is optional.
|
williamr@2
|
396 |
|
williamr@2
|
397 |
@param aSampleRates
|
williamr@2
|
398 |
Reference to an array of supported sample rates.
|
williamr@2
|
399 |
*/
|
williamr@2
|
400 |
inline virtual void GetSupportedSampleRatesL(RArray<TUint>& aSampleRates);
|
williamr@2
|
401 |
|
williamr@2
|
402 |
/**
|
williamr@2
|
403 |
Gets the supported bit rates.
|
williamr@2
|
404 |
|
williamr@2
|
405 |
The default leaves with KErrNotSupported.
|
williamr@2
|
406 |
|
williamr@2
|
407 |
This should return an array of bit rates supported by the format where applicable. Note that this
|
williamr@2
|
408 |
refers to the possible bit rates supported by the format, not the actual bit rate, which will be
|
williamr@2
|
409 |
one of the supported bit rates. The implementation of this function is optional.
|
williamr@2
|
410 |
|
williamr@2
|
411 |
@param aBitRates
|
williamr@2
|
412 |
Reference to an array of supported bit rates.
|
williamr@2
|
413 |
*/
|
williamr@2
|
414 |
inline virtual void GetSupportedBitRatesL(RArray<TUint>& aBitRates);
|
williamr@2
|
415 |
|
williamr@2
|
416 |
/**
|
williamr@2
|
417 |
Gets the supported number of channels.
|
williamr@2
|
418 |
|
williamr@2
|
419 |
The default leaves with KErrNotSupported.
|
williamr@2
|
420 |
|
williamr@2
|
421 |
The implementation of this procedure should return an array of channels supported by the format
|
williamr@2
|
422 |
where applicable. Note that this refers to the possible number of channels supported by the format,
|
williamr@2
|
423 |
not the actual number of channels, which will be one of the supported channels. For example, for a
|
williamr@2
|
424 |
format decode plugin capable of supporting mono and stereo the procedure would return an array of
|
williamr@2
|
425 |
length two the first array member containing the value 1 and the second containing the value 2. The
|
williamr@2
|
426 |
implementation of this function is optional.
|
williamr@2
|
427 |
|
williamr@2
|
428 |
@param aNumChannels
|
williamr@2
|
429 |
A reference to an array of supported number of channels.
|
williamr@2
|
430 |
*/
|
williamr@2
|
431 |
inline virtual void GetSupportedNumChannelsL(RArray<TUint>& aNumChannels);
|
williamr@2
|
432 |
|
williamr@2
|
433 |
/**
|
williamr@2
|
434 |
Gets the supported data types for the given media type id.
|
williamr@2
|
435 |
|
williamr@2
|
436 |
The default leaves with KErrNotSupported.
|
williamr@2
|
437 |
|
williamr@2
|
438 |
The implementation of this procedure should return an array of data types supported by the format where
|
williamr@2
|
439 |
applicable. Note that this refers to the possible data types that may be supported by the format, not the
|
williamr@2
|
440 |
actual data type of the format, which will be one of the supported data types. For example, for a format
|
williamr@2
|
441 |
decode plugin capable of supporting pcm16 and GSM610 the procedure would return an array of length two the
|
williamr@2
|
442 |
first array member containing the fourCC code ' P16' and the second containing the value GSM6. The
|
williamr@2
|
443 |
implementation of this function is optional.
|
williamr@2
|
444 |
|
williamr@2
|
445 |
@param aMediaId
|
williamr@2
|
446 |
The media type id.
|
williamr@2
|
447 |
@param aDataTypes
|
williamr@2
|
448 |
A reference to an array of supported data types.
|
williamr@2
|
449 |
*/
|
williamr@2
|
450 |
inline virtual void GetSupportedDataTypesL(TMediaId aMediaId, RArray<TFourCC>& aDataTypes);
|
williamr@2
|
451 |
|
williamr@2
|
452 |
/**
|
williamr@2
|
453 |
Used by the sink to suggest a source buffer size.
|
williamr@2
|
454 |
|
williamr@2
|
455 |
This is an optional function provided so that a controller can suggest a buffer
|
williamr@2
|
456 |
size for the format. The controller should not assume that the format will accept
|
williamr@2
|
457 |
the suggested buffer size and there is no obligation on behalf of the format to
|
williamr@2
|
458 |
use the suggested buffer size.
|
williamr@2
|
459 |
|
williamr@2
|
460 |
@param aSuggestedBufferSize
|
williamr@2
|
461 |
A recommended buffer size that the format should create.
|
williamr@2
|
462 |
*/
|
williamr@2
|
463 |
inline virtual void SuggestSourceBufferSize(TUint aSuggestedBufferSize);
|
williamr@2
|
464 |
|
williamr@2
|
465 |
/**
|
williamr@2
|
466 |
Used to set the format's position.
|
williamr@2
|
467 |
|
williamr@2
|
468 |
Subsequent data reads should ignore the FrameNumber in the CMMFBuffer and use this
|
williamr@2
|
469 |
setting to determine what data to provide.
|
williamr@2
|
470 |
|
williamr@2
|
471 |
The actual position the format sets itself may vary from this setting to ensure
|
williamr@2
|
472 |
that it is aligned to the sample boundaries ensuring consistent data output.
|
williamr@2
|
473 |
|
williamr@2
|
474 |
If not supported, positional information should be extracted from the FrameNumber in CMMFBuffer
|
williamr@2
|
475 |
|
williamr@2
|
476 |
@param aPosition
|
williamr@2
|
477 |
The position the format should use.
|
williamr@2
|
478 |
*/
|
williamr@2
|
479 |
inline virtual void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
|
williamr@2
|
480 |
|
williamr@2
|
481 |
|
williamr@2
|
482 |
/**
|
williamr@2
|
483 |
Supplies the current position.
|
williamr@2
|
484 |
|
williamr@2
|
485 |
Subsequent data reads will commence from this position.
|
williamr@2
|
486 |
|
williamr@2
|
487 |
@return The current position in microseconds.
|
williamr@2
|
488 |
*/
|
williamr@2
|
489 |
virtual TTimeIntervalMicroSeconds PositionL() {User::Leave(KErrNotSupported);return TTimeIntervalMicroSeconds(0);}
|
williamr@2
|
490 |
|
williamr@2
|
491 |
protected:
|
williamr@2
|
492 |
//ConstructSourceL should never be called. The CMMFFormatDecode NewL functions should
|
williamr@2
|
493 |
//always be used to instantiate a CMMFFormatDecode object (not MDataSource::NewL)
|
williamr@2
|
494 |
/**
|
williamr@2
|
495 |
@internalAll
|
williamr@2
|
496 |
*/
|
williamr@2
|
497 |
virtual void ConstructSourceL( const TDesC8& /*aInitData*/ ) {User::Leave(KErrNotSupported);}
|
williamr@2
|
498 |
|
williamr@2
|
499 |
//ConstructSinkL should never be called. The CMMFFormatDecode NewL functions should
|
williamr@2
|
500 |
//always be used to instantiate a CMMFFormatDecode object (not MDataSink::NewL)
|
williamr@2
|
501 |
/**
|
williamr@2
|
502 |
@internalAll
|
williamr@2
|
503 |
*/
|
williamr@2
|
504 |
virtual void ConstructSinkL( const TDesC8& /*aInitData*/ ) {User::Leave(KErrNotSupported);}
|
williamr@2
|
505 |
|
williamr@2
|
506 |
/**
|
williamr@2
|
507 |
Default constructor
|
williamr@2
|
508 |
*/
|
williamr@2
|
509 |
CMMFFormatDecode() : MDataSource(KUidMmfFormatDecode), MDataSink(KUidMmfFormatDecode) {};
|
williamr@2
|
510 |
|
williamr@2
|
511 |
// Creates and initialises format plugin.
|
williamr@2
|
512 |
static CMMFFormatDecode* CreateFormatL(TUid aImplementationUid, MDataSource* aSource);
|
williamr@2
|
513 |
protected:
|
williamr@2
|
514 |
|
williamr@2
|
515 |
/**
|
williamr@2
|
516 |
The clip is the source for the decode format.
|
williamr@2
|
517 |
*/
|
williamr@2
|
518 |
MDataSource* iClip;
|
williamr@2
|
519 |
|
williamr@2
|
520 |
/**
|
williamr@2
|
521 |
The data path is the sink for the decode format.
|
williamr@2
|
522 |
*/
|
williamr@2
|
523 |
MDataSink* iDataPath;
|
williamr@2
|
524 |
private:
|
williamr@2
|
525 |
TUid iDtor_ID_Key; // do not move - referenced inline in ~CMMFFormatDecode()
|
williamr@2
|
526 |
TUid iImplementationUid; // do not move - referenced inline in ImplementationUid()
|
williamr@2
|
527 |
};
|
williamr@2
|
528 |
|
williamr@2
|
529 |
|
williamr@2
|
530 |
/**
|
williamr@2
|
531 |
Extension class to allow derived classes to support custom interfaces
|
williamr@2
|
532 |
|
williamr@2
|
533 |
@publishedPartner
|
williamr@2
|
534 |
@prototype
|
williamr@2
|
535 |
*/
|
williamr@2
|
536 |
|
williamr@2
|
537 |
class CMMFFormatDecode2 : public CMMFFormatDecode
|
williamr@2
|
538 |
{
|
williamr@2
|
539 |
public:
|
williamr@2
|
540 |
/**
|
williamr@2
|
541 |
Gets a custom interface.
|
williamr@2
|
542 |
|
williamr@2
|
543 |
@param aInterfaceId
|
williamr@2
|
544 |
The Uid of the particular interface required.
|
williamr@2
|
545 |
|
williamr@2
|
546 |
@return Custom interface pointer. NULL if the requested interface is not supported.
|
williamr@2
|
547 |
*/
|
williamr@2
|
548 |
virtual TAny* CustomInterface(TUid aInterfaceId)=0;
|
williamr@2
|
549 |
};
|
williamr@2
|
550 |
|
williamr@2
|
551 |
|
williamr@2
|
552 |
/**
|
williamr@2
|
553 |
@publishedAll
|
williamr@2
|
554 |
@released
|
williamr@2
|
555 |
|
williamr@2
|
556 |
Base class from which sink formats can be derived from.
|
williamr@2
|
557 |
|
williamr@2
|
558 |
The intended usage is for controllers that can support more than one type of format.
|
williamr@2
|
559 |
The class is an MDataSink as far as the data path is concerned but is an MDataSource to the clip
|
williamr@2
|
560 |
that is the sink of the actual data. All CMMFFormatEncode plugin DLLs must include
|
williamr@2
|
561 |
interface_uid = KMmfUidPluginInterfaceFormatEncode in their .rss files.
|
williamr@2
|
562 |
*/
|
williamr@2
|
563 |
class CMMFFormatEncode : public CBase, public MDataSource, public MDataSink
|
williamr@2
|
564 |
{
|
williamr@2
|
565 |
public:
|
williamr@2
|
566 |
// ECOM creation.
|
williamr@2
|
567 |
IMPORT_C static CMMFFormatEncode* NewL( TUid aUid, MDataSink* aSink );
|
williamr@2
|
568 |
IMPORT_C static CMMFFormatEncode* NewL( const TDesC& aFileName, MDataSink* aSink, const TDesC& aPreferredSupplier ) ;
|
williamr@2
|
569 |
IMPORT_C static CMMFFormatEncode* NewL( const TDesC8& aSourceHeader, MDataSink* aSink, const TDesC& aPreferredSupplier ) ;
|
williamr@2
|
570 |
IMPORT_C static CMMFFormatEncode* NewL( MDataSink* aSink, const TDesC& aPreferredSupplier ) ;
|
williamr@2
|
571 |
|
williamr@2
|
572 |
/**
|
williamr@2
|
573 |
Destructor.
|
williamr@2
|
574 |
*/
|
williamr@2
|
575 |
virtual ~CMMFFormatEncode() {REComSession::DestroyedImplementation(iDtor_ID_Key);}
|
williamr@2
|
576 |
|
williamr@2
|
577 |
// returns ECOM plugin uid of this format
|
williamr@2
|
578 |
/**
|
williamr@2
|
579 |
Gets the ECom plugin UID of this format.
|
williamr@2
|
580 |
|
williamr@2
|
581 |
@return The plugin UID.
|
williamr@2
|
582 |
*/
|
williamr@2
|
583 |
TUid ImplementationUid() const {return iImplementationUid;}
|
williamr@2
|
584 |
|
williamr@2
|
585 |
/**
|
williamr@2
|
586 |
Returns the time interval for one frame for the specified media type.
|
williamr@2
|
587 |
|
williamr@2
|
588 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
589 |
|
williamr@2
|
590 |
@param aMediaType
|
williamr@2
|
591 |
The media type ID.
|
williamr@2
|
592 |
@return The frame time interval in microseconds.
|
williamr@2
|
593 |
*/
|
williamr@2
|
594 |
virtual TTimeIntervalMicroSeconds FrameTimeInterval(TMediaId aMediaType) const = 0;
|
williamr@2
|
595 |
|
williamr@2
|
596 |
/**
|
williamr@2
|
597 |
Returns the duration of the sink clip for the specified media type.
|
williamr@2
|
598 |
|
williamr@2
|
599 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
600 |
|
williamr@2
|
601 |
@param aMediaType
|
williamr@2
|
602 |
The media type ID.
|
williamr@2
|
603 |
|
williamr@2
|
604 |
@return The duration of the sink clip.
|
williamr@2
|
605 |
*/
|
williamr@2
|
606 |
virtual TTimeIntervalMicroSeconds Duration(TMediaId aMediaType) const = 0;
|
williamr@2
|
607 |
|
williamr@2
|
608 |
/**
|
williamr@2
|
609 |
@internalAll
|
williamr@2
|
610 |
|
williamr@2
|
611 |
Request from CMMFDataPath to fill the specified buffer.
|
williamr@2
|
612 |
|
williamr@2
|
613 |
@param aBuffer
|
williamr@2
|
614 |
The buffer to fill.
|
williamr@2
|
615 |
@param aConsumer
|
williamr@2
|
616 |
The consumer.
|
williamr@2
|
617 |
@param aMediaId
|
williamr@2
|
618 |
The media ID.
|
williamr@2
|
619 |
*/
|
williamr@2
|
620 |
inline virtual void FillBufferL(CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId);
|
williamr@2
|
621 |
|
williamr@2
|
622 |
/**
|
williamr@2
|
623 |
Called by the clip when it has added the data to the file.
|
williamr@2
|
624 |
|
williamr@2
|
625 |
@param aBuffer
|
williamr@2
|
626 |
The emptied buffer.
|
williamr@2
|
627 |
*/
|
williamr@2
|
628 |
virtual void BufferEmptiedL(CMMFBuffer* aBuffer) {iDataPath->BufferEmptiedL(aBuffer);}
|
williamr@2
|
629 |
|
williamr@2
|
630 |
/**
|
williamr@2
|
631 |
Tests whether a source buffer can be created.
|
williamr@2
|
632 |
|
williamr@2
|
633 |
The default implementation returns EFalse.
|
williamr@2
|
634 |
|
williamr@2
|
635 |
@return A boolean indicating if the buffer can be created. ETrue if buffer can be created, EFalse otherwise.
|
williamr@2
|
636 |
*/
|
williamr@2
|
637 |
virtual TBool CanCreateSourceBuffer() {return EFalse;}
|
williamr@2
|
638 |
|
williamr@2
|
639 |
/**
|
williamr@2
|
640 |
Creates a source buffer. The default returns NULL.
|
williamr@2
|
641 |
|
williamr@2
|
642 |
@param aMediaId
|
williamr@2
|
643 |
The media type id.
|
williamr@2
|
644 |
@param aReference
|
williamr@2
|
645 |
If ETrue the MDataSource owns the buffer.
|
williamr@2
|
646 |
If EFalse, then the caller owns the buffer.
|
williamr@2
|
647 |
|
williamr@2
|
648 |
@return Source buffer.
|
williamr@2
|
649 |
*/
|
williamr@2
|
650 |
inline virtual CMMFBuffer* CreateSourceBufferL(TMediaId aMediaId, TBool &aReference);
|
williamr@2
|
651 |
|
williamr@2
|
652 |
/**
|
williamr@2
|
653 |
Returns the source data type code for the specified media type ID.
|
williamr@2
|
654 |
|
williamr@2
|
655 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
656 |
|
williamr@2
|
657 |
@param aMediaId
|
williamr@2
|
658 |
The media type id.
|
williamr@2
|
659 |
|
williamr@2
|
660 |
@return The source data type code.
|
williamr@2
|
661 |
*/
|
williamr@2
|
662 |
inline virtual TFourCC SourceDataTypeCode(TMediaId aMediaId);
|
williamr@2
|
663 |
|
williamr@2
|
664 |
/**
|
williamr@2
|
665 |
Adds a buffer to a clip.
|
williamr@2
|
666 |
|
williamr@2
|
667 |
Called by CMMFDataPath.
|
williamr@2
|
668 |
(from MDataSink - CMMFFormatEncode is a MDataSink to a CMMFDataPath)
|
williamr@2
|
669 |
|
williamr@2
|
670 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
671 |
|
williamr@2
|
672 |
@param aBuffer
|
williamr@2
|
673 |
The buffer to which the clip is added.
|
williamr@2
|
674 |
@param aSupplier
|
williamr@2
|
675 |
The data source.
|
williamr@2
|
676 |
@param aMediaId
|
williamr@2
|
677 |
The media type ID.
|
williamr@2
|
678 |
*/
|
williamr@2
|
679 |
virtual void EmptyBufferL(CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId aMediaId)=0;
|
williamr@2
|
680 |
|
williamr@2
|
681 |
/**
|
williamr@2
|
682 |
@internalAll
|
williamr@2
|
683 |
|
williamr@2
|
684 |
Called by the CMMFDataPath's MDataSource when it has filled the buffer.
|
williamr@2
|
685 |
|
williamr@2
|
686 |
@param aBuffer
|
williamr@2
|
687 |
The buffer that has been filled.
|
williamr@2
|
688 |
*/
|
williamr@2
|
689 |
inline virtual void BufferFilledL(CMMFBuffer* aBuffer);
|
williamr@2
|
690 |
|
williamr@2
|
691 |
/**
|
williamr@2
|
692 |
Tests whether a sink buffer can be created.
|
williamr@2
|
693 |
|
williamr@2
|
694 |
Format would normally pass its own buffer onto the CMMFClip, so
|
williamr@2
|
695 |
this may not be required. The default returns ETrue.
|
williamr@2
|
696 |
|
williamr@2
|
697 |
@return A boolean indicating if the buffer can be created. ETrue if buffer can be created, EFalse otherwise.
|
williamr@2
|
698 |
*/
|
williamr@2
|
699 |
virtual TBool CanCreateSinkBuffer() {return ETrue;}
|
williamr@2
|
700 |
|
williamr@2
|
701 |
/**
|
williamr@2
|
702 |
Creates a sink buffer for the specified media ID.
|
williamr@2
|
703 |
|
williamr@2
|
704 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
705 |
|
williamr@2
|
706 |
@param aMediaId
|
williamr@2
|
707 |
The media type ID.
|
williamr@2
|
708 |
@param aReference
|
williamr@2
|
709 |
If ETrue then MDataSink owns the buffer.
|
williamr@2
|
710 |
If EFalse, then the caller owns the buffer.
|
williamr@2
|
711 |
|
williamr@2
|
712 |
@return A pointer to the CMMFBuffer sink buffer.
|
williamr@2
|
713 |
*/
|
williamr@2
|
714 |
virtual CMMFBuffer* CreateSinkBufferL(TMediaId aMediaId, TBool &aReference)=0;
|
williamr@2
|
715 |
|
williamr@2
|
716 |
/**
|
williamr@2
|
717 |
Returns the sink data type code for the specified media type ID.
|
williamr@2
|
718 |
|
williamr@2
|
719 |
This would be the same as the source data type four CC although the clip
|
williamr@2
|
720 |
is not going to need this info.
|
williamr@2
|
721 |
|
williamr@2
|
722 |
This is a virtual function that each derived class must implement.
|
williamr@2
|
723 |
|
williamr@2
|
724 |
@param aMediaId
|
williamr@2
|
725 |
The media type ID.
|
williamr@2
|
726 |
|
williamr@2
|
727 |
@return The sink data type code.
|
williamr@2
|
728 |
*/
|
williamr@2
|
729 |
virtual TFourCC SinkDataTypeCode(TMediaId aMediaId) = 0;
|
williamr@2
|
730 |
|
williamr@2
|
731 |
/**
|
williamr@2
|
732 |
This function is used to truncate the sink ie. a CMMFClip,
|
williamr@2
|
733 |
|
williamr@2
|
734 |
If aToEnd = ETrue the sink is cropped from the aPosition to the end of the clip.
|
williamr@2
|
735 |
If aToEnd = EFalse then the sink is cropped from the start of the clip to aPosition.
|
williamr@2
|
736 |
|
williamr@2
|
737 |
This function would be called by the CMMFController. The default implementation leaves
|
williamr@2
|
738 |
with KErrNotSupported.
|
williamr@2
|
739 |
|
williamr@2
|
740 |
@param aPosition
|
williamr@2
|
741 |
The position within the clip.
|
williamr@2
|
742 |
@param aToEnd
|
williamr@2
|
743 |
Flag to determine which part of the clip to delete.
|
williamr@2
|
744 |
*/
|
williamr@2
|
745 |
inline virtual void CropL(TTimeIntervalMicroSeconds aPosition, TBool aToEnd = ETrue);
|
williamr@2
|
746 |
|
williamr@2
|
747 |
|
williamr@2
|
748 |
/**
|
williamr@2
|
749 |
Gets the number of meta data entries.
|
williamr@2
|
750 |
|
williamr@2
|
751 |
The encode format is capable of reading and writing meta data to the clip.
|
williamr@2
|
752 |
|
williamr@2
|
753 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
754 |
|
williamr@2
|
755 |
@param aNumberOfEntries
|
williamr@2
|
756 |
On return, contains the number of meta data entries.
|
williamr@2
|
757 |
*/
|
williamr@2
|
758 |
inline virtual void GetNumberOfMetaDataEntriesL(TInt& aNumberOfEntries);
|
williamr@2
|
759 |
|
williamr@2
|
760 |
/**
|
williamr@2
|
761 |
Returns the specified meta data entry.
|
williamr@2
|
762 |
|
williamr@2
|
763 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
764 |
|
williamr@2
|
765 |
@param aIndex
|
williamr@2
|
766 |
The zero based meta data entry index to retrieve.
|
williamr@2
|
767 |
|
williamr@2
|
768 |
@return The meta data entry.
|
williamr@2
|
769 |
*/
|
williamr@2
|
770 |
inline virtual CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex);
|
williamr@2
|
771 |
|
williamr@2
|
772 |
/**
|
williamr@2
|
773 |
Adds the specified meta data entry to the clip.
|
williamr@2
|
774 |
|
williamr@2
|
775 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
776 |
|
williamr@2
|
777 |
@param aNewEntry
|
williamr@2
|
778 |
The meta data entry to add.
|
williamr@2
|
779 |
*/
|
williamr@2
|
780 |
inline virtual void AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry);
|
williamr@2
|
781 |
|
williamr@2
|
782 |
/**
|
williamr@2
|
783 |
Removes the specified meta data entry.
|
williamr@2
|
784 |
|
williamr@2
|
785 |
The default implementation returns KErrNotSupported.
|
williamr@2
|
786 |
|
williamr@2
|
787 |
@param aIndex
|
williamr@2
|
788 |
The zero based meta data entry index to remove.
|
williamr@2
|
789 |
|
williamr@2
|
790 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
791 |
another of the system-wide error codes.
|
williamr@2
|
792 |
*/
|
williamr@2
|
793 |
inline virtual TInt RemoveMetaDataEntry(TInt aIndex);
|
williamr@2
|
794 |
|
williamr@2
|
795 |
/**
|
williamr@2
|
796 |
Replaces the specified meta data entry with the entry supplied in aNewEntry.
|
williamr@2
|
797 |
|
williamr@2
|
798 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
799 |
|
williamr@2
|
800 |
@param aIndex
|
williamr@2
|
801 |
The zero based meta data entry index to replace.
|
williamr@2
|
802 |
@param aNewEntry
|
williamr@2
|
803 |
The meta data entry to replace.
|
williamr@2
|
804 |
*/
|
williamr@2
|
805 |
inline virtual void ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry);
|
williamr@2
|
806 |
|
williamr@2
|
807 |
//audio format methods
|
williamr@2
|
808 |
|
williamr@2
|
809 |
/**
|
williamr@2
|
810 |
Sets the number of channels.
|
williamr@2
|
811 |
|
williamr@2
|
812 |
The default implementation returns KErrNotSupported.
|
williamr@2
|
813 |
|
williamr@2
|
814 |
@param aChannels
|
williamr@2
|
815 |
The number of channels.
|
williamr@2
|
816 |
|
williamr@2
|
817 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
818 |
another of the system-wide error codes.
|
williamr@2
|
819 |
*/
|
williamr@2
|
820 |
inline virtual TInt SetNumChannels(TUint aChannels);
|
williamr@2
|
821 |
|
williamr@2
|
822 |
/**
|
williamr@2
|
823 |
Sets the sample rate.
|
williamr@2
|
824 |
|
williamr@2
|
825 |
The default implementation returns KErrNotSupported.
|
williamr@2
|
826 |
|
williamr@2
|
827 |
@param aSampleRate
|
williamr@2
|
828 |
The sample rate.
|
williamr@2
|
829 |
|
williamr@2
|
830 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
831 |
another of the system-wide error codes.
|
williamr@2
|
832 |
*/
|
williamr@2
|
833 |
inline virtual TInt SetSampleRate(TUint aSampleRate);
|
williamr@2
|
834 |
|
williamr@2
|
835 |
/**
|
williamr@2
|
836 |
Sets the bit rate.
|
williamr@2
|
837 |
|
williamr@2
|
838 |
The default implementation returns KErrNotSupported.
|
williamr@2
|
839 |
|
williamr@2
|
840 |
@param aBitRate
|
williamr@2
|
841 |
The bit rate.
|
williamr@2
|
842 |
|
williamr@2
|
843 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
williamr@2
|
844 |
another of the system-wide error codes.
|
williamr@2
|
845 |
*/
|
williamr@2
|
846 |
inline virtual TInt SetBitRate(TUint aBitRate);
|
williamr@2
|
847 |
|
williamr@2
|
848 |
/**
|
williamr@2
|
849 |
Returns the number of channels.
|
williamr@2
|
850 |
|
williamr@2
|
851 |
The default implementation returns 0.
|
williamr@2
|
852 |
|
williamr@2
|
853 |
@return The number of channels.
|
williamr@2
|
854 |
*/
|
williamr@2
|
855 |
virtual TUint NumChannels() {return 0;}
|
williamr@2
|
856 |
|
williamr@2
|
857 |
/**
|
williamr@2
|
858 |
Returns the sample rate.
|
williamr@2
|
859 |
|
williamr@2
|
860 |
The default implementation returns 0.
|
williamr@2
|
861 |
|
williamr@2
|
862 |
@return The sample rate.
|
williamr@2
|
863 |
*/
|
williamr@2
|
864 |
virtual TUint SampleRate() {return 0;}
|
williamr@2
|
865 |
|
williamr@2
|
866 |
/**
|
williamr@2
|
867 |
Returns the default sample rate.
|
williamr@2
|
868 |
|
williamr@2
|
869 |
The default returns 0.
|
williamr@2
|
870 |
|
williamr@2
|
871 |
@return The default sample rate.
|
williamr@2
|
872 |
*/
|
williamr@2
|
873 |
virtual TUint GetDefaultSampleRate() {return 0;}
|
williamr@2
|
874 |
|
williamr@2
|
875 |
/**
|
williamr@2
|
876 |
Returns the bit rate.
|
williamr@2
|
877 |
|
williamr@2
|
878 |
The default returns 0.
|
williamr@2
|
879 |
|
williamr@2
|
880 |
@return The bit rate.
|
williamr@2
|
881 |
*/
|
williamr@2
|
882 |
virtual TUint BitRate() {return 0;}
|
williamr@2
|
883 |
|
williamr@2
|
884 |
/**
|
williamr@2
|
885 |
Returns the bytes per second.
|
williamr@2
|
886 |
|
williamr@2
|
887 |
The default returns 0.
|
williamr@2
|
888 |
|
williamr@2
|
889 |
@return The bytes per second.
|
williamr@2
|
890 |
*/
|
williamr@2
|
891 |
virtual TInt64 BytesPerSecond() {return 0;}
|
williamr@2
|
892 |
|
williamr@2
|
893 |
/**
|
williamr@2
|
894 |
Gets the supported sample rates.
|
williamr@2
|
895 |
|
williamr@2
|
896 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
897 |
|
williamr@2
|
898 |
@param aSampleRates
|
williamr@2
|
899 |
A reference to an array of supported sample rates.
|
williamr@2
|
900 |
*/
|
williamr@2
|
901 |
inline virtual void GetSupportedSampleRatesL(RArray<TUint>& aSampleRates);
|
williamr@2
|
902 |
|
williamr@2
|
903 |
/**
|
williamr@2
|
904 |
Gets the supported bit rates.
|
williamr@2
|
905 |
|
williamr@2
|
906 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
907 |
|
williamr@2
|
908 |
@param aBitRates
|
williamr@2
|
909 |
A reference to an array of supported bit rates.
|
williamr@2
|
910 |
*/
|
williamr@2
|
911 |
inline virtual void GetSupportedBitRatesL(RArray<TUint>& aBitRates);
|
williamr@2
|
912 |
|
williamr@2
|
913 |
/**
|
williamr@2
|
914 |
Gets the supported number of channels.
|
williamr@2
|
915 |
|
williamr@2
|
916 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
917 |
|
williamr@2
|
918 |
@param aNumChannels
|
williamr@2
|
919 |
A reference to an array of supported number of channels.
|
williamr@2
|
920 |
*/
|
williamr@2
|
921 |
inline virtual void GetSupportedNumChannelsL(RArray<TUint>& aNumChannels);
|
williamr@2
|
922 |
|
williamr@2
|
923 |
/**
|
williamr@2
|
924 |
Gets the supported data types for the given media type ID.
|
williamr@2
|
925 |
|
williamr@2
|
926 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
927 |
|
williamr@2
|
928 |
@param aMediaId
|
williamr@2
|
929 |
The media type id.
|
williamr@2
|
930 |
@param aDataTypes
|
williamr@2
|
931 |
A reference to an array of supported data types.
|
williamr@2
|
932 |
*/
|
williamr@2
|
933 |
inline virtual void GetSupportedDataTypesL(TMediaId aMediaId, RArray<TFourCC>& aDataTypes);
|
williamr@2
|
934 |
|
williamr@2
|
935 |
/**
|
williamr@2
|
936 |
Sets the maximum clip size.
|
williamr@2
|
937 |
|
williamr@2
|
938 |
The default implementation leaves with KErrNotSupported.
|
williamr@2
|
939 |
|
williamr@2
|
940 |
@param aBytes
|
williamr@2
|
941 |
The maximum clip size.
|
williamr@2
|
942 |
*/
|
williamr@2
|
943 |
inline virtual void SetMaximumClipSizeL(TInt aBytes);
|
williamr@2
|
944 |
|
williamr@2
|
945 |
/**
|
williamr@2
|
946 |
Returns the maximum clip size.
|
williamr@2
|
947 |
|
williamr@2
|
948 |
The default returns 0.
|
williamr@2
|
949 |
|
williamr@2
|
950 |
@return The maximum clip size.
|
williamr@2
|
951 |
*/
|
williamr@2
|
952 |
virtual TInt MaximumClipSize() { return 0;}
|
williamr@2
|
953 |
|
williamr@2
|
954 |
/**
|
williamr@2
|
955 |
Used to set the format's position.
|
williamr@2
|
956 |
|
williamr@2
|
957 |
Subsequent data reads should ignore the FrameNumber in the CMMFBuffer and use this
|
williamr@2
|
958 |
setting to determine what data to provide.
|
williamr@2
|
959 |
|
williamr@2
|
960 |
The actual position the format sets itself may vary to this setting to ensure
|
williamr@2
|
961 |
that it is aligned to the sample boundaries ensuring consistent data output.
|
williamr@2
|
962 |
|
williamr@2
|
963 |
If not supported, positional information should be extracted from the FrameNumber in CMMFBuffer
|
williamr@2
|
964 |
|
williamr@2
|
965 |
@param aPosition
|
williamr@2
|
966 |
The position the format should use.
|
williamr@2
|
967 |
*/
|
williamr@2
|
968 |
inline virtual void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
|
williamr@2
|
969 |
|
williamr@2
|
970 |
|
williamr@2
|
971 |
/**
|
williamr@2
|
972 |
Supplies the current position.
|
williamr@2
|
973 |
|
williamr@2
|
974 |
Subsequent data reads will commence from this position.
|
williamr@2
|
975 |
|
williamr@2
|
976 |
@return The current position in microseconds.
|
williamr@2
|
977 |
*/
|
williamr@2
|
978 |
virtual TTimeIntervalMicroSeconds PositionL() {User::Leave(KErrNotSupported);return TTimeIntervalMicroSeconds(0);}
|
williamr@2
|
979 |
|
williamr@2
|
980 |
|
williamr@2
|
981 |
protected:
|
williamr@2
|
982 |
//ConstructSourceL should never be called. The CMMFFormatEncode NewL functions should
|
williamr@2
|
983 |
//always be used to instantiate a CMMFFormatEncode object (not MDataSource::NewL)
|
williamr@2
|
984 |
/**
|
williamr@2
|
985 |
@internalAll
|
williamr@2
|
986 |
*/
|
williamr@2
|
987 |
virtual void ConstructSourceL( const TDesC8& /*aInitData*/ ) {User::Leave(KErrNotSupported);}
|
williamr@2
|
988 |
//ConstructSinkL should never be called. The CMMFFormatEncode NewL functions should
|
williamr@2
|
989 |
//always be used to instantiate a CMMFFormatEncode object (not MDataSink::NewL)
|
williamr@2
|
990 |
/**
|
williamr@2
|
991 |
@internalAll
|
williamr@2
|
992 |
*/
|
williamr@2
|
993 |
virtual void ConstructSinkL( const TDesC8& /*aInitData*/ ) {User::Leave(KErrNotSupported);}
|
williamr@2
|
994 |
|
williamr@2
|
995 |
/**
|
williamr@2
|
996 |
Default constructor
|
williamr@2
|
997 |
*/
|
williamr@2
|
998 |
CMMFFormatEncode() : MDataSource(KUidMmfFormatEncode), MDataSink(KUidMmfFormatEncode) {};
|
williamr@2
|
999 |
|
williamr@2
|
1000 |
// Creates and initialises format plugin.
|
williamr@2
|
1001 |
static CMMFFormatEncode* CreateFormatL(TUid aImplementationUid, MDataSink* aSink);
|
williamr@2
|
1002 |
protected:
|
williamr@2
|
1003 |
|
williamr@2
|
1004 |
/**
|
williamr@2
|
1005 |
The Data path is the source for the encode format.
|
williamr@2
|
1006 |
*/
|
williamr@2
|
1007 |
MDataSource* iDataPath;
|
williamr@2
|
1008 |
|
williamr@2
|
1009 |
/**
|
williamr@2
|
1010 |
The clip is the sink for the encode format.
|
williamr@2
|
1011 |
*/
|
williamr@2
|
1012 |
MDataSink* iClip;
|
williamr@2
|
1013 |
private:
|
williamr@2
|
1014 |
TUid iDtor_ID_Key; // do not move - referenced inline in ~CMMFFormatDecode()
|
williamr@2
|
1015 |
TUid iImplementationUid; // do not move - referenced inline in ImplementationUid()
|
williamr@2
|
1016 |
};
|
williamr@2
|
1017 |
|
williamr@2
|
1018 |
|
williamr@2
|
1019 |
class CMMFFormatPluginSelectionParameters;
|
williamr@2
|
1020 |
|
williamr@2
|
1021 |
/**
|
williamr@2
|
1022 |
@publishedAll
|
williamr@2
|
1023 |
@released
|
williamr@2
|
1024 |
|
williamr@2
|
1025 |
Provides an internal utility function to choose a format plugin from ECom.
|
williamr@2
|
1026 |
*/
|
williamr@2
|
1027 |
class MMFFormatEcomUtilities
|
williamr@2
|
1028 |
{
|
williamr@2
|
1029 |
public:
|
williamr@2
|
1030 |
//Internal utility function to choose a format plugin from ECOM
|
williamr@2
|
1031 |
static TUid SelectFormatPluginL(const CMMFFormatPluginSelectionParameters& aSelectParams);
|
williamr@2
|
1032 |
|
williamr@2
|
1033 |
// Internal utility function to instantiate each format decode plugin in turn
|
williamr@2
|
1034 |
// until we find one that works
|
williamr@2
|
1035 |
static CMMFFormatDecode* SelectFormatDecodePluginL(const CMMFFormatPluginSelectionParameters& aSelectParams, MDataSource* aSource);
|
williamr@2
|
1036 |
|
williamr@2
|
1037 |
static CMMFFormatDecode* SelectFormatDecodePluginL(const CMMFFormatPluginSelectionParameters& aSelectParams, MDataSource* aSource, TBool& aSupportsCustomInterfaces);
|
williamr@2
|
1038 |
};
|
williamr@2
|
1039 |
|
williamr@2
|
1040 |
#include "mmfformat.inl"
|
williamr@2
|
1041 |
|
williamr@2
|
1042 |
#endif
|