Main Page | Modules | Data Structures | File List | Globals | Related Pages

anx_read.h File Reference


Detailed Description

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:

#include <annodex/anx_types.h>

Go to the source code of this file.

Typedefs

typedef int(* AnxReadStream )(ANNODEX *annodex, double timebase, char *utc, void *user_data)
 Signature for a callback called when the 'Annodex' stream header is parsed.

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.

typedef int(* AnxReadHead )(ANNODEX *annodex, const AnxHead *head, void *user_data)
 Signature for a callback called when the head element is parsed.

typedef int(* AnxReadClip )(ANNODEX *annodex, const AnxClip *clip, void *user_data)
 Signature for a callback called each time a clip element is parsed.

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.


Functions

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.

void * anx_get_read_stream_user_data (ANNODEX *annodex)
 Retrieve the user_data associated with an attached AnxReadStream 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.

void * anx_get_read_track_user_data (ANNODEX *annodex)
 Retrieve the user_data associated with an attached AnxReadTrack 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.

void * anx_get_read_head_user_data (ANNODEX *annodex)
 Retrieve the user_data associated with an attached AnxReadHead 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.

void * anx_get_read_clip_user_data (ANNODEX *annodex)
 Retrieve the user_data associated with an attached AnxReadClip 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.

void * anx_get_read_raw_user_data (ANNODEX *annodex)
 Retrieve the user_data associated with an attached AnxReadRaw callback.

int anx_set_user_data (ANNODEX *annodex, void *user_data)
 Associate arbitrary data with read callbacks.

long anx_read (ANNODEX *annodex, long n)
 Read from an annodex opened with anx_open() or anx_open_stdio().

long anx_read_input (ANNODEX *annodex, unsigned char *buf, long n)
 Input data from a memory buffer into an annodex.


Typedef Documentation

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

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

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

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

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


Function Documentation

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

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

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

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

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

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

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

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

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

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

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.

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

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

int anx_set_user_data ANNODEX annodex,
void *  user_data
 

Associate arbitrary data with read callbacks.

Parameters:
annodex an ANNODEX* handle
user_data a pointer to a user defined object to be passed to each of the read callbacks.
Returns:
0 on success, -1 on failure


Generated on Sat May 22 19:44:48 2004 for libannodex by doxygen 1.3.5