FastLED
3.9.15
Loading...
Searching...
No Matches
mp4_parser.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
fl/stl/stdint.h
"
4
#include "
fl/stl/string.h
"
5
#include "
fl/stl/vector.h
"
6
#include "
fl/stl/span.h
"
7
8
namespace
fl
{
9
10
// Minimal ISO BMFF / MP4 container parser for H.264 video.
11
// Navigates ftyp→moov→trak→mdia→minf→stbl→stsd→avc1→avcC
12
// to extract SPS/PPS NAL units and video dimensions.
13
14
struct
Mp4TrackInfo
{
15
fl::u16
width
= 0;
16
fl::u16
height
= 0;
17
fl::u8
profile
= 0;
// H.264 profile_idc from avcC
18
fl::u8
level
= 0;
// H.264 level_idc from avcC
19
fl::u8
lengthSizeMinusOne
= 0;
// NALU length field size minus 1 (typically 3 → 4 bytes)
20
fl::vector<fl::vector<fl::u8>
>
sps
;
// Sequence Parameter Sets
21
fl::vector<fl::vector<fl::u8>
>
pps
;
// Picture Parameter Sets
22
bool
isValid
=
false
;
23
};
24
25
// Parse an MP4 container and extract H.264 track info.
26
// Only handles single-track H.264 video (avc1 codec).
27
Mp4TrackInfo
parseMp4
(
fl::span<const fl::u8>
data,
fl::string
* error =
nullptr
);
28
29
// Extract H.264 NAL units from MP4 mdat section, converting AVCC→Annex B format.
30
// Prepends 0x00000001 start codes to each NAL unit.
31
fl::vector<fl::u8>
extractH264NalUnits
(
fl::span<const fl::u8>
data,
32
const
Mp4TrackInfo
& track,
33
fl::string
* error =
nullptr
);
34
35
}
// namespace fl
fl::span
Definition
span.h:385
fl::string
Definition
string.h:193
fl::vector
Definition
vector.h:449
fl::fl::u8
unsigned char u8
Definition
s16x16x4.h:132
fl::extractH264NalUnits
fl::vector< fl::u8 > extractH264NalUnits(fl::span< const fl::u8 > data, const Mp4TrackInfo &track, fl::string *error)
Definition
mp4_parser.cpp.hpp:283
fl::parseMp4
Mp4TrackInfo parseMp4(fl::span< const fl::u8 > data, fl::string *error)
Definition
mp4_parser.cpp.hpp:106
fl
Base definition for an LED controller.
Definition
crgb.hpp:179
fl::Mp4TrackInfo::height
fl::u16 height
Definition
mp4_parser.h:16
fl::Mp4TrackInfo::lengthSizeMinusOne
fl::u8 lengthSizeMinusOne
Definition
mp4_parser.h:19
fl::Mp4TrackInfo::pps
fl::vector< fl::vector< fl::u8 > > pps
Definition
mp4_parser.h:21
fl::Mp4TrackInfo::width
fl::u16 width
Definition
mp4_parser.h:15
fl::Mp4TrackInfo::sps
fl::vector< fl::vector< fl::u8 > > sps
Definition
mp4_parser.h:20
fl::Mp4TrackInfo::profile
fl::u8 profile
Definition
mp4_parser.h:17
fl::Mp4TrackInfo::isValid
bool isValid
Definition
mp4_parser.h:22
fl::Mp4TrackInfo::level
fl::u8 level
Definition
mp4_parser.h:18
fl::Mp4TrackInfo
Definition
mp4_parser.h:14
span.h
stdint.h
string.h
vector.h
fl
codec
mp4_parser.h
Generated on Tue Jun 16 2026 00:06:59 for FastLED by
1.13.2