Twitch SDK (Internal)
flvformat.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #ifndef FLVFORMAT_H
10 #define FLVFORMAT_H
11 
12 namespace ttv
13 {
14  namespace broadcast
15  {
16  namespace flv
17  {
18  struct Header;
19  struct TagHeader;
20  struct TagFooter;
21 
22  enum TagTypes : uint8_t
23  {
24  Audio = 0x08,
25  Video = 0x09,
26  Meta = 0x12
27  };
28 
29  typedef uint8_t uint24_t[3];
30 
31  #pragma pack(push)
32  #pragma pack(1)
33 
34  struct Header
35  {
37  : mSignature{0, 0, 0}
38  , mVersion(0)
39  , mFlags(0)
40  , mHeaderSize(0)
41  {
42  }
43 
44  uint24_t mSignature;
45  uint8_t mVersion;
46  uint8_t mFlags;
47  uint32_t mHeaderSize;
48  };
49 
50  struct TagHeader
51  {
53  : mPacketType(Audio)
54  , mPacketLength{0, 0, 0}
55  , mPacketTimestamp{0, 0, 0}
56  , mPacketExtendedTimestamp(0)
57  , mStreamId{0, 0, 0}
58  {
59  }
60 
62  uint24_t mPacketLength;
63  uint24_t mPacketTimestamp;
65  uint24_t mStreamId;
66  };
67 
68  struct TagFooter
69  {
71  : mLength(0)
72  {
73  }
74 
75  uint32_t mLength; // Should be TagHeader.mPacketLength + sizeof (flv::TagHeader);
76  };
77 
78  #pragma pack(pop)
79  }
80  }
81 }
82 
83 #endif
Definition: flvformat.h:26
Definition: flvformat.h:50
uint24_t mPacketTimestamp
Definition: flvformat.h:63
uint8_t mVersion
Definition: flvformat.h:45
Definition: flvformat.h:34
uint8_t uint24_t[3]
Definition: flvformat.h:29
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
uint8_t mFlags
Definition: flvformat.h:46
uint32_t mHeaderSize
Definition: flvformat.h:47
TagTypes
Definition: flvformat.h:22
Definition: flvformat.h:25
uint8_t mPacketExtendedTimestamp
Definition: flvformat.h:64
Header()
Definition: flvformat.h:36
uint32_t mLength
Definition: flvformat.h:75
Definition: flvformat.h:24
TagHeader()
Definition: flvformat.h:52
TagFooter()
Definition: flvformat.h:70
uint24_t mPacketLength
Definition: flvformat.h:62
Definition: flvformat.h:68
uint24_t mSignature
Definition: flvformat.h:44
uint24_t mStreamId
Definition: flvformat.h:65
TagTypes mPacketType
Definition: flvformat.h:61