os/mm/mmplugins/lib3gp/wrapper/inc/c3gplibrary.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef C3GPLIBRARY_H
sl@0
    17
#define C3GPLIBRARY_H
sl@0
    18
sl@0
    19
#include <f32file.h>
sl@0
    20
#include <f32file64.h>
sl@0
    21
#include <caf/content.h>
sl@0
    22
#include <e32base.h>
sl@0
    23
#include <3gplibrary/mp4lib.h>
sl@0
    24
sl@0
    25
/**
sl@0
    26
Error code for C3GPParse API
sl@0
    27
sl@0
    28
3GP Parser requires more data before the requested information can be retrieved
sl@0
    29
*/
sl@0
    30
const TInt KErr3gpLibMoreDataRequired = (-12300);
sl@0
    31
sl@0
    32
class M3GPParseCallback;
sl@0
    33
sl@0
    34
/** 
sl@0
    35
File format to use when composing a file.
sl@0
    36
@publishedPartner
sl@0
    37
@released
sl@0
    38
*/
sl@0
    39
enum T3GPFileFormatType
sl@0
    40
	{
sl@0
    41
	/** 3GP file format. */
sl@0
    42
	E3GP3GP,
sl@0
    43
	/** MPEG-4 file format. */
sl@0
    44
	E3GPMP4,
sl@0
    45
	/** 3GPP2 file format. */
sl@0
    46
	E3GP3G2
sl@0
    47
	};
sl@0
    48
sl@0
    49
/** 
sl@0
    50
Optional flags to be used when composing a file.
sl@0
    51
@publishedPartner
sl@0
    52
@released
sl@0
    53
*/
sl@0
    54
enum T3GPComposeFlag
sl@0
    55
	{
sl@0
    56
	/** Default value. No special setup. */
sl@0
    57
	E3GPNoFlag = 0x0000,
sl@0
    58
	/** Metadata is placed at end of file. */
sl@0
    59
	E3GPMetaDataLast = 0x0001,
sl@0
    60
	/** Collect metadata in files instead of storing it in memory. */
sl@0
    61
	E3GPLongClip = 0x0002, 
sl@0
    62
	};
sl@0
    63
sl@0
    64
/** 
sl@0
    65
Type of stream contained in the file.
sl@0
    66
@publishedPartner
sl@0
    67
@released
sl@0
    68
*/
sl@0
    69
enum T3GPFrameType
sl@0
    70
	{
sl@0
    71
	/** Frame contains audio data. */
sl@0
    72
	E3GPAudio,
sl@0
    73
	/** Frame contains video data. */
sl@0
    74
	E3GPVideo
sl@0
    75
	};
sl@0
    76
sl@0
    77
/** 
sl@0
    78
Type of video stream contained in the file. 
sl@0
    79
@publishedPartner
sl@0
    80
@released
sl@0
    81
*/
sl@0
    82
enum T3GPVideoType
sl@0
    83
	{
sl@0
    84
	/** No Video */
sl@0
    85
	E3GPNoVideo,
sl@0
    86
	/** MPEG-4 video (MPEG-4 Part 2) - Simple and Advance Simple Profiles */
sl@0
    87
	E3GPMpeg4Video, 
sl@0
    88
	/** H263 Profile 0  */
sl@0
    89
	E3GPH263Profile0, 
sl@0
    90
	/** H263 Profile 3 */
sl@0
    91
	E3GPH263Profile3,
sl@0
    92
	/** AVC (also known as H.264) Baseline Profile */               
sl@0
    93
	E3GPAvcProfileBaseline,
sl@0
    94
	/** AVC (also known as H.264) Main Profile */               
sl@0
    95
    E3GPAvcProfileMain,
sl@0
    96
    /** AVC (also known as H.264) Extended Profile */               
sl@0
    97
    E3GPAvcProfileExtended,
sl@0
    98
    /** AVC (also known as H.264) High Profile */               
sl@0
    99
    E3GPAvcProfileHigh
sl@0
   100
	};
sl@0
   101
sl@0
   102
sl@0
   103
/** 
sl@0
   104
Type of audio stream contained in the file.
sl@0
   105
@publishedPartner
sl@0
   106
@released
sl@0
   107
*/
sl@0
   108
