libannodex provides a convenient callback based framework for reading Annodex media.
More...
Go to the source code of this file.
|
typedef int(* | AnxReadStream) (ANNODEX *annodex, double timebase, char *utc, void *user_data) |
| Signature for a callback called when the 'Annodex' stream header is parsed. More...
|
|
typedef int(* | AnxReadTrack) (ANNODEX *annodex, long serialno, char *id, char *content_type, anx_int64_t granule_rate_n, anx_int64_t granule_rate_d, int nr_header_packets, void *user_data) |
| Signature for a callback called each time an 'AnxData' track header is parsed. More...
|
|
typedef int(* | AnxReadHead) (ANNODEX *annodex, const AnxHead *head, void *user_data) |
| Signature for a callback called when the head element is parsed. More...
|
|
typedef int(* | AnxReadClip) (ANNODEX *annodex, const AnxClip *clip, void *user_data) |
| Signature for a callback called each time a clip element is parsed. More...
|
|
typedef int(* | AnxReadRaw) (ANNODEX *annodex, unsigned char *data, long n, long serialno, anx_int64_t granulepos, void *user_data) |
| Signature for a callback called each time a raw data packet is found. More...
|
|
|
int | anx_set_read_stream_callback (ANNODEX *annodex, AnxReadStream read_stream, void *user_data) |
| Set the function to call each time an 'Annodex' stream header is parsed. More...
|
|
void * | anx_get_read_stream_user_data (ANNODEX *annodex) |
| Retrieve the user_data associated with an attached AnxReadStream callback. More...
|
|
int | anx_set_read_track_callback (ANNODEX *annodex, AnxReadTrack read_track, void *user_data) |
| Set the function to call each time an 'AnxData' track header is parsed. More...
|
|
void * | anx_get_read_track_user_data (ANNODEX *annodex) |
| Retrieve the user_data associated with an attached AnxReadTrack callback. More...
|
|
int | anx_set_read_head_callback (ANNODEX *annodex, AnxReadHead read_head, void *user_data) |
| Set the function to call when the head element is read. More...
|
|
void * | anx_get_read_head_user_data (ANNODEX *annodex) |
| Retrieve the user_data associated with an attached AnxReadHead callback. More...
|
|
int | anx_set_read_clip_callback (ANNODEX *annodex, AnxReadClip read_clip, void *user_data) |
| Set the function to call each time a clip is parsed. More...
|
|
void * | anx_get_read_clip_user_data (ANNODEX *annodex) |
| Retrieve the user_data associated with an attached AnxReadClip callback. More...
|
|
int | anx_set_read_raw_callback (ANNODEX *annodex, AnxReadRaw read_raw, void *user_data) |
| Set the function to call each time a raw data packet is read. More...
|
|
void * | anx_get_read_raw_user_data (ANNODEX *annodex) |
| Retrieve the user_data associated with an attached AnxReadRaw callback. More...
|
|
long | anx_read (ANNODEX *annodex, long n) |
| Read from an annodex opened with anx_open() or anx_open_stdio(). More...
|
|
long | anx_read_input (ANNODEX *annodex, unsigned char *buf, long n) |
| Input data from a memory buffer into an annodex. More...
|
|
libannodex provides a convenient callback based framework for reading Annodex media.
After opening an annodex for reading, you can attach various callbacks relevant to the parts of the file you are interested in, including the stream header, track headers, head element, clips and media data. Then, as bytes are read, libannodex will call your callbacks as appropriate.
For tutorial information and examples, refer to the following:
◆ AnxReadClip
typedef int(* AnxReadClip) (ANNODEX *annodex, const AnxClip *clip, void *user_data) |
Signature for a callback called each time a clip element is parsed.
- Parameters
-
annodex | the ANNODEX* handle in use |
clip | the clip element |
user_data | A generic pointer you have provided earlier |
- Returns
- ANX_CONTINUE on success, and to inform anx_read*() functions to continue on to the next packet
- ANX_STOP_OK on success, to inform anx_read*() functions to return without further processing
- ANX_STOP_ERR on error, to inform anx_read*() functions to return without further processing
◆ AnxReadHead
typedef int(* AnxReadHead) (ANNODEX *annodex, const AnxHead *head, void *user_data) |
Signature for a callback called when the head element is parsed.
- Parameters
-
annodex | the ANNODEX* handle in use |
head | the head element |
user_data | A generic pointer you have provided earlier |
- Returns
- ANX_CONTINUE on success, and to inform anx_read*() functions to continue on to the next packet
- ANX_STOP_OK on success, to inform anx_read*() functions to return without further processing
- ANX_STOP_ERR on error, to inform anx_read*() functions to return without further processing
◆ AnxReadRaw
typedef int(* AnxReadRaw) (ANNODEX *annodex, unsigned char *data, long n, long serialno, anx_int64_t granulepos, void *user_data) |
Signature for a callback called each time a raw data packet is found.
- Parameters
-
annodex | the ANNODEX* handle in use |
data | a pointer to the data read from the packet |
n | the length in bytes of the data |
serialno | the track serial number of the packet |
granulepos | the granule position of the packet |
user_data | A generic pointer you have provided earlier |
- Returns
- ANX_CONTINUE on success, and to inform anx_read*() functions to continue on to the next packet
- ANX_STOP_OK on success, to inform anx_read*() functions to return without further processing
- ANX_STOP_ERR on error, to inform anx_read*() functions to return without further processing
◆ AnxReadStream
typedef int(* AnxReadStream) (ANNODEX *annodex, double timebase, char *utc, void *user_data) |
Signature for a callback called when the 'Annodex' stream header is parsed.
- Parameters
-
annodex | the ANNODEX* handle in use |
timebase | the timebase of the annodex |
utc | the UTC timebase of the annodex |
user_data | A generic pointer you have provided earlier |
- Returns
- ANX_CONTINUE on success, and to inform anx_read*() functions to continue on to the next packet
- ANX_STOP_OK on success, to inform anx_read*() functions to return without further processing
- ANX_STOP_ERR on error, to inform anx_read*() functions to return without further processing
◆ AnxReadTrack
typedef int(* AnxReadTrack) (ANNODEX *annodex, long serialno, char *id, char *content_type, anx_int64_t granule_rate_n, anx_int64_t granule_rate_d, int nr_header_packets, void *user_data) |
Signature for a callback called each time an 'AnxData' track header is parsed.
- Parameters
-
annodex | the ANNODEX* handle in use |
serialno | the track serial number |
id | the id attribute of the track |
content_type | the content type of the track |
granule_rate_n | the numerator of the granule rate |
granule_rate_d | the denominator of the granule rate |
nr_header_packets | the number of header packets of the track |
user_data | A generic pointer you have provided earlier |
- Returns
- ANX_CONTINUE on success, and to inform anx_read*() functions to continue on to the next packet
- ANX_STOP_OK on success, to inform anx_read*() functions to return without further processing
- ANX_STOP_ERR on error, to inform anx_read*() functions to return without further processing
◆ anx_get_read_clip_user_data()
void* anx_get_read_clip_user_data |
( |
ANNODEX * |
annodex | ) |
|
Retrieve the user_data associated with an attached AnxReadClip callback.
- Parameters
-
annodex | an ANNODEX* handle |
- Returns
- the associated user_data
◆ anx_get_read_head_user_data()
void* anx_get_read_head_user_data |
( |
ANNODEX * |
annodex | ) |
|
Retrieve the user_data associated with an attached AnxReadHead callback.
- Parameters
-
annodex | an ANNODEX* handle |
- Returns
- the associated user_data
◆ anx_get_read_raw_user_data()
void* anx_get_read_raw_user_data |
( |
ANNODEX * |
annodex | ) |
|
Retrieve the user_data associated with an attached AnxReadRaw callback.
- Parameters
-
annodex | an ANNODEX* handle |
- Returns
- the associated user_data
◆ anx_get_read_stream_user_data()
void* anx_get_read_stream_user_data |
( |
ANNODEX * |
annodex | ) |
|
Retrieve the user_data associated with an attached AnxReadStream callback.
- Parameters
-
annodex | an ANNODEX* handle |
- Returns
- the associated user_data
◆ anx_get_read_track_user_data()
void* anx_get_read_track_user_data |
( |
ANNODEX * |
annodex | ) |
|
Retrieve the user_data associated with an attached AnxReadTrack callback.
- Parameters
-
annodex | an ANNODEX* handle |
- Returns
- the associated user_data
◆ anx_read()
long anx_read |
( |
ANNODEX * |
annodex, |
|
|
long |
n |
|
) |
| |
Read from an annodex opened with anx_open() or anx_open_stdio().
The annodex is automatically parsed and relevant read callbacks are called, stopping when the required number of bytes have been read, or earlier if any of the read callbacks returned other than ANX_CONTINUE.
- Parameters
-
annodex | an ANNODEX* handle |
n | count of bytes to read |
- Returns
- the count of bytes actually read
◆ anx_read_input()
long anx_read_input |
( |
ANNODEX * |
annodex, |
|
|
unsigned char * |
buf, |
|
|
long |
n |
|
) |
| |
Input data from a memory buffer into an annodex.
Usually the annodex would have been created with anx_new(). The annodex is automatically parsed and relevant read callbacks are called, stopping when the required number of bytes have been read, or earlier if any of the read callbacks returned other than ANX_CONTINUE.
- Parameters
-
annodex | an ANNODEX* handle |
buf | a memory buffer containing data to input |
n | count of bytes to input |
- Returns
- the count of bytes actually input
◆ anx_set_read_clip_callback()
int anx_set_read_clip_callback |
( |
ANNODEX * |
annodex, |
|
|
AnxReadClip |
read_clip, |
|
|
void * |
user_data |
|
) |
| |
Set the function to call each time a clip is parsed.
- Parameters
-
annodex | an ANNODEX* handle |
read_clip | the callback to call |
user_data | Arbitrary data you wish to pass to your callback |
- Returns
- 0 on success
◆ anx_set_read_head_callback()
int anx_set_read_head_callback |
( |
ANNODEX * |
annodex, |
|
|
AnxReadHead |
read_head, |
|
|
void * |
user_data |
|
) |
| |
Set the function to call when the head element is read.
- Parameters
-
annodex | an ANNODEX* handle |
read_head | the callback to call |
user_data | Arbitrary data you wish to pass to your callback |
- Returns
- 0 on success, -1 on failure
◆ anx_set_read_raw_callback()
int anx_set_read_raw_callback |
( |
ANNODEX * |
annodex, |
|
|
AnxReadRaw |
read_raw, |
|
|
void * |
user_data |
|
) |
| |
Set the function to call each time a raw data packet is read.
- Parameters
-
annodex | an ANNODEX* handle |
read_raw | the callback to call |
user_data | Arbitrary data you wish to pass to your callback |
- Returns
- 0 on success, -1 on failure
◆ anx_set_read_stream_callback()
Set the function to call each time an 'Annodex' stream header is parsed.
- Parameters
-
annodex | an ANNODEX* handle |
read_stream | the callback to call |
user_data | Arbitrary data you wish to pass to your callback |
- Returns
- 0 on success, -1 on failure
◆ anx_set_read_track_callback()
int anx_set_read_track_callback |
( |
ANNODEX * |
annodex, |
|
|
AnxReadTrack |
read_track, |
|
|
void * |
user_data |
|
) |
| |
Set the function to call each time an 'AnxData' track header is parsed.
- Parameters
-
annodex | an ANNODEX* handle |
read_track | the callback to call |
user_data | Arbitrary data you wish to pass to your callback |
- Returns
- 0 on success, -1 on failure