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: More...

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);
}