enum T3GPAudioType
sl@0
   109
	{
sl@0
   110
	/** No audio */
sl@0
   111
	E3GPNoAudio,
sl@0
   112
	/** MPEG-4 audio (MPEG-4 Part 3) */
sl@0
   113
	E3GPMpeg4Audio,
sl@0
   114
	/** AMR NB */
sl@0
   115
	E3GPAmrNB,   
sl@0
   116
	/** AMR WB */   
sl@0
   117
	E3GPAmrWB,
sl@0
   118
	/** QCELP 13K */
sl@0
   119
	E3GPQcelp13K
sl@0
   120
	};
sl@0
   121
sl@0
   122
sl@0
   123
/** 
sl@0
   124
Location of the user data in the file.
sl@0
   125
@publishedPartner
sl@0
   126
@released
sl@0
   127
*/
sl@0
   128
enum T3GPUdtaLocation
sl@0
   129
	{
sl@0
   130
	/** User data resides within the Movie Box. */
sl@0
   131
	E3GPUdtaMoov,
sl@0
   132
	/** User data resides within the Track Box for video. */
sl@0
   133
	E3GPUdtaVideoTrak,
sl@0
   134
	/** User data resides within the Track Box for audio. */
sl@0
   135
	E3GPUdtaAudioTrak
sl@0
   136
	};	
sl@0
   137
sl@0
   138
/** 
sl@0
   139
Storage method of QCELP audio stream. 
sl@0
   140
@publishedPartner
sl@0
   141
@released
sl@0
   142
*/
sl@0
   143
enum T3GPQcelpStorageMode
sl@0
   144
	{
sl@0
   145
	/** QCELP Sample Entry ('sqcp') box is used for the storage of QCELP media data. */
sl@0
   146
	E3GPQcelpSampleEntryBox,
sl@0
   147
	/** MP4 Audio Sample Entry ('esds') box is used for the storage of QCELP media data. */
sl@0
   148
	E3GPMP4AudioDescriptionBox	
sl@0
   149
	};	
sl@0
   150
sl@0
   151
/** 
sl@0
   152
Define the dependency information between video frames.
sl@0
   153
@publishedPartner
sl@0
   154
@released
sl@0
   155
*/
sl@0
   156
enum T3GPVideoFrameDependency
sl@0
   157
	{
sl@0
   158
	/** The dependency of this sample is unknown or the dependency of other 
sl@0
   159
	samples on this sample is unknown. */
sl@0
   160
	E3GPDependencyUnknown = 0,
sl@0
   161
	/** This sample does depend on others or other samples depend on this sample. */
sl@0
   162
	E3GPDependencyExists,
sl@0
   163
	/** This sample does not depend on others or no other sample depends on this sample. */
sl@0
   164
	E3GPDependencyNone,
sl@0
   165
	};	
sl@0
   166
sl@0
   167
/** 
sl@0
   168
Define the existence of redundant coding in a frame.
sl@0
   169
@publishedPartner
sl@0
   170
@released
sl@0
   171
*/
sl@0
   172
enum T3GPVideoFrameRedundancy
sl@0
   173
	{
sl@0
   174
	/** It is unknown whether there is redundant coding in this sample. */
sl@0
   175
	E3GPRedundancyUnknown = 0,
sl@0
   176
	/** There is redundant coding in this sample. */
sl@0
   177
	E3GPRedundancyExists,
sl@0
   178
	/** There is no redundant coding in this sample. */
sl@0
   179
	E3GPRedundancyNone,
sl@0
   180
	};		
sl@0
   181
sl@0
   182
/** 
sl@0
   183
Structure containing a frame's dependency information.
sl@0
   184
@publishedPartner
sl@0
   185
@released
sl@0
   186
*/
sl@0
   187
NONSHARABLE_STRUCT(T3GPFrameDependencies)
sl@0
   188
	{
sl@0
   189
	/** Defines the current frame’s dependency.  It can be defined as an I-frame 
sl@0
   190
	(E3GPDependencyNone), not an I-frame (E3GPDependencyExists), or dependency 
sl@0
   191
	unknown (E3GPDependencyUnknown).  See T3GPVideoFrameDependency.
sl@0
   192
	*/
sl@0
   193
	T3GPVideoFrameDependency iDependsOn;
sl@0
   194
	/** Defines the dependency of other frames on this frame. It can be defined as a disposable 
sl@0
   195
	frame (E3GPDependencyNone), non-disposable (E3GPDependencyExists), or dependency unknown 
sl@0
   196
	(E3GPDependencyUnknown).  See T3GPVideoFrameDependency.
sl@0
   197
	*/
sl@0
   198
	T3GPVideoFrameDependency iIsDependedOn;
sl@0
   199
	/** Defines the existence of redundant coding in this frame.  See T3GPVideoFrameRedundancy. */
sl@0
   200
	T3GPVideoFrameRedundancy iHasRedundancy;
sl@0
   201
	};
