FastLED 3.9.15
Loading...
Searching...
No Matches
mpeg1.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/codec/common.h" // IWYU pragma: keep
4// IWYU pragma: begin_keep
6#include "fl/stl/noexcept.h"
7// IWYU pragma: end_keep
8
9namespace fl {
10
11// MPEG1 metadata information structure
12struct Mpeg1Info {
13 fl::u16 width = 0; // Video width in pixels
14 fl::u16 height = 0; // Video height in pixels
15 fl::u16 frameRate = 0; // Frame rate (fps)
16 fl::u32 frameCount = 0; // Total number of frames (may be 0 if unknown)
17 fl::u32 duration = 0; // Duration in milliseconds (may be 0 if unknown)
18 bool hasAudio = false; // True if MPEG1 contains audio track
19 bool isValid = false; // True if metadata was successfully parsed
20
22
23 // Constructor for easy initialization
24 Mpeg1Info(fl::u16 w, fl::u16 h, fl::u16 fps)
25 : width(w), height(h), frameRate(fps), isValid(true) {}
26};
27
28// Re-export MPEG1 configuration from third_party
30
31// MPEG1 decoder factory
32class Mpeg1 {
33public:
34 // Create an MPEG1 decoder for the current platform
35 static IDecoderPtr createDecoder(const Mpeg1Config& config, fl::string* error_message = nullptr);
36
37 // Create an MPEG1 decoder with default config (Streaming, 30fps, no audio)
38 static IDecoderPtr createDecoder(fl::string* error_message = nullptr) {
39 Mpeg1Config config; // Uses defaults
40 return createDecoder(config, error_message);
41 }
42
43 // Check if MPEG1 decoding is supported on this platform
44 static bool isSupported();
45
46 // Parse MPEG1 metadata from byte data without creating a decoder
47 // This is a fast, lightweight operation that only reads the MPEG1 header
48 static Mpeg1Info parseMpeg1Info(fl::span<const fl::u8> data, fl::string* error_message = nullptr);
49};
50
51} // namespace fl
static bool isSupported()
Definition mpeg1.cpp.hpp:14
static IDecoderPtr createDecoder(fl::string *error_message=nullptr)
Definition mpeg1.h:38
static Mpeg1Info parseMpeg1Info(fl::span< const fl::u8 > data, fl::string *error_message=nullptr)
Definition mpeg1.cpp.hpp:19
static IDecoderPtr createDecoder(const Mpeg1Config &config, fl::string *error_message=nullptr)
Definition mpeg1.cpp.hpp:8
third_party::Mpeg1Config Mpeg1Config
Definition mpeg1.h:29
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT
fl::u32 frameCount
Definition mpeg1.h:16
fl::u16 height
Definition mpeg1.h:14
bool hasAudio
Definition mpeg1.h:18
Mpeg1Info() FL_NOEXCEPT=default
fl::u32 duration
Definition mpeg1.h:17
fl::u16 frameRate
Definition mpeg1.h:15
fl::u16 width
Definition mpeg1.h:13
bool isValid
Definition mpeg1.h:19