CVB++ 15.0
Encoder Class Referencefinal

An encoder for video frames. More...

#include <cvb/codec_bridge/encoder.hpp>

Public Member Functions

CodecStatus Encode (const Frame &frame)
 Encode a video frame. More...
 
void Flush ()
 Flush the encoder and finish encoding. More...
 
std::unique_ptr< PacketReceivePacket ()
 Receive an encoded packet. More...
 

Static Public Member Functions

static std::unique_ptr< EncoderCreate (const CodecConfig &codecConfig)
 Creates an encoder with a given configuration. More...
 

Detailed Description

An encoder for video frames.

An encoder can encode video frames into raw encoded packets.

Member Function Documentation

◆ Create()

static std::unique_ptr< Encoder > Create ( const CodecConfig codecConfig)
inlinestatic

Creates an encoder with a given configuration.

Parameters
[in]codecConfigThe configuration.
Returns
A pointer to a encoder object.
Exceptions
Anyexception derived from std::exception including CvbException.

As encoders may use exclusive system resources the number of encoders active simultaneously is often limited to one.

◆ Encode()

CodecStatus Encode ( const Frame frame)
inline

Encode a video frame.

Parameters
[in]frameThe video frame to encode.
Returns
A the status of the encoder.
Exceptions
Anyexception derived from std::exception including CvbException.

Encoders will usually deliver packets only after a few frames have been encoded. If no packets are received the encoder will refuse to take new frames and return ReadoutRequired.

◆ Flush()

void Flush ( )
inline

Flush the encoder and finish encoding.

Exceptions
Anyexception derived from std::exception including CvbException.

Notify the encoder that no more frames will be send, so the remaining packets can be delivered. The encoder will not accept any more frames after flushing.

◆ ReceivePacket()

std::unique_ptr< Packet > ReceivePacket ( )
inline

Receive an encoded packet.

Returns
A pointer to the packet object (may be empty).
Exceptions
Anyexception derived from std::exception including CvbException.

Encoders will usually deliver packets only after a few frames have been encoded. If no new packets can be received this method will return empty pointers.