Video Decoding
gpu::VideoReader_GPU
Video reader class.
gpu::VideoReader_GPU::Codec
Video codecs supported by :ocv:class:`gpu::VideoReader_GPU` .
gpu::VideoReader_GPU::ChromaFormat
Chroma formats supported by :ocv:class:`gpu::VideoReader_GPU` .
gpu::VideoReader_GPU::FormatInfo
Struct providing information about video file format.
struct FormatInfo
{
Codec codec;
ChromaFormat chromaFormat;
int width;
int height;
};
gpu::VideoReader_GPU::VideoReader_GPU
Constructors.
The constructors initialize video reader. FFMPEG is used to read videos. User can implement own demultiplexing with :ocv:class:`gpu::VideoReader_GPU::VideoSource` .
gpu::VideoReader_GPU::open
Initializes or reinitializes video reader.
The method opens video reader. Parameters are the same as in the constructor :ocv:func:`gpu::VideoReader_GPU::VideoReader_GPU` . The method throws :ocv:class:`Exception` if error occurs.
gpu::VideoReader_GPU::isOpened
Returns true if video reader has been successfully initialized.
gpu::VideoReader_GPU::close
Releases the video reader.
gpu::VideoReader_GPU::read
Grabs, decodes and returns the next video frame.
If no frames has been grabbed (there are no more frames in video file), the methods return false
. The method throws :ocv:class:`Exception` if error occurs.
gpu::VideoReader_GPU::format
Returns information about video file format.
The method throws :ocv:class:`Exception` if video reader wasn't initialized.
gpu::VideoReader_GPU::dumpFormat
Dump information about video file format to specified stream.
The method throws :ocv:class:`Exception` if video reader wasn't initialized.
gpu::VideoReader_GPU::VideoSource
Interface for video demultiplexing.
class VideoSource
{
public:
VideoSource();
virtual ~VideoSource() {}
virtual FormatInfo format() const = 0;
virtual void start() = 0;
virtual void stop() = 0;
virtual bool isStarted() const = 0;
virtual bool hasError() const = 0;
protected:
bool parseVideoData(const unsigned char* data, size_t size, bool endOfStream = false);
};
User can implement own demultiplexing by implementing this interface.
gpu::VideoReader_GPU::VideoSource::format
Returns information about video file format.
gpu::VideoReader_GPU::VideoSource::start
Starts processing.
Implementation must create own thread with video processing and call periodic :ocv:func:`gpu::VideoReader_GPU::VideoSource::parseVideoData` .
gpu::VideoReader_GPU::VideoSource::stop
Stops processing.
gpu::VideoReader_GPU::VideoSource::isStarted
Returns true
if processing was successfully started.
gpu::VideoReader_GPU::VideoSource::hasError
Returns true
if error occured during processing.
gpu::VideoReader_GPU::VideoSource::parseVideoData
Parse next video frame. Implementation must call this method after new frame was grabbed.