3#include "codec_bridge.hpp"
4#include "../global.hpp"
5#include "../utilities/system_info.hpp"
6#include "../shims/stdoptional.hpp"
14 inline HandleGuard<CodecBridge::Packet>::HandleGuard(
void *handle) noexcept
15 : HandleGuard<CodecBridge::Packet>(handle, [](
void *handle) { CVB_CALL_CAPI(
ReleaseObject(handle)); })
35 return std::make_unique<Packet>(
std::move(guard));
38 explicit Packet(HandleGuard<Packet> &&guard) noexcept
43 Packet(
const Packet &other) =
delete;
44 Packet &operator=(
const Packet &other) =
delete;
45 Packet(Packet &&other) =
delete;
46 Packet &operator=(Packet &&other) =
delete;
50 void *Handle()
const noexcept
52 return handle_.Handle();
63 CVB_CALL_CAPI_CHECKED(CVCBufferGetSize(Handle(), size));
76 void *basePtr =
nullptr;
77 CVB_CALL_CAPI_CHECKED(CVCBufferGetBasePtr(Handle(), basePtr));
92 auto index = Property<int>(CExports::CVCBPP_StreamIndex);
108 return static_cast<int64_t
>(Property<int64_t>(CExports::CVCBPP_PresentationTimestamp));
119 auto timeBase = Property<CExports::CVCBRational>(CExports::CVCBPP_TimeBase);
120 return {timeBase.Numerator, timeBase.Denominator};
125 T Property(CExports::CVCBPacketProperty property)
const
128 size_t size =
sizeof(T);
129 CVB_CALL_CAPI_CHECKED(CVCBPacketGetProperty(Handle(), property, &value, size));
133 HandleGuard<Packet> handle_;
26 class Packet final {
…};
size_t Size() const
Get the size of the packet.
Definition packet.hpp:60
Cvb::optional< int > StreamIndex() const
Get the stream index this packet belongs to, if any.
Definition packet.hpp:90
int64_t PresentationTimeStamp() const
Get the presentation time stamp for this packet.
Definition packet.hpp:106
Rational TimeBase() const
Get time base that was used for encoding this packet.
Definition packet.hpp:117
void * BasePtr() const
Get the pointer to the packet content.
Definition packet.hpp:74
A pair of rational numbers.
Definition codec_bridge.hpp:199
This class is a replacement for C++17 std::optional.
Definition optional.hpp:61
cvbbool_t ReleaseObject(OBJ &Object)
Namespace for encoding and decoding videos.
Definition codec_bridge.hpp:24
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17