First public contribution.
1 // Copyright (c) 2006-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.
22 // Utility class for performing bit operations.
32 void SetExtensionFlag(){ iFlags |= KBit0; }
33 void SetBit(TUint32 aMask) { iFlags |= aMask; }
35 TUint32 GetBitField(TUint32 aMask, TUint8 aRightShift = 0)
37 return ((iFlags & aMask) >> aRightShift);
51 static TBool ReadAndSkipID3L(CReader& aReader);
56 // A raw-AAC audio file parser.
61 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);
64 TAACParser(CReader& aReader, TFlags& aFlags);
66 TInt CheckForFrameHeaderL(TInt& aFrameLength);
75 // A raw-MP3 audio file parser.
80 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);
83 TMP3Parser(CReader& aReader, TFlags& aFlags);
85 TInt CheckForFrameHeaderL(TInt& aFrameLength);
94 // An MPEG4 container file format parser.
96 #define KMPEG4BoxTitleLen 4
101 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);
104 TMPEG4Parser(CReader& aReader, TFlags& aFlags);
105 const TText8* MatchFileType(const TDesC& aExt);
106 static TInt IsCompatibleBrand(TUint32 aBrand, TInt aStartPos = 0);
110 void SkipCurrentBoxL();
111 void ReadBoxHeaderL();
112 void ReadFileTypeL();
115 void ReadTrackHeaderL();
121 TUint32 iTitle; // The title of the current box.
124 TInt64 iSize; // The current box's size.
133 // An MPEG2 container file format parser.
138 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);
141 TMPEG2Parser(CReader& aReader, TFlags& aFlags);
143 TBool NextStartCodeL();
144 void ReadPackHeaderL();
146 const TText8* MatchExtension(const TDesC& aExt);
155 // A Matroska container file format parser.
157 class TMatroskaParser
160 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);
163 TMatroskaParser(CReader& aReader, TFlags& aFlags);
165 TUint64 ReadDataL(TBool aTurnOffHighestSetBit = EFalse);
166 void ReadElementL(TUint64& aElementID, TInt64& aSize);
167 TBool ReadSegmentL(TUint64& aNextID, TInt64& aNextSize);
168 TBool ReadTrackL(TInt64 aTrackSize);
169 const TText8* MatchExtension(const TDesC& aExt);
178 // A Windows Media ASF file format parser.
183 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);
186 TASFParser(CReader& aReader, TFlags& aFlags);
188 void ReadObjectL(TDes8& aGUID, TInt64& aSize);
189 void ReadGUIDL(TDes8& aGUID);
190 const TText8* MatchExtension(const TDesC& aExt, TBool aVideo);
199 // A RealMedia file format parser.
204 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);
207 TRMParser(CReader& aReader, TFlags& aFlags);
209 void ReadChunkHeaderL(TUint32& aObjectId, TUint32& aSize, TBool aFirstChunk = EFalse);
210 void MatchExtension(const TDesC& aFileExt);
211 TBool ReadMediaPropertiesL();
220 // A RAM file parser.
225 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);
230 // An SDP file parser.
235 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);
240 // An XPS file parser.
245 static void DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch);