22 #include "SubtecPacket.hpp"
23 #include "SubtecChannel.hpp"
42 appendType(Packet::PacketType::WEBVTT_SELECTION);
44 append32(WEBVTT_SELECTION_PACKET_SIZE);
51 static constexpr std::uint8_t WEBVTT_SELECTION_PACKET_SIZE = 12;
71 std::uint32_t counter,
72 std::int64_t timeOffsetMs,
73 std::vector<std::uint8_t> &&dataBuffer) :
Packet(counter)
75 auto& buffer = getBuffer();
76 uint32_t size = 8 + 4 + dataBuffer.size();
78 appendType(PacketType::WEBVTT_DATA);
82 append64(timeOffsetMs);
84 for (
auto &
byte : dataBuffer)
85 buffer.push_back(
byte);
101 std::uint32_t counter,
102 std::uint64_t timestamp) :
Packet(counter)
104 appendType(PacketType::WEBVTT_TIMESTAMP);
106 append32(WEBVTT_TIMESTAMP_PACKET_SIZE);
113 static constexpr std::uint8_t WEBVTT_TIMESTAMP_PACKET_SIZE = 12;
122 virtual void SendSelectionPacket(uint32_t width, uint32_t height)
override {
123 sendPacket<WebVttSelectionPacket>(width, height);
125 virtual void SendDataPacket(std::vector<uint8_t> &&data, std::int64_t time_offset_ms = 0)
override {
126 sendPacket<WebVttDataPacket>(time_offset_ms, std::move(data));
128 virtual void SendTimestampPacket(uint64_t timestampMs)
override {
129 sendPacket<WebVttTimestampPacket>(timestampMs);