FastLED 3.9.15
Loading...
Searching...
No Matches

◆ parseAvcC()

bool fl::anonymous_namespace{mp4_parser.cpp.hpp}::parseAvcC ( fl::span< const fl::u8 > data,
fl::size offset,
fl::size boxEnd,
Mp4TrackInfo & info )

Definition at line 46 of file mp4_parser.cpp.hpp.

47 {
48 // avcC box: 8 bytes header, then:
49 // u8 configVersion (1)
50 // u8 profile_idc
51 // u8 profile_compat
52 // u8 level_idc
53 // u8 lengthSizeMinusOne (& 0x03)
54 // u8 numSPS (& 0x1F)
55 // for each SPS: u16 spsLength, u8[] spsData
56 // u8 numPPS
57 // for each PPS: u16 ppsLength, u8[] ppsData
58
59 fl::size pos = offset + 8; // skip box header
60 if (pos + 6 > boxEnd) return false;
61
62 fl::u8 configVersion = data[pos++];
63 if (configVersion != 1) return false;
64
65 info.profile = data[pos++];
66 pos++; // profile_compat
67 info.level = data[pos++];
68 info.lengthSizeMinusOne = data[pos++] & 0x03;
69
70 fl::u8 numSPS = data[pos++] & 0x1F;
71 for (fl::u8 i = 0; i < numSPS; i++) {
72 bool ok = true;
73 fl::u16 spsLen = readU16BE(data, pos, ok);
74 if (!ok) return false;
75 pos += 2;
76 if (pos + spsLen > boxEnd) return false;
77 fl::vector<fl::u8> sps(spsLen);
78 for (fl::u16 j = 0; j < spsLen; j++) {
79 sps[j] = data[pos + j];
80 }
81 info.sps.push_back(sps);
82 pos += spsLen;
83 }
84
85 if (pos >= boxEnd) return false;
86 fl::u8 numPPS = data[pos++];
87 for (fl::u8 i = 0; i < numPPS; i++) {
88 bool ok = true;
89 fl::u16 ppsLen = readU16BE(data, pos, ok);
90 if (!ok) return false;
91 pos += 2;
92 if (pos + ppsLen > boxEnd) return false;
93 fl::vector<fl::u8> pps(ppsLen);
94 for (fl::u16 j = 0; j < ppsLen; j++) {
95 pps[j] = data[pos + j];
96 }
97 info.pps.push_back(pps);
98 pos += ppsLen;
99 }
100
101 return true;
102}
uint8_t pos
Definition Blur.ino:11
void push_back(const T &value) FL_NOEXCEPT
Definition vector.h:624
fl::UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)
fl::u16 readU16BE(fl::span< const fl::u8 > data, fl::size offset, bool &ok)
unsigned char u8
Definition s16x16x4.h:132
unsigned char u8
Definition stdint.h:131
fl::u8 lengthSizeMinusOne
Definition mp4_parser.h:19
fl::vector< fl::vector< fl::u8 > > pps
Definition mp4_parser.h:21
fl::vector< fl::vector< fl::u8 > > sps
Definition mp4_parser.h:20

References fl::Mp4TrackInfo::lengthSizeMinusOne, fl::Mp4TrackInfo::level, offset(), parseAvcC(), pos, fl::Mp4TrackInfo::pps, fl::Mp4TrackInfo::profile, fl::vector< T >::push_back(), readU16BE(), and fl::Mp4TrackInfo::sps.

Referenced by parseAvcC().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: