CopperSpice API  1.7.2
QVideoFilterRunnable Class Referenceabstract

Represents the implementation of a video filter. More...

Public Typedefs

using RunFlags = QFlags< RunFlag >
 

Public Types

enum  RunFlag
 

Public Methods

virtual QVideoFrame run (QVideoFrame *input, const QVideoSurfaceFormat &surfaceFormat, RunFlags flags) = 0
 

Detailed Description

The QVideoFilterRunnable class represents the implementation of a filter that owns all graphics and computational resources, and performs the actual filtering or calculations.

Video filters are split into QAbstractVideoFilter and corresponding QVideoFilterRunnable instances. This is necessary to support threaded rendering scenarios. QVideoFilterRunnable instances always live on a worker thread and all its methods such as run(), the constructor, and the destructor, are guaranteed to be invoked on the worker thread.The OpenGL context is bound to the worker thread. QAbstractVideoFilter instances live on the main (GUI) thread.

Once created QVideoFilterRunnable instances are managed by CsMultimedia and will be automatically destroyed and recreated when necessary. For example when the scene graph is invalidated or the window changes or is closed. Creation happens via the QAbstractVideoFilter::createFilterRunnable() factory function.

Note
Additional documentation pending.
See also
QAbstractVideoFilter

Member Typedef Documentation

Member Enumeration Documentation

Constant Value Description
QVideoFilterRunnable::LastInChain 0x01 Indicates that the filter runnable's associated QAbstractVideoFilter is the last in the corresponding VideoOutput type's filters list, meaning that the returned frame is the one that is going to be presented to the scene graph without invoking any further filters.

Method Documentation

QVideoFrame QVideoFilterRunnable::run ( QVideoFrame input,
const QVideoSurfaceFormat surfaceFormat,
RunFlags  flags 
)
pure virtual

You will need to reimplement this method to perform filtering or computation on the input video frame. Like a constructor or destructor this method is always called on the render thread with the OpenGL context bound. Implementations that do not modify the video frame can simply return input.

It is safe to access properties of the associated QAbstractVideoFilter instance from this method.

The value input will not be mapped and so the implementation of this method must call QVideoFrame::map() and QVideoFrame::unmap() when necessary.

The value surfaceFormat provides additional information. For example it can be used to determine the orientation of the input image. This is important for filters to operate on multiple platforms with multiple cameras.

Note
Additional documentation pending.
See also
QVideoFrame, QVideoSurfaceFormat