Plasma Logo     Video processing on the fly

Documentation
 

 

Home
News
Installation
Documentation
Examples
Download

Syntax of Plasma

The Plasma objects follow the naming convention of Tk. So ".m.sub" is a sub or child object of ".m" and ".m" is referred as the parent object. Only the child object can be linked to the parent object.

media mplay mout mpack munpack mconcat munconcat mbind munbind mevent mset munset mremove


NAME
media - creates an instance of a media stream.

SYNOPSIS
media object_name ?url? (for audio/video/image streams or files, auto detection)
media object_name text string font_width font_height ?duration? (for text)
media object_name width height R G B ?duration? (for rectangle)
media object_name mash url (for real time stream using mash decoder)
media object_name indiva mount_host camera_session conference_sesion plasma_host (for stream from indiva)

DESCRIPTION
With any protocal heading, url stands for a local file path. It also can be a RTSP url. Without url, media creates an empty container for sub media streams. It works similiar like Tk command "frame".
For example: "media .m" creates an empty container
"media .m.sub" creates a component inside the container
"media .m.sub rtsp://sentosa.comp.nus.edu.sg/lions.mpg"
"media .media /home/zhutao/lions.mpg"

OPERATIONS
Each object created by media can perform operations in such syntax: object operation arg1 arg2 ....

scale width height - scale a video stream spatially
mute - mute a video stream
volume value - change volume in percentage
grayscale - make a video stream grayscale
color - make a grayscale video stream colored
pos x y - change the relative position of a video stream crop x y width height - crop a video stream (x and y are coordinates of left upper corner)
pause - pause a stream
resume - resume a paused stream
visible - make the object visible (default state)
invisible - make the object invisible
text text x y font_width font_height - add the temporary text for the current frame
abort - stop a stream
drop - drop current frame of a video stream
alpha - change the transparency in percentage
tk_photo photoname - update the content of created Tk photo with current frame of the object
childtree - return the names separated by a space of all children
packtree - return the names of all packed children
concattree - return the names of all concatenated children
event - return the names of events
manipulation - list all manipulation done to the object
width - return the width of the object
height - return the height of the object
cavity_width - return the cavity width
cavity_height - return the cavity height
visibility - return visibility
x - return x coordinate
y - return y coordinate


NAME
mplay - starts to output the resultant media stream

SYNOPSIS
mplay object_name url

DESCRIPTION
url can be a local file path, or special tag "dev" for local device, or a rtsp url that sets a rtsp server at port 5454, or a RTP multicast url with ip address and port number.
For example:
"mplay .m myfile.avi" writes .m object into an mp4 avi file.
"mplay .m {dev rtsp://mympg.mpg}" outputs .m to screen and speakers. Meanwhile, it starts a RTSP server with default port 5454. So client can playback the stream by URL: rtsp://?host_name?:5454/mympg.mpg
"mplay .m {dev rtp://255.254.2.2:7777/mympg.mpg}" outputs .m to screen and speakers. Meanwhile, it starts a RTSP server with default port 5454. So client can playback the stream by a SDP file with URL: rtp://255.254.2.2:777/mympg.mpg


NAME
mout - the single threaded version of mplay

SYNOPOSIS
mout object_name url

DESCRIPTION
"mout" does the exactly the same thing as "mplay" except that "mout" will hold the control until "mout" finishes execution but "mplay" will release the control after the command is issued. Our advise is to use "mout" for a non-GUI applications and "mplay" for Tk-GUI applications.


NAME
mpack - specify spacial relations among video streams

SYNOPSIS
mpack object_name ?-side side? ?-anchor anchor?

DESCRIPTION
"mpack" packs a child media object into a parent object. If the parent object is a container, it works exactly like Tk widgets. It follows the cavity model of Tk and you need to specify argument "side" and "anchor" to set the relative positions of the child components.
-side: takes left, right, top, and bottom
-anchor: takes directions of compass. (i.e. n,nw,ne,s,se,sw,w,e)

If the parent object is not empty, packing a child object means a new layer onto the parent. The "side" argument will no longer be considered but user can set "anchor" to position the child layer. In addition, user can use operation pos to change the relative position of a child object as well.


NAME
munpack - remove spatial relations among video streams

SYNOPSIS
munpack object_name

DESCRIPTION
"munpack" provides reversed action for "mpack".


NAME
mconcat - concatenates a child object to its parent object

SYNOPSIS
munconcat object_name

DESCRIPTION
For example, "mconcat .m.sub" concats .m.sub to .m.


NAME
munconcat - remove temporal relations among video streams

SYNOPSIS
munconcat object_name

DESCRIPTION
"munconcat" provides reversed action for "mconcat".


NAME
mbind - binds a event to a media stream

SYNOPSIS
mbind event_type object_name script

RETURN
An automatically generated event handle for mremove and munbind.

DESCRIPTION
"mbind" binds an event and the action associated to a media stream.

EVENT TYPE
Each event type is embraced by < > like Tk. However, some of the event types might take a parameter in this way: < event_type : parameter >

timer : interval_value - a script is executed at every interval_value frame.
packetloss : (+ or -)percentage - a script is executed when the packetloss rate from the client exceeds or reaches below percentage. (positive percentage means exceeding while negative percentage means reaching below)
key : key - a script is executed when a key is pressed. So only up,down,left,right and enter are supported.
mouseclick - a script is executed when the bound object is clicked. (If the resultant presentation is output by 'dev'.)
remotemouseclick - a script is executed when the bound object is clicked in the remote client. (If the resultant presentation is output by 'rtsp')
mousedrag - a script is executed when the mouse finishes dragging the bound object.
motiondetect psnr - a script is executed when the PSNR value of two adjacent frames exceeds or reaches below psnr. (positive psnr means exceeding, negative psnr means reaches below)


NAME
munbind - remove a bound event

SYNOPSIS
munbind object_name

DESCRIPTION
"munbind" provides reversed action for "mbind".


NAME
mevent -
creates an event for a media object.

SYNOPSIS
mevent <event_name> {object_variable} {event_condition}

DESCRIPTION
"mevent" should be attached to a particular media object with defined actions to the event. The condition is constantly checked in time, i.e. every frame. Once it is true, event is triggered and corresponding actions of the attached object are performed.

OPERATION
mevent can be attached to a multiple number of objects using command "mbind". For example mevent <detect> after definition is attached to a media object using "mbind":

mevent <detect> {obj} {( condition of the trigger)}

mbind <detect> .object_name {reaction to the event}


NAME
mset - links a keyframe to an object

SYNOPSIS
mset object_name

DESCRIPTION
For example, "mset .m.keyframe" links the keyframe to .m.


NAME
mset - removes the linkage between a keyframe and an object

SYNOPSIS
munset object_name

DESCRIPTION
"munset" provides the reversed action for "mset".


NAME
mremove - free the memory allocated for an object, a keyframe, or an event

SYNOPSIS
mremove object_name

DESCRIPTION
"mremove" deallocates any type of object created. It can be a media object, an event or a keyframe. However, the object must be "unpacked","unset" or "unbound" first.

 

Home ]

Send mail to pavelkor@gmail.com with questions or comments about this web site.