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