Synchronized Multimedia Integration Language

The Internal to Synchronized Multimedia Integration Language (SMIL) Conversion by Campcaster. Up-to-date background documentation about SMIL is available  here 2.1 and  here 3.0 at w3.org.

Why do we use SMIL in  Campcaster, instead of M3U for instance?

  • allows for nested playlists (this is the only feature we currently use it for)
  • allows for multiple items to be played at the same time (not just crossfades)
  • allows for making a plalylist editor that has millisecond precision

The internal format is described in the doxygen documentation of  Core::Playlist.

The DTD of the SMIL document:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE smil [
<!ATTLIST smil  xmlns   CDATA   #FIXED  "http://www.w3.org/2001/SMIL20/Language" >
<!ELEMENT smil      (body)   >
<!ELEMENT body      (par)    >
<!ELEMENT par       (audio*) >
<!ELEMENT audio     (animate?, animate?) >
<!ATTLIST audio     src             CDATA   #REQUIRED >
<!ATTLIST audio     begin           CDATA   #REQUIRED >
<!ELEMENT animate   EMPTY >
<!ATTLIST animate   attributeName   CDATA   #FIXED  "soundLevel" >
<!ATTLIST animate   from            CDATA   #REQUIRED            >
<!ATTLIST animate   to              CDATA   #REQUIRED            >
<!ATTLIST animate   calcMode        CDATA   #FIXED  "linear"     >
<!ATTLIST animate   begin           CDATA   #REQUIRED            >
<!ATTLIST animate   end             CDATA   #REQUIRED            >
<!ATTLIST animate   fill            CDATA   #FIXED  "freeze"     >

Where, in the <audio> tag:

  • the src attribute is the URL of the playlist element, which could either be an mp3 or ogg file, or another SMIL file containing the description of an embedded playlist;
  • the begin attribute is the starting time of the playlist element, from the PlaylistElement’s relativeOffset, but converted to number of seconds, rounded to the nearest millisecond. For example: “1234.567s”, “0.89s”, or “3s”.

There can be 0, 1 or 2 <animate> tags, depending on whether there is a <fadeInfo> child in the <playlistElement>.

  • from and to are either equal to “0%” and “100%” (for fadeIn) or “100%” and “0%” (for fadeOut);
  • begin and end are times relative to the playlistElement. They are either “0s” and the fadeIn value, or (playlength – fadeOut) and the playlength value, respectively. All time values are converted as described for the audio/@begin attribute.

An example for a SMIL file (from  modules/playlistExecutor/var/):

animatedSmil.smil

<?xml version="1.0" encoding="utf-8" ?>
<smil xmlns    = "http://www.w3.org/2001/SMIL20/Language">
    <body>
        <par>
            <audio src="file:var/test10001.mp3" begin="0s">
                <animate attributeName = "soundLevel"
                         from          = "100%"
                         to            = "0%"
                         calcMode      = "linear"
                         begin         = "6.23s"
                         end           = "11.23s"
                         fill          = "freeze"
                />
            </audio>
            <audio src="file:var/test10002.mp3" begin="6.23s"> 
                <animate attributeName = "soundLevel"
                         from          = "0%"
                         to            = "100%"
                         calcMode      = "linear"
                         begin         = "0s"
                         end           = "5s"
                         fill          = "freeze"
                />
            </audio>
            <audio src="file:var/test10003.mp3" begin="18.45s">
            </audio> 
        </par>
    </body>
</smil>

More example SMIL files are here available  modules/gstreamerElements/var/.