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

Detailed Description

General functions related to Annodex media.


Function Documentation

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.
AnxClip* anx_clip_free ( AnxClip clip)

Free an AnxClip structure.

Parameters:
clipthe structure to free
Returns:
NULL on success
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
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)
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
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
int anx_flush ( ANNODEX annodex)

Flush any unwritten data associated with an annodex.

Parameters:
annodexAn ANNODEX* handle
Returns:
0 on success, -1 on failure
double anx_get_basetime ( ANNODEX annodex)

Query the basetime of an annodex.

Parameters:
annodexan ANNODEX* handle
Returns:
the basetime of the annodex
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
double anx_get_duration ( ANNODEX annodex)

Query the duration of an annodex.

Parameters:
annodexan ANNODEX* handle
Returns:
the duration of the annodex
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
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
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
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.
AnxHead* anx_head_free ( AnxHead head)

Free an AnxHead structure.

Parameters:
headthe structure to free
Returns:
NULL on success
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
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
AnxLinkElement* anx_link_element_clone ( AnxLinkElement link)

Clone an AnxLinkElement structure.

Parameters:
linkthe link tag structure to clone
Returns:
a new link tag structure
AnxMetaElement* anx_meta_element_clone ( AnxMetaElement meta)

Clone an AnxMetaElement structure.

Parameters:
metathe meta tag structure to clone
Returns:
a new meta tag structure
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
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
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
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
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
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)
double anx_set_basetime ( ANNODEX annodex,
double  seconds 
)

Set the basetime of an annodex.

Parameters:
annodexan ANNODEX* handle
secondsthe new basetime
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.
double anx_set_presentation_time ( ANNODEX annodex,
double  seconds 
)

Set the presentation time of an annodex.

Parameters:
annodexan ANNODEX* handle
secondsthe new presentation time
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_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?
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