87 template <
class Inserter>
90 auto p =
reinterpret_cast<uint8_t*
>(&val);
97 template <
class Inserter>
100 auto p =
reinterpret_cast<uint8_t*
>(&val);
106 template <
class Inserter>
109 auto p =
reinterpret_cast<uint8_t*
>(&val);
118 auto pSource =
reinterpret_cast<uint8_t*
> (&source);
119 auto pTarget =
reinterpret_cast<uint8_t*
> (&target);
120 pTarget[0] = pSource[3];
121 pTarget[1] = pSource[2];
122 pTarget[2] = pSource[1];
123 pTarget[3] = pSource[0];
132 auto pTarget =
reinterpret_cast<uint8_t*
> (&target);
133 pTarget[0] = source[2];
134 pTarget[1] = source[1];
135 pTarget[2] = source[0];
156 assert ((firstByteOfChunk & 0x3f) != 0x3f);
174 #pragma clang diagnostic push 175 #pragma clang diagnostic ignored "-Wold-style-cast" 198 memcpy(p, buffer+pos, 4);
203 #pragma clang diagnostic pop 223 assert(mState != Used || mDataWritten == mPacketLength);
231 : mChunkChannel(chunkChannel)
232 , mTimestamp(timestamp)
233 , mPacketLength(packetLength)
234 , mMessageType(messageType)
235 , mMessageStreamId(messageStreamId)
237 , mDataWritten(0) { }
253 inline bool IsNew()
const {
return mState == New;}
255 uint32_t
Length()
const {
return mPacketLength;}
260 assert (mState == Used || mState == New);
270 header[pos++] = (
type << 6) + mChunkChannel;
272 uint32_t shortTimestamp = std::min(0xFFFFFFU, mTimestamp);
276 auto p =
reinterpret_cast<uint8_t*
>(&shortTimestamp);
277 header[pos++] = p[2];
278 header[pos++] = p[1];
279 header[pos++] = p[0];
283 auto p =
reinterpret_cast<uint8_t*
>(&mPacketLength);
284 header[pos++] = p[2];
285 header[pos++] = p[1];
286 header[pos++] = p[0];
287 header[pos++] = mMessageType;
292 auto p =
reinterpret_cast<uint32_t*
>(&header[pos]);
293 *p = mMessageStreamId;
297 if (shortTimestamp == 0xFFFFFF)
299 auto p =
reinterpret_cast<uint8_t*
>(&mTimestamp);
300 header[pos++] = p[3];
301 header[pos++] = p[2];
302 header[pos++] = p[1];
303 header[pos++] = p[0];
uint32_t mMessageStreamId
Definition: rtmp.h:315
needs to be chopped up
Definition: rtmp.h:68
amf3 metadata body
Definition: rtmp.h:60
Chunktype type
Definition: rtmp.h:143
PacketType messageType
Definition: rtmp.h:147
Responds with the ping's timestamp, so RTT can be calculated (4B)
Definition: rtmp.h:83
See RTMP_CTL_* below for possible values.
Definition: rtmp.h:51
cmd-name, trans-id, amf3 body
Definition: rtmp.h:62
The request doesn't exist.
uint32_t mTimestamp
Definition: rtmp.h:312
RtmpMessageDetails()
Definition: rtmp.h:218
Channel
Definition: rtmp.h:30
CtlType
Definition: rtmp.h:75
amf0 metadata body
Definition: rtmp.h:64
uint8_t uint24_t[3]
Definition: flvformat.h:29
uint32_t messageStreamId
Definition: rtmp.h:148
uint32_t Length() const
Definition: rtmp.h:255
uint32_t mDataWritten
Definition: rtmp.h:317
State
Definition: rtmp.h:211
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
No payloads actually documented...
Definition: rtmp.h:55
PacketType
Definition: rtmp.h:45
Data: stream-id (4B)
Definition: rtmp.h:77
uint32_t timestamp
Definition: rtmp.h:145
#define assert(expr)
Definition: assertion.h:47
bool IsValid() const
Definition: rtmp.h:254
Data: stream-id (4B)
Definition: rtmp.h:78
RtmpMessageDetails(const RtmpMessageDetails &rhs)
Definition: rtmp.h:239
bool IsNew() const
Definition: rtmp.h:253
void InsertBigEndian(Inserter it, uint32_t val)
Definition: rtmp.h:98
uint32_t mPacketLength
Definition: rtmp.h:313
~RtmpMessageDetails()
Definition: rtmp.h:221
amf0 shared object command (don't support)
Definition: rtmp.h:65
State mState
Definition: rtmp.h:316
cmd-name, trans-id, amf0 body
Definition: rtmp.h:66
uint8_t streamId
Definition: rtmp.h:144
Data: timestamp (4B)
Definition: rtmp.h:82
Chunktype
Definition: rtmp.h:18
Not a real value according to the standard.
Definition: rtmp.h:47
void DataWritten(uint32_t length)
Definition: rtmp.h:256
uint32_t BigToLittle(uint32_t source)
Definition: rtmp.h:114
uint8_t RtmpMessageheader[16]
Definition: rtmp.h:206
RtmpMessageDetails(Channel chunkChannel, uint32_t timestamp, uint32_t packetLength, PacketType messageType, uint32_t messageStreamId)
Definition: rtmp.h:226
size_t PackMessageHeader(RtmpMessageheader header)
Definition: rtmp.h:258
Data: stream-id, buffer-length in milliseconds (*** 8B ***)
Definition: rtmp.h:80
Channel mChunkChannel
Definition: rtmp.h:311
void InsertBigEndian32(Inserter it, uint32_t val)
Definition: rtmp.h:88
ChunkHeader PopulateChunkHeader(const uint8_t *buffer)
Definition: rtmp.h:172
amf3 shared object command (don't support)
Definition: rtmp.h:61
Server telling client it's not live, Data: stream-id (4B)
Definition: rtmp.h:81
Data: stream-id (4B)
Definition: rtmp.h:79
size_t GetChunkSize(char firstByteOfChunk)
Definition: rtmp.h:151
uint32_t packetLength
Definition: rtmp.h:146
PacketType mMessageType
Definition: rtmp.h:314
RtmpMessageDetails & operator=(const RtmpMessageDetails &rhs)
Definition: rtmp.h:244