To play a 3GP file, use the Natural Access ADI service in combination with MMFI functions. Complete the following steps to play a 3GP file:
Step |
Action |
Use |
1 |
Check the library version to ensure that it supports the 3GP format. |
|
2 |
Open the 3GP file. |
mmOpenFile in read mode |
3 |
Obtain information about the 3GP file, including general file information, stream characteristics, and codec configuration. |
|
4 |
For each type of media stream, create the media stream structure, and specify the following information:
|
|
5 |
Read the next memory buffer from the 3GP file. |
|
6 |
Issue an ADI request to play the data. You can issue one play request for each stream type. If the application is using partial buffer mode (adiPlayMMAsync), repeat the mmReadStream call. |
|
7 |
When the transmission of all streams is complete, close the 3GP file. |
The call flow for a single buffer play is shown below:
MMFI Lib |
App |
ADI service |
||||||||||||||||||||||||
|
||||||||||||||||||||||||||
The call flow for a partial buffer play is shown below:
MMFI Lib |
App |
ADI service |
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
To randomly access and play a 3GP file, use the Natural Access ADI service in combination with MMFI functions as explained in the examples in this section.
There are restrictions on ADI processing when performing seek operations for random access. The restrictions are:
During a playback, seek operations (mmSeekToTime, mmSeekToNextSyncPoint, mmSeekToPrevSyncPoint) may not be performed while ADI play (adiPlayMMAsync) is in progress.
A seek operation may only be performed when playing back using partial buffer mode (adiPlayMMAsync).
Only mmSeekToTime and mmSeekToNextSyncPoint seek operations are allowed before the first ADI play function.
When a seek operation is called after the first ADI play, the following steps must be performed:
Step |
Action |
1 |
Stop ADI processing using adiStopPlaying. |
2 |
Perform the seek operation using mmSeekToTime, mmSeekToNextSyncPoint, or mmSeekToPrevPoint. |
3 |
Start the play process as before using mmReadStream and adiStartPlaying. |
The following table shows a call flow for using random access functions after the first ADI play function call.
Step |
Action |
Use |
1 |
Check the library version to ensure that it supports the 3GP format. |
|
2 |
Open the 3GP file. |
mmOpenFile in read mode |
3 |
The returned structure FILE_INFO_DESC contains a field named NbSyncPoints. This provides the size of the sync table for future use in the application. |
|
4 |
Open the media stream. |
|
5 |
Allocate memory for the time-based sync table according to the field NbSyncPoints. The memory allocation is for an array of unsigned integers with size equal to NbSyncPoints. |
|
6 |
Obtain the time-based sync table. The timing information is in milliseconds. |
|
7 |
Using the obtained sync point information, set the track position pointer to a time within the 3GP file, or move the track position pointer to the next sync point. |
|
8 |
Read the next memory buffer from the 3GP file. |
|
9 |
Play the next buffer. |
|
10 |
When the transmission of all streams is complete, close the 3GP file. |
A call flow using random access functions in this manner is shown below:
MMFI Lib |
App |
ADI service |
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
The following table shows a call flow for using random access functions after the first ADI play function call.
Step |
Action |
Use |
1 |
Check the library version to ensure that it supports the 3GP format. |
|
2 |
Open the 3GP file. |
mmOpenFile in read mode |
3 |
The returned structure FILE_INFO_DESC contains a field named NbSyncPoints. This provides the size of the sync table for future use in the application. |
|
4 |
Open the media stream. |
|
5 |
Allocate memory for the time-based sync table according to the field NbSyncPoints. The memory allocation is for an array of unsigned integers with size equal to NbSyncPoints. |
|
6 |
Obtain the time-based sync table. The timing information is in units of ms. |
|
7 |
Read the next memory buffer from the 3GP file. |
|
8 |
Play the next buffer. ADI play and mmReadStream operations continue until the seek operation is performed. |
adiSubmitPlayBuffer |
9 |
Stop ADI processing before the seek operation. |
adiStopPlaying |
10 |
Obtain the track position pointer's current value if needed by the application. |
|
11 |
Using the obtained sync point information, set the track position pointer to a time within the 3GP file, or move the track position pointer to the next or previous sync point. |
|
12 |
Read the next memory buffer from the 3GP file (as in Step 7). |
|
13 |
Play the buffer. |
adiSubmitPlayBuffer |
14 |
When the transmission of all streams is complete, close the 3GP file. |
The following illustration shows a call flow performing random access on a 3GP file after the first ADI play function call:
Part 1
MMFI Lib |
App |
ADI service |
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
Part 2
MMFI Lib |
App |
ADI service |
||||||||||||||||||||
|
||||||||||||||||||||||