upnpsharing/upnpdlnaprofiler/inc/upnpaudiosolverbase.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:      Base DLNA profile resolver class for audio files.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef C_UPNPAUDIOSOLVERBASE_H
       
    24 #define C_UPNPAUDIOSOLVERBASE_H
       
    25 
       
    26 
       
    27 // system includes
       
    28 #include <mda/client/utility.h> // MMdaObjectStateChangeObserver
       
    29 #include <mda/common/audio.h> // TMdaFileClipLocation
       
    30 #include <mmf/common/mmfutilities.h> // TFourCC
       
    31 
       
    32 // user includes
       
    33 #include "upnpprofiler.h"
       
    34 
       
    35 // forward declarations
       
    36 class CMdaAudioConvertUtility;
       
    37 class TMdaFileClipLocation;
       
    38 
       
    39 // constants
       
    40 // NONE
       
    41 
       
    42 /**
       
    43  *  Audio file DLNA profile base resolver class.
       
    44  *
       
    45  *  This class is the base class for resolving DLNA profile of audio files.
       
    46  *  It contains methods for querying the profiles supported by this solver 
       
    47  *  and for resolving a DLNA profile of a given audio file.
       
    48  *
       
    49  *
       
    50  *  @lib dlnaprofiler.lib
       
    51  *  @since S60 v3.1
       
    52  */
       
    53 NONSHARABLE_CLASS( CUpnpAudioSolverBase ) : 
       
    54                                         public CBase,
       
    55                                         public MUpnpProfiler, 
       
    56                                         public MMdaObjectStateChangeObserver
       
    57     {
       
    58 
       
    59 public:
       
    60 
       
    61     static CUpnpAudioSolverBase* NewL();
       
    62 
       
    63     static CUpnpAudioSolverBase* NewLC();
       
    64 
       
    65     virtual ~CUpnpAudioSolverBase();
       
    66 
       
    67 // from base class MUpnpProfiler
       
    68 
       
    69     /**
       
    70      * From MUpnpProfiler.
       
    71      * SupportedProfilesL returns DLNA profiles that are currently supported.
       
    72      *
       
    73      * @since S60 v3.1
       
    74      * @param aProfiles Descriptor array where supported DLNA profiles are 
       
    75      *                  added.
       
    76      * @return TInt Error code, KErrNone if successfull.
       
    77      */
       
    78     TInt SupportedProfilesL( CDesC16ArrayFlat* aProfiles ) const;
       
    79 
       
    80     /**
       
    81      * From MUpnpProfiler.
       
    82      * ProfileForFileL is for resolving a DLNA profile of a given file.
       
    83      * Besides of file name, also mime type of the file is passed as a 
       
    84      * parameter in order to avoid re-opening of the file.
       
    85      *
       
    86      * @since S60 v3.1
       
    87      * @param aFileName Filename of the file which is to be resolved.
       
    88      * @param aMimeType Mime type of the file which is to be resolved.
       
    89      * @param aFile Handle to opened file specified by aFilename.
       
    90      * @return DLNA profile of the file as a HBufC*, 
       
    91      *         NULL if could not be resolved
       
    92      */
       
    93     HBufC* ProfileForFileL( const TDesC& aFilename, 
       
    94                             const TDesC8& aMimetype, 
       
    95                             RFile& aFile );
       
    96 
       
    97 private:
       
    98 
       
    99     CUpnpAudioSolverBase();
       
   100 
       
   101     void ConstructL();
       
   102 
       
   103     /**
       
   104      * GetAudioFileInformationL
       
   105      *
       
   106      * @since S60 v3.1
       
   107      * @param aFileName Filename of the file which is to be resolved.
       
   108      * @return Error code. KErrNone if successfull.
       
   109      */
       
   110     TInt GetAudioFileInformationL( const TDesC& aFilename );
       
   111 
       
   112     
       
   113 // from base class MMdaObjectStateChangeObserver
       
   114 
       
   115     /**
       
   116      * From MMdaObjectStateChangeObserver.
       
   117      * MoscoStateChangeEvent 
       
   118      *
       
   119      * @since S60 v3.1
       
   120      * @param aObject
       
   121      * @param aPreviousState
       
   122      * @param aCurrentState
       
   123      * @param aErrorCode
       
   124      */
       
   125     void MoscoStateChangeEvent( CBase *aObject, TInt aPreviousState, 
       
   126                                 TInt aCurrentState, TInt aErrorCode );
       
   127 
       
   128     /**
       
   129      * Determine3GppProfileL chooses the correct profile among supported 3gpp 
       
   130      * profiles. The decision is made based on audio file attributes that 
       
   131      * are stored in member variables of this class. 
       
   132      *
       
   133      * @since S60 v3.1
       
   134      * @return HBufC*. Pointer to string descriptor containing the profile.
       
   135      */
       
   136     HBufC* Determine3GppProfileL() const;
       
   137 
       
   138     /**
       
   139      * DetermineWmaProfileL chooses the correct profile among supported wma 
       
   140      * profiles. The decision is made based on audio file attributes that 
       
   141      * are stored in member variables of this class. 
       
   142      *
       
   143      * @since S60 v3.1
       
   144      * @return HBufC*. Ponter to string descriptor containing the profile.
       
   145      */
       
   146     HBufC* DetermineWmaProfileL() const;
       
   147 
       
   148     /**
       
   149      * DetermineMp4ProfileL chooses the correct profile among supported mp4 
       
   150      * profiles. The decision is made based on audio file attributes that 
       
   151      * are stored in member variables of this class. 
       
   152      *
       
   153      * @since S60 v3.1
       
   154      * @return HBufC*. Pointer to string descriptor containing the profile.
       
   155      */
       
   156     HBufC* DetermineMp4ProfileL() const;
       
   157 
       
   158 private: // data
       
   159     CMdaAudioConvertUtility*    iAudioconverter; // owned
       
   160     CActiveSchedulerWait*       iWait; // owned
       
   161     
       
   162     // attributes related to audio file attributes. 
       
   163     TUint iChannelCount;
       
   164     TUint iSampleRate;
       
   165     TUint iBitrate;
       
   166     };
       
   167 
       
   168 #endif // C_UPNPAUDIOSOLVERBASE_H