libannodex  0.7.3
Functions
anx_general.h File Reference

General functions related to Annodex media. More...

#include <annodex/anx_types.h>

Go to the source code of this file.

Functions

double anx_parse_time (const char *str)
 Time parsing.
 
int anx_last_error (ANNODEX *annodex)
 Retrieve the error code of the most recent error on an annodex. More...
 
const char * anx_strerror (ANNODEX *annodex)
 Retrieve a printable error string corresponding to the most recent error on annodex. More...
 
int anx_get_mode (ANNODEX *annodex)
 Get the mode of an Annodex. More...
 
ANNODEXanx_open (char *filename, int mode)
 Open a file containing Annodex media. More...
 
ANNODEXanx_open_stdio (FILE *file, int mode)
 Attach to an existing file descriptor. More...
 
ANNODEXanx_new (int mode)
 Create a managed Annodex handle This is an alternative interface for non-file annodexes. More...
 
int anx_flush (ANNODEX *annodex)
 Flush any unwritten data associated with an annodex. More...
 
ANNODEXanx_close (ANNODEX *annodex)
 Close an annodex. More...
 
int anx_destroy (ANNODEX *annodex)
 Forcefully close an annodex without flushing any file descriptors. More...
 
int anx_ready (ANNODEX *annodex)
 Query if an annodex is ready. More...
 
int anx_eos (ANNODEX *annodex)
 Query if an annodex has reached its 'End Of Stream' markers. More...
 
AnxHeadanx_set_head (ANNODEX *annodex, AnxHead *head)
 Set the head element of the Annodex. More...
 
AnxHeadanx_get_head (ANNODEX *annodex)
 Get a copy of the head element of an annodex. More...
 
anx_int64_t anx_tell (ANNODEX *annodex)
 Query the current byte offset of an annodex. More...
 
int anx_seek_id (ANNODEX *annodex, const char *id)
 Seek to an anchor identified by id. More...
 
double anx_get_presentation_time (ANNODEX *annodex)
 Query the presentation time of an annodex. More...
 
double anx_set_presentation_time (ANNODEX *annodex, double seconds)
 Set the presentation time of an annodex. More...
 
double anx_get_basetime (ANNODEX *annodex)
 Query the basetime of an annodex. More...
 
double anx_set_basetime (ANNODEX *annodex, double seconds)
 Set the basetime of an annodex. More...
 
double anx_get_bitrate (ANNODEX *annodex)
 Query the bitrate of an annodex. More...
 
double anx_get_duration (ANNODEX *annodex)
 Query the duration of an annodex. More...
 
double anx_tell_time (ANNODEX *annodex)
 Query the current offset of an annodex expressed as time in seconds. More...
 
double anx_seek_time (ANNODEX *annodex, double seconds, int whence)
 Seek to a time point in an annodex. More...
 
int anx_head_snprint (char *buf, int n, AnxHead *h)
 Print an AnxHead structure to a memory buffer. More...
 
int anx_clip_snprint (char *buf, int n, AnxClip *a, double start, double end)
 Print an AnxAnchor structure to a memory buffer. More...
 
AnxHeadanx_head_free (AnxHead *head)
 Free an AnxHead structure. More...
 
AnxClipanx_clip_free (AnxClip *clip)
 Free an AnxClip structure. More...
 
AnxHeadanx_head_clone (AnxHead *head)
 Clone an AnxHead structure. More...
 
AnxClipanx_clip_clone (AnxClip *clip)
 Clone an AnxClip structure. More...
 
AnxMetaElementanx_meta_element_clone (AnxMetaElement *meta)
 Clone an AnxMetaElement structure. More...
 
AnxLinkElementanx_link_element_clone (AnxLinkElement *link)
 Clone an AnxLinkElement structure. More...
 

Detailed Description

General functions related to Annodex media.

Function Documentation

◆ anx_clip_clone()

AnxClip* anx_clip_clone ( AnxClip clip)

Clone an AnxClip structure.

Parameters
clipthe clip to clone
Returns
a new clip structure
Note
All components of the original clip are cloned, including all strings and its list of meta tags.

◆ anx_clip_free()

AnxClip* anx_clip_free ( AnxClip clip)

Free an AnxClip structure.

Parameters
clipthe structure to free
Returns
NULL on success

◆ anx_clip_snprint()

int anx_clip_snprint ( char *  buf,
int  n,
AnxClip a,
double  start,
double  end 
)

Print an AnxAnchor structure to a memory buffer.

The head is serialized to XML conformant with the anxa DTD.

Parameters
bufa buffer to print into
nthe maximum number of characters to print
athe anchor to print
startthe value of the 'start' attribute, as a time in seconds. If start is negative, the 'start' attribute is not printed.
Returns
the number of characters printed, -1 on potential overrun
Bug:
This should follow C99 semantics

◆ anx_close()

ANNODEX* anx_close ( ANNODEX annodex)

Close an annodex.

Parameters
annodexan ANNODEX* handle
Returns
NULL on success; returns the unchanged annodex on failure (eg. due to system close() failing)

◆ anx_destroy()

int anx_destroy ( ANNODEX annodex)

Forcefully close an annodex without flushing any file descriptors.

Parameters
annodexan ANNODEX* handle
Returns
0 on success, -1 on failure

◆ anx_eos()

int anx_eos ( ANNODEX annodex)

Query if an annodex has reached its 'End Of Stream' markers.

Parameters
annodexan ANNODEX* handle
Returns
0 if annodex is not at eos, 1 if it is

◆ anx_flush()

int anx_flush ( ANNODEX annodex)

Flush any unwritten data associated with an annodex.

Parameters
annodexAn ANNODEX* handle
Returns
0 on success, -1 on failure

◆ anx_get_basetime()