sl@0
   202
sl@0
   203
/** 
sl@0
   204
Structure containing video frame properties.
sl@0
   205
@publishedPartner
sl@0
   206
@released
sl@0
   207
*/
sl@0
   208
NONSHARABLE_STRUCT(T3GPFrameInfoParameters)
sl@0
   209
	{
sl@0
   210
	/** Frame size. */
sl@0
   211
	TUint32 iSize;
sl@0
   212
	/** Frame start time. */
sl@0
   213
	TUint32 iStartTime;
sl@0
   214
	/** ETrue if frame is an intra or random access point. */
sl@0
   215
	TBool iIsRandomAccessPoint;
sl@0
   216
	};
sl@0
   217
sl@0
   218
/**
sl@0
   219
This class should not be used directly.  It stores common properties amongst all supported 
sl@0
   220
types of video data. 
sl@0
   221
sl@0
   222
Note: iTimescale should be chosen so that the duration of each sample is an integer.  It should also 
sl@0
   223
be chosen so that the duration of the presentation fits into 32 bits.
sl@0
   224
sl@0
   225
@publishedPartner
sl@0
   226
@released
sl@0
   227
*/	
sl@0
   228
NONSHARABLE_CLASS(T3GPVideoPropertiesBase)
sl@0
   229
	{	
sl@0
   230
protected:
sl@0
   231
	/**
sl@0
   232
 	@internalTechnology
sl@0
   233
 	*/
sl@0
   234
	T3GPVideoPropertiesBase(T3GPVideoType aType, TUint aTimescale, const TSize& aSize);
sl@0
   235
public:
sl@0
   236
	/** Type of video stream contained in the file. */
sl@0
   237
	T3GPVideoType iType;
sl@0
   238
	/** Timescale of the video data.  This is the number of time units that pass in one second. */
sl@0
   239
	TUint iTimescale;
sl@0
   240
	/** Video width and height in pixels */
sl@0
   241
	TSize iSize;	
sl@0
   242
	};
sl@0
   243
sl@0
   244
/** 
sl@0
   245
This structure stores the common and MPEG-4 video specific properties of video data
sl@0
   246
@publishedPartner
sl@0
   247
@released
sl@0
   248
*/
sl@0
   249
NONSHARABLE_CLASS(T3GPVideoPropertiesMpeg4Video) : public T3GPVideoPropertiesBase
sl@0
   250
	{
sl@0
   251
public:
sl@0
   252
	IMPORT_C T3GPVideoPropertiesMpeg4Video(TUint aTimescale, const TSize& aSize, TUint aMaxBitRate, TUint aAvgBitRate, const TDesC8& aDecoderSpecificInfo);
sl@0
   253
public:
sl@0
   254
	/** Maximum video bit rate */
sl@0
   255
	TUint iMaxBitRate;
sl@0
   256
	/** Average video bit rate */
sl@0
   257
	TUint iAvgBitRate;	
sl@0
   258
	/** MPEG-4 video decoder specific info data stored in an ESDS atom */
sl@0
   259
	const TDesC8& iDecoderSpecificInfo;
sl@0
   260
	};
sl@0
   261
sl@0
   262
/** 
sl@0
   263
This structure stores the common and H.263 specific properties of video data 
sl@0
   264
@publishedPartner
sl@0
   265
@released
sl@0
   266
*/
sl@0
   267
NONSHARABLE_CLASS(T3GPVideoPropertiesH263) : public T3GPVideoPropertiesBase
sl@0
   268
	{
sl@0
   269
public:
sl@0
   270
	enum TProfile { EProfile0, EProfile3 };
sl@0
   271
sl@0
   272
public:
sl@0
   273
	IMPORT_C T3GPVideoPropertiesH263(TUint aTimescale, const TSize& aSize, TInt aVideoLevel, TProfile aProfile);	
sl@0
   274
public:
sl@0
   275
	/** Indicates the H263 video level. */
sl@0
   276
	TInt iVideoLevel;
sl@0
   277
	};
sl@0
   278
sl@0
   279
