This tutorial describes how to set up a 3GP Parser.
The purpose of this tutorial is to show you how to set up a 3GP Parser to read a 3GP, 3G2 or MP4 file.
Required background
The 3GP Library Overview introduces the 3GP Parser.
Introduction
The C3GPParse class provides the setup functions for the 3GP Parser.
The following tasks are covered in this tutorial:
Creating an instance of a 3GP Parser
Create an instance of a 3GP Parser by calling one of the overloads of C3GPParse::NewL():
To use the default read buffer size, call C3GPParse::NewL():
static IMPORT_C C3GPParse *NewL();
The default value for the read buffer size is 8KB.
To set the read buffer size, call C3GPParse::NewL(TInt) and set aReadBufferSize to be the required buffer size:
static IMPORT_C C3GPParse *NewL(TInt aReadBufferSize);
Initialising a 3GP Parser for reading 3GP, 3G2 or MP4 data
Initialise the 3GP Parser for reading data by calling one of the overloads of C3GPParse::Open():
To initialise the 3GP Parser for reading data from a buffer, call C3GPParse::Open():
IMPORT_C TInt Open();
To initialise the 3GP Parser for reading data from a file, call C3GPParse::Open(const TDesC &) and set aFilename to be the full path name of the file:
IMPORT_C TInt Open(const TDesC &aFilename);
To initialise the 3GP Parser for reading data from a file, call C3GPParse::Open(const RFile &) and set aFile to be the file handle of the file:
IMPORT_C TInt Open(const RFile &aFile);
To initialise the 3GP Parser for reading data from a CAF object, call C3GPParse::Open(const ContentAccess::CData &) and set aData to be CData object pointing to a CAF object:
IMPORT_C TInt Open(const ContentAccess::CData &aData);
The following example shows you how to set up a 3GP Parser to read a 3GP, 3G2 or MP4 file through an opened RFile handle.
CMyApp::ReadFileL(const RFile& aFile) { ... C3GPParse* parser = C3GPParse::NewL(); CleanupStack::PushL(parser); User::LeaveIfError(parser->Open(aFile)); CleanupStack::Pop(parser); ... }
You can use either a file handle or a file path to specify the input file in C3GPParse::Open(). In the event that the input file is encrypted, a CData object should be supplied instead, for example:
CMyApp::ReadFileL(const RFile& aFile) { ... C3GPParse* parser = C3GPParse::NewL(); CleanupStack::PushL(parser); CData* data = CData::NewLC(aFile, ...); User::LeaveIfError(parser->Open(*data)); CleanupStack::Pop(2); // parser, data ... }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.