4#include "codec_bridge.hpp"
5#include "../global.hpp"
6#include "../utilities/system_info.hpp"
7#include "../shims/stdoptional.hpp"
15inline HandleGuard<CodecBridge::Packet>::HandleGuard(
void* handle) noexcept
16 : HandleGuard<CodecBridge::Packet>(handle, [](
void* handle) { CVB_CALL_CAPI(ReleaseObject(handle)); })
37 return std::make_unique<Packet>(std::move(guard));
40 explicit Packet(HandleGuard<Packet>&& guard) noexcept
41 : handle_(std::move(guard))
53 void* Handle()
const noexcept
55 return handle_.Handle();
66 CVB_CALL_CAPI_CHECKED(CVCBufferGetSize(Handle(), size));
79 void* basePtr =
nullptr;
80 CVB_CALL_CAPI_CHECKED(CVCBufferGetBasePtr(Handle(), basePtr));
95 auto index = Property<int>(CExports::CVCBPP_StreamIndex);
110 return static_cast<int64_t
>(Property<int64_t>(CExports::CVCBPP_PresentationTimestamp));
121 auto timeBase = Property<CExports::CVCBRational>(CExports::CVCBPP_TimeBase);
122 return { timeBase.Numerator, timeBase.Denominator };
129 T Property(CExports::CVCBPacketProperty property)
const
132 size_t size =
sizeof(T);
133 CVB_CALL_CAPI_CHECKED(CVCBPacketGetProperty(Handle(), property, &value, size));
137 HandleGuard<Packet> handle_;
A packet that holds encoded data frame data.
Definition: packet.hpp:28
size_t Size() const
Get the size of the packet.
Definition: packet.hpp:63
Cvb::optional< int > StreamIndex() const
Get the stream index this packet belongs to, if any.
Definition: packet.hpp:93
int64_t PresentationTimeStamp() const
Get the presentation time stamp for this packet.
Definition: packet.hpp:108
Rational TimeBase() const
Get time base that was used for encoding this packet.
Definition: packet.hpp:119
void * BasePtr() const
Get the pointer to the packet content.
Definition: packet.hpp:77
A pair of rational numbers.
Definition: codec_bridge.hpp:200
This class is a replacement for C++17 std::optional.
Definition: optional.hpp:60
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24