libcmml  0.9.1
Macros | Functions | Variables
cmml-validate.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <cmml.h>

Macros

#define BUFSIZE   100000
 

Functions

static void PrintUsage (char *prog)
 
static int read_stream (CMML *cmml, const CMML_Stream *stream, void *user_data)
 
static int read_head (CMML *cmml, const CMML_Head *head, void *user_data)
 
static int read_clip (CMML *cmml, const CMML_Clip *clip, void *user_data)
 
int main (int argc, char *argv[])
 

Variables

static int verbose
 

Detailed Description

cmml-validate: parses a CMML instance document and validates it against the CMML.dtd returning true/false and in case of fault the faulty tag including line and col number. Also spits out warnings for strange stuff.

Usage: cmml-validate [Options] filename
Validate a CMML file.
 
Possible options:
  -i clip_id, --id clip_id
                 Start parsing from the named clip.
  -s seconds, --sec seconds
                 Start parsing from the given seconds offset
  -u utc,     --utc utc
                 Start parsing from the given utc time
  -b, --verbose  Output parsed file to stdout
  -h, --help     Display this help information
  -v, --version  Display version information

View source code at: cmml-validate.c

Macro Definition Documentation

◆ BUFSIZE

#define BUFSIZE   100000

Function Documentation

◆ PrintUsage()

static void PrintUsage ( char *  prog)
static

PrintUsage: prints out help on how to use this program

Parameters
progthe program's name
Examples:
cmml-validate.c.

Referenced by main().

◆ read_stream()

static int read_stream ( CMML cmml,
const CMML_Stream stream,
void *  user_data 
)
static

read_stream: the callback for a stream element

Parameters
cmmlthe CMML* handle in use
streamthe stream element's content represented in a CMML_Stream*
user_datauser defined data
Returns
0 on success, 1 on error
Examples:
cmml-validate.c.

References BUFSIZE, cmml_error_snprint(), cmml_get_last_error(), cmml_stream_pretty_snprint(), and verbose.

Referenced by main().

◆ read_head()

static int read_head ( CMML cmml,
const CMML_Head head,
void *  user_data 
)
static

read_head: the callback for a head element

Parameters
cmmlthe CMML* handle in use
headthe head element's content represented in a CMML_Head*
user_datauser defined data
Returns
0 on success, 1 on error
Examples:
cmml-parse.c, and cmml-validate.c.

References BUFSIZE, cmml_error_snprint(), cmml_get_last_error(), cmml_head_pretty_snprint(), and verbose.

Referenced by main().

◆ read_clip()

static int read_clip ( CMML cmml,
const CMML_Clip clip,
void *  user_data 
)
static

read_clip: the callback for a clip element

Parameters
cmmlthe CMML* handle in use
clipthe clip element's content represented in a CMML_Clip*
user_datauser defined data
Returns
0 on success, 1 on error
Examples:
cmml-seek-clip.c, cmml-seek-offset.c, cmml-seek-utc.c, cmml-uri-file.c, and cmml-validate.c.

References BUFSIZE, cmml_clip_pretty_snprint(), cmml_error_snprint(), cmml_get_last_error(), and verbose.

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

main function of cmml-validate, which opens the CMML file, seeks to any given offsets, registers the callbacks, and then steps through the file in chunks of BUFSIZE size, during which the callbacks get activated as the relevant elements get parsed.

Examples:
cmml-parse.c, cmml-seek-clip.c, cmml-seek-offset.c, cmml-seek-utc.c, cmml-uri-file.c, cmml-validate.c, and cmml-write.c.

References BUFSIZE, cmml_close(), CMML_EOF, cmml_error_snprint(), cmml_get_last_error(), cmml_get_preamble(), cmml_new(), cmml_open(), cmml_preamble_snprint(), cmml_read(), cmml_set_read_callbacks(), cmml_set_sloppy(), cmml_skip_to_id(), cmml_skip_to_secs(), cmml_skip_to_utc(), PrintUsage(), read_clip(), read_head(), read_stream(), secs, CMML_Error::type, and verbose.

Variable Documentation

◆ verbose

int verbose
static

verbose: turns on printing of parsed CMML file

Examples:
cmml-validate.c.

Referenced by main(), read_clip(), read_head(), and read_stream().