libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
flvtag.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_PROAV
13#include <cstdint>
14#include <promeki/namespace.h>
15#include <promeki/buffer.h>
16#include <promeki/bufferview.h>
17#include <promeki/error.h>
18#include <promeki/string.h>
19#include <promeki/amf0.h>
20
21PROMEKI_NAMESPACE_BEGIN
22
58class FlvVideoTag {
59 public:
61 enum FrameType : uint8_t {
62 FrameTypeUnknown = 0,
63 Keyframe = 1,
64 InterFrame = 2,
65 DisposableInterFrame = 3,
66 GeneratedKeyframe = 4,
67 InfoFrame = 5
68 };
69
77 enum Codec : uint8_t {
78 CodecUnknown = 0,
79 H263 = 2,
80 Screen1 = 3,
81 Vp6 = 4,
82 Vp6Alpha = 5,
83 Screen2 = 6,
84 Avc = 7,
85 // Enhanced RTMP: not legacy CodecID values.
86 ExHevc = 100,
87 ExVp9 = 101,
88 ExAv1 = 102
89 };
90
92 enum AvcPacketType : uint8_t {
93 SequenceHeader = 0,
94 Nalu = 1,
95 EndOfSequence = 2
96 };
97
99 static constexpr uint32_t FourCcHvc1 = 0x68766331;
100 static constexpr uint32_t FourCcVp09 = 0x76703039;
101 static constexpr uint32_t FourCcAv01 = 0x61763031;
102
103 FrameType frameType = InterFrame;
104 Codec codec = Avc;
105 AvcPacketType packetType = Nalu;
106 int32_t compositionTimeOffsetMs = 0;
107 Buffer data;
108
115 Error pack(Buffer &out) const;
116
125 static Error unpack(const BufferView &in, FlvVideoTag &out);
126};
127
144class FlvAudioTag {
145 public:
147 enum SoundFormat : uint8_t {
148 LinearPcmPlatform = 0,
149 Adpcm = 1,
150 Mp3 = 2,
151 LinearPcmLittleEndian = 3,
152 Nellymoser16k = 4,
153 Nellymoser8k = 5,
154 Nellymoser = 6,
155 G711ALaw = 7,
156 G711MuLaw = 8,
157 Aac = 10,
158 Speex = 11,
159 Mp38k = 14,
160 DeviceSpecific = 15
161 };
162
164 enum SoundRate : uint8_t {
165 Rate5500 = 0,
166 Rate11000 = 1,
167 Rate22000 = 2,
168 Rate44000 = 3
169 };
170
172 enum SoundSize : uint8_t { Bits8 = 0, Bits16 = 1 };
173
175 enum SoundType : uint8_t { Mono = 0, Stereo = 1 };
176
178 enum AacPacketType : uint8_t {
179 AudioSpecificConfig = 0,
180 Raw = 1
181 };
182
183 SoundFormat format = Aac;
184 SoundRate rate = Rate44000;
185 SoundSize size = Bits16;
186 SoundType channelType = Stereo;
187 AacPacketType aacPacketType = Raw;
188 Buffer data;
189
191 Error pack(Buffer &out) const;
192
194 static Error unpack(const BufferView &in, FlvAudioTag &out);
195};
196
208class FlvScriptTag {
209 public:
211 promeki::String name;
212
214 Amf0Value body;
215
217 Error pack(Buffer &out) const;
218
220 static Error unpack(const BufferView &in, FlvScriptTag &out);
221};
222
223PROMEKI_NAMESPACE_END
224
225#endif // PROMEKI_ENABLE_PROAV