Main Page | Data Structures | File List | Data Fields | Globals

libdaisy.h File Reference


Detailed Description

Header file for the libdaisy development package.

Libdaisy is a toolkit for parsing and playing Daisy Digital Talking Books (DTB).

Date:
21.03.2006

Go to the source code of this file.

Typedefs

typedef void * daisyplayer_t
 This will need to be initialized and passed along to the daisy functions.

Enumerations

enum  daisy_status {
  DAISY_ERROR_UNKNOWN = 0x0000, DAISY_ERROR_AUDIO_NOT_INITIALIZED = 0x0200, DAISY_ERROR_AUDIO_CREATE_MMAP = 0x0201, DAISY_ERROR_AUDIO_FSTAT = 0x0202,
  DAISY_ERROR_AUDIO_OPEN = 0x0203, DAISY_ERROR_AUDIO_FREE_MMAP = 0x0204, DAISY_ERROR_AUDIO_INITIATE_DATA = 0x0205, DAISY_ERROR_AUDIO_NOT_PLAYING = 0x0206,
  DAISY_ERROR_AUDIO_NOT_STOPPED = 0x0207, DAISY_ERROR_AUDIO_DATA_IS_NULL = 0x0208, DAISY_ERROR_AUDIO_MALLOC = 0x0209, DAISY_ERROR_AUDIO_PAUSED_WHILE_NOT_PLAYING = 0x0210,
  DAISY_ERROR_AUDIO_STOPPED_WHILE_NOT_PLAYING = 0x0211, DAISY_ERROR_PLAYBACK_NO_TEXT_IN_SEGMENT = 0x0301, DAISY_ERROR_PLAYBACK_NO_AUDIO_IN_SEGMENT = 0x0302, DAISY_ERROR_PLAYBACK_NO_DTB_LOADED = 0x0303,
  DAISY_ERROR_PLAYBACK_SEEK_FAILED = 0x0304, DAISY_ERROR_MISC_INIT_MUTEX = 0x0400, DAISY_END_OF_BOOK = 0x1100
}
 The different sort of status messages libdaisy might return. More...
enum  daisy_seek_option {
  DAISY_SEEK_PREV_CHAPTER = 1, DAISY_SEEK_PREV_PASSAGE = 2, DAISY_SEEK_NEXT_CHAPTER = 3, DAISY_SEEK_NEXT_PASSAGE = 4,
  DAISY_SEEK_TO_BEGINNING = 5
}
 The different seek operations supported by the engine. More...
enum  daisy_bookinfo_option { DAISY_BOOKINFO_TITLETEXT = 1, DAISY_BOOKINFO_TITLEIMAGE = 2, DAISY_BOOKINFO_TOTALTIME = 3 }
 The different types of book information. More...
enum  daisy_chapter_info { DAISY_CHAPTER_TITLE = 1, DAISY_CHAPTER_WEIGHT = 2 }
 The different types of chapter information. More...

Functions

daisyplayer_t daisy_init (void *data, void(*l_cb_daisy_audio_done)(void *), void(*l_cb_daisy_audio_next)(void *, unsigned long int), void(*l_cb_daisy_text)(void *, void *), void(*l_cb_daisy_id)(void *, void *), void(*l_cb_daisy_error)(void *, enum daisy_status, const char *daisy_status_msg), void(*l_cb_daisy_progress)(void *, long int))
 Initializes the daisy library.
void daisy_term (daisyplayer_t daisy)
 Terminates the daisy library and frees memory used by it.
int daisy_load (daisyplayer_t daisy, char *path)
 Loads a new daisy book.
int daisy_play (daisyplayer_t daisy)
 Starts playback if a book is loaded.
int daisy_seek (daisyplayer_t daisy, int seek_option)
 Seek operations which can be performed when a book is loaded.
daisy_positiondaisy_get_position (daisyplayer_t daisy)
 Retrieves the current playback position.
int daisy_goto_position (daisyplayer_t daisy, daisy_position *position)
 Seeks to a playback position (bookmark) and continue playback from there.
