Skip to main content

VideoController

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

enumCommand { PLAY, PAUSE, SEEK, SHOW, STOP, SET_REPEAT }
The commands send to the Controller.
typedef uint32_tHandle
Type to identify a video stream.

Public Functions

virtual voiddraw(const Handle handle, const Rect & invalidatedArea, const VideoWidget & widget) =0
Draw the video content.
virtual uint32_tgetCurrentFrameNumber(const Handle handle) =0
Get the current frame number.
virtual boolgetIsPlaying(const Handle handle) =0
Check if the video stream is playing (not paused or stopped).
virtual voidgetVideoInformation(const Handle handle, VideoInformation * data) =0
Get Video information.
virtual HandleregisterVideoWidget(VideoWidget & widget) =0
Register a VideoWidget to get a Handle.
virtual voidsetCommand(const Handle handle, Command cmd, uint32_t param) =0
Pass a command from the Widget to the Controller.
virtual voidsetFrameRate(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 voidsetVideoData(const Handle handle, const uint8_t * movie, const uint32_t length) =0
Set the video data for the stream.
virtual voidsetVideoData(const Handle handle, VideoDataReader & reader) =0
Set the video data for the stream.
virtual voidunregisterVideoWidget(const Handle handle) =0
Unregister a VideoWidget to release the handle.
virtual boolupdateFrame(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.

PLAYPlay the video.
PAUSEPause the playing.
SEEKSeek to frame.
SHOWShow a frame.
STOPStop the video.
SET_REPEATSet repeat mode.

Handle

typedef uint32_t Handle

Type to identify a video stream.

Public Functions Documentation

draw

virtual void draw(const Handlehandle ,=0
const Rect &invalidatedArea ,=0
const VideoWidget &widget=0
)=0

Draw the video content.

Parameters:
handleThe stream handle.
invalidatedAreaThe area of the widget that must be redrawn.
widgetReference to the widget.

getCurrentFrameNumber

virtual uint32_t getCurrentFrameNumber(const Handlehandle)

Get the current frame number.

Parameters:
handleThe stream handle.
Returns:

Return the current frame number.

getIsPlaying

virtual bool getIsPlaying(const Handlehandle)

Check if the video stream is playing (not paused or stopped).

Parameters:
handleThe stream handle.
Returns:

Returns true if the video is playing.

getVideoInformation

virtual void getVideoInformation(const Handlehandle ,=0
VideoInformation *data=0
)=0

Get Video information.

Get information from the video data.

Parameters:
handleThe stream handle.
dataPointer to VideoInformation where information should be stored.

registerVideoWidget

virtual Handle registerVideoWidget(VideoWidget &widget)

Register a VideoWidget to get a Handle.

Parameters:
widgetThe VideoWidget.
Returns:

A video stream handle.

setCommand

virtual void setCommand(const Handlehandle ,=0
Commandcmd ,=0
uint32_tparam=0
)=0

Pass a command from the Widget to the Controller.

Parameters:
handleThe stream handle.
cmdThe Command.
paramA parameter.

setFrameRate

virtual void setFrameRate(const Handlehandle ,=0
uint32_tui_frames ,=0
uint32_tvideo_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.

Parameters:
handleThe stream handle.
ui_framesNumber of UI frames (divider)
video_framesNumber of video_frames (dividend)

setVideoData

virtual void setVideoData(const Handlehandle ,=0
const uint8_t *movie ,=0
const uint32_tlength=0
)=0

Set the video data for the stream.

Parameters:
handleThe stream handle.
moviePointer to the video data.
lengthLength of the video data.

setVideoData

virtual void setVideoData(const Handlehandle ,=0
VideoDataReader &reader=0
)=0

Set the video data for the stream.

Parameters:
handleThe stream handle.
readerReference to a VideoDataReader object.

unregisterVideoWidget

virtual void unregisterVideoWidget(const Handlehandle)

Unregister a VideoWidget to release the handle.

Parameters:
handleThe stream handle.

updateFrame

virtual bool updateFrame(const Handlehandle ,=0
VideoWidget &widget=0
)=0

Signal that the widget can be invalidated (tickEvent).

Parameters:
handleThe stream handle.
widgetThe Widget.
Returns:

Returns true if video has more frames (i.e. false on the last frame).

~VideoController

virtual ~VideoController()

Virtual destructor.

getInstance

static VideoController & getInstance()

Gets the VideoController instance.

Returns:

The VideoController instance.