NAME(S)

     CMApp_ResolveMovie,
     CMApp_WriteMovie,
     CMApp_IsMovie,
     CMApp_ReadURL,
     CMApp_ReadMovie,
     CMApp_ParseClipLine,
     CMApp_ResolveClip,


SYNOPSIS

     CMApp_ResolveMovie <playList>

     CMApp_WriteMovie <playList> ?fileName?

     CMApp_IsMovie <fileName>

     CMApp_ReadURL <url>

     CMApp_ReadMovie <fileName>

     CMApp_ParseClipLine <line>

     CMApp_ResolveClip <clip> <prevEnd>


DESCRIPTION

     Simple movie model functions.  These functions all deal with
     cmt-movies (scripts).  They have two representations, a file
     format and a playList format.  Playlists are  a  simple  tcl
     internal  representation  (a  list  of  lists)  which can be
     stored in simple tcl variables.  When read from a script all
     of  the media files (clip-files) represented in the playList
     are stored as URLs and many fields may be unspecified (BAD).
     CMApp_ResolveMovie  does  the  necisary  network queries and
     file investigations to produce a list ready for playback (it
     replaces  all  BAD  fields and adds an address tupple to the
     end of the list.

     File format:

     Following is an example movie file:

             # CMT-Movie-1.0

             movie video audio

             # empty lines, white space and comments allowed
             clip 0 ~eric14/raid1
             clip                                               0
     cmtp://cms.berkeley.edu:666/n/vid6/meetings/chips.mpeg
             clip 0 /n/vid2/lost -ss 2 -se 3 -ls 5  -le  7  -type
     video
             clip 1 relativelyBad -ss 2 -se 3 -ls 5 -le  7  -type

     audio/mpeg2


     This file is intended to be scanned, not sourced, so  'clip'
     and the number and type of tracks in the file:

          movie ?trackType? ... ?-tags {?{<tag> <value>}? ...}?

     So the example above specifies  a  movie  with  two  tracks.
     Track 0 is a video track and track 1 is an audio track.  The
     clip lines each specify a continuous segment of media from a
     single file.

          clip <trackNum> <file> ?switch value? ...

     The file may be either a local file or a cmtp or  vods  URL.
     All  other  fields  are optional switches.  At read time any
     missing information about a clip will be derived by  examin-
     ing  the  source  file via CMApp_SourceFileInfo which deter-
     mines the TYPE, FORMAT and duration of any clip.  Given this
     information  all  of  a  clip's  fields  can be inteligently
     defaulted.  If the clip does not  include  a  logical  start
     time,  then  the  clip is assumed to begin immediately after
     the previous clip in its track.

          -ss    - source start time
          -se    - source end time
          -ls    - logical start time (output time)
          -le    - logical end time
          -type  - type/format info needed to choose CMT objects


     Internal PlayList format:

     The  playList   for   the   movie   listed   above   (before
     CMApp_ResolveMovie) would be:

         {video
           {~eric14/raid1 BAD BAD BAD BAD BAD}
           {cmtp://cms.berkeley.edu:666/n/vid6/meetings/chips.mpeg
     BAD BAD BAD BAD BAD}
           {/n/vid2/lost video 2 3 5 7}}
         {audio
           {relativelyBad audio:mpeg2 2 3 5 7}}



  CMApp_ResolveMovie <playList>
     Takes a playList  (as  returned  from  CMApp_ReadMovie)  and
     translates  each  media  URL  into a {host port file}-tupple
     which refferances a runnning CMX.  Any BAD fields in a  clip
     are  also replaced with valid entries.  This maybe expensive
     if media URLs point to non-clip files or VODS  urls...   The
     tupples are appended to the end of each clip-list.

  CMApp_WriteMovie <playList> ?fileName?
     Takes a playList  (as  returned  from  CMApp_ReadMovie)  and
     writes  it to the given file. If no file name or {} is given
     then the file is returned, not writen.

  CMApp_IsMovie <fileName>
     Opens the given file and tests the first line to see  if  it
     is a proper CMT-Movie header.

     Returns: 0 or 1

  CMApp_ReadURL <url>
     This is the WONDER FUNCTION.  Takes any cmfile  or  URL  and
     returns a playList (as returned by CMApp_ReadMovie).  If the
     referanced  file  is  a  Movie  files,  it  is  read   using
     CMApp_ReadMovie,  otherwise, a simple script is generated to
     play the given media file.

  CMApp_ReadMovie <fileName>
     Opens the given file and returns a playList.  See above  for
     format.

     Returns: a list of the form:
         {<tagList> ?<track>?...}

         <track> := {<cmType> ?<clipInfo>?...}}

         <cmType> is one of {audio or video (may be extended)}
         <clipInfo>   :=   {<ss>    <se>    <ls>    <le>    <URL>
     <cmType>/<format> <tagList>}
         <ss> := source start
         <se> := source end
         <ls> := LTS start
         <le> := LTS end

         <tagList> = {?{<tag> <value>}?...}

  CMApp_ParseClipLine <line>
     Helping function to scan a clip line

  CMApp_ResolveClip <clip> <prevEnd>
     Helping function to choose good default  values  for  unknow
     fields of a clip

     Returns: A news version of the clip without BAD fields.


AUTHOR

     Eric Baldeschwieler, eric14@cs.berkeley.edu