libcmml: Writing CMML files

# Writing CMML files

The following simple example CMML file demonstrates the main features of CMML:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <!DOCTYPE cmml SYSTEM "cmml.dtd">

    <cmml lang="en" dir="ltr" id="simple" granulerate="1000/1">

    <stream id="fish" basetime="0">
      <import id="videosrc" lang="en" dir="ltr" title="Video fish"
              granulerate="25/1" contenttype="video/mpeg"
              src="fish.mpg" start="0" end="360">
        <param id="vheight" name="video.height" value="250"/>
        <param id="vwidth"  name="video.width"  value="180"/>
      </import>
    </stream>

    <head>
      <title>Types of fish</title>
      <meta name="Producer" content="Joe Ordinary"/>
      <meta name="DC.Author" content="Joe's friend"/>
    </head>

    <clip id="intro" start="0">
      <a href="http://www.blah.au/fish.html">Read more about fish</a>
      <desc>This is the introduction to the film Joe made about fish.</desc>
    </clip>

    <clip id="dolphin" start="npt:3.5" end="npt:5:5.9">
      <img src="dolphin.jpg"/>
      <desc>Here, Joe caught sight of a dolphin in the ocean.</desc>
      <meta name="Subject" content="dolphin"/>
    </clip>

    <clip id="goldfish" start="npt:5:5.9">
      <a href="http://www.blah.au/morefish.anx?id=goldfish">More video clips on goldfish.</a>
      <img src="http://www.blah.au/goldfish.jpg"/>
      <desc>Joe has a fishtank at home with many colourful fish. The common goldfish is one of them and Joe's favourite. Here are some fabulous pictures he has taken of them.</desc>
      <meta name="Location" content="Joe's fishtank"/>
      <meta name="Subject" content="goldfish"/>
    </clip>

    </cmml>

## The preamble

After the usual preamble including the xml processing instruction and the doctype declaration, the root cmml tag houses the markup.

## The stream tag

The first markup will usually be a stream tag which names the source media file(s) that the markup of the CMML file relates to. The stream tag is optional as you may want to prepare a CMML file for a not yet existing media file, for a live media stream, or just as a template.

## The head tag

The head tag is mandatory as with html. It will at least contain either a title or a base tag. The title tag contains a short description of the complete annotated work. More structured information for the work go into the meta tags. It is recommended to use existing meta schemes such as the Dublin Core for the structured annotations.

## The clip tag

The following clip tags structure the work into temporal sections by specification of start and end times for each section. The end time is optional as a clip will be implicitly ended with the start of the next clip or the end of the file. You may attach an a tag to a clip to specify a related Web resource through its href attribute. You may attach an img tag to a clip to specify a URL to an image that represents the content of the clip visually. You may attach a desc tag to a clip to provide a textual description. More structured information for the clip go into the meta tags.

## Finishing the CMML file

The closing of the cmml tag ends the CMML file.