Writing a CMML file
Although libcmml was created mainly for the purpose of parsing existing CMML files, it also provides rudimentary support for creating CMML files. This basically consists in providing the data structures for the different tags and API functions to print those tags. There is no validation or sequence checking available for the writing side.
The general sequence of API calls is the following:
This procedure is illustrated in cmml-write.c:
#include <stdio.h>
#include <string.h>
#define BUFSIZE 100000
int main(
int argc,
char *argv[])
{
puts(buf);
head->
title = strdup(
"This is a test file");
puts(buf);
clip->
anchor_text = strdup(
"hyperlink to annodex.net");
puts (buf);
printf ("</cmml>\n");
exit(0);
}
int main(int argc, char *argv[])
Definition: cmml-validate.c:212
#define BUFSIZE
Definition: cmml-validate.c:79
int cmml_head_snprint(char *buf, int n, CMML_Head *head)
CMML_Time * cmml_time_new(const char *s)
CMML_Preamble * cmml_preamble_new(char *encoding, char *id, char *lang, char *dir, char *granulerate)
int cmml_clip_snprint(char *buf, int n, CMML_Clip *clip)
void cmml_clip_destroy(CMML_Clip *clip)
int cmml_preamble_snprint(char *buf, int n, CMML_Preamble *pre)
void cmml_preamble_destroy(CMML_Preamble *preamble)
int cmml_npt_snprint(char *buf, int n, double seconds)
CMML_Head * cmml_head_new(void)
CMML_Clip * cmml_clip_new(CMML_Time *start_time, CMML_Time *end_time)
void cmml_head_destroy(CMML_Head *head)
char * desc_text
Definition: cmml.h:271
char * anchor_text
Definition: cmml.h:258
char * anchor_href
Definition: cmml.h:257
char * title
Definition: cmml.h:228