3#include "codec_bridge.hpp"
4#include "../global.hpp"
5#include "../utilities/system_info.hpp"
7#include "codec_config.hpp"
17 inline HandleGuard<CodecBridge::Encoder>::HandleGuard(
void *handle) noexcept
18 : HandleGuard<CodecBridge::Encoder>(handle, [](
void *handle) { CVB_CALL_CAPI(
ReleaseObject(handle)); })
46 return Internal::DoResCallObjectOut<Encoder>(
47 [&](
void *&handle) {
return CVB_CALL_CAPI(CVCBCreateEncoder(codecConfig.Handle(), handle)); });
55 return std::make_unique<Encoder>(
std::move(guard));
58 explicit Encoder(HandleGuard<Encoder> &&guard) noexcept
63 Encoder(
const Encoder &other) =
delete;
64 Encoder &operator=(
const Encoder &other) =
delete;
65 Encoder(Encoder &&other) =
delete;
66 Encoder &operator=(Encoder &&other) =
delete;
70 void *Handle() const noexcept
72 return handle_.Handle();
86 CExports::CVCBCodecStatus status = CExports::CVCBCS_ReadoutRequired;
87 CVB_CALL_CAPI_CHECKED(CVCBEncoderSendFrame(Handle(), frame.Handle(), status));
100 CExports::CVCBCodecStatus status = CExports::CVCBCS_ReadoutRequired;
101 CVB_CALL_CAPI_CHECKED(CVCBEncoderSendFrame(Handle(),
nullptr, status));
114 CExports::CVCBPACKET handle =
nullptr;
115 CVB_CALL_CAPI_CHECKED(CVCBEncoderReceivePacket(Handle(), handle));
118 HandleGuard<Packet> guard(handle);
119 return Packet::FromHandle(
std::move(guard));
123 HandleGuard<Encoder> handle_;
31 class Encoder final {
…};
A configuration defining a codec.
Definition codec_config.hpp:32
void Flush()
Flush the encoder and finish encoding.
Definition encoder.hpp:98
static std::unique_ptr< Encoder > Create(const CodecConfig &codecConfig)
Creates an encoder with a given configuration.
Definition encoder.hpp:44
CodecStatus Encode(const Frame &frame)
Encode a video frame.
Definition encoder.hpp:84
std::unique_ptr< Packet > ReceivePacket()
Receive an encoded packet.
Definition encoder.hpp:112
A video frame for encoding and decoding.
Definition frame.hpp:30
cvbbool_t ReleaseObject(OBJ &Object)
Namespace for encoding and decoding videos.
Definition codec_bridge.hpp:24
CodecStatus
Status of the encoder/decoder after sending data.
Definition codec_bridge.hpp:186
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17