/** 
sl@0
   280
This structure stores the common and AVC-specific properties of video data. 
sl@0
   281
@publishedPartner
sl@0
   282
@released
sl@0
   283
*/
sl@0
   284
NONSHARABLE_CLASS(T3GPVideoPropertiesAvc) : public T3GPVideoPropertiesBase
sl@0
   285
	{
sl@0
   286
public:
sl@0
   287
	IMPORT_C T3GPVideoPropertiesAvc(TUint aTimescale, const TSize& aSize, const TDesC8& aDecoderSpecificInfo);	
sl@0
   288
public:
sl@0
   289
	/** AVCDecoderConfigurationRecord data that will be stored in the avcC atom. */
sl@0
   290
	const TDesC8& iDecoderSpecificInfo;
sl@0
   291
	};
sl@0
   292
sl@0
   293
/** 
sl@0
   294
This class should not be used directly.  This structure stores common properties amongst all supported types of audio data 
sl@0
   295
@publishedPartner
sl@0
   296
@released
sl@0
   297
*/
sl@0
   298
NONSHARABLE_CLASS(T3GPAudioPropertiesBase)
sl@0
   299
	{
sl@0
   300
protected:
sl@0
   301
	/**
sl@0
   302
 	@internalTechnology
sl@0
   303
 	*/
sl@0
   304
	T3GPAudioPropertiesBase(T3GPAudioType aType, TUint aTimescale, TInt aFramesPerSample);
sl@0
   305
public:
sl@0
   306
	/** Type of audio stream contained in the file */
sl@0
   307
	T3GPAudioType iType;
sl@0
   308
	/** Timescale of the audio data.  This is the number of time units that pass in one second.  It 
sl@0
   309
	 must be smaller than 65536. */
sl@0
   310
	TUint iTimescale;
sl@0
   311
	/** Frames per sample.  It must be smaller than 512. MPEG-4 audio has a fixed value of 1. */
sl@0
   312
	TInt iFramesPerSample;
sl@0
   313
	};
sl@0
   314
sl@0
   315
/** 
sl@0
   316
This structure stores the common and MPEG-4 audio specific properties of audio data 
sl@0
   317
@publishedPartner
sl@0
   318
@released
sl@0
   319
*/
sl@0
   320
NONSHARABLE_CLASS(T3GPAudioPropertiesMpeg4Audio) : public T3GPAudioPropertiesBase
sl@0
   321
	{
sl@0
   322
public:
sl@0
   323
	IMPORT_C T3GPAudioPropertiesMpeg4Audio(TUint aTimescale, const TDesC8& aDecoderSpecificInfo);
sl@0
   324
public:
sl@0
   325
	/** MPEG-4 audio decoder specific info data stored in an ESDS atom */
sl@0
   326
	const TDesC8& iDecoderSpecificInfo;	
sl@0
   327
	};
sl@0
   328
sl@0
   329
/** 
sl@0
   330
This structure stores the common and AMR specific properties of audio data 
sl@0
   331
@publishedPartner
sl@0
   332
@released
sl@0
   333
*/
sl@0
   334
NONSHARABLE_CLASS(T3GPAudioPropertiesAmr) : public T3GPAudioPropertiesBase
sl@0
   335
	{
sl@0
   336
public:
sl@0
   337
	enum TSpeechCodec{ EAmrWB, EAmrNB };
sl@0
   338
sl@0
   339
public:
sl@0
   340
	IMPORT_C T3GPAudioPropertiesAmr(TUint aTimescale, TInt aFramesPerSample, TInt aModeSet, TSpeechCodec aCodec);
sl@0
   341
public:	
sl@0
   342
	/** AMR mode set. */
sl@0
   343
	TInt iModeSet;
sl@0
   344
	};
sl@0
   345
sl@0
   346
/** 
sl@0
   347
This structure stores the common and Qcelp specific properties of audio data 
sl@0
   348
@publishedPartner
sl@0
   349
@released
sl@0
   350
*/
sl@0
   351
