#include <mad.h>
#include <ao/ao.h>
#include <sys/stat.h>
#include <pthread.h>
#include "daisylibao.h"
#include "libdaisy.h"
Go to the source code of this file.
Data Structures | |
struct | buffer |
struct | struct_audio_data_t |
Typedefs | |
typedef void * | audio_data_t |
typedef enum AUDIO_FILE_TYPE | audio_file_t |
Enumerations | |
enum | AUDIO_FILE_TYPE { AUDIO_FILE_WAV, AUDIO_FILE_MP3, AUDIO_FILE_AAC, AUDIO_FILE_UNKNOWN } |
enum | audio_state_t { AUDIO_STATE_PLAY, AUDIO_STATE_PAUSE, AUDIO_STATE_STOP, AUDIO_STATE_NOOP } |
Functions | |
unsigned long int | audio_play (audio_data_t _data, const char *fname, const char *start, const char *stop) |
int | audio_pause (audio_data_t _data) |
int | audio_stop (audio_data_t _data) |
int | callback (audio_data_t _data, long int) |
void | audio_terminate (audio_data_t _data) |
audio_data_t | audio_initiate (daisyplayer_t daisy, void(*done)(daisyplayer_t d), void(*error)(void *data, enum daisy_status, const char *), void(*progress)(void *data, long int progress_ms)) |
void * | audio_thread (void *_data) |
audio_state_t | audio_get_state (audio_data_t _data) |
|
Points to a struct_audio_data_t. This gives the user a possibility to refer to a struct_audio_data_t, but not access to it's internal data. Definition at line 54 of file audio.h. Referenced by audio_decoder(), audio_get_state(), audio_initiate(), audio_pause(), audio_play(), audio_stop(), audio_terminate(), callback(), error(), header(), input(), output(), start_audio(), and stop_audio(). |
|
Type to identify different audio file formats. Referenced by get_file_type(). |
|
Type to identify different audio file formats. |
|
Audio engine states. These are the different states the audio-engine can be in. Definition at line 71 of file audio.h. Referenced by audio_decoder(), audio_get_state(), audio_pause(), audio_thread(), daisy_goto_position(), and daisy_seek(). |
|
Returns the current state of the audio engine.
Definition at line 717 of file audio.c. References audio_data_t, audio_state_t, struct_audio_data_t::mutex, and struct_audio_data_t::state. Referenced by audio_terminate(), daisy_goto_position(), and daisy_seek(). |
|
Initiate the audio engine. This is called when the program wants us to start and prepare for audio playback This should allocate the basic resources needed by the audio engine.
Referenced by start_audio(). |
|
Pause audio. Sets the audio engine state to pause.
Definition at line 357 of file audio.c. References audio_data_t, AUDIO_MAGIC_NUMBER, AUDIO_STATE_NOOP, AUDIO_STATE_PAUSE, AUDIO_STATE_PLAY, audio_state_t, struct_audio_data_t::cb_error, struct_audio_data_t::daisy, DAISY_ERROR_AUDIO_PAUSED_WHILE_NOT_PLAYING, struct_audio_data_t::is_playing, struct_audio_data_t::magic, struct_audio_data_t::mutex, REP_DEBUG, report(), struct_audio_data_t::state, and struct_audio_data_t::unpause_cond. Referenced by daisy_pause(). |
|
Plays a file from start to stop.
Definition at line 314 of file audio.c. References audio_data_t, AUDIO_MAGIC_NUMBER, AUDIO_STATE_PLAY, AUDIO_STATE_STOP, struct_audio_data_t::cb_error, struct_audio_data_t::daisy, DAISY_ERROR_AUDIO_NOT_STOPPED, DAISY_ERROR_AUDIO_OPEN, struct_audio_data_t::magic, struct_audio_data_t::mutex, open_file(), parse_time_get_dur(), parse_time_mad_time_t(), struct_audio_data_t::progress, REP_ERROR, REP_WARNING, report(), struct_audio_data_t::start, struct_audio_data_t::state, struct_audio_data_t::stop, and STRLEN. Referenced by daisy_play(). |
|
Stops audio. Sets the state to stop and blocks to make sure that audio has actually stopped.
Definition at line 402 of file audio.c. References audio_data_t, AUDIO_MAGIC_NUMBER, AUDIO_STATE_PLAY, AUDIO_STATE_STOP, struct_audio_data_t::cb_error, struct_audio_data_t::daisy, DAISY_ERROR_AUDIO_DATA_IS_NULL, DAISY_ERROR_AUDIO_STOPPED_WHILE_NOT_PLAYING, daisy_status, struct_audio_data_t::is_playing, struct_audio_data_t::magic, struct_audio_data_t::mutex, REP_DEBUG, report(), and struct_audio_data_t::state. Referenced by audio_terminate(), daisy_goto_position(), daisy_seek(), and daisy_stop(). |
|
Stops and frees audio engine resources. This is called when the user wants us to terminate.
Definition at line 494 of file audio.c. References aac_terminate(), audio_data_t, audio_get_state(), AUDIO_MAGIC_NUMBER, AUDIO_STATE_STOP, audio_stop(), struct_audio_data_t::cb_error, struct_audio_data_t::daisy, DAISY_ERROR_AUDIO_FREE_MMAP, struct_audio_data_t::fd, struct_audio_data_t::fdm, struct_audio_data_t::file_name, struct_audio_data_t::file_type, struct_audio_data_t::magic, mp3_close(), struct_audio_data_t::mp3_dither, struct_audio_data_t::mutex, REP_MESSAGE, report(), and struct_audio_data_t::stat. Referenced by stop_audio(). |
|
Audio thread. This is run as a thread from daisyplayer.c and keeps the audio-engine alive. audio_initiate MUST be called before this function. audio_terminate MUST be called once you are done using the audio engine.
Definition at line 635 of file audio.c. References audio_decoder(), AUDIO_MAGIC_NUMBER, AUDIO_STATE_PLAY, AUDIO_STATE_STOP, audio_state_t, struct_audio_data_t::cb_playing_done, struct_audio_data_t::daisy, daisyplayer_t, struct_audio_data_t::do_callback_done, struct_audio_data_t::is_playing, struct_audio_data_t::magic, struct_audio_data_t::mutex, REP_DEBUG, report(), and struct_audio_data_t::state. |
|
callback is called by the decoder loop.
Definition at line 461 of file audio.c. References audio_data_t, AUDIO_MAGIC_NUMBER, AUDIO_STATE_PAUSE, AUDIO_STATE_STOP, struct_audio_data_t::cb_progress, struct_audio_data_t::daisy, struct_audio_data_t::magic, struct_audio_data_t::mutex, REP_DEBUG, report(), struct_audio_data_t::state, and struct_audio_data_t::unpause_cond. Referenced by header(). |