MOGetAudioPacket

C Specification

#include <mo/Mobiclip.h>

MOResult MOGetAudioPacket(MOInstance* pInstance, u16* pAudioBuffer, u32 audioBufferSize, u32 *pSizeInBytes)

Arguments

pInstance Instance of the concerned movie.
pAudioBuffer Pointer to the buffer where the PCM data will be written
audioBufferSize Size of audioBuffer in bytes
pSizeInBytes That field will contain the size in bytes of the PCM data written to the buffer

Return Values

MO_RESULT_OK Success.
MO_RESULT_NULL MOInstance pointer is NULL or buffer too small.
MO_RESULT_NOT_OPENED A successfull call to MOOpen function have not been done before, or open process not complete yet.
MO_RESULT_NO_AUDIO_TRACK There is no audio track in the movie data.
MO_RESULT_NO_VALID_AUDIO_PACKET There is no valid audio packet in the audio queue.

Description

That function will pop one audio block from the library decoded audio queue.

The calling application gives a buffer and a maximum write size and the function will fill the buffer and give the amound of bytes written.

The data written in the buffer has the following format:

- It is 16 bits PCM audio.

- The sampling rate depends on the movie data(call MOGetAudioFrequency function to obtain that information).

- The number of channels(mono or stereo) depends on the movie data(call MOGetAudioChannels function to obtain that information).

- In case of stereo signal the left and right channels are interleaved. The interleave order can be defined by calling MOSetAudioChannelOrdering function and retrieved by calling MOGetAudioChannelOrdering function

To know the size of the buffer to give, the calling application can use the MOGetNextAudioPacketSize function.

See Also

MODecode

MOSkipAudioPacket

MOGetNextAudioPacketSize

MOSetAudioChannelOrdering

MOGetAudioChannelOrdering

Revision History

02/24/2010 Description about MO_RESULT_NO_AUDIO_TRACK and MO_RESULT_NO_VALID_AUDIO_PACKET return values added.

10/22/2009 Added links to MOSetAudioChannelOrdering and MOGetAudioChannelOrdering functions in 'See Also' section and described data format written in output buffer in 'Description' section.

03/26/2009 Parameter renaming done.

06/22/2008 Initial version.