NONSHARABLE_CLASS(T3GPAudioPropertiesQcelp) : public T3GPAudioPropertiesBase
sl@0
   352
	{
sl@0
   353
public:
sl@0
   354
	IMPORT_C T3GPAudioPropertiesQcelp(TUint aTimescale, TInt aFramesPerSample, const TDesC8& aDecoderSpecificInfo);
sl@0
   355
	IMPORT_C T3GPAudioPropertiesQcelp(TUint aTimescale, TInt aFramesPerSample);
sl@0
   356
public:	
sl@0
   357
	/** Specifies the mode to store QCELP audio data.
sl@0
   358
	In 3G2 files, QCELP can be registered to be stored in two ways:
sl@0
   359
	- Use QCELP Sample Entry (‘sqcp’) Box.  This is the default mode.
sl@0
   360
	- Use MPEG4 Audio Sample Description (‘esds’) Box.  If this mode is selected, decoder specific info should be supplied.
sl@0
   361
	See T3GPQcelpStorageMode. */
sl@0
   362
	T3GPQcelpStorageMode iMode;	
sl@0
   363
	/** MPEG-4 audio decoder specific info data stored in an ESDS atom.
sl@0
   364
	If this is provided as an input parameter, the storage mode is automatically set to MPEG4 Audio 
sl@0
   365
	Sample Description Box mode	 */
sl@0
   366
	const TDesC8& iDecoderSpecificInfo;
sl@0
   367
	};
sl@0
   368
sl@0
   369
/** 
sl@0
   370
@publishedPartner
sl@0
   371
@released
sl@0
   372
sl@0
   373
The 3GP composer accepts H.263 /H.264 / MPEG-4 / AVC video, and AMR / MPEG-4 AAC / QCELP 
sl@0
   374
audio as input to create a 3GP / 3G2 / MP4 file. 
sl@0
   375
*/
sl@0
   376
NONSHARABLE_CLASS(C3GPCompose) : public CBase
sl@0
   377
	{
sl@0
   378
public:
sl@0
   379
	IMPORT_C static C3GPCompose* NewL();
sl@0
   380
	IMPORT_C static C3GPCompose* NewL(TInt aMediaWriteBufferSize, TInt aWriteBufferMaxCount);	
sl@0
   381
	IMPORT_C ~C3GPCompose();
sl@0
   382
	
sl@0
   383
	IMPORT_C TInt Open(T3GPFileFormatType aFileFormat, const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio, const TDesC& aFilename, TUint aFlags = E3GPNoFlag);	
sl@0
   384
	IMPORT_C TInt Open(T3GPFileFormatType aFileFormat, const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio, RFile& aFile, TUint aFlags = E3GPNoFlag);
sl@0
   385
	IMPORT_C TInt Open(T3GPFileFormatType aFileFormat, const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio, RFile64& aFile, TUint aFlags = E3GPNoFlag);
sl@0
   386
	IMPORT_C TInt WriteVideoFrame(const TDesC8& aBuffer, TUint aDuration, TBool aKeyFrame);	
sl@0
   387
	IMPORT_C TInt WriteVideoFrame(const TDesC8& aBuffer, TUint aDuration, TBool aKeyFrame, const T3GPFrameDependencies& aDependencies);
sl@0
   388
	IMPORT_C TInt WriteAudioFrames(const TDesC8& aBuffer, TUint aDuration);
sl@0
   389
	IMPORT_C TInt SetUserData(T3GPUdtaLocation aLocation, const TDesC8& aBuffer);     	
sl@0
   390
	IMPORT_C TInt Complete();
sl@0
   391
private:
sl@0
   392
	C3GPCompose(TInt aMediaWriteBufferSize = 0, TInt aWriteBufferMaxCount = 0);
sl@0
   393
	
sl@0
   394
	TInt SymbianOSError(MP4Err aError);
sl@0
   395
	mp4_u32 Mp4Type(const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio);
sl@0
   396
	TInt SetComposeProperties(const T3GPVideoPropertiesBase* aVideo, const T3GPAudioPropertiesBase* aAudio, T3GPFileFormatType aFileFormat, TUint aFlag);
sl@0
   397
	TInt SetMPeg4VideoProperties(const T3GPVideoPropertiesBase* aVideo);
sl@0
   398
	TInt SetAvcVideoProperties(const T3GPVideoPropertiesBase* aVideo);
sl@0
   399
	TInt SetH263VideoProperties(const T3GPVideoPropertiesBase* aVideo);
sl@0
   400
	TInt SetMpeg4AudioProperties(const T3GPAudioPropertiesBase* aAudio);
sl@0
   401
	TInt SetAmrAudioProperties(const T3GPAudioPropertiesBase* aAudio);
sl@0
   402
	TInt SetQcelpAudioProperties(const T3GPAudioPropertiesBase* aAudio);
sl@0
   403
	TInt SetComposeFlag(T3GPFileFormatType aFileFormat, TUint aFlag);
sl@0
   404
	void Reset();
sl@0
   405
	static void Panic(TInt aPanic);
sl@0
   406
private:
sl@0
   407
	MP4Handle iHandler;
sl@0
   408
	TInt iMediaWriteBufferSize;
sl@0
   409
	TInt iWriteBufferMaxCount;
sl@0
   410
	TBool iHasVideo;
sl@0
   411
	TBool iHasAudio;
sl@0
   412
	TBool iDuplicateFileHandleCreated;
sl@0
   413
	RFile64 iFile;
sl@0
   414
	};
