4#include "codec_bridge.hpp"
5#include "../global.hpp"
6#include "../utilities/system_info.hpp"
8#include "codec_config.hpp"
18 inline HandleGuard<CodecBridge::Encoder>::HandleGuard(
void* handle) noexcept
19 : HandleGuard<CodecBridge::Encoder>(handle, [](
void* handle) { CVB_CALL_CAPI(ReleaseObject(handle)); })
48 return Internal::DoResCallObjectOut<Encoder>([&](
void*& handle)
50 return CVB_CALL_CAPI(CVCBCreateEncoder(codecConfig.Handle(), handle));
59 return std::make_unique<Encoder>(std::move(guard));
62 explicit Encoder(HandleGuard<Encoder>&& guard) noexcept
63 : handle_(std::move(guard))
68 Encoder(
const Encoder& other) =
delete;
69 Encoder& operator=(
const Encoder& other) =
delete;
70 Encoder(Encoder&& other) =
delete;
71 Encoder& operator=(Encoder&& other) =
delete;
75 void* Handle() const noexcept
77 return handle_.Handle();
91 CExports::CVCBCodecStatus status = CExports::CVCBCS_ReadoutRequired;
92 CVB_CALL_CAPI_CHECKED(CVCBEncoderSendFrame(Handle(), frame.Handle(), status));
105 CExports::CVCBCodecStatus status = CExports::CVCBCS_ReadoutRequired;
106 CVB_CALL_CAPI_CHECKED(CVCBEncoderSendFrame(Handle(),
nullptr, status));
119 CExports::CVCBPACKET handle =
nullptr;
120 CVB_CALL_CAPI_CHECKED(CVCBEncoderReceivePacket(Handle(), handle));
123 HandleGuard<Packet> guard(handle);
124 return Packet::FromHandle(std::move(guard));
130 HandleGuard<Encoder> handle_;
A configuration defining a codec.
Definition: codec_config.hpp:33
An encoder for video frames.
Definition: encoder.hpp:33
void Flush()
Flush the encoder and finish encoding.
Definition: encoder.hpp:103
static std::unique_ptr< Encoder > Create(const CodecConfig &codecConfig)
Creates an encoder with a given configuration.
Definition: encoder.hpp:46
CodecStatus Encode(const Frame &frame)
Encode a video frame.
Definition: encoder.hpp:89
std::unique_ptr< Packet > ReceivePacket()
Receive an encoded packet.
Definition: encoder.hpp:117
A video frame for encoding and decoding.
Definition: frame.hpp:30
CodecStatus
Status of the encoder/decoder after sending data.
Definition: codec_bridge.hpp:187
Root namespace for the Image Manager interface.
Definition: c_barcode.h:15