FastLED 3.10.8
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#include "fl/stl/noexcept.h"
8
9namespace fl {
10
11// Minimal ISO BMFF / MP4 container parser for H.264 video.
12// Navigates ftyp→moov→trak→mdia→minf→stbl→stsd→avc1→avcC
13// to extract SPS/PPS NAL units and video dimensions.
14
16 fl::u16 width = 0;
17 fl::u16 height = 0;
18 fl::u8 profile = 0; // H.264 profile_idc from avcC
19 fl::u8 level = 0; // H.264 level_idc from avcC
20 fl::u8 lengthSizeMinusOne = 0; // NALU length field size minus 1 (typically 3 → 4 bytes)
21 fl::vector<fl::vector<fl::u8>> sps; // Sequence Parameter Sets
22 fl::vector<fl::vector<fl::u8>> pps; // Picture Parameter Sets
23 bool isValid = false;
24};
25
26// Parse an MP4 container and extract H.264 track info.
27// Only handles single-track H.264 video (avc1 codec).
29
30// Extract H.264 NAL units from MP4 mdat section, converting AVCC→Annex B format.
31// Prepends 0x00000001 start codes to each NAL unit.
32fl::vector<fl::u8> extractH264NalUnits(fl::span<const fl::u8> data,
33 const Mp4TrackInfo& track,
34 fl::string* error = nullptr) FL_NO_EXCEPT;
35
36} // namespace fl
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
Mp4TrackInfo parseMp4(fl::span< const fl::u8 > data, fl::string *error) FL_NO_EXCEPT
fl::vector< fl::u8 > extractH264NalUnits(fl::span< const fl::u8 > data, const Mp4TrackInfo &track, fl::string *error) FL_NO_EXCEPT
Base definition for an LED controller.
Definition crgb.hpp:179
fl::u8 lengthSizeMinusOne
Definition mp4_parser.h:20
fl::vector< fl::vector< fl::u8 > > pps
Definition mp4_parser.h:22
fl::vector< fl::vector< fl::u8 > > sps
Definition mp4_parser.h:21