/* Media Sequence Server v1.0 - DMS - jul '98 - by Marc BARILLEY */ /* rev january 2001 - by Sebastien DENEUX */ defcom cMediaIs = mediaIs I S S S S S S S;; /* errorcode alias file mbegin mend sbegin send loop */ defcom cPlaySequence=playSequence;; defcom cStopSequence=stopSequence;; defcom cPlayMedia=playMedia S;; /* alias */ defcom cStopMedia=stopMedia S;; /* alias */ typeof medias = [[S S S S S S S] r1];; /* alias file mbegin mend sbegin send loop */ fun cmpStart (o1, o2)= let o1 -> [_ _ b1 _ _ _ _] in let o2 -> [_ _ b2 _ _ _ _] in if (atof b1) >. (atof b2) then 1 else if (atof b1) <. (atof b2) then -1 else 0;; fun sendMedias (l)= if l==nil then _DMSsend this DMSsender cMediaIs [2 nil nil nil nil nil nil nil] else { let hd l -> [alias file mbegin mend sbegin send loop] in _DMSsend this DMSsender cMediaIs [1 alias file mbegin mend sbegin send loop]; sendMedias tl l; };; fun __started()= _DMSsend this DMSsender cMediaIs [0 nil nil nil nil nil nil nil]; sendMedias medias;; fun loadMedias (l)= if l==nil then 0 else let hd l -> [keyword [alias [file [mbegin [mend [sbegin [send [loop _]]]]]]]] in if (!strcmp keyword "media") then { set medias = [alias file mbegin mend sbegin send loop]::medias; _RSregister this file 1 file; loadMedias tl l } else loadMedias tl l;; fun activate (from, cli, action, param, rep)= if !strcmp action "start" then _DMScreateClientDMI this cli nil else if !strcmp action "destroy" then _DMSdelClientDMI this cli else if !strcmp action "play" then _DMSsend this cli cPlaySequence [] else if !strcmp action "stop" then _DMSsend this cli cStopSequence [] else if !strcmp (substr action 0 5) "play " then _DMSsend this cli cPlayMedia [(substr action 5 (strlen action)-5)] else if !strcmp (substr action 0 5) "stop " then _DMSsend this cli cStopMedia [(substr action 5 (strlen action)-5)] else nil;; fun IniDMI(file)= loadMedias strextr _getpack _checkpack file; set medias = rquicksort @cmpStart medias; _DMSregisterDMI this @activate nil nil nil;;