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
8namespace 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
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).
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.
32 const Mp4TrackInfo& track,
33 fl::string* error = nullptr);
34
35} // namespace fl
unsigned char u8
Definition s16x16x4.h:132
fl::vector< fl::u8 > extractH264NalUnits(fl::span< const fl::u8 > data, const Mp4TrackInfo &track, fl::string *error)
Mp4TrackInfo parseMp4(fl::span< const fl::u8 > data, fl::string *error)
Base definition for an LED controller.
Definition crgb.hpp:179
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