javauis/mmapi_qt/baseline/inc.emc/cmmaemcresolver.h
changeset 23 98ccebc37403
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
       
     1 /*
       
     2 * Copyright (c) 2008 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMMAEMCRESOLVER_H
       
    19 #define CMMAEMCRESOLVER_H
       
    20 
       
    21 #include <MimeTypes.h>
       
    22 #include "cmmaplayer.h"
       
    23 
       
    24 //Supported file extensions
       
    25 
       
    26 _LIT(K3g2FileExtension, ".3g2");
       
    27 _LIT(K3gpFileExtension, ".3gp");
       
    28 _LIT(KAacFileExtension, ".aac");
       
    29 _LIT(KAmrFileExtension, ".amr");
       
    30 _LIT(KAwbFileExtension, ".awb");
       
    31 _LIT(KM4aFileExtension, ".m4a");
       
    32 _LIT(KMp3FileExtension, ".mp3");
       
    33 _LIT(KMp4FileExtension, ".mp4");
       
    34 _LIT(KWmaFileExtension, ".wma");
       
    35 _LIT(KRmFileExtension, ".rm");
       
    36 _LIT(KRaFileExtension, ".ra");
       
    37 
       
    38 const TInt KContentTypeMaxLength = 30;
       
    39 
       
    40 
       
    41 //  CLASS DECLARATION
       
    42 
       
    43 NONSHARABLE_CLASS(CMMAEMCResolver): public CBase
       
    44 
       
    45 {
       
    46 public: // Construction
       
    47     /**
       
    48      * Constructs a new mmf resolver object.
       
    49      * @return The new object created.  Note that the new object will be
       
    50      * left on the cleanup stack.
       
    51      */
       
    52     static CMMAEMCResolver* NewLC();
       
    53 
       
    54 public: // New methods.
       
    55 
       
    56     HBufC* ContentTypeOwnership();
       
    57 
       
    58     HBufC8* MimeTypeOwnership();
       
    59 
       
    60     /**
       
    61      * Returns content type
       
    62      */
       
    63     HBufC* ContentType();
       
    64 
       
    65     /**
       
    66      * Sets filename
       
    67      * @param aFileName File name to be set or NULL
       
    68      */
       
    69 
       
    70     void SetFileNameL(const TDesC* aFileName);
       
    71 
       
    72     /**
       
    73      * Sets Mime Type
       
    74      * @param aFileName File name to be set or NULL
       
    75      */
       
    76 
       
    77     void SetMimeTypeL(const TDesC* aFileName);
       
    78 
       
    79     /**
       
    80      * Returns possible filename or NULL if not set
       
    81      * Ownership is transfered.
       
    82      * @return Content type or NULL if type is not available.
       
    83      */
       
    84     HBufC* FileNameOwnership();
       
    85 
       
    86     /**
       
    87      * Get all supported content types.
       
    88      * @param aMimeTypeArray Will contain supported mime types.
       
    89      */
       
    90     void GetSupportedContentTypesL(CDesC16Array& aMimeTypeArray);
       
    91 
       
    92 
       
    93 private:
       
    94 
       
    95     /** Finds content type from given File name.
       
    96     */
       
    97     void ResolveContentTypeL(const TDesC& aFileName, TDes8& aMimeType);
       
    98 
       
    99     void ResolveContentTypeL();
       
   100 
       
   101 private:
       
   102     ~CMMAEMCResolver();
       
   103 
       
   104 private:
       
   105 
       
   106     // Owned. Ownership can be transferred with ContentType method.
       
   107     HBufC* iContentType;
       
   108 
       
   109     // Owned. Ownership can be transferred with MimeType method.
       
   110     HBufC8* iMimeType;
       
   111 
       
   112     // Owned. Ownership can be transferred with FileName method.
       
   113     HBufC* iFileName;
       
   114 
       
   115 public: // new method
       
   116     void SetSourceInfoL(const HBufC8* aHeaderData);
       
   117 
       
   118 private:
       
   119     TBool IsRealVideoTypeL(const TDesC8& aHeader);
       
   120 
       
   121     TBool IsRealMimeTypeSupported(const TDesC& aMimeType);
       
   122 
       
   123 private: // Data
       
   124     const HBufC8* iHeaderData; // not owned
       
   125 };
       
   126 
       
   127 #endif // CMMAEMCRESOLVER_H