1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __MMF_SERVER_FORMAT_H__
17 #define __MMF_SERVER_FORMAT_H__
19 #include <mmf/server/mmfdatasink.h>
20 #include <mmf/server/mmfdatasource.h>
21 #include <ecom/ecom.h>
22 #include <mmf/plugin/mmfplugininterfaceuids.hrh>
24 const TUint KMMFFormatDefaultFrameSize = 0x1000; //4K
30 Base class from which source formats can be derived from. The intended usage is for controllers that can support more
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
32 that is the source of the actual data.
34 All CMMFFormatDecode plugin DLLs must include interface_uid = KMmfUidPluginInterfaceFormatDecode in their .rss files.
36 class CMMFFormatDecode : public CBase, public MDataSource, public MDataSink
40 IMPORT_C static CMMFFormatDecode* NewL( TUid aUid, MDataSource* aSource );
42 IMPORT_C static CMMFFormatDecode* NewL( const TDesC& aFileName, MDataSource* aSource, const TDesC& aPreferredSupplier ) ;
43 IMPORT_C static CMMFFormatDecode* NewL( const TDesC8& aSourceHeader, MDataSource* aSource, const TDesC& aPreferredSupplier ) ;
44 IMPORT_C static CMMFFormatDecode* NewL( MDataSource* aSource, const TDesC& aPreferredSupplier ) ;
46 IMPORT_C static CMMFFormatDecode* NewL( const TDesC& aFileName, MDataSource* aSource, const TDesC& aPreferredSupplier, TBool& aSupportsCustomInterfaces ) ;
47 IMPORT_C static CMMFFormatDecode* NewL( const TDesC8& aSourceHeader, MDataSource* aSource, const TDesC& aPreferredSupplier, TBool& aSupportsCustomInterfaces ) ;
48 IMPORT_C static CMMFFormatDecode* NewL( MDataSource* aSource, const TDesC& aPreferredSupplier, TBool& aSupportsCustomInterfaces ) ;
53 virtual ~CMMFFormatDecode() {REComSession::DestroyedImplementation(iDtor_ID_Key);};
56 Returns the ECom plugin UID of this format.
58 @return The plugin UID.
60 TUid ImplementationUid() const {return iImplementationUid;}
63 Gets the number of streams of the specified media type.
65 This is a virtual function that each derived class must implement.
68 The UID of the media type, for example KUidMediaTypeAudio or KUidMediaTypeVideo.
70 @return The number of streams of multimedia data in the format for the specified media type.
71 For example, for a WAV or mp3 audio file this procedure would return 1 for a media
72 type of audio and 0 for a media type of video. More complex multimedia formats (for
73 example AVI and mp4) can support multiple streams of both video and audio.
75 virtual TUint Streams(TUid aMediaType) const = 0;
78 Returns the time interval for one frame for the specified media type.
80 This is a virtual function that each derived class must implement.
82 In the case of video, a frame would usually be one frame of video. In the case of
83 audio, a frame may correspond to a frame of audio, if the particular audio data type
84 is framed eg mp3. There are two definitions of a frame. A format frame, which may
85 consist of several frames of a particular framed audio data type. This may be the case,
86 for example for GSM610 (a low quality audio data type used in telephony) where a frame
87 is only 65 bytes large. In this case a format frame consists of several GSM610 data type
88 frames as passing the data out 65 bytes at a time would be inefficient. In the case of
89 non-framed data such as pcm, a frame can be an arbitrary size determined by the format plugin.
94 @return The frame time interval
96 virtual TTimeIntervalMicroSeconds FrameTimeInterval(TMediaId aMediaType) const = 0;
100 Returns the duration of the clip for the specified media type.
102 This is a virtual function that each derived class must implement.
107 @return The duration of the clip.
109 virtual TTimeIntervalMicroSeconds Duration(TMediaId aMediaType) const = 0;
112 Request from CMMFDataPath to fill the specified buffer.
113 The CMMFFormat needs to break this down into one or more reads from the clip
114 (from MDataSource - CMMFFormatDecode is a MDataSource to a CMMFDataPath consumer).
116 This is a virtual function that each derived class must implement.
118 This method is the means by which data is obtained from the data source. aBuffer is
119 the buffer that needs filling from the source data stream as identified by aMediaId. The
120 format should read the frame number of the buffer via the buffer's CMMFBuffer::FrameNumber()
121 method. From this the format should be able to determine the actual position of the data on
122 the data source. The technique here depends on the nature of the format. For a linear audio
123 format, the position can be obtained by a simple calculation of the frame size, the header size
124 and where appropriate the datatype.
126 For non-linear formats either an index table of frame number and location will need to be
127 created in the NewL() or some form of approximating algorithm will be required. Some formats have
128 an index table as part of the format e.g. AVI. If no random access is required then no index table
129 is required, the format can keep track of the current read position and increment it on each access,
130 and reset it if the frame number is reset to 0 or 1. Given that for non-linear i.e. variable bit rate
131 formats, the size of the data read may vary from frame to frame, then the format should either set
132 the request size of the buffer for the required frame or call the source's ReadBufferL() (either
133 CMMFClip::ReadBufferL(), CMMFDescriptor ::ReadBufferL() or CMMFFile::ReadBufferL()) function that
134 takes the aLength parameter.
136 It is the responsibility of the format decode to determine the size and position of the source data
137 for each frame. For linear audio formats, the format decode should fill the buffer up to its maximum
138 length. For multimedia formats e.g. mp4, AVI etc, the format decode is effectively acting as a demultiplexor,
139 and must obtain the appropriate data from the source depending on the aMediaId.
148 virtual void FillBufferL(CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId)=0;
153 Indicates data has been added to the file.
158 inline virtual void BufferEmptiedL(CMMFBuffer* aBuffer);
161 Tests whether a source buffer can be created.
163 The format knows what type of source buffer it requires so default returns ETrue.
164 It doesn't usually need to set the size of this buffer.
166 @return A boolean indicating whether a buffer can be created. ETrue if the buffer can be created,
169 virtual TBool CanCreateSourceBuffer() {return ETrue;}
172 Creates a source buffer.
174 This is a virtual function that each derived class must implement.
176 This function should create a buffer of length 0, the maximum length should be equal to the maximum
177 possible frame size. In the case of non framed data it should be set to an arbitrary size, which is
178 effectively a trade off between being too small which will affect performance as more source reads
179 are required, and being too large which will give very coarse positioning granularity. For pcm data,
180 a buffer size of 4K is a good compromise. The same compromise also applies when deciding to put multiple
181 audio frames into one format frame. The sink buffer size may also effect the format buffer size and
182 the controller may use this to suggest a buffer size to the format by calling the format's SuggestSourceBufferSize()
183 method. Alternatively the MDataSource::CreateSourceBufferL() function that takes the additional aSinkBuffer
184 parameter may also be used when deciding the source buffer maximum size of the created source buffer.
189 If ETrue the MDataSource owns the buffer. If EFalse, then the caller owns the buffer. This
190 should normally be set to EFalse as format plugins do not create the reference buffer.
192 @return The created source buffer.
194 virtual CMMFBuffer* CreateSourceBufferL(TMediaId aMediaId, TBool &aReference)=0;
197 Returns the source data type code for the specified media type ID.
199 Used by the CMMFDataPath for codec matching.
201 This is a virtual function that each derived class must implement.
206 @return The source data type code.
208 virtual TFourCC SourceDataTypeCode(TMediaId aMediaId)=0;
213 Adds a buffer to a clip.
216 The buffer to which the clip is added.
222 inline virtual void EmptyBufferL(CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId aMediaId);
225 Indicates the data source has filled the buffer.
227 Called by the CMMFFormat's MDataSource when it has filled the buffer.
228 The default implementation below would need overriding in cases where multiple
229 clip reads were required to fill the buffer from the data path.
232 The buffer to which the clip is added.
234 virtual void BufferFilledL(CMMFBuffer* aBuffer) {iDataPath->BufferFilledL(aBuffer);}
237 Tests whether a sink buffer can be created.
239 Format would normally pass its own buffer onto the CMMFClip, so
240 this may not be required. The default returns EFalse.
242 @return A boolean indicating if the sink buffer can be created. ETrue if buffer can be created, EFalse otherwise.
244 virtual TBool CanCreateSinkBuffer() {return EFalse;}
247 Creates a sink buffer for the specified media ID. The default version returns NULL.
252 If ETrue the MDataSink owns the buffer.
253 If EFalse, then the caller owns the buffer.
254 @return The CMMFBuffer sink buffer.
256 inline virtual CMMFBuffer* CreateSinkBufferL(TMediaId aMediaId, TBool &aReference);
259 Returns the sink data type code for the specified media type ID.
260 This would be the same as the source data type four CC although
261 the clip is not going to need this info.
266 @return The sink data type code.
268 inline virtual TFourCC SinkDataTypeCode(TMediaId aMediaId);
271 Gets the number of meta data entries.
273 Meta Data support. The decode format is only capable of reading meta data entries from the clip.
275 This is an optional method, used to return the number of meta data entries present in the format.
276 A meta data entry is a format-specific field such as authorship, copyright, security details etc.
277 The function is optional as many formats do not provide support for such additional meta data fields.
279 The default leaves with KErrNotSupported.
281 @param aNumberOfEntries
282 A reference to the number of meta data entries supported by the format. On return, contains
283 the number of meta data entries.
285 inline virtual void GetNumberOfMetaDataEntriesL(TInt& aNumberOfEntries);
288 Returns the specified meta data entry.
290 This method is optional as many formats do not provide support for such additional meta data fields.
292 The default leaves with KErrNotSupported.
295 The zero based meta data entry index to retrieve.
297 @return The meta data entry.
299 inline virtual CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex);
301 //audio format methods
304 Sets the number of channels.
306 The default returns KErrNotSupported.
308 There would normally be no need to override this function as the format decode plugin can normally
309 determine for itself the number of channels. It is only necessary to override this in cases where the
310 format decode plugin cannot determine for itself the number of channels. This function should not be
311 used if the audio clip already exists; that is, in the "Open and Append" scenario, when the function's
312 behaviour is undefined.
315 The number of channels.
317 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
318 another of the system-wide error codes.
320 inline virtual TInt SetNumChannels(TUint aChannels);
323 Sets the sample rate.
325 The default implementation returns KErrNotSupported.
327 There would normally be no need to override this function as the format decode can normally determine
328 the sample rate for itself. It is only necessary to override this in cases where the format decode plugin
329 cannot determine for itself the sample rate.
334 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
335 another of the system-wide error codes.
337 inline virtual TInt SetSampleRate(TUint aSampleRate);
342 The default implementation returns KErrNotSupported.
344 This method is mainly provided for variable bit rate formats, such as mp3, where the bit rate can
345 not be directly calculated from the sample rate. There would normally be no need to override this
346 function as the format decode can normally determine the sample rate for itself. It is only necessary
347 to override this in cases where the format decode plugin cannot determine for itself the sample rate.
350 The bit rate in bits per second.
352 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
353 another of the system-wide error codes.
355 inline virtual TInt SetBitRate(TUint aBitRate);
358 Returns the number of channels.
360 The default implementation returns 0.
362 @return The number of channels.
364 virtual TUint NumChannels() {return 0;}
367 Gets the sample rate.
369 The default implementation returns 0.
371 @return The sample rate.
373 virtual TUint SampleRate() {return 0;}
378 The default implementation returns 0.
380 This method is mainly provided for variable bit rate formats, such as mp3, where the bit rate
381 can not be directly calculated from the sample rate. This function needs overriding for any format
382 decode that supports audio.
384 @return The bit rate.
386 virtual TUint BitRate() {return 0;}
389 Gets the supported sample rates.
391 The default implementation leaves with KErrNotSupported.
393 This should return an array of sample rates supported by the format where applicable. Note
394 that this refers to the possible sample rates supported by the format, not the actual sample rate,
395 which will be one of the supported sample rates. The implementation of this function is optional.
398 Reference to an array of supported sample rates.
400 inline virtual void GetSupportedSampleRatesL(RArray<TUint>& aSampleRates);
403 Gets the supported bit rates.
405 The default leaves with KErrNotSupported.
407 This should return an array of bit rates supported by the format where applicable. Note that this
408 refers to the possible bit rates supported by the format, not the actual bit rate, which will be
409 one of the supported bit rates. The implementation of this function is optional.
412 Reference to an array of supported bit rates.
414 inline virtual void GetSupportedBitRatesL(RArray<TUint>& aBitRates);
417 Gets the supported number of channels.
419 The default leaves with KErrNotSupported.
421 The implementation of this procedure should return an array of channels supported by the format
422 where applicable. Note that this refers to the possible number of channels supported by the format,
423 not the actual number of channels, which will be one of the supported channels. For example, for a
424 format decode plugin capable of supporting mono and stereo the procedure would return an array of
425 length two the first array member containing the value 1 and the second containing the value 2. The
426 implementation of this function is optional.
429 A reference to an array of supported number of channels.
431 inline virtual void GetSupportedNumChannelsL(RArray<TUint>& aNumChannels);
434 Gets the supported data types for the given media type id.
436 The default leaves with KErrNotSupported.
438 The implementation of this procedure should return an array of data types supported by the format where
439 applicable. Note that this refers to the possible data types that may be supported by the format, not the
440 actual data type of the format, which will be one of the supported data types. For example, for a format
441 decode plugin capable of supporting pcm16 and GSM610 the procedure would return an array of length two the
442 first array member containing the fourCC code ' P16' and the second containing the value GSM6. The
443 implementation of this function is optional.
448 A reference to an array of supported data types.
450 inline virtual void GetSupportedDataTypesL(TMediaId aMediaId, RArray<TFourCC>& aDataTypes);
453 Used by the sink to suggest a source buffer size.
455 This is an optional function provided so that a controller can suggest a buffer
456 size for the format. The controller should not assume that the format will accept
457 the suggested buffer size and there is no obligation on behalf of the format to
458 use the suggested buffer size.
460 @param aSuggestedBufferSize
461 A recommended buffer size that the format should create.
463 inline virtual void SuggestSourceBufferSize(TUint aSuggestedBufferSize);
466 Used to set the format's position.
468 Subsequent data reads should ignore the FrameNumber in the CMMFBuffer and use this
469 setting to determine what data to provide.
471 The actual position the format sets itself may vary from this setting to ensure
472 that it is aligned to the sample boundaries ensuring consistent data output.
474 If not supported, positional information should be extracted from the FrameNumber in CMMFBuffer
477 The position the format should use.
479 inline virtual void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
483 Supplies the current position.
485 Subsequent data reads will commence from this position.
487 @return The current position in microseconds.
489 virtual TTimeIntervalMicroSeconds PositionL() {User::Leave(KErrNotSupported);return TTimeIntervalMicroSeconds(0);}
492 //ConstructSourceL should never be called. The CMMFFormatDecode NewL functions should
493 //always be used to instantiate a CMMFFormatDecode object (not MDataSource::NewL)
497 virtual void ConstructSourceL( const TDesC8& /*aInitData*/ ) {User::Leave(KErrNotSupported);}
499 //ConstructSinkL should never be called. The CMMFFormatDecode NewL functions should
500 //always be used to instantiate a CMMFFormatDecode object (not MDataSink::NewL)
504 virtual void ConstructSinkL( const TDesC8& /*aInitData*/ ) {User::Leave(KErrNotSupported);}
509 CMMFFormatDecode() : MDataSource(KUidMmfFormatDecode), MDataSink(KUidMmfFormatDecode) {};
511 // Creates and initialises format plugin.
512 static CMMFFormatDecode* CreateFormatL(TUid aImplementationUid, MDataSource* aSource);
516 The clip is the source for the decode format.
521 The data path is the sink for the decode format.
523 MDataSink* iDataPath;
525 TUid iDtor_ID_Key; // do not move - referenced inline in ~CMMFFormatDecode()
526 TUid iImplementationUid; // do not move - referenced inline in ImplementationUid()
531 Extension class to allow derived classes to support custom interfaces
537 class CMMFFormatDecode2 : public CMMFFormatDecode
541 Gets a custom interface.
544 The Uid of the particular interface required.
546 @return Custom interface pointer. NULL if the requested interface is not supported.
548 virtual TAny* CustomInterface(TUid aInterfaceId)=0;
556 Base class from which sink formats can be derived from.
558 The intended usage is for controllers that can support more than one type of format.
559 The class is an MDataSink as far as the data path is concerned but is an MDataSource to the clip
560 that is the sink of the actual data. All CMMFFormatEncode plugin DLLs must include
561 interface_uid = KMmfUidPluginInterfaceFormatEncode in their .rss files.
563 class CMMFFormatEncode : public CBase, public MDataSource, public MDataSink
567 IMPORT_C static CMMFFormatEncode* NewL( TUid aUid, MDataSink* aSink );
568 IMPORT_C static CMMFFormatEncode* NewL( const TDesC& aFileName, MDataSink* aSink, const TDesC& aPreferredSupplier ) ;
569 IMPORT_C static CMMFFormatEncode* NewL( const TDesC8& aSourceHeader, MDataSink* aSink, const TDesC& aPreferredSupplier ) ;
570 IMPORT_C static CMMFFormatEncode* NewL( MDataSink* aSink, const TDesC& aPreferredSupplier ) ;
575 virtual ~CMMFFormatEncode() {REComSession::DestroyedImplementation(iDtor_ID_Key);}
577 // returns ECOM plugin uid of this format
579 Gets the ECom plugin UID of this format.
581 @return The plugin UID.
583 TUid ImplementationUid() const {return iImplementationUid;}
586 Returns the time interval for one frame for the specified media type.
588 This is a virtual function that each derived class must implement.
592 @return The frame time interval in microseconds.
594 virtual TTimeIntervalMicroSeconds FrameTimeInterval(TMediaId aMediaType) const = 0;
597 Returns the duration of the sink clip for the specified media type.
599 This is a virtual function that each derived class must implement.
604 @return The duration of the sink clip.
606 virtual TTimeIntervalMicroSeconds Duration(TMediaId aMediaType) const = 0;
611 Request from CMMFDataPath to fill the specified buffer.
620 inline virtual void FillBufferL(CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId);
623 Called by the clip when it has added the data to the file.
628 virtual void BufferEmptiedL(CMMFBuffer* aBuffer) {iDataPath->BufferEmptiedL(aBuffer);}
631 Tests whether a source buffer can be created.
633 The default implementation returns EFalse.
635 @return A boolean indicating if the buffer can be created. ETrue if buffer can be created, EFalse otherwise.
637 virtual TBool CanCreateSourceBuffer() {return EFalse;}
640 Creates a source buffer. The default returns NULL.
645 If ETrue the MDataSource owns the buffer.
646 If EFalse, then the caller owns the buffer.
648 @return Source buffer.
650 inline virtual CMMFBuffer* CreateSourceBufferL(TMediaId aMediaId, TBool &aReference);
653 Returns the source data type code for the specified media type ID.
655 This is a virtual function that each derived class must implement.
660 @return The source data type code.
662 inline virtual TFourCC SourceDataTypeCode(TMediaId aMediaId);
665 Adds a buffer to a clip.
667 Called by CMMFDataPath.
668 (from MDataSink - CMMFFormatEncode is a MDataSink to a CMMFDataPath)
670 This is a virtual function that each derived class must implement.
673 The buffer to which the clip is added.
679 virtual void EmptyBufferL(CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId aMediaId)=0;
684 Called by the CMMFDataPath's MDataSource when it has filled the buffer.
687 The buffer that has been filled.
689 inline virtual void BufferFilledL(CMMFBuffer* aBuffer);
692 Tests whether a sink buffer can be created.
694 Format would normally pass its own buffer onto the CMMFClip, so
695 this may not be required. The default returns ETrue.
697 @return A boolean indicating if the buffer can be created. ETrue if buffer can be created, EFalse otherwise.
699 virtual TBool CanCreateSinkBuffer() {return ETrue;}
702 Creates a sink buffer for the specified media ID.
704 This is a virtual function that each derived class must implement.
709 If ETrue then MDataSink owns the buffer.
710 If EFalse, then the caller owns the buffer.
712 @return A pointer to the CMMFBuffer sink buffer.
714 virtual CMMFBuffer* CreateSinkBufferL(TMediaId aMediaId, TBool &aReference)=0;
717 Returns the sink data type code for the specified media type ID.
719 This would be the same as the source data type four CC although the clip
720 is not going to need this info.
722 This is a virtual function that each derived class must implement.
727 @return The sink data type code.
729 virtual TFourCC SinkDataTypeCode(TMediaId aMediaId) = 0;
732 This function is used to truncate the sink ie. a CMMFClip,
734 If aToEnd = ETrue the sink is cropped from the aPosition to the end of the clip.
735 If aToEnd = EFalse then the sink is cropped from the start of the clip to aPosition.
737 This function would be called by the CMMFController. The default implementation leaves
738 with KErrNotSupported.
741 The position within the clip.
743 Flag to determine which part of the clip to delete.
745 inline virtual void CropL(TTimeIntervalMicroSeconds aPosition, TBool aToEnd = ETrue);
749 Gets the number of meta data entries.
751 The encode format is capable of reading and writing meta data to the clip.
753 The default implementation leaves with KErrNotSupported.
755 @param aNumberOfEntries
756 On return, contains the number of meta data entries.
758 inline virtual void GetNumberOfMetaDataEntriesL(TInt& aNumberOfEntries);
761 Returns the specified meta data entry.
763 The default implementation leaves with KErrNotSupported.
766 The zero based meta data entry index to retrieve.
768 @return The meta data entry.
770 inline virtual CMMFMetaDataEntry* MetaDataEntryL(TInt aIndex);
773 Adds the specified meta data entry to the clip.
775 The default implementation leaves with KErrNotSupported.
778 The meta data entry to add.
780 inline virtual void AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry);
783 Removes the specified meta data entry.
785 The default implementation returns KErrNotSupported.
788 The zero based meta data entry index to remove.
790 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
791 another of the system-wide error codes.
793 inline virtual TInt RemoveMetaDataEntry(TInt aIndex);
796 Replaces the specified meta data entry with the entry supplied in aNewEntry.
798 The default implementation leaves with KErrNotSupported.
801 The zero based meta data entry index to replace.
803 The meta data entry to replace.
805 inline virtual void ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry);
807 //audio format methods
810 Sets the number of channels.
812 The default implementation returns KErrNotSupported.
815 The number of channels.
817 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
818 another of the system-wide error codes.
820 inline virtual TInt SetNumChannels(TUint aChannels);
823 Sets the sample rate.
825 The default implementation returns KErrNotSupported.
830 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
831 another of the system-wide error codes.
833 inline virtual TInt SetSampleRate(TUint aSampleRate);
838 The default implementation returns KErrNotSupported.
843 @return An error code indicating if the function call was successful. KErrNone on success, otherwise
844 another of the system-wide error codes.
846 inline virtual TInt SetBitRate(TUint aBitRate);
849 Returns the number of channels.
851 The default implementation returns 0.
853 @return The number of channels.
855 virtual TUint NumChannels() {return 0;}
858 Returns the sample rate.
860 The default implementation returns 0.
862 @return The sample rate.
864 virtual TUint SampleRate() {return 0;}
867 Returns the default sample rate.
869 The default returns 0.
871 @return The default sample rate.
873 virtual TUint GetDefaultSampleRate() {return 0;}
876 Returns the bit rate.
878 The default returns 0.
880 @return The bit rate.
882 virtual TUint BitRate() {return 0;}
885 Returns the bytes per second.
887 The default returns 0.
889 @return The bytes per second.
891 virtual TInt64 BytesPerSecond() {return 0;}
894 Gets the supported sample rates.
896 The default implementation leaves with KErrNotSupported.
899 A reference to an array of supported sample rates.
901 inline virtual void GetSupportedSampleRatesL(RArray<TUint>& aSampleRates);
904 Gets the supported bit rates.
906 The default implementation leaves with KErrNotSupported.
909 A reference to an array of supported bit rates.
911 inline virtual void GetSupportedBitRatesL(RArray<TUint>& aBitRates);
914 Gets the supported number of channels.
916 The default implementation leaves with KErrNotSupported.
919 A reference to an array of supported number of channels.
921 inline virtual void GetSupportedNumChannelsL(RArray<TUint>& aNumChannels);
924 Gets the supported data types for the given media type ID.
926 The default implementation leaves with KErrNotSupported.
931 A reference to an array of supported data types.
933 inline virtual void GetSupportedDataTypesL(TMediaId aMediaId, RArray<TFourCC>& aDataTypes);
936 Sets the maximum clip size.
938 The default implementation leaves with KErrNotSupported.
941 The maximum clip size.
943 inline virtual void SetMaximumClipSizeL(TInt aBytes);
946 Returns the maximum clip size.
948 The default returns 0.
950 @return The maximum clip size.
952 virtual TInt MaximumClipSize() { return 0;}
955 Used to set the format's position.
957 Subsequent data reads should ignore the FrameNumber in the CMMFBuffer and use this
958 setting to determine what data to provide.
960 The actual position the format sets itself may vary to this setting to ensure
961 that it is aligned to the sample boundaries ensuring consistent data output.
963 If not supported, positional information should be extracted from the FrameNumber in CMMFBuffer
966 The position the format should use.
968 inline virtual void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
972 Supplies the current position.
974 Subsequent data reads will commence from this position.
976 @return The current position in microseconds.
978 virtual TTimeIntervalMicroSeconds PositionL() {User::Leave(KErrNotSupported);return TTimeIntervalMicroSeconds(0);}
982 //ConstructSourceL should never be called. The CMMFFormatEncode NewL functions should
983 //always be used to instantiate a CMMFFormatEncode object (not MDataSource::NewL)
987 virtual void ConstructSourceL( const TDesC8& /*aInitData*/ ) {User::Leave(KErrNotSupported);}
988 //ConstructSinkL should never be called. The CMMFFormatEncode NewL functions should
989 //always be used to instantiate a CMMFFormatEncode object (not MDataSink::NewL)
993 virtual void ConstructSinkL( const TDesC8& /*aInitData*/ ) {User::Leave(KErrNotSupported);}
998 CMMFFormatEncode() : MDataSource(KUidMmfFormatEncode), MDataSink(KUidMmfFormatEncode) {};
1000 // Creates and initialises format plugin.
1001 static CMMFFormatEncode* CreateFormatL(TUid aImplementationUid, MDataSink* aSink);
1005 The Data path is the source for the encode format.
1007 MDataSource* iDataPath;
1010 The clip is the sink for the encode format.
1014 TUid iDtor_ID_Key; // do not move - referenced inline in ~CMMFFormatDecode()
1015 TUid iImplementationUid; // do not move - referenced inline in ImplementationUid()
1019 class CMMFFormatPluginSelectionParameters;
1025 Provides an internal utility function to choose a format plugin from ECom.
1027 class MMFFormatEcomUtilities
1030 //Internal utility function to choose a format plugin from ECOM
1031 static TUid SelectFormatPluginL(const CMMFFormatPluginSelectionParameters& aSelectParams);
1033 // Internal utility function to instantiate each format decode plugin in turn
1034 // until we find one that works
1035 static CMMFFormatDecode* SelectFormatDecodePluginL(const CMMFFormatPluginSelectionParameters& aSelectParams, MDataSource* aSource);
1037 static CMMFFormatDecode* SelectFormatDecodePluginL(const CMMFFormatPluginSelectionParameters& aSelectParams, MDataSource* aSource, TBool& aSupportsCustomInterfaces);
1040 #include <mmf/server/mmfformat.inl>