sl@0
   415
sl@0
   416
sl@0
   417
/**
sl@0
   418
The Parser provides APIs to parse 3GP, 3G2 and MP4 contents (from a file, a CAF object, or given 
sl@0
   419
through memory buffer), containing H.263/MPEG-4/H.264 video and AMR/MPEG-4/QCELP audio.
sl@0
   420
@publishedPartner
sl@0
   421
@released
sl@0
   422
*/
sl@0
   423
NONSHARABLE_CLASS(C3GPParse) : public CBase, public M3GPMP4LibAsyncObserver
sl@0
   424
	{
sl@0
   425
public:
sl@0
   426
	IMPORT_C static C3GPParse* NewL();
sl@0
   427
	IMPORT_C static C3GPParse* NewL(TInt aReadBufferSize);
sl@0
   428
	IMPORT_C ~C3GPParse();
sl@0
   429
	
sl@0
   430
	IMPORT_C TInt Open();
sl@0
   431
	IMPORT_C TInt Open(const TDesC& aFilename);
sl@0
   432
	IMPORT_C TInt Open(const RFile& aFile);
sl@0
   433
	IMPORT_C TInt Open(const RFile64& aFile);
sl@0
   434
	IMPORT_C TInt Open(const ContentAccess::CData& aData);
sl@0
   435
	IMPORT_C TInt InsertData(const TDesC8& aBuffer);
sl@0
   436
	IMPORT_C TInt GetVideoProperties(T3GPVideoType& aType, TUint& aLength, TReal& aFrameRate, TUint& aAvgBitRate, TSize& aSize, TUint& aTimeScale) const;
sl@0
   437
	IMPORT_C TInt GetAudioProperties(T3GPAudioType& aType, TUint& aLength, TInt& aFramesPerSample, TUint& aAvgBitRate, TUint& aTimeScale) const;
sl@0
   438
	IMPORT_C TInt GetContainerProperties(TUint& aSize, TUint& aAvgBitRate) const;
sl@0
   439
	IMPORT_C TInt GetNumBufferedBytes(TInt& aNum) const;
sl@0
   440
	IMPORT_C TInt GetFrameType(T3GPFrameType& aType) const;
sl@0
   441
	IMPORT_C TInt GetVideoFrameSize(TUint& aSize) const;
sl@0
   442
	IMPORT_C TInt GetAudioFramesSize(TUint& aSize) const;	
sl@0
   443
	IMPORT_C TInt GetVideoDecoderSpecificInfoSize(TInt& aSize) const;
sl@0
   444
	IMPORT_C TInt GetVideoDecoderSpecificInfo(TDes8& aInfo) const;
sl@0
   445
	IMPORT_C TInt GetAudioDecoderSpecificInfoSize(TInt& aSize) const;
sl@0
   446
	IMPORT_C TInt GetAudioDecoderSpecificInfo(TDes8& aBuffer) const;
sl@0
   447
	IMPORT_C TInt GetVideoTimestamp(TUint& aTimeStampInMs, TUint& aTimeStampInTimescale) const;
sl@0
   448
	IMPORT_C TInt GetStreamable(TBool& aStreamable) const;
sl@0
   449
	IMPORT_C TInt Seek(TUint aPosition, TBool aKeyFrame, TUint& aAudioPosition, TUint& aVideoPosition) const;	
sl@0
   450
	IMPORT_C TInt GetFrameAvailability(T3GPFrameType aType, TBool& aAvailable) const;	
sl@0
   451
	IMPORT_C TInt GetNumberOfVideoFrames(TUint& aNum) const;
sl@0
   452
	IMPORT_C TInt GetVideoSampleEntryIndex(TUint& aIndex) const;
sl@0
   453
	IMPORT_C TInt GetVideoFrameSize(TUint aIndex, TUint& aSize) const;
sl@0
   454
	IMPORT_C TInt GetVideoFrameStartTime(TUint aIndex, TUint& aTimeStampInMs, TUint& aTimeStampInTimescale) const;	
sl@0
   455
	IMPORT_C TInt GetVideoFrameKeyType(TUint aIndex, TBool& aKeyFrame) const;
sl@0
   456
	IMPORT_C TInt GetAudioSampleEntryIndex(TUint& aIndex) const;	
sl@0
   457
	IMPORT_C TInt GetQcelpStorageMode(T3GPQcelpStorageMode& aMode) const;
sl@0
   458
	IMPORT_C TInt GetH263VideoLevel(TInt& aLevel) const;
sl@0
   459
	IMPORT_C TInt GetUserDataAtomSize(TUint32 aType, T3GPUdtaLocation aLocation, TUint& aAtomIndex, TInt& aSize) const;
sl@0
   460
	IMPORT_C TInt GetUserDataAtom(TUint32 aType, T3GPUdtaLocation aLocation, TDes8& aBuffer, TUint& aAtomIndex) const;
sl@0
   461
	IMPORT_C TInt GetVideoFrameDependencies(T3GPFrameDependencies& aDependencies) const;
sl@0
   462
	IMPORT_C TInt GetVideoFrameProperties(TUint aStartIndex, TUint aNumberOfFrames, RArray<T3GPFrameInfoParameters>& aArray) const;	
sl@0
   463
	IMPORT_C TInt ReadVideoFrame(TDes8& aBuffer, TBool& aKeyFrame, TUint& aTimeStampInMs, TUint& aTimeStampInTimescale) const;	
sl@0
   464
	IMPORT_C void ReadVideoFrame(M3GPParseCallback& aCallback, TDes8& aBuffer);
sl@0
   465
	IMPORT_C TInt ReadAudioFrames(TDes8& aBuffer, TInt& aReturnedFrames, TUint& aTimeStampInMs, TUint& aTimeStampInTimescale) const;
sl@0
   466
	IMPORT_C void ReadAudioFrames(M3GPParseCallback& aCallback, TDes8& aBuffer);
sl@0
   467
	IMPORT_C void CancelReadFrame();
sl@0
   468
	IMPORT_C TInt Complete();
sl@0
   469
private:
sl@0
   470
	C3GPParse(TInt aReadBufferSize = 0);
sl@0
   471
		
sl@0
   472
	TInt SymbianOSError(MP4Err aError) const;
sl@0
   473
	TInt DoGetVideoProperties()  const; 
sl@0
   474
	TInt DoGetAudioProperties() const;
sl@0
   475
	TInt DoGetStreamProperties() const;
sl@0
   476
	T3GPVideoType WrapperVideoType(TUint aType) const;
sl@0
   477
	T3GPAudioType WrapperAudioType(TUint aType) const;
sl@0
   478
	mp4_u8 UdtaLocation(T3GPUdtaLocation aLocation) const;
sl@0
   479
	void Reset();
sl@0
   480
	static void Panic(TInt aPanic);
sl@0
   481
	
sl@0
   482
	// From M3GPMP4LibAsyncObserver
sl@0
   483
	void M3GPMP4LibVideoFrameAvailable(MP4Err aError, mp4_u32 aFrameSize, mp4_u32 aTimeStamp, mp4_bool aKeyFrame, mp4_u32 aTimestamp2); 
sl@0
   484
	void M3GPMP4LibAudioFramesAvailable(MP4Err aError, mp4_u32 aAudioSize, mp4_u32 aTimeStamp, mp4_u32 aReturnedFrames, mp4_u32 aTimestamp2);
sl@0
   485
	
sl@0
   486
private:
sl@0
   487
	MP4Handle iHandler;
sl@0
   488
	TInt iReadBufferSize;
sl@0
   489
	
sl@0
   490
	// Async read
sl@0
   491
	M3GPParseCallback* iCallback;
sl@0
   492
	TDes8* iAsyncReadBuffer;
sl@0
   493
	
sl@0
   494
sl@0
   495
	TBool iDuplicateFileHandleCreated;
sl@0
   496
	RFile64 iFile;
sl@0
   497
	// Video properties
sl@0
   498
	mutable T3GPVideoType iVideoType;
sl@0
   499
	mutable TUint iVideoLength;
sl@0
   500
	mutable TUint iVideoMp4Type;
sl@0
   501
	mutable TReal iVideoFrameRate; 
sl@0
   502
	mutable TSize iVideoSize; 
sl@0
   503
	mutable TUint iVideoTimeScale;
sl@0
   504
	mutable TBool iVideoPropertiesSaved;
sl@0
   505
	mutable TInt iVideoError;
sl@0
   506
	
sl@0
   507
	// Audio Properties
sl@0
   508
	mutable T3GPAudioType iAudioType;
sl@0
   509
	mutable TUint iAudioLength;
sl@0
   510
	mutable TUint iAudioMp4Type;
sl@0
   511
	mutable TReal iAudioFramesPerSample; 
sl@0
   512
	mutable TSize iAudioSize; 
sl@0
   513
	mutable TUint iAudioTimeScale;
sl@0
   514
	mutable TUint iAudioAvgBitRate;
sl@0
   515
	mutable TBool iAudioPropertiesSaved;
sl@0
   516
	mutable TInt iAudioError;
sl@0
   517
	
sl@0
   518
	// Stream properties
sl@0
   519
	mutable TUint iStreamAvgBitRate;
sl@0
   520
	mutable TUint iStreamSize;
sl@0
   521
	mutable TBool iStreamPropertiesSaved;
sl@0
   522
	mutable TInt iStreamError;
sl@0
   523
    };
