mmserv/metadatautility/Src/3GPExtParser.h
changeset 0 71ca22bcf22a
child 18 a36789189b53
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 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:  This class implements an 3GPExt metadata parser 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C3GPEXTPARSER_H
       
    21 #define C3GPEXTPARSER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <mp4lib.h>
       
    26 
       
    27 #include "MetaDataFieldContainer.h"
       
    28 #include "MetaDataField.hrh"
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 _LIT8 (K3GPExtMetaTitleFormat, "%cnam"); 
       
    33 _LIT8 (K3GPExtMetaArtistFormat, "%cART"); 
       
    34 _LIT8 (K3GPExtMetaComposerFormat, "%cwrt"); 
       
    35 _LIT8 (K3GPExtMetaAlbumFormat, "%calb"); 
       
    36 _LIT8 (K3GPExtMetaCommentFormat, "%ccmt"); 
       
    37 _LIT8 (K3GPExtMetaCustomGenreFormat, "%cgen");  // mapped to rating
       
    38 _LIT8 (K3GPExtMetaYearFormat, "%cday"); 
       
    39 _LIT8 (K3GPExtMetaGenre, "gnre");
       
    40 _LIT8 (K3GPExtMetaTrack, "trkn"); 
       
    41 _LIT8 (K3GPExtMetaJpeg, "covr"); 
       
    42 
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47 *  This class implements an 3GPExt metadata parser.
       
    48 *
       
    49 *  @lib 3GPExtParser.lib
       
    50 *  @since 3.0
       
    51 */
       
    52 class C3GPExtParser : public CBase
       
    53 	{
       
    54     public:  // Constructors and destructor
       
    55 
       
    56         /**
       
    57         * Two-phased constructor.
       
    58         * @return A pointer to a new instance of parser; NULL if parser is not created.
       
    59         */
       
    60         IMPORT_C static C3GPExtParser* NewL(MP4Handle& aMP4Handle);
       
    61 
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         IMPORT_C virtual ~C3GPExtParser();
       
    66         
       
    67         /**
       
    68 		* Extract meta data boxes from ilst
       
    69 		* @since 3.0
       
    70 		* @param aBox wanted metadata box
       
    71         * @param aFieldId metadata field in 3GPExtParser
       
    72 		* @return void
       
    73 		*/
       
    74 		IMPORT_C void GetilstBoxesL(const TDesC8& aBox, TMetaDataFieldId aFieldId, HBufC** aBuf);
       
    75 		/**
       
    76 		* Extract meta data boxes from ilst
       
    77 		* 8-bit version to support international languages in string metadata
       
    78 		* @since 3.1
       
    79 		* @param aBox wanted metadata box
       
    80         * @param aFieldId metadata field in 3GPExtParser
       
    81 		* @return void
       
    82 		*/
       
    83 		IMPORT_C void GetilstBoxesL(const TDesC8& aBox, TMetaDataFieldId aFieldId, HBufC8** aBuf);
       
    84 				
       
    85 		/** 
       
    86 		* Checks if file has 3GPExt metadata
       
    87 		*/ 
       
    88 		IMPORT_C TBool Is3GPExtMetadataL();
       
    89 
       
    90  	private:
       
    91 
       
    92         /**
       
    93         * C++ default constructor.
       
    94         */
       
    95 		C3GPExtParser(MP4Handle& aMP4Handle);
       
    96 
       
    97         /**
       
    98         * By default Symbian 2nd phase constructor is private.
       
    99         */
       
   100 		void ConstructL();
       
   101 		
       
   102 		/**
       
   103         * Maps ID3v1 genre integer to string
       
   104         * @param aNum genre integer code
       
   105         * @param aGenrePtr string genre value returned
       
   106         * @since 3.0
       
   107         * @return void
       
   108         */
       
   109 		void MapID3GenreToString(TInt aNum, TDes& aGenrePtr);
       
   110 		
       
   111 		/**
       
   112         * Translates error code from MP4 library to one of System Errors.
       
   113         * @since 3.0
       
   114         * @param aError error code from MP4 library
       
   115         * @return System error
       
   116         */
       
   117 		TInt TranslateMP4Err( MP4Err aError );
       
   118 
       
   119 		/**
       
   120         * Parses iList Boxes
       
   121         * @since 3.0
       
   122         * @param none
       
   123         * @return void 
       
   124         */
       
   125 		void ParseIlstBoxesL();
       
   126 
       
   127 	private:
       
   128 	
       
   129 		// MP4 Handle
       
   130 		MP4Handle& iMP4Handle;
       
   131 		// ilst box
       
   132 		TPtrC8 ilst;
       
   133 		// 3GPExt metadata exists
       
   134 		TBool iExists;
       
   135 		// local chunk
       
   136 		RChunk iChunk;
       
   137 		// chuck status
       
   138 		TInt iChunkStatus;
       
   139  			
       
   140 		
       
   141 		TUint32 iTitleOffset;
       
   142 		TUint32 iTitleSize;
       
   143  		TUint32 iArtistOffset;	
       
   144  		TUint32 iArtistSize;
       
   145  		TUint32 iComposerOffset;
       
   146  		TUint32 iComposerSize;
       
   147  		TUint32 iAlbumOffset;
       
   148  		TUint32 iAlbumSize;
       
   149  		TUint32 iCommentOffset;
       
   150  		TUint32 iCommentSize;
       
   151  		TUint32 iCustomGenreOffset;
       
   152  		TUint32 iCustomGenreSize;
       
   153  		TUint32 iYearOffset;
       
   154  		TUint32 iYearSize;
       
   155  		TUint32 iGenreOffset;
       
   156  		TUint32 iGenreSize;
       
   157  		TUint32 iTrackNumberOffset;
       
   158  		TUint32 iTrackNumberSize;
       
   159  		TUint32 iCoverOffset;
       
   160  		TUint32 iCoverSize;
       
   161  		
       
   162  	public:
       
   163  				// constants
       
   164 		TBuf8<4> K3GPExtMetaTitle;
       
   165 		TBuf8<4> K3GPExtMetaArtist;
       
   166 		TBuf8<4> K3GPExtMetaComposer;
       
   167 		TBuf8<4> K3GPExtMetaAlbum;
       
   168 		TBuf8<4> K3GPExtMetaComment;
       
   169 		TBuf8<4> K3GPExtMetaCustomGenre;
       
   170 		TBuf8<4> K3GPExtMetaYear;
       
   171     };
       
   172 
       
   173 #endif      // C3GPEXTPARSER_H
       
   174 
       
   175 // End of File