audiostubs/devsoundextensions_stubs/mmfdevsoundadaptation_stub/src/DevSoundUtility.h
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Audio Stubs -  Class that provides API to list ECOM plugin implementation IDs
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MMFDEVSOUNDUTILITY_H
       
    21 #define MMFDEVSOUNDUTILITY_H
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #include <ecom.h>
       
    26 #include <badesca.h>
       
    27 
       
    28 #include "mmfutilities.h" // For TFourCC
       
    29 
       
    30 #define KFOURCCLENGTH 4
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  Utility class.
       
    36 *
       
    37 *  @lib MmfDevSoundAdaptation.lib
       
    38 *  @since S60 3.0
       
    39 */
       
    40 class TMMFRawPackage
       
    41     {
       
    42     public:
       
    43 
       
    44         /**
       
    45         * Returns a descriptor reference.
       
    46         * @since S60 3.0
       
    47         * @return TPtr8& A descriptor reference
       
    48         */
       
    49         inline TPtr8& Package();
       
    50 
       
    51         /**
       
    52         * Returns a constant descriptor reference.
       
    53         * @since S60 3.0
       
    54         * @return TPtr8& A constant descriptor reference
       
    55         */
       
    56         inline const TPtr8& Package() const;
       
    57 
       
    58     protected:
       
    59 
       
    60         /**
       
    61         * Constructor.
       
    62         * @since S60 3.0
       
    63         * @param TInt aDerivedSize Size of the descriptor.
       
    64         */
       
    65         TMMFRawPackage(TInt aDerivedSize);
       
    66 
       
    67         /**
       
    68         * Sets the size of the descriptor.
       
    69         * @since S60 3.0
       
    70         * @param TInt aDerivedSize New descriptor size.
       
    71         * @return void
       
    72         */
       
    73         inline void SetSize(TInt aDerivedSize);
       
    74 
       
    75     protected:
       
    76         TPtr8 iThis;
       
    77     };
       
    78 
       
    79 // CLASS DECLARATION
       
    80 
       
    81 /**
       
    82 *  Utlilty class used for Fixed Sequences.
       
    83 *
       
    84 *  @lib MmfDevSoundAdaptation.lib
       
    85 *  @since S60 3.0
       
    86 */
       
    87 class TMMFToneFixedSequenceNames : public TMMFRawPackage
       
    88     {
       
    89     public:
       
    90 
       
    91         /**
       
    92         * Constructor.
       
    93         * @since S60 3.0
       
    94         */
       
    95         inline TMMFToneFixedSequenceNames();
       
    96 
       
    97     public:
       
    98         TInt iCount;
       
    99     };
       
   100 
       
   101 // CLASS DECLARATION
       
   102 
       
   103 /**
       
   104 *  Utlilty class used for Fixed Sequences.
       
   105 *
       
   106 *  @lib MmfDevSoundAdaptation.lib
       
   107 *  @since S60 3.0
       
   108 */
       
   109 class HMMFToneFixedSequenceNames : public TMMFToneFixedSequenceNames
       
   110     {
       
   111     public:
       
   112 
       
   113         /**
       
   114         * Constructor.
       
   115         * @since S60 3.0
       
   116         */
       
   117         HMMFToneFixedSequenceNames();
       
   118 
       
   119         /**
       
   120         * Adds name to this object.
       
   121         * @since S60 3.0
       
   122         * @param const TDesC& aName A descriptor containing name to be added.
       
   123         * @return HMMFToneFixedSequenceNames* A pointer to this object.
       
   124         */
       
   125         HMMFToneFixedSequenceNames* AddNameL(const TDesC& aName);
       
   126     };
       
   127 
       
   128 
       
   129 // CLASS DECLARATION
       
   130 
       
   131 /**
       
   132 *  Utility class.used by DevSound.
       
   133 *
       
   134 *  @lib MmfDevSoundAdaptation.lib
       
   135 *  @since S60 3.0
       
   136 */
       
   137 class CMMFDevSoundUtility : public CBase
       
   138     {
       
   139     public:  // Constructors and destructor
       
   140 
       
   141         /**
       
   142         * Constructs, and returns a pointer to, a new CMMFDevSound object.
       
   143         * Leaves on failure.
       
   144         * @return CMMFDevSoundUtility* A pointer to newly created utlitly object.
       
   145         */
       
   146         static CMMFDevSoundUtility* NewL();
       
   147 
       
   148         /**
       
   149         * Constructs, leaves object on the cleanup stack, and returns a pointer
       
   150         * to, a new CMMFDevSound object.
       
   151         * Leaves on failure.
       
   152         * @return CMMFDevSoundUtility* A pointer to newly created utlitly object.
       
   153         */
       
   154         static CMMFDevSoundUtility* NewLC();
       
   155 
       
   156         /**
       
   157         * Destructor.
       
   158         */
       
   159         ~CMMFDevSoundUtility();
       
   160 
       
   161     public: // New functions
       
   162 
       
   163         /**
       
   164         * Finds the ECom plugins based on FourCC.
       
   165         * @since S60 3.0
       
   166         * @param TUid aInterfaceUid The interface Uid where to look for the plugin.
       
   167         * @param RImplInfoPtrArray& aPlugInArray The array of ECom plugins Uids
       
   168         *        that will be filled in by this function.
       
   169         * @param const TFourCC& aSrcDataType The source data type.
       
   170         * @param const TFourCC& aDstDataType The destination data type.
       
   171         * @return void
       
   172         */
       
   173         void SeekUsingFourCCLC(TUid aInterfaceUid,
       
   174                                RImplInfoPtrArray& aPlugInArray,
       
   175                                const TFourCC& aSrcDataType,
       
   176                                const TFourCC& aDstDataType,
       
   177                                const TDesC& aPreferredSupplier);
       
   178 
       
   179         /**
       
   180         * local function to disable items which do not match the preferred
       
   181         * supplier. Note that at least one enabled item is returned (if there
       
   182         * was an enabled item to begin with) which may not match the preferred
       
   183         * supplier.
       
   184         * @since S60 3.0
       
   185         * @param RImplInfoPtrArray& aPlugInArray An array containing the list of
       
   186         *        ECom plugin Uids.
       
   187         * @param const TDesC &aPreferredSupplier Additional resolution criteria
       
   188         *        when searching for ECom plugin. If this is provided, the list
       
   189         *        of matching plugins will be further searched for the latest
       
   190         *        version of a plugin supplied by supplier named. Note that the
       
   191         *        display name field is parsed for a match.
       
   192         * @return void
       
   193         */
       
   194         void SelectByPreference(RImplInfoPtrArray& aPlugInArray, const TDesC& aPreferredSupplier);
       
   195 
       
   196         /*
       
   197         *  This method looks for hwDevicePlugins that support the state given in
       
   198         * aState which must be either EMMFStatePlaying or EMMFStateRecording for
       
   199         * each HwDevice plugin found the datatype as indicated by its FourCC
       
   200         * code from the default_data field in the resource file is added to the
       
   201         * array of aSupportedDataTypes
       
   202         * Leaves on failure.
       
   203         * @since S60 3.0
       
   204         * @param RArray<TFourCC>& aSupportedDataTypes An array of fourCC codes
       
   205         *        that has a fourCC code added to for each hardware device found.
       
   206         * @param TMMFState aState EMMFStatePlaying if seeking HwDevice plugins
       
   207         *        that support play and EMMFStateRecording if seeking HwDevice
       
   208         *        plugins that support record        *
       
   209         * @return void
       
   210         */
       
   211         void SeekHwDevicePluginsL(RArray<TFourCC>& aSupportedDataTypes, TMMFState aState);
       
   212 
       
   213         /**
       
   214         * Initializes the names of Fixed Sequences.
       
   215         * Leaves on failure.
       
   216         * @since S60 3.0
       
   217         * @param CPtrC8Array** aFixedSequences A pointer to a pointer reference
       
   218         *        which will be populated with Fixed Sequence names when this
       
   219         *        funtion returns.
       
   220         * @return void
       
   221         */
       
   222         void InitializeFixedSequenceL(CPtrC8Array** aFixedSequences);
       
   223 
       
   224         /**
       
   225         * Recognizes tone sequence.
       
   226         * @since S60 3.0
       
   227         * @param const TDesC8& aData A reference to descriptor containing tone
       
   228         *        sequence.
       
   229         * @return ETrue of the sequence starts with 'SQNC' else EFalse.
       
   230         */
       
   231         TBool RecognizeSequence(const TDesC8& aData);
       
   232 
       
   233         /**
       
   234         * Returns a descriptor reference containing name of the fixed sequence.
       
   235         * @since S60 3.0
       
   236         * @param TInt aSequenceNumber Sequence number.
       
   237         * @return A constant reference to descriptor.
       
   238         */
       
   239         const TDesC& FixedSequenceName(TInt aSequenceNumber);
       
   240 
       
   241     private:
       
   242 
       
   243         /*
       
   244         * This method takes a given resource entry from a hardware device and
       
   245         * determines whether the hwdevice plugin is a data type match for
       
   246         * playing or recording depending on the setting of aState. The method
       
   247         * matchs the default_data field from the hw device resource entry
       
   248         * matching it with the aHwMatchFourCC code.
       
   249         * @since S60 3.0
       
   250         * @param CImplementationInformation aHwDeviceResourceEntry The hw device
       
   251         *        resource entry that is to be checked whether it can be used to
       
   252         *        play or record
       
   253         * @param TDesC8& aHwMatchFourCC The data type FourCC code to match to
       
   254         *        that the hardware device that must convert to for playing and
       
   255         *        convert from for recording - for the reference DevSound this
       
   256         *        is always ' P16' ie pcm16
       
   257         * @param TMMFState aState EMMFStatePlaying for playing and
       
   258         *        EMMFStateRecording for recording
       
   259         * @return ETrue if a match for play or record else EFalse.
       
   260         */
       
   261         TBool IsDataTypeMatch(CImplementationInformation* hwDeviceResourceEntry,
       
   262                               const TDesC8& fourCCPtrPCM16,
       
   263                               TMMFState aState);
       
   264 
       
   265 
       
   266     private:
       
   267 
       
   268         /**
       
   269         * C++ default constructor.
       
   270         */
       
   271         CMMFDevSoundUtility();
       
   272 
       
   273         /**
       
   274         * By default Symbian 2nd phase constructor is private.
       
   275         */
       
   276         void ConstructL();
       
   277 
       
   278     private:    // Data
       
   279         //data_declaration;
       
   280 
       
   281         HMMFToneFixedSequenceNames* iFixedSequenceNames;
       
   282         HBufC8* iInfo;
       
   283 
       
   284     };
       
   285 
       
   286 #endif // MMFDEVSOUNDUTILITY_H
       
   287 
       
   288 // End of File