Reference for the Mosaic class Resources::ExternVideo

Resources::ExternVideo
CurrentVideoFrame
Name
NoOfVideoFrames
OnChangeState
OnNewVideoFrame
Paused
Speed
GetError()
GetErrorCode()
GetFrameRate()
GetState()
Pause
Resume
Resources::Bitmap
FrameDelay
FrameSize
NoOfFrames
Core::Resource

The class Resources::ExternVideo provides the functionality to represent bitmaps loaded at the runtime by an extern video decoder. Bitmaps loaded in this manner can be used as regular bitmap resources -> they can be shown in all adequate views like Views::Image, Views::Wallpaper, Views::Frame, Views::WarpImage and Views::AttrText.

To identify the video content, the property Name is available. It can be used, for example, to specify the path to a video file. The playback speed and the position can be determined and queried by using the properties Speed and CurrentVideoFrame. The property NoOfVideoFrames, in turn, is useful to query the length of the video content. To query the frame rate (the number of frames per second) the method GetFrameRate is available.

To control the playback use the property Paused or the slot methods Pause and Resume. The properties OnChangeState and OnNewVideoFrame are suitable to react to corresponding events.

Please note, this class depends on a video decoder implementation which of course is specific for each target and pixel format. It is thus up to you to provide this loader implementation for your particular target system. You will need to implement a set of 'C' functions and link them with the generated GUI application code. Following list provides an overview of the 'C' functions this class depends on:

property int32 CurrentVideoFrame = 0;

The property 'CurrentVideoFrame' stores the current playback position as frame number within the decoded video. Consequently, the frame number 0 (zero) corresponds to the start position of the video. The entire number of frames belonging to the video content can be queried by using the property NoOfVideoFrames. To query the frame rate (the number of frames per second) please use the method GetFrameRate.

By evaluating this property the current position within the video content can be estimated. By changing this property, the Extern Video object will skip to the new specified position.

method Resources::ExternVideoError GetError();

The method GetError() returns the error code (if any) recognized by the video decoder. The possible error codes depend on the used video decoder. Generally, the value 0 (zero) represents 'no error'.

method uint32 GetErrorCode();

The method GetErrorCode() returns the error code (if any) recognized by the video decoder. The possible error codes depend on the used video decoder. Generally, the value 0 (zero) represents 'no error'.

method float GetFrameRate();

The method GetFrameRate() returns the number of frames per second, the video content is providing. This is the frame rate the video has been originally encoded for.

Please note, the resulting playback is additionally affected by the property Speed. For example, if the frame rate is 24 frames per second and the speed is 200 %, the Extern Video object will effectively decode 48 frames per second.

Please note, if the target system is not fast enough to decode all frames, the decoder will skip over frames in order to keep the playback speed constant.

method Resources::ExternVideoState GetState();

The method GetState() returns the latest known state of the video decoder. For more details see the enumeration Resources::ExternVideoState.

property string Name = "";

The property 'Name' stores a string identifying unambiguously a video file to load within this extern video object. The object will thereupon represent the video content so it can be shown e.g. in an Image view. The usage of this property depends on your particular application case and it's up to you how you interpret the content of this property. For example:

Modification of this property at the runtime causes the extern video object to load the specified video file replacing the previous content of the extern video object. If the video playback was paused previously (by setting the property Paused to the value 'true'), the first frame of the new content is shown and the playback is stopped.

property int32 NoOfVideoFrames = 0;

The property 'NoOfVideoFrames' stores the number of frames belonging to the decoded video. The value corresponds to the duration of the video content. To query the frame rate (the number of frames per second) please use the method GetFrameRate.

Please note, this property is READ-ONLY. It is intended to query the duration of the video only. Modifying this property is not possible.

property slot OnChangeState = null;

The property 'OnChangeState' can refer to a slot method, which will be signaled when the external video decoder has reported an alternation of its state. The actual state of the decoder can be queried by using the method GetState().

property slot OnNewVideoFrame = null;

The property 'OnNewVideoFrame' can refer to a slot method, which will be signaled each time a new video frame has been provided by the video decoder. This corresponds to a changed position within the played video. To query or change the current frame use the property CurrentVideoFrame.

slot Pause;

The slot method 'Pause' stops the video decoding if a signal is sent to this slot method. Thereupon the extern video object retains the latest obtained video frame.

To continue the decoding again send a signal to the slot method Resume. To control the playback state you can also use the property Paused. To query the state use the method GetState().

property bool Paused = false;

The property 'Paused' determines whether the playback is actually paused or not. Setting this property to the value 'true' stops the playback.

This, however, does not prevent the Extern Video object from being able to change the frame number. When the property CurrentFrameNumber is modified while the playback is paused, the Extern Video object changes to the corresponding frame.

If new video content is specified in the property Name while playback is paused, the Extern Video object will display the first frame of the new content and stop until the property Paused is set 'false' again.

slot Resume;

The slot method 'Resume' reactivates the previously paused extern video object if a signal is sent to this slot method. Thereupon the video decoder will continue decoding the associated video content.

To pause the decoding send a signal to the slot method Pause. To control the playback state you can also use the property Paused. To query the state use the method GetState().

property int32 Speed = 100;

The property 'Speed' stores the current playback speed expressed as a percentual value. For example, 100 means normal speed, -400, in turn, means 4x rewind.