double anx_get_basetime ( ANNODEX annodex)

Query the basetime of an annodex.

Parameters
annodexan ANNODEX* handle
Returns
the basetime of the annodex

◆ anx_get_bitrate()

double anx_get_bitrate ( ANNODEX annodex)

Query the bitrate of an annodex.

Parameters
annodexan ANNODEX* handle
Returns
the bitrate of the annodex
Return values
-1.0Unknown

◆ anx_get_duration()

double anx_get_duration ( ANNODEX annodex)

Query the duration of an annodex.

Parameters
annodexan ANNODEX* handle
Returns
the duration of the annodex

◆ anx_get_head()

AnxHead* anx_get_head ( ANNODEX annodex)

Get a copy of the head element of an annodex.

Parameters
annodexan ANNODEX* handle
Returns
a copy of the head element

◆ anx_get_mode()

int anx_get_mode ( ANNODEX annodex)

Get the mode of an Annodex.

Parameters
annodexan ANNODEX* handle
Return values
ANX_READannodex is a reader
ANX_WRITEannodex is a writer
ANX_ERR_INVALIDannodex is invalid

◆ anx_get_presentation_time()

double anx_get_presentation_time ( ANNODEX annodex)

Query the presentation time of an annodex.

Parameters
annodexan ANNODEX* handle
Returns
the presentation time of the annodex

◆ anx_head_clone()

AnxHead* anx_head_clone ( AnxHead head)

Clone an AnxHead structure.

Parameters
headthe head to clone
Returns
a new head structure
Note
All components of the original head are cloned, including all strings and its list of meta tags.

◆ anx_head_free()

AnxHead* anx_head_free ( AnxHead head)

Free an AnxHead structure.

Parameters
headthe structure to free
Returns
NULL on success

◆ anx_head_snprint()

int anx_head_snprint ( char *  buf,
int  n,
AnxHead h 
)

Print an AnxHead structure to a memory buffer.

The head is serialized to XML conformant with the anxhead DTD.

Parameters
bufa buffer to print into
nthe maximum number of characters to print
hthe head to print
Returns
the number of characters printed, -1 on potential overrun
Bug:
This should follow C99 semantics

◆ anx_last_error()

int anx_last_error ( ANNODEX annodex)

Retrieve the error code of the most recent error on an annodex.

Parameters
annodexan ANNODEX* handle
Returns
the error code of the most recent error

◆ anx_link_element_clone()

AnxLinkElement* anx_link_element_clone ( AnxLinkElement link)

Clone an AnxLinkElement structure.

Parameters
linkthe link tag structure to clone
Returns
a new link tag structure

◆ anx_meta_element_clone()

AnxMetaElement* anx_meta_element_clone ( AnxMetaElement meta)

Clone an AnxMetaElement structure.

Parameters
metathe meta tag structure to clone
Returns
a new meta tag structure

◆ anx_new()

ANNODEX* anx_new ( int  mode)

Create a managed Annodex handle This is an alternative interface for non-file annodexes.

Parameters
modeANX_READ or ANX_WRITE
Returns
an ANNODEX* handle

◆ anx_open()

ANNODEX* anx_open ( char *  filename,
int  mode 
)

Open a file containing Annodex media.

Parameters
filenamepath to the file
modeANX_READ or ANX_WRITE
Returns
an ANNODEX* handle

◆ anx_open_stdio()

ANNODEX* anx_open_stdio ( FILE *  file,
int  mode 
)

Attach to an existing file descriptor.

Parameters
fdan open file descriptor
modeANX_READ or ANX_WRITE
Returns
an ANNODEX* handle

◆ anx_ready()

int anx_ready ( ANNODEX annodex)

Query if an annodex is ready.

Parameters
annodexan ANNODEX* handle
Returns
0 if annodex is not ready, 1 if it is

◆ anx_seek_id()

int anx_seek_id ( ANNODEX annodex,
const char *  id 
)

Seek to an anchor identified by id.

Parameters
annodexan ANNODEX* handle
idThe id of the anchor to seek to

◆ anx_seek_time()

double anx_seek_time ( ANNODEX annodex,
double  seconds,
int  whence 
)

Seek to a time point in an annodex.

Parameters
annodexan ANNODEX* handle
secondsthe time to seek to
whencewhence parameter (defined in anx_constants.h)

◆ anx_set_basetime()

double anx_set_basetime ( ANNODEX annodex,
double  seconds 
)

Set the basetime of an annodex.

Parameters
annodexan ANNODEX* handle
secondsthe new basetime

◆ anx_set_head()

AnxHead* anx_set_head ( ANNODEX annodex,
AnxHead head 
)

Set the head element of the Annodex.

Parameters
annodexan ANNODEX* handle
heada complete AnxHead structure to set
Returns
the head if successful, NULL on failure
Note
libannodex makes a copy of the head; it can be safely freed after returning from this call.

◆ anx_set_presentation_time()

double anx_set_presentation_time ( ANNODEX annodex,
double  seconds 
)

Set the presentation time of an annodex.

Parameters
annodexan ANNODEX* handle
secondsthe new presentation time

◆ anx_strerror()

const char* anx_strerror ( ANNODEX annodex)

Retrieve a printable error string corresponding to the most recent error on annodex.

Parameters
annodexan ANNODEX* handle
Returns
an error string

◆ anx_tell()

anx_int64_t anx_tell ( ANNODEX annodex)

Query the current byte offset of an annodex.

Parameters
annodexan ANNODEX* handle
Returns
the current byte offset XXX: Deprecated?

◆ anx_tell_time()

double anx_tell_time ( ANNODEX annodex)

Query the current offset of an annodex expressed as time in seconds.

Parameters
annodexan ANNODEX* handle
Returns
the current time offset