os/mm/mmplugins/lib3gp/wrapper/inc/c3gplibrary.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmplugins/lib3gp/wrapper/inc/c3gplibrary.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,566 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef C3GPLIBRARY_H
    1.20 +#define C3GPLIBRARY_H
    1.21 +
    1.22 +#include <f32file.h>
    1.23 +#include <f32file64.h>
    1.24 +#include <caf/content.h>
    1.25 +#include <e32base.h>
    1.26 +#include <3gplibrary/mp4lib.h>
    1.27 +
    1.28 +/**
    1.29 +Error code for C3GPParse API
    1.30 +
    1.31 +3GP Parser requires more data before the requested information can be retrieved
    1.32 +*/
    1.33 +const TInt KErr3gpLibMoreDataRequired = (-12300);
    1.34 +
    1.35 +class M3GPParseCallback;
    1.36 +
    1.37 +/** 
    1.38 +File format to use when composing a file.
    1.39 +@publishedPartner
    1.40 +@released
    1.41 +*/
    1.42 +enum T3GPFileFormatType
    1.43 +	{
    1.44 +	/** 3GP file format. */
    1.45 +	E3GP3GP,
    1.46 +	/** MPEG-4 file format. */
    1.47 +	E3GPMP4,
    1.48 +	/** 3GPP2 file format. */
    1.49 +	E3GP3G2
    1.50 +	};
    1.51 +
    1.52 +/** 
    1.53 +Optional flags to be used when composing a file.
    1.54 +@publishedPartner
    1.55 +@released
    1.56 +*/
    1.57 +enum T3GPComposeFlag
    1.58 +	{
    1.59 +	/** Default value. No special setup. */
    1.60 +	E3GPNoFlag = 0x0000,
    1.61 +	/** Metadata is placed at end of file. */
    1.62 +	E3GPMetaDataLast = 0x0001,
    1.63 +	/** Collect metadata in files instead of storing it in memory. */
    1.64 +	E3GPLongClip = 0x0002, 
    1.65 +	};
    1.66 +
    1.67 +/** 
    1.68 +Type of stream contained in the file.
    1.69 +@publishedPartner
    1.70 +@released
    1.71 +*/
    1.72 +enum T3GPFrameType
    1.73 +	{
    1.74 +	/** Frame contains audio data. */
    1.75 +	E3GPAudio,
    1.76 +	/** Frame contains video data. */
    1.77 +	E3GPVideo
    1.78 +	};
    1.79 +
    1.80 +/** 
    1.81 +Type of video stream contained in the file. 
    1.82 +@publishedPartner
    1.83 +@released
    1.84 +*/
    1.85 +enum T3GPVideoType
    1.86 +	{
    1.87 +	/** No Video */
    1.88 +	E3GPNoVideo,
    1.89 +	/** MPEG-4 video (MPEG-4 Part 2) - Simple and Advance Simple Profiles */
    1.90 +	E3GPMpeg4Video, 
    1.91 +	/** H263 Profile 0  */
    1.92 +	E3GPH263Profile0, 
    1.93 +	/** H263 Profile 3 */
    1.94 +	E3GPH263Profile3,
    1.95 +	/** AVC (also known as H.264) Baseline Profile */               
    1.96 +	E3GPAvcProfileBaseline,
    1.97 +	/** AVC (also known as H.264) Main Profile */               
    1.98 +    E3GPAvcProfileMain,
    1.99 +    /** AVC (also known as H.264) Extended Profile */               
   1.100 +    E3GPAvcProfileExtended,
   1.101 +    /** AVC (also known as H.264) High Profile */               
   1.102 +    E3GPAvcProfileHigh
   1.103 +	};
   1.104 +
   1.105 +
   1.106 +/** 
   1.107 +Type of audio stream contained in the file.
   1.108 +@publishedPartner
   1.109 +@released
   1.110 +*/
   1.111 +enum T3GPAudioType
   1.112 +	{
   1.113 +	/** No audio */
   1.114 +	E3GPNoAudio,
   1.115 +	/** MPEG-4 audio (MPEG-4 Part 3) */
   1.116 +	E3GPMpeg4Audio,
   1.117 +	/** AMR NB */
   1.118 +	E3GPAmrNB,   
   1.119 +	/** AMR WB */   
   1.120 +	E3GPAmrWB,
   1.121 +	/** QCELP 13K */
   1.122 +	E3GPQcelp13K
   1.123 +	};
   1.124 +
   1.125 +
   1.126 +/** 
   1.127 +Location of the user data in the file.
   1.128 +@publishedPartner
   1.129 +@released
   1.130 +*/
   1.131 +enum T3GPUdtaLocation
   1.132 +	{
   1.133 +	/** User data resides within the Movie Box. */
   1.134 +	E3GPUdtaMoov,
   1.135 +	/** User data resides within the Track Box for video. */
   1.136 +	E3GPUdtaVideoTrak,
   1.137 +	/** User data resides within the Track Box for audio. */
   1.138 +	E3GPUdtaAudioTrak
   1.139 +	};	
   1.140 +
   1.141 +/** 
   1.142 +Storage method of QCELP audio stream. 
   1.143 +@publishedPartner
   1.144 +@released
   1.145 +*/
   1.146 +enum T3GPQcelpStorageMode
   1.147 +	{
   1.148 +	/** QCELP Sample Entry ('sqcp') box is used for the storage of QCELP media data. */
   1.149 +	E3GPQcelpSampleEntryBox,
   1.150 +	/** MP4 Audio Sample Entry ('esds') box is used for the storage of QCELP media data. */
   1.151 +	E3GPMP4AudioDescriptionBox	
   1.152 +	};	
   1.153 +
   1.154 +/** 
   1.155 +Define the dependency information between video frames.
   1.156 +@publishedPartner
   1.157 +@released
   1.158 +*/
   1.159 +enum T3GPVideoFrameDependency
   1.160 +	{
   1.161 +	/** The dependency of this sample is unknown or the dependency of other 
   1.162 +	samples on this sample is unknown. */
   1.163 +	E3GPDependencyUnknown = 0,
   1.164 +	/** This sample does depend on others or other samples depend on this sample. */
   1.165 +	E3GPDependencyExists,
   1.166 +	/** This sample does not depend on others or no other sample depends on this sample. */
   1.167 +	E3GPDependencyNone,
   1.168 +	};	
   1.169 +
   1.170 +/** 
   1.171 +Define the existence of redundant coding in a frame.
   1.172 +@publishedPartner
   1.173 +@released
   1.174 +*/
   1.175 +enum T3GPVideoFrameRedundancy
   1.176 +	{
   1.177 +	/** It is unknown whether there is redundant coding in this sample. */
   1.178 +	E3GPRedundancyUnknown = 0,
   1.179 +	/** There is redundant coding in this sample. */
   1.180 +	E3GPRedundancyExists,
   1.181 +	/** There is no redundant coding in this sample. */
   1.182 +	E3GPRedundancyNone,
   1.183 +	};		
   1.184 +
   1.185 +/** 
   1.186 +Structure containing a frame's dependency information.
   1.187 +@publishedPartner
   1.188 +@released
   1.189 +*/
   1.190 +NONSHARABLE_STRUCT(T3GPFrameDependencies)
   1.191 +	{
   1.192 +	/** Defines the current frame’s dependency.  It can be defined as an I-frame 
   1.193 +	(E3GPDependencyNone), not an I-frame (E3GPDependencyExists), or dependency 
   1.194 +	unknown (E3GPDependencyUnknown).  See T3GPVideoFrameDependency.
   1.195 +	*/
   1.196 +	T3GPVideoFrameDependency iDependsOn;
   1.197 +	/** Defines the dependency of other frames on this frame. It can be defined as a disposable 
   1.198 +	frame (E3GPDependencyNone), non-disposable (E3GPDependencyExists), or dependency unknown 
   1.199 +	(E3GPDependencyUnknown).  See T3GPVideoFrameDependency.
   1.200 +	*/
   1.201 +	T3GPVideoFrameDependency iIsDependedOn;
   1.202 +	/** Defines the existence of redundant coding in this frame.  See T3GPVideoFrameRedundancy. */
   1.203 +	T3GPVideoFrameRedundancy iHasRedundancy;
   1.204 +	};
   1.205 +
   1.206 +/** 
   1.207 +Structure containing video frame properties.
   1.208 +@publishedPartner
   1.209 +@released
   1.210 +*/
   1.211 +NONSHARABLE_STRUCT(T3GPFrameInfoParameters)
   1.212 +	{
   1.213 +	/** Frame size. */
   1.214 +	TUint32 iSize;
   1.215 +	/** Frame start time. */
   1.216 +	TUint32 iStartTime;
   1.217 +	/** ETrue if frame is an intra or random access point. */
   1.218 +	TBool iIsRandomAccessPoint;
   1.219 +	};
   1.220 +
   1.221 +/**
   1.222 +This class should not be used directly.  It stores common properties amongst all supported 
   1.223 +types of video data. 
   1.224 +
   1.225 +Note: iTimescale should be chosen so that the duration of each sample is an integer.  It should also 
   1.226 +be chosen so that the duration of the presentation fits into 32 bits.
   1.227 +
   1.228 +@publishedPartner
   1.229 +@released
   1.230 +*/	
   1.231 +NONSHARABLE_CLASS(T3GPVideoPropertiesBase)
   1.232 +	{	
   1.233 +protected:
   1.234 +	/**
   1.235 + 	@internalTechnology
   1.236 + 	*/
   1.237 +	T3GPVideoPropertiesBase(T3GPVideoType aType, TUint aTimescale, const TSize& aSize);
   1.238 +public:
   1.239 +	/** Type of video stream contained in the file. */
   1.240 +	T3GPVideoType iType;
   1.241 +	/** Timescale of the video data.  This is the number of time units that pass in one second. */
   1.242 +	TUint iTimescale;
   1.243 +	/** Video width and height in pixels */
   1.244 +	TSize iSize;	
   1.245 +	};
   1.246 +
   1.247 +/** 
   1.248 +This structure stores the common and MPEG-4 video specific properties of video data
   1.249 +@publishedPartner
   1.250 +@released
   1.251 +*/
   1.252 +NONSHARABLE_CLASS(T3GPVideoPropertiesMpeg4Video) : public T3GPVideoPropertiesBase
   1.253 +	{
   1.254 +public:
   1.255 +	IMPORT_C T3GPVideoPropertiesMpeg4Video(TUint aTimescale, const TSize& aSize, TUint aMaxBitRate, TUint aAvgBitRate, const TDesC8& aDecoderSpecificInfo);
   1.256 +public:
   1.257 +	/** Maximum video bit rate */
   1.258 +	TUint iMaxBitRate;
   1.259 +	/** Average video bit rate */
   1.260 +	TUint iAvgBitRate;	
   1.261 +	/** MPEG-4 video decoder specific info data stored in an ESDS atom */
   1.262 +	const TDesC8& iDecoderSpecificInfo;
   1.263 +	};
   1.264 +
   1.265 +/** 
   1.266 +This structure stores the common and H.263 specific properties of video data 
   1.267 +@publishedPartner
   1.268 +@released
   1.269 +*/
   1.270 +NONSHARABLE_CLASS(T3GPVideoPropertiesH263) : public T3GPVideoPropertiesBase
   1.271 +	{
   1.272 +public:
   1.273 +	enum TProfile { EProfile0, EProfile3 };
   1.274 +
   1.275 +public:
   1.276 +	IMPORT_C T3GPVideoPropertiesH263(TUint aTimescale, const TSize& aSize, TInt aVideoLevel, TProfile aProfile);	
   1.277 +public:
   1.278 +	/** Indicates the H263 video level. */
   1.279 +	TInt iVideoLevel;
   1.280 +	};
   1.281 +
   1.282 +/** 
   1.283 +This structure stores the common and AVC-specific properties of video data. 
   1.284 +@publishedPartner
   1.285 +@released
   1.286 +*/
   1.287 +NONSHARABLE_CLASS(T3GPVideoPropertiesAvc) : public T3GPVideoPropertiesBase
   1.288 +	{
   1.289 +public:
   1.290 +	IMPORT_C T3GPVideoPropertiesAvc(TUint aTimescale, const TSize& aSize, const TDesC8& aDecoderSpecificInfo);	
   1.291 +public:
   1.292 +	/** AVCDecoderConfigurationRecord data that will be stored in the avcC atom. */
   1.293 +	const TDesC8& iDecoderSpecificInfo;
   1.294 +	};
   1.295 +
   1.296 +/** 
   1.297 +This class should not be used directly.  This structure stores common properties amongst all supported types of audio data 
   1.298 +@publishedPartner
   1.299 +@released
   1.300 +*/
   1.301 +NONSHARABLE_CLASS(T3GPAudioPropertiesBase)
   1.302 +	{
   1.303 +protected:
   1.304 +	/**
   1.305 + 	@internalTechnology
   1.306 + 	*/
   1.307 +	T3GPAudioPropertiesBase(T3GPAudioType aType, TUint aTimescale, TInt aFramesPerSample);
   1.308 +public:
   1.309 +	/** Type of audio stream contained in the file */
   1.310 +	T3GPAudioType iType;
   1.311 +	/** Timescale of the audio data.  This is the number of time units that pass in one second.  It 
   1.312 +	 must be smaller than 65536. */
   1.313 +	TUint iTimescale;
   1.314 +	/** Frames per sample.  It must be smaller than 512. MPEG-4 audio has a fixed value of 1. */
   1.315 +	TInt iFramesPerSample;
   1.316 +	};
   1.317 +
   1.318 +/** 
   1.319 +This structure stores the common and MPEG-4 audio specific properties of audio data 
   1.320 +@publishedPartner
   1.321 +@released
   1.322 +*/
   1.323 +NONSHARABLE_CLASS(T3GPAudioPropertiesMpeg4Audio) : public T3GPAudioPropertiesBase
   1.324 +	{
   1.325 +public:
   1.326 +	IMPORT_C T3GPAudioPropertiesMpeg4Audio(TUint aTimescale, const TDesC8& aDecoderSpecificInfo);
   1.327 +public:
   1.328 +	/** MPEG-4 audio decoder specific info data stored in an ESDS atom */
   1.329 +	const TDesC8& iDecoderSpecificInfo;	
   1.330 +	};
   1.331 +
   1.332 +/** 
   1.333 +This structure stores the common and AMR specific properties of audio data 
   1.334 +@publishedPartner
   1.335 +@released
   1.336 +*/
   1.337 +NONSHARABLE_CLASS(T3GPAudioPropertiesAmr) : public T3GPAudioPropertiesBase
   1.338 +	{
   1.339 +public:
   1.340 +	enum TSpeechCodec{ EAmrWB, EAmrNB };
   1.341 +
   1.342 +public:
   1.343 +	IMPORT_C T3GPAudioPropertiesAmr(TUint aTimescale, TInt aFramesPerSample, TInt aModeSet, TSpeechCodec aCodec);
   1.344 +public:	
   1.345 +	/** AMR mode set. */
   1.346 +	TInt iModeSet;
   1.347 +	};
   1.348 +
   1.349 +/** 
   1.350 +This structure stores the common and Qcelp specific properties of audio data 
   1.351 +@publishedPartner
   1.352 +@released
   1.353 +*/
   1.354 +NONSHARABLE_CLASS(T3GPAudioPropertiesQcelp) : public T3GPAudioPropertiesBase
   1.355 +	{
   1.356 +public:
   1.357 +	IMPORT_C T3GPAudioPropertiesQcelp(TUint aTimescale, TInt aFramesPerSample, const TDesC8& aDecoderSpecificInfo);
   1.358 +	IMPORT_C T3GPAudioPropertiesQcelp(TUint aTimescale, TInt aFramesPerSample);
   1.359 +public:	
   1.360 +	/** Specifies the mode to store QCELP audio data.
   1.361 +	In 3G2 files, QCELP can be registered to be stored in two ways:
   1.362 +	- Use QCELP Sample Entry (‘sqcp’) Box.  This is the default mode.
   1.363 +	- Use MPEG4 Audio Sample Description (‘esds’) Box.  If this mode is selected, decoder specific info should be supplied.
   1.364 +	See T3GPQcelpStorageMode. */
   1.365 +	T3GPQcelpStorageMode iMode;	
   1.366 +	/** MPEG-4 audio decoder specific info data stored in an ESDS atom.
   1.367 +	If this is provided as an input parameter, the storage mode is automatically set to MPEG4 Audio 
   1.368 +	Sample Description Box mode	 */
   1.369 +	const TDesC8& iDecoderSpecificInfo;
   1.370 +	};
   1.371 +
   1.372 +/** 
   1.373 +@publishedPartner
   1.374 +@released
   1.375 +
   1.376 +The 3GP composer accepts H.263 /H.264 / MPEG-4 / AVC video, and AMR / MPEG-4 AAC / QCELP 
   1.377 +audio as input to create a 3GP / 3G2 / MP4 file. 
   1.378 +*/
   1.379 +NONSHARABLE_CLASS(C3GPCompose) : public CBase
   1.380 +	{
   1.381 +public:
   1.382 +	IMPORT_C static C3GPCompose* NewL();
   1.383 +	IMPORT_C static C3GPCompose* NewL(TInt aMediaWriteBufferSize, TInt aWriteBufferMaxCount);	
   1.384 +	IMPORT_C ~C3GPCompose();
   1.385 +	
   1.386 +	IMPORT_C TInt Open(T3GPFileFormatType aFileFormat, const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio, const TDesC& aFilename, TUint aFlags = E3GPNoFlag);	
   1.387 +	IMPORT_C TInt Open(T3GPFileFormatType aFileFormat, const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio, RFile& aFile, TUint aFlags = E3GPNoFlag);
   1.388 +	IMPORT_C TInt Open(T3GPFileFormatType aFileFormat, const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio, RFile64& aFile, TUint aFlags = E3GPNoFlag);
   1.389 +	IMPORT_C TInt WriteVideoFrame(const TDesC8& aBuffer, TUint aDuration, TBool aKeyFrame);	
   1.390 +	IMPORT_C TInt WriteVideoFrame(const TDesC8& aBuffer, TUint aDuration, TBool aKeyFrame, const T3GPFrameDependencies& aDependencies);
   1.391 +	IMPORT_C TInt WriteAudioFrames(const TDesC8& aBuffer, TUint aDuration);
   1.392 +	IMPORT_C TInt SetUserData(T3GPUdtaLocation aLocation, const TDesC8& aBuffer);     	
   1.393 +	IMPORT_C TInt Complete();
   1.394 +private:
   1.395 +	C3GPCompose(TInt aMediaWriteBufferSize = 0, TInt aWriteBufferMaxCount = 0);
   1.396 +	
   1.397 +	TInt SymbianOSError(MP4Err aError);
   1.398 +	mp4_u32 Mp4Type(const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio);
   1.399 +	TInt SetComposeProperties(const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio, T3GPFileFormatType aFileFormat, TUint aFlag);
   1.400 +	TInt SetMPeg4VideoProperties(const T3GPVideoPropertiesBase* aVideo);
   1.401 +	TInt SetAvcVideoProperties(const T3GPVideoPropertiesBase* aVideo);
   1.402 +	TInt SetH263VideoProperties(const T3GPVideoPropertiesBase* aVideo);
   1.403 +	TInt SetMpeg4AudioProperties(const T3GPAudioPropertiesBase* aAudio);
   1.404 +	TInt SetAmrAudioProperties(const T3GPAudioPropertiesBase* aAudio);
   1.405 +	TInt SetQcelpAudioProperties(const T3GPAudioPropertiesBase* aAudio);
   1.406 +	TInt SetComposeFlag(T3GPFileFormatType aFileFormat, TUint aFlag);
   1.407 +	void Reset();
   1.408 +	static void Panic(TInt aPanic);
   1.409 +private:
   1.410 +	MP4Handle iHandler;
   1.411 +	TInt iMediaWriteBufferSize;
   1.412 +	TInt iWriteBufferMaxCount;
   1.413 +	TBool iHasVideo;
   1.414 +	TBool iHasAudio;
   1.415 +	TBool iDuplicateFileHandleCreated;
   1.416 +	RFile64 iFile;
   1.417 +	};
   1.418 +
   1.419 +
   1.420 +/**
   1.421 +The Parser provides APIs to parse 3GP, 3G2 and MP4 contents (from a file, a CAF object, or given 
   1.422 +through memory buffer), containing H.263/MPEG-4/H.264 video and AMR/MPEG-4/QCELP audio.
   1.423 +@publishedPartner
   1.424 +@released
   1.425 +*/
   1.426 +NONSHARABLE_CLASS(C3GPParse) : public CBase, public M3GPMP4LibAsyncObserver
   1.427 +	{
   1.428 +public:
   1.429 +	IMPORT_C static C3GPParse* NewL();
   1.430 +	IMPORT_C static C3GPParse* NewL(TInt aReadBufferSize);
   1.431 +	IMPORT_C ~C3GPParse();
   1.432 +	
   1.433 +	IMPORT_C TInt Open();
   1.434 +	IMPORT_C TInt Open(const TDesC& aFilename);
   1.435 +	IMPORT_C TInt Open(const RFile& aFile);
   1.436 +	IMPORT_C TInt Open(const RFile64& aFile);
   1.437 +	IMPORT_C TInt Open(const ContentAccess::CData& aData);
   1.438 +	IMPORT_C TInt InsertData(const TDesC8& aBuffer);
   1.439 +	IMPORT_C TInt GetVideoProperties(T3GPVideoType& aType, TUint& aLength, TReal& aFrameRate, TUint& aAvgBitRate, TSize& aSize, TUint& aTimeScale) const;
   1.440 +	IMPORT_C TInt GetAudioProperties(T3GPAudioType& aType, TUint& aLength, TInt& aFramesPerSample, TUint& aAvgBitRate, TUint& aTimeScale) const;
   1.441 +	IMPORT_C TInt GetContainerProperties(TUint& aSize, TUint& aAvgBitRate) const;
   1.442 +	IMPORT_C TInt GetNumBufferedBytes(TInt& aNum) const;
   1.443 +	IMPORT_C TInt GetFrameType(T3GPFrameType& aType) const;
   1.444 +	IMPORT_C TInt GetVideoFrameSize(TUint& aSize) const;
   1.445 +	IMPORT_C TInt GetAudioFramesSize(TUint& aSize) const;	
   1.446 +	IMPORT_C TInt GetVideoDecoderSpecificInfoSize(TInt& aSize) const;
   1.447 +	IMPORT_C TInt GetVideoDecoderSpecificInfo(TDes8& aInfo) const;
   1.448 +	IMPORT_C TInt GetAudioDecoderSpecificInfoSize(TInt& aSize) const;
   1.449 +	IMPORT_C TInt GetAudioDecoderSpecificInfo(TDes8& aBuffer) const;
   1.450 +	IMPORT_C TInt GetVideoTimestamp(TUint& aTimeStampInMs, TUint& aTimeStampInTimescale) const;
   1.451 +	IMPORT_C TInt GetStreamable(TBool& aStreamable) const;
   1.452 +	IMPORT_C TInt Seek(TUint aPosition, TBool aKeyFrame, TUint& aAudioPosition, TUint& aVideoPosition) const;	
   1.453 +	IMPORT_C TInt GetFrameAvailability(T3GPFrameType aType, TBool& aAvailable) const;	
   1.454 +	IMPORT_C TInt GetNumberOfVideoFrames(TUint& aNum) const;
   1.455 +	IMPORT_C TInt GetVideoSampleEntryIndex(TUint& aIndex) const;
   1.456 +	IMPORT_C TInt GetVideoFrameSize(TUint aIndex, TUint& aSize) const;
   1.457 +	IMPORT_C TInt GetVideoFrameStartTime(TUint aIndex, TUint& aTimeStampInMs, TUint& aTimeStampInTimescale) const;	
   1.458 +	IMPORT_C TInt GetVideoFrameKeyType(TUint aIndex, TBool& aKeyFrame) const;
   1.459 +	IMPORT_C TInt GetAudioSampleEntryIndex(TUint& aIndex) const;	
   1.460 +	IMPORT_C TInt GetQcelpStorageMode(T3GPQcelpStorageMode& aMode) const;
   1.461 +	IMPORT_C TInt GetH263VideoLevel(TInt& aLevel) const;
   1.462 +	IMPORT_C TInt GetUserDataAtomSize(TUint32 aType, T3GPUdtaLocation aLocation, TUint& aAtomIndex, TInt& aSize) const;
   1.463 +	IMPORT_C TInt GetUserDataAtom(TUint32 aType, T3GPUdtaLocation aLocation, TDes8& aBuffer, TUint& aAtomIndex) const;
   1.464 +	IMPORT_C TInt GetVideoFrameDependencies(T3GPFrameDependencies& aDependencies) const;
   1.465 +	IMPORT_C TInt GetVideoFrameProperties(TUint aStartIndex, TUint aNumberOfFrames, RArray<T3GPFrameInfoParameters>& aArray) const;	
   1.466 +	IMPORT_C TInt ReadVideoFrame(TDes8& aBuffer, TBool& aKeyFrame, TUint& aTimeStampInMs, TUint& aTimeStampInTimescale) const;	
   1.467 +	IMPORT_C void ReadVideoFrame(M3GPParseCallback& aCallback, TDes8& aBuffer);
   1.468 +	IMPORT_C TInt ReadAudioFrames(TDes8& aBuffer, TInt& aReturnedFrames, TUint& aTimeStampInMs, TUint& aTimeStampInTimescale) const;
   1.469 +	IMPORT_C void ReadAudioFrames(M3GPParseCallback& aCallback, TDes8& aBuffer);
   1.470 +	IMPORT_C void CancelReadFrame();
   1.471 +	IMPORT_C TInt Complete();
   1.472 +private:
   1.473 +	C3GPParse(TInt aReadBufferSize = 0);
   1.474 +		
   1.475 +	TInt SymbianOSError(MP4Err aError) const;
   1.476 +	TInt DoGetVideoProperties()  const; 
   1.477 +	TInt DoGetAudioProperties() const;
   1.478 +	TInt DoGetStreamProperties() const;
   1.479 +	T3GPVideoType WrapperVideoType(TUint aType) const;
   1.480 +	T3GPAudioType WrapperAudioType(TUint aType) const;
   1.481 +	mp4_u8 UdtaLocation(T3GPUdtaLocation aLocation) const;
   1.482 +	void Reset();
   1.483 +	static void Panic(TInt aPanic);
   1.484 +	
   1.485 +	// From M3GPMP4LibAsyncObserver
   1.486 +	void M3GPMP4LibVideoFrameAvailable(MP4Err aError, mp4_u32 aFrameSize, mp4_u32 aTimeStamp, mp4_bool aKeyFrame, mp4_u32 aTimestamp2); 
   1.487 +	void M3GPMP4LibAudioFramesAvailable(MP4Err aError, mp4_u32 aAudioSize, mp4_u32 aTimeStamp, mp4_u32 aReturnedFrames, mp4_u32 aTimestamp2);
   1.488 +	
   1.489 +private:
   1.490 +	MP4Handle iHandler;
   1.491 +	TInt iReadBufferSize;
   1.492 +	
   1.493 +	// Async read
   1.494 +	M3GPParseCallback* iCallback;
   1.495 +	TDes8* iAsyncReadBuffer;
   1.496 +	
   1.497 +
   1.498 +	TBool iDuplicateFileHandleCreated;
   1.499 +	RFile64 iFile;
   1.500 +	// Video properties
   1.501 +	mutable T3GPVideoType iVideoType;
   1.502 +	mutable TUint iVideoLength;
   1.503 +	mutable TUint iVideoMp4Type;
   1.504 +	mutable TReal iVideoFrameRate; 
   1.505 +	mutable TSize iVideoSize; 
   1.506 +	mutable TUint iVideoTimeScale;
   1.507 +	mutable TBool iVideoPropertiesSaved;
   1.508 +	mutable TInt iVideoError;
   1.509 +	
   1.510 +	// Audio Properties
   1.511 +	mutable T3GPAudioType iAudioType;
   1.512 +	mutable TUint iAudioLength;
   1.513 +	mutable TUint iAudioMp4Type;
   1.514 +	mutable TReal iAudioFramesPerSample; 
   1.515 +	mutable TSize iAudioSize; 
   1.516 +	mutable TUint iAudioTimeScale;
   1.517 +	mutable TUint iAudioAvgBitRate;
   1.518 +	mutable TBool iAudioPropertiesSaved;
   1.519 +	mutable TInt iAudioError;
   1.520 +	
   1.521 +	// Stream properties
   1.522 +	mutable TUint iStreamAvgBitRate;
   1.523 +	mutable TUint iStreamSize;
   1.524 +	mutable TBool iStreamPropertiesSaved;
   1.525 +	mutable TInt iStreamError;
   1.526 +    };
   1.527 +
   1.528 +/**
   1.529 +A mixin class to be implemented by the client in order to use the asynchronous frame retrieval 
   1.530 +APIs provided by the C3GPParse class.  The derived class methods are called by C3GPParse when 
   1.531 +the audio/video frames retrieval completes, successful or not.
   1.532 +@publishedPartner
   1.533 +@released
   1.534 +*/
   1.535 +class M3GPParseCallback
   1.536 +	{
   1.537 +public:
   1.538 +	/**
   1.539 +	This is called upon the completion of an asynchronous request to retrieve audio 
   1.540 +	frames by the API C3GPParse::ReadAudioFramesAsync.
   1.541 +	
   1.542 +	@see C3GPParse::ReadAudioFramesAsync
   1.543 +	
   1.544 +	@param	aError			Returns KErrNone on success.  Returns KErrAccessDenied if the 3GP Parser is in buffer mode. 
   1.545 +							Otherwise, returns one of the system wide error codes. See synchronous version of 
   1.546 +							C3GPParse::ReadAudioFrames.
   1.547 +	@param	aReturnedFrames	Number of the returned frames or 0 if not known.
   1.548 +	@param	aTimeStampInMs	Audio frame presentation time in milliseconds from the beginning of the audio sequence.	
   1.549 +	@param	aTimeStampInTimescale	Audio frame presentation time in timescale from the beginning of the audio sequence.
   1.550 +	*/
   1.551 +	virtual void AudioFramesAvailable(TInt aError, TUint aReturnedFrames, TUint aTimeStampInMs, TUint aTimeStampInTimescale) = 0;
   1.552 +	
   1.553 +	/**
   1.554 +	VideoFrameAvailable is called upon completion of an asynchronous request to retrieve 
   1.555 +	video frames by the API C3GPParse::ReadVideoFrameAsync.
   1.556 +	
   1.557 +	@see C3GPParse::ReadVideoFrameAsync
   1.558 +	
   1.559 +	@param	aError		Returns KErrNone on success.  Returns KErrAccessDenied if the 3GP Parser is in buffer mode.  
   1.560 +						Otherwise, returns one of the system wide error codes. See synchronous version of 
   1.561 +						C3GPParse::ReadVideoFrame.
   1.562 +	@param	aKeyFrame	Returns ETrue if the current frame is a key frame (intra), otherwise the value is EFalse.
   1.563 +	@param	aTimeStampInMs	Video frame presentation time in milliseconds from the beginning of the video sequence.	
   1.564 +	@param	aTimeStampInTimescale	Video frame presentation time in timescale from the beginning of the video sequence.
   1.565 +	*/
   1.566 +	virtual void VideoFrameAvailable(TInt aError, TBool aKeyFrame, TUint aTimeStampInMs, TUint aTimeStampInTimescale) = 0;
   1.567 +	};
   1.568 +
   1.569 +#endif // C3GPLIBRARY_H