sl@0
   524
sl@0
   525
/**
sl@0
   526
A mixin class to be implemented by the client in order to use the asynchronous frame retrieval 
sl@0
   527
APIs provided by the C3GPParse class.  The derived class methods are called by C3GPParse when 
sl@0
   528
the audio/video frames retrieval completes, successful or not.
sl@0
   529
@publishedPartner
sl@0
   530
@released
sl@0
   531
*/
sl@0
   532
class M3GPParseCallback
sl@0
   533
	{
sl@0
   534
public:
sl@0
   535
	/**
sl@0
   536
	This is called upon the completion of an asynchronous request to retrieve audio 
sl@0
   537
	frames by the API C3GPParse::ReadAudioFramesAsync.
sl@0
   538
	
sl@0
   539
	@see C3GPParse::ReadAudioFramesAsync
sl@0
   540
	
sl@0
   541
	@param	aError			Returns KErrNone on success.  Returns KErrAccessDenied if the 3GP Parser is in buffer mode. 
sl@0
   542
							Otherwise, returns one of the system wide error codes. See synchronous version of 
sl@0
   543
							C3GPParse::ReadAudioFrames.
sl@0
   544
	@param	aReturnedFrames	Number of the returned frames or 0 if not known.
sl@0
   545
	@param	aTimeStampInMs	Audio frame presentation time in milliseconds from the beginning of the audio sequence.	
sl@0
   546
	@param	aTimeStampInTimescale	Audio frame presentation time in timescale from the beginning of the audio sequence.
sl@0
   547
	*/
sl@0
   548
	virtual void AudioFramesAvailable(TInt aError, TUint aReturnedFrames, TUint aTimeStampInMs, TUint aTimeStampInTimescale) = 0;
sl@0
   549
	
sl@0
   550
	/**
sl@0
   551
	VideoFrameAvailable is called upon completion of an asynchronous request to retrieve 
sl@0
   552
	video frames by the API C3GPParse::ReadVideoFrameAsync.
sl@0
   553
	
sl@0
   554
	@see C3GPParse::ReadVideoFrameAsync
sl@0
   555
	
sl@0
   556
	@param	aError		Returns KErrNone on success.  Returns KErrAccessDenied if the 3GP Parser is in buffer mode.  
sl@0
   557
						Otherwise, returns one of the system wide error codes. See synchronous version of 
sl@0
   558
						C3GPParse::ReadVideoFrame.
sl@0
   559
	@param	aKeyFrame	Returns ETrue if the current frame is a key frame (intra), otherwise the value is EFalse.
sl@0
   560
	@param	aTimeStampInMs	Video frame presentation time in milliseconds from the beginning of the video sequence.	
sl@0
   561
	@param	aTimeStampInTimescale	Video frame presentation time in timescale from the beginning of the video sequence.
sl@0
   562
	*/
sl@0
   563
	virtual void VideoFrameAvailable(TInt aError, TBool aKeyFrame, TUint aTimeStampInMs, TUint aTimeStampInTimescale) = 0;
sl@0
   564
	};
sl@0
   565
sl@0
   566
#endif // C3GPLIBRARY_H