int daisy_stop (daisyplayer_t daisy)
 Stops playback.
int daisy_pause (daisyplayer_t daisy)
 Toggle pause.
char * daisy_get_info (daisyplayer_t daisy, int value)
 Retrieves book meta information.
int daisy_get_chapter_count (daisyplayer_t daisy)
 Retrieves the number of chapters in in the loaded Daisy DTB.
char * daisy_get_chapter_info (daisyplayer_t daisy, int num, int option)
 Retrieves information about a given chapter.


Typedef Documentation

typedef void* daisyplayer_t
 

This will need to be initialized and passed along to the daisy functions.


Enumeration Type Documentation

enum daisy_bookinfo_option
 

The different types of book information.

See also:
daisy_get_info
Enumeration values:
DAISY_BOOKINFO_TITLETEXT 
DAISY_BOOKINFO_TITLEIMAGE 
DAISY_BOOKINFO_TOTALTIME 

enum daisy_chapter_info
 

The different types of chapter information.

See also:
daisy_get_chapter_info
Enumeration values:
DAISY_CHAPTER_TITLE 
DAISY_CHAPTER_WEIGHT 

enum daisy_seek_option
 

The different seek operations supported by the engine.

See also:
daisy_seek
Enumeration values:
DAISY_SEEK_PREV_CHAPTER 
DAISY_SEEK_PREV_PASSAGE 
DAISY_SEEK_NEXT_CHAPTER 
DAISY_SEEK_NEXT_PASSAGE 
DAISY_SEEK_TO_BEGINNING 

enum daisy_status
 

The different sort of status messages libdaisy might return.

Enumeration values:
DAISY_ERROR_UNKNOWN 
DAISY_ERROR_AUDIO_NOT_INITIALIZED 
DAISY_ERROR_AUDIO_CREATE_MMAP 
DAISY_ERROR_AUDIO_FSTAT 
DAISY_ERROR_AUDIO_OPEN 
DAISY_ERROR_AUDIO_FREE_MMAP 
DAISY_ERROR_AUDIO_INITIATE_DATA 
DAISY_ERROR_AUDIO_NOT_PLAYING 
DAISY_ERROR_AUDIO_NOT_STOPPED 
DAISY_ERROR_AUDIO_DATA_IS_NULL 
DAISY_ERROR_AUDIO_MALLOC 
DAISY_ERROR_AUDIO_PAUSED_WHILE_NOT_PLAYING 
DAISY_ERROR_AUDIO_STOPPED_WHILE_NOT_PLAYING 
DAISY_ERROR_PLAYBACK_NO_TEXT_IN_SEGMENT 
DAISY_ERROR_PLAYBACK_NO_AUDIO_IN_SEGMENT 
DAISY_ERROR_PLAYBACK_NO_DTB_LOADED 
DAISY_ERROR_PLAYBACK_SEEK_FAILED 
DAISY_ERROR_MISC_INIT_MUTEX 
DAISY_END_OF_BOOK 


Function Documentation

int daisy_get_chapter_count daisyplayer_t  daisy  ) 
 

Retrieves the number of chapters in in the loaded Daisy DTB.

Parameters:
daisy - the daisy struct which must be passed along with all the API functions.
Returns:
the number of chapters, or -1 in case of error.

char* daisy_get_chapter_info daisyplayer_t  daisy,
int  num,
int  option
 

Retrieves information about a given chapter.

Parameters:
daisy - the daisy struct which must be passed along with all the API functions.
num - the chapter number to retrive information from (use daisy_get_chapter_count to get the number of chapters available).
option - a daisy_chapter_info which states what information to retrieve.
Returns:
a pointer to a string containing the information, or NULL in case of error.
See also:
daisy_chapter_info

daisy_get_chapter_count

char* daisy_get_info daisyplayer_t  daisy,
int  value
 

Retrieves book meta information.

Parameters:
daisy - the daisy struct which must be passed along with all the API functions.
value - a daisy_bookinfo_option value which states what information to retrieve.
Returns:
the string if found, otherwise NULL. The string must be deallocated by the caller.
See also:
daisy_bookinfo_option

