libannodex  0.7.3
Writing to files and file descriptors

If you wish to write Annodex media to a file or file descriptor (such as a network socket), it can be directly written as follows:

This procedure is illustrated in src/examples/write-clip-file.c:

#include <stdio.h>
#include <string.h>
int
main (int argc, char *argv[])
{
ANNODEX * anx = NULL;
AnxClip my_clip;
char * infilename, * outfilename;
long n;
if (argc != 3) {
fprintf (stderr, "Usage: %s infile outfile.anx\n", argv[0]);
exit (1);
}
/* Load all importers */
infilename = argv[1];
outfilename = argv[2];
/* Create an ANNODEX* writer, writing to outfilename */
anx = anx_open (outfilename, ANX_WRITE);
/* Import infilename into the writer */
anx_write_import (anx, infilename, NULL /* id */,
NULL /* unknown content-type */,
0 /* seek_offset */, -1 /* seek_end */, 0 /* flags */);
/* Insert a clip starting at time 0 */
memset (&my_clip, 0, sizeof (AnxClip));
my_clip.anchor_href = "http://www.annodex.net/";
my_clip.anchor_text = "Find out about Annodex media";
anx_insert_clip (anx, 0, &my_clip);
/* End the clip at time 2.0 seconds */
anx_insert_clip (anx, 2.0, NULL);
while ((n = anx_write (anx, 1024)) > 0);
anx_close (anx);
exit (0);
}
annodex.h
ANNODEX
void ANNODEX
An ANNODEX handle.
Definition: anx_types.h:55
anx_write_import
int anx_write_import(ANNODEX *annodex, char *filename, char *id, char *content_type, double seek_offset, double seek_end, int flags)
Import a file into the current ANNODEX* writer.
anx_open
ANNODEX * anx_open(char *filename, int mode)
Open a file containing Annodex media.
_AnxClip
Definition: anx_types.h:102
anx_write
long anx_write(ANNODEX *annodex, long n)
Write to an annodex opened with anx_open() or anx_open_stdio().
anx_insert_clip
int anx_insert_clip(ANNODEX *annodex, double at_time, AnxClip *clip)
Insert a clip into an ANNODEX* writer.
anx_close
ANNODEX * anx_close(ANNODEX *annodex)
Close an annodex.
anx_init_importers
void anx_init_importers(char *content_type_pattern)
Initialise system importers matching a given content type pattern.
_AnxClip::anchor_href
const char * anchor_href
href out of clip
Definition: anx_types.h:114
_AnxClip::anchor_text
const char * anchor_text
anchor text
Definition: anx_types.h:115