VideoController
touchgfx/hal/VideoController.hpp
The VideoController is an abstract interface for the video decoder. A concrete implementation will be generated by the TouchGFX Generator.
The VideoController can control multiple video streams in multiple VideoWidgets. These are recognized by their Handle.
Application code should only interact with the VideoWidget class.
See: VideoWidget
Public Types
enum | Command { PLAY, PAUSE, SEEK, SHOW, STOP, SET_REPEAT } |
The commands send to the Controller. | |
typedef uint32_t | Handle |
Type to identify a video stream. | |
Public Functions
virtual void | draw(const Handle handle, const Rect & invalidatedArea, const VideoWidget & widget) =0 |
Draw the video content. | |
virtual uint32_t | getCurrentFrameNumber(const Handle handle) =0 |
Get the current frame number. | |
virtual bool | getIsPlaying(const Handle handle) =0 |
Check if the video stream is playing (not paused or stopped). | |
virtual void | getVideoInformation(const Handle handle, VideoInformation * data) =0 |
Get Video information. | |
virtual Handle | registerVideoWidget(VideoWidget & widget) =0 |
Register a VideoWidget to get a Handle. | |
virtual void | setCommand(const Handle handle, Command cmd, uint32_t param) =0 |
Pass a command from the Widget to the Controller. | |
virtual void | setFrameRate(const Handle handle, uint32_t ui_frames, uint32_t video_frames) =0 |
Set the framerate for video using a qoutient of screen frames /video frames. | |
virtual void | setVideoData(const Handle handle, const uint8_t * movie, const uint32_t length) =0 |
Set the video data for the stream. | |
virtual void | setVideoData(const Handle handle, VideoDataReader & reader) =0 |
Set the video data for the stream. | |
virtual void | setVideoFrameRateCompensation(bool allow) =0 |
Allow skipping of video frames to compensate for long decoding times. | |
virtual void | unregisterVideoWidget(const Handle handle) =0 |
Unregister a VideoWidget to release the handle. | |
virtual bool | updateFrame(const Handle handle, VideoWidget & widget) =0 |
Signal that the widget can be invalidated (tickEvent). | |
virtual | ~VideoController() |
Virtual destructor. | |
VideoController & | getInstance() |
Gets the VideoController instance. | |
Public Types Documentation
Command
enum Command
The commands send to the Controller.
PLAY | Play the video. |
PAUSE | Pause the playing. |
SEEK | Seek to frame. |
SHOW | Show a frame. |
STOP | Stop the video. |
SET_REPEAT | Set repeat mode. |
Handle
typedef uint32_t Handle
Type to identify a video stream.
Public Functions Documentation
draw
virtual void draw | ( | const Handle | handle , | =0 | |
const Rect & | invalidatedArea , | =0 | |||
const VideoWidget & | widget | =0 | |||
) | =0 |
Draw the video content.
handle | The stream handle. |
invalidatedArea | The area of the widget that must be redrawn. |
widget | Reference to the widget. |
getCurrentFrameNumber
virtual uint32_t getCurrentFrameNumber | ( | const Handle | handle | ) | |
Get the current frame number.
handle | The stream handle. |
Return the current frame number.
getIsPlaying
virtual bool getIsPlaying | ( | const Handle | handle | ) | |
Check if the video stream is playing (not paused or stopped).
handle | The stream handle. |
Returns true if the video is playing.
getVideoInformation
virtual void getVideoInformation | ( | const Handle | handle , | =0 | |
VideoInformation * | data | =0 | |||
) | =0 |
Get Video information.
Get information from the video data.
handle | The stream handle. |
data | Pointer to VideoInformation where information should be stored. |
registerVideoWidget
virtual Handle registerVideoWidget | ( | VideoWidget & | widget | ) | |
Register a VideoWidget to get a Handle.
widget | The VideoWidget. |
A video stream handle.
setCommand
virtual void setCommand | ( | const Handle | handle , | =0 | |
Command | cmd , | =0 | |||
uint32_t | param | =0 | |||
) | =0 |
Pass a command from the Widget to the Controller.
handle | The stream handle. |
cmd | The Command. |
param | A parameter. |
setFrameRate
virtual void setFrameRate | ( | const Handle | handle , | =0 | |
uint32_t | ui_frames , | =0 | |||
uint32_t | video_frames | =0 | |||
) | =0 |
Set the framerate for video using a qoutient of screen frames /video frames.
To get 20 video frames pr second on a 60 fps display use video_frames = 20 and ui_frames = 60.
handle | The stream handle. |
ui_frames | Number of UI frames (divider) |
video_frames | Number of video_frames (dividend) |
setVideoData
virtual void setVideoData | ( | const Handle | handle , | =0 | |
const uint8_t * | movie , | =0 | |||
const uint32_t | length | =0 | |||
) | =0 |
Set the video data for the stream.
handle | The stream handle. |
movie | Pointer to the video data. |
length | Length of the video data. |
setVideoData
virtual void setVideoData | ( | const Handle | handle , | =0 | |
VideoDataReader & | reader | =0 | |||
) | =0 |
Set the video data for the stream.
handle | The stream handle. |
reader | Reference to a VideoDataReader object. |
setVideoFrameRateCompensation
virtual void setVideoFrameRateCompensation | ( | bool | allow | ) | |
Allow skipping of video frames to compensate for long decoding times.
allow | true if compensation is allowed. |
unregisterVideoWidget
virtual void unregisterVideoWidget | ( | const Handle | handle | ) | |
Unregister a VideoWidget to release the handle.
handle | The stream handle. |
updateFrame
virtual bool updateFrame | ( | const Handle | handle , | =0 | |
VideoWidget & | widget | =0 | |||
) | =0 |
Signal that the widget can be invalidated (tickEvent).
handle | The stream handle. |
widget | The Widget. |
Returns true if video has more frames (i.e. false on the last frame).
~VideoController
virtual ~VideoController | ( | ) |
Virtual destructor.
getInstance
static VideoController & getInstance | ( | ) |