daisy_position* daisy_get_position daisyplayer_t  daisy  ) 
 

Retrieves the current playback position.

Parameters:
daisy - the daisy data struct which must be passed along with all the API functions.
Returns:
a pointer to a daisy_position struct containing the chapter and passage positions, or NULL in case of error. The struct must be deallocated by the caller.
See also:
daisy_position

daisy_goto_position

int daisy_goto_position daisyplayer_t  daisy,
daisy_position position
 

Seeks to a playback position (bookmark) and continue playback from there.

Parameters:
daisy - the daisy data struct which must be passed along with all the API functions.
position - a pointer to a daisy_position struct with the chapter and passage position.
Returns:
1 in case of success and -1 in case of error.
See also:
daisy_position

daisy_get_position

daisyplayer_t daisy_init void *  data,
void(*)(void *)  l_cb_daisy_audio_done,
void(*)(void *, unsigned long int)  l_cb_daisy_audio_next,
void(*)(void *, void *)  l_cb_daisy_text,
void(*)(void *, void *)  l_cb_daisy_id,
void(*)(void *, enum daisy_status, const char *daisy_status_msg)  l_cb_daisy_error,
void(*)(void *, long int)  l_cb_daisy_progress
 

Initializes the daisy library.

It should be called before any attempt to use the daisy functionality.

Parameters:
data - a void pointer to any object or datastructure you may need in the callback functions. This data pointer will be available in all callback functions. You can e.g. pass along a GUI object in c++ so that you can output the text from the callbackfunctions in the GUI. Set this parameter to NULL if you don't need it.
l_cb_daisy_audio_done - a pointer to the function which will be called when an audio segment is done playing.
l_cb_daisy_audio_next - a pointer to the function which will be called when an new audio segment starts playing, supplying the duration of the segment in ms.
l_cb_daisy_text - a pointer to the function which will be called when an new audio segment starts playing, supplying the text corresponding to the audio.
l_cb_daisy_id - a pointer to the function which will be called when an new audio segment starts playing, supplying the id of the text passage in the xml file.
l_cb_daisy_error - a pointer to the function which will be called when an engine error occures.
l_cb_daisy_progress - a pointer to the function which will be called during playback, supplying the progress in ms.
Returns:
daisyplayer_t - the daisy data struct which must be passed along with all the API functions.

int daisy_load daisyplayer_t  daisy,
char *  path
 

Loads a new daisy book.

Parameters:
daisy - the daisy data struct which must be passed along with all the API functions.
path - a full path to the daisy dtb (ncc.* | *.ncx) to open.
Returns:
1 in case of success and -1 in case of error.

int daisy_pause daisyplayer_t  daisy  ) 
 

Toggle pause.

Pauses playback if state is playing and continues playing of state is paused.

Parameters:
daisy - the daisy data struct which must be passed along with all the API functions.
Returns:
1 in case of success and -1 in case of error.

int daisy_play daisyplayer_t  daisy  ) 
 

Starts playback if a book is loaded.

Parameters:
daisy - the daisy data struct which must be passed along with all the API functions.
Returns:
1 in case of success and -1 in case of error.

int daisy_seek daisyplayer_t  daisy,
int  seek_option
 

Seek operations which can be performed when a book is loaded.

Parameters:
daisy - the daisy data struct which must be passed along with all the API functions.
seek_option - a daisy_seek_option.
Returns:
0 if end_of_book, 1 in case of success and -1 in case of error.
See also:
daisy_seek_option

int daisy_stop daisyplayer_t  daisy  ) 
 

Stops playback.

Parameters:
daisy - the daisy data struct which must be passed along with all the API functions.
Returns:
1 in case of success. Has no other return values at this point.

void daisy_term daisyplayer_t  daisy  ) 
 

Terminates the daisy library and frees memory used by it.

It should be called when daisy are no longer needed.

Parameters:
daisy - the daisy data struct which must be passed along with all the API functions.


Generated on Thu May 18 12:46:34 2006 for libdaisy by  doxygen 1.4.2