MediaPlayer Class Definitions. More...
#include <MediaPlayer.h>
Public Types | |
enum | PlayerId { Player0 , Player1 } |
Audio library allows you to use two players simultaneously. Please set Player ID that player instance id created to use. More... | |
Public Member Functions | |
err_t | begin (void) |
Initialize the MediaPlayer. More... | |
err_t | end (void) |
Finalize the MediaPlayer. More... | |
err_t | create (PlayerId id) |
Creation of the MediaPlayer. More... | |
err_t | create (PlayerId id, AudioAttentionCb attcb) |
Creation of the MediaPlayer. More... | |
err_t | activate (PlayerId id, MediaPlayerCallback mpcb) |
Activate the MediaPlayer. More... | |
err_t | activate (PlayerId id, uint8_t output_device, MediaPlayerCallback mpcb) |
Activate the MediaPlayer (old interface) More... | |
err_t | activate (PlayerId id, MediaPlayerCallback mpcb, uint32_t player_bufsize) |
Activate the MediaPlayer. More... | |
err_t | activate (PlayerId id, uint8_t output_device, MediaPlayerCallback mpcb, uint32_t player_bufsize) |
Activate the MediaPlayer (Old compatible) More... | |
err_t | init (PlayerId id, uint8_t codec_type, uint32_t sampling_rate, uint8_t channel_number) |
Initialize the MediaPlayer (Abridged version). More... | |
err_t | init (PlayerId id, uint8_t codec_type, uint32_t sampling_rate, uint8_t bit_length, uint8_t channel_number) |
Initialize the MediaPlayer (Abridged version). More... | |
err_t | init (PlayerId id, uint8_t codec_type, const char *codec_path, uint32_t sampling_rate, uint8_t channel_number) |
Initialize the MediaPlayer (Abridged version). More... | |
err_t | init (PlayerId id, uint8_t codec_type, const char *codec_path, uint32_t sampling_rate, uint8_t bit_length, uint8_t channel_number) |
Initialize the MediaPlayer. More... | |
err_t | start (PlayerId id, DecodeDoneCallback dccb) |
Start playing. More... | |
err_t | stop (PlayerId id) |
Stop playing. More... | |
err_t | stop (PlayerId id, uint8_t mode) |
Stop playing (Stop mode specify). More... | |
err_t | reqNextProcess (PlayerId id, AsRequestNextType type) |
Request next process to player. More... | |
err_t | deactivate (PlayerId id) |
Deactivate the MediaPlayer. More... | |
err_t | writeFrames (PlayerId id, File &myfile) |
Write(Supply) audio data to play. More... | |
err_t | writeFrames (PlayerId id, uint8_t *data, uint32_t size) |
Write(Supply) audio data to play. More... | |
Static Public Member Functions | |
static MediaPlayer * | getInstance () |
Get instance of MediaRecorder for singleton. | |
MediaPlayer Class Definitions.
err_t MediaPlayer::begin | ( | void | ) |
Initialize the MediaPlayer.
This function is called only once when using the MediaPlayer. In this function, alloc memory area of FIFO for ES data supply.
|
inline |
Finalize the MediaPlayer.
This function is called only once when finish the MediaPlayer.
Creation of the MediaPlayer.
This function is called only once when using the MediaPlayer. In this function, create objcets for audio data decoding.
id | Select Player ID. |
Creation of the MediaPlayer.
This function can set callback funtion which receive attention notify.
id | Select Player ID. |
attcb | Attention callback |
Activate the MediaPlayer.
This function activates media player system. The result of APIs will be returnd by callback function which is specified by this function.
id | Select Player ID. |
mpcb | Sepcify callback function which is called to notify API results. |
Activate the MediaPlayer (old interface)
This function activates media player system. The result of APIs will be returnd by callback function which is specified by this function.
id | Select Player ID. |
output_device | Set output device.(not supported) |
mpcb | Sepcify callback function which is called to notify API results. |
Activate the MediaPlayer.
This API works as same as activate(id, mpcb), but you can set buffer size of player.
id | Select Player ID. |
mpcb | Sepcify callback function which is called to notify API results. |
player_bufsize | buffer size of player |
err_t MediaPlayer::activate | ( | PlayerId | id, |
uint8_t | output_device, | ||
MediaPlayerCallback | mpcb, | ||
uint32_t | player_bufsize | ||
) |
Activate the MediaPlayer (Old compatible)
This API works as same as activate(id, output_device, mpcb), but you can set buffer size of player.
id | Select Player ID. |
output_device | Set output device.(not supported) |
mpcb | Sepcify callback function which is called to notify API results. |
player_bufsize | buffer size of player |
err_t MediaPlayer::init | ( | PlayerId | id, |
uint8_t | codec_type, | ||
uint32_t | sampling_rate, | ||
uint8_t | channel_number | ||
) |
Initialize the MediaPlayer (Abridged version).
This is abridged version on initialize API. You can init media player with codec type, sampling rate, and number of channels. When this API is called, other parameters are fixed as below.
Bit length : 16bit DSP binary path : /mnt/sd0/BIN
id | Select Player ID. |
codec_type | Set compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
sampling_rate | Set sampling rate. AS_SAMPLINGRATE_XXXXX |
channel_number | Set channnel number. AS_CHANNEL_MONO or AS_CHANNEL_STEREO |
err_t MediaPlayer::init | ( | PlayerId | id, |
uint8_t | codec_type, | ||
uint32_t | sampling_rate, | ||
uint8_t | bit_length, | ||
uint8_t | channel_number | ||
) |
Initialize the MediaPlayer (Abridged version).
This is abridged version on initialize API. If you would like to set all of decode parameters but DSP binary path can be default, you can call this API. DSP binary path will be defautl as below.
DSP binary path : /mnt/sd0/BIN
id | Select Player ID. |
codec_type | Set compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
sampling_rate | Set sampling rate. AS_SAMPLINGRATE_XXXXX |
bit_length | Set bit length. AS_BITLENGTH_16 or AS_BITLENGTH_24 |
channel_number | Set channnel number. AS_CHANNEL_MONO or AS_CHANNEL_STEREO |
err_t MediaPlayer::init | ( | PlayerId | id, |
uint8_t | codec_type, | ||
const char * | codec_path, | ||
uint32_t | sampling_rate, | ||
uint8_t | channel_number | ||
) |
Initialize the MediaPlayer (Abridged version).
This is abridged version on initialize API. If you would like to set DSP binary path but bit length paramter can be default, you can call this API. Bit length parameter will be defautl as below.
DSP binary path : /mnt/sd0/BIN
id | Select Player ID. |
codec_type | Set compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
codec_path | Set DSP binary placement path |
sampling_rate | Set sampling rate. AS_SAMPLINGRATE_XXXXX |
channel_number | Set channnel number. AS_CHANNEL_MONO or AS_CHANNEL_STEREO |
err_t MediaPlayer::init | ( | PlayerId | id, |
uint8_t | codec_type, | ||
const char * | codec_path, | ||
uint32_t | sampling_rate, | ||
uint8_t | bit_length, | ||
uint8_t | channel_number | ||
) |
Initialize the MediaPlayer.
This is full version on initialize API. You can set all of decode parameters. Before you start playing, you must initialize media player by this API or abridge versions of this APS.
id | Select Player ID. |
codec_type | Set compression code. AS_CODECTYPE_MP3 or AS_CODECTYPE_WAV |
codec_path | Set DSP binary placement path |
sampling_rate | Set sampling rate. AS_SAMPLINGRATE_XXXXX |
bit_length | Set bit length. AS_BITLENGTH_16 or AS_BITLENGTH_24 |
channel_number | Set channnel number. AS_CHANNEL_MONO or AS_CHANNEL_STEREO |
Start playing.
This function starts playing audio data. When you call this API, player system pull out audio data from FIFO. So, you have to push audio data which will play into FIFO by "write frame API". Decode completion and decodec data will be notified by callback function which is specified by this API. You can process them.
id | Select Player ID. |
dccb | Callback function for notify decode completion |
Stop playing.
This function stops playing audio data. You can call this API when playing is activate. When you call this API, return of API will back soon but internal work cannot stop immediately. So, after API call, decodec data will be returned to application while supplied data runs out. It is better to process them.
Stop playing (Stop mode specify).
This function stops playing audio data with stop mode. Stop mode is "Wait ES ends : stop after play all of supplied data and reply result" and "Immediately stop : stop soon". You can set either of them.
id | Select Player ID. |
mode | Set stop mode. AS_STOPPLAYER_NORMAL or AS_STOPPLAYER_ESEND |
Request next process to player.
This function requests next process to player. You should call this API at timing of next decode can be done. For example, timing of decoded data rendering is done.
id | Select Player ID. |
type | Set Request type. AsNextNormalRequest or AsNextStopResRequest |
Deactivate the MediaPlayer.
This function deactivates media player system.
Write(Supply) audio data to play.
This function supplies audio data to player system. When you call this API, player read "myfile" and supply audio data to FIFO and the data will be decoded. If you do not, FIFO will occuers underflow.
id | Select Player ID. |
Write(Supply) audio data to play.
This function works as same as above writeFrames(PlayerId, File &). However, take audio data from buffer, not from file.
id | Select Player ID. |
data | Pointer to audio data which would like to sound |
size | Size of audio data |