Each scene element has a collection of attributes. Their change leads to the change of element behavior. There are general and additional attributes in MMixer.
General attributes
Attribute name | Possible values | Description |
---|---|---|
show | true/false | Indicates whether the element is displayed. |
alpha | 0..1 | Transparency of element. |
x | -1..1 (relative to the parent element) | A horizontal position of the element. |
y | -1..1 (relative to the parent element) | A vertical position of the element. |
w | -1..1 (relative to the parent element) | A width of the element. Negative values are for mirror reflection of the element. |
h | -1..1 (relative to the parent element) | A height of the element. Negative values are for mirror reflection of the element. |
rotate.angle | integer | the angle of rotation of the element (for GPU-pipeline only) |
rotate.scale | 0..double | a scale of the rotated image. 0 means "no scale". |
rotate.crop | true/false | Sets whether the rotating frame is crop by its original rectangle. |
pos | "center", "right", "left", "top", "bottom", "bottom-right", "bottom-left", "top-right", "top-left" |
A point from which all positions are specified. |
sx | -1..1 (relative to the parent element) | Crop X (horizontal) position |
sy | -1..1 (relative to the parent element) | Crop Y (vertical) position |
sw | 0..1 (relative to the parent element) | Width of crop |
sh |
0..1 (relative to the parent element) |
Height of crop |
spos | "center", "right", "left", "top", "bottom", "bottom-right", "bottom-left", "top-right", "top-left" |
A point from which crop positions are specified. |
_change_accel_ | 0 .. 1.0 | elements transition acceleration. The less the value the linear the movement of the item when you change position, size etc. A value greater than 1 lead to a faster movement for a shorter time interval. Possible to use only with the ElementMultipleSet method, e.g. ElementMultipleSet( "x=0, y=0, _change_accel_=0.0", 5.0); |
stream_idx | string | Index of a stream (streamID or a unique number of stream). |
stream_id | string | stream ID |
borders | string
|
borders around the scene element. The width of the borders is in pixels. |
borders_color | Possible values: "color name", for example, "red" or hex-code of the color, for example, "A1B2C3". It is possible to set different colors for each side of the border (see borders) | color of borders |
maintain_ar | Possible values: 0, 1, "true", "false" | An aspect ratio of the element |
audio_gain | Possible values: dB value | Audio gain (in dB) |
force_cc | Possible values: 0, 1, "true", "false" | Indicates whether Closed Captioning is used from this stream. |
mask | Possible values: "circle", "rect", "round_rect" or path to file | Mask (smooth borders) of the element |
screen_mask | Possible values: "circle", "rect", "round_rect" or path to file | Mask (smooth borders) of the full screen. Only for the current scene block. |
To understand the influence of crop attributes (sx, sy, sw, sh) on the element behavior see the example below.
Example
You have a scene with a single element.
If you change crop attributes then you get
sx and sy are a position of video part that you need to get.
sw and sh are a measurement of this part.
With these values, you get the top-right corner of the source video.
Groups of additional attributes
Name | Description |
---|---|
on_hide | Determines how and where the element should hide. |
on_show | Determines how and where the element should appear. |
on_select | Determines reaction of the element to the ElementInvoke( “select”, …) method. |
add | Determines the behavior of the element on each frame. You need to set these values for each frame. For example, to move an element from left to right. |
vary | Determines the oscillation of the element. |
You can add coordinates' attributes (x and y) separately to these groups.
Here is an example of how to set attributes programmatically:
MElement pRoot; m_objMixer.ElementsGetByIndex(0, out pRoot); MElement playLive, playLive2, playLive3, playFile; //you can set attributes while adding elements to your scene ((IMElements)pRoot).ElementsAdd("", "video", "stream_id=1 h=0.4 w=0.4 x=-0.253677 y=0.203333 show=1", out playLive, 0.0); ((IMElements)pRoot).ElementsAdd("", "video", "stream_id=2 h=0.4 w=0.4 x=0.241422 y=0.220588 show=1", out playLive2, 0.0); ((IMElements)pRoot).ElementsAdd("", "video", "stream_id=3 h=0.4 w=0.4 x=0.243872 y=-0.228039 show=1", out playLive3, 0.0); ((IMElements)pRoot).ElementsAdd("", "video", "stream_id=4 h=0.4 w=0.4 x=-0.258578 y=-0.252549 show=1", out playFile, 0.0); //or get element and set its attributes separately MElement myElement; ((IMElements)pRoot).ElementsGetByIndex(1, out myElement); myElement.AttributesMultipleSet("borders=5 borders_color=red", eMUpdateType.eMUT_Update);
There are 2 ways to set element attributes: with IMAttributes or with IMElement interface. The main difference between these interfaces that IMattributes is not only for MMixer object and its methods are immediately implemented while IMElement methods are implemented only after _dblTimeForChange.