Supplying Data to a 3GP Parser

This tutorial describes how to supply data to a 3GP Parser.

Purpose

To use the 3GP Parser in buffer mode, you must supply MP4/3GP/3G2 content in sequential blocks of data. The purpose of this tutorial is to show you how to supply the data to a 3GP Parser.

Required background

The 3GP Library Overview introduces the 3GP Parser.

Introduction

You use the C3GPParse::InsertData() function to supply data to a 3GP Parser. If there is not enough data to process requests, the 3GP Parser returns KErrMM3GPLibMoreDataRequired. You supply more data to the 3GP Parser through the C3GPParse::InsertData() function. A copy of the supplied data will be stored within the 3GP Parser. You are safe to destroy your copy on the return of C3GPParse::InsertData().

Setup and configuration requirements

To initialise the 3GP Parser to read data from a buffer, you must use the correct overload of C3GPParse::Open(). For more information, see Setting up a 3GP Parser.

Using InsertData()

The following tasks are covered in this tutorial:

Supplying data to a 3GP Parser

The high-level steps to supply data to a 3GP Parser are shown here:

Example

The following example shows you how to supply a received data block into the 3GP Parser:

CMyApp::ReceiveFileContentL(const TDesC& aData)
    {
    ...
    // assume parser already setup in buffer mode
    ...
// supply the received data block into the parser
User::LeaveIfError(iParser->InsertData(aData));       
    
// attempt to retrieve video properties
err = parser->GetVideoProperties(...);
if (err == KErrMM3GPLibMoreDataRequired)
   {
   // indicate to supplier of the content more data is needed
   // before this can be processed.  Possibly to trigger CMyApp::ReceiveFileContentL
   // to be called again with the next block of data
   }     
else 
   {
   // do something with the video properties
   }    
    }