FastLED 3.10.6
Loading...
Searching...
No Matches
read.h File Reference

Detailed Description

Decoding files into FastLED types.

Separate from fl/fs/fs.h on purpose. Opening a file and decoding a JPEG are unrelated concerns, and keeping them apart means a sketch that only reads bytes does not compile the video and JPEG headers (FastLED #4003, #4008).

if (fs.begin(fl::getSdFs(5))) {
fl::FramePtr frame = fl::readJpeg(fs, "photo.jpg") FL_NO_EXCEPT;
}
bool begin(FsImplPtr platform_filesystem)
Definition fs.cpp.hpp:96
FsImplPtr getSdFs(int cs_pin) FL_NO_EXCEPT
Removable SD card on the given chip-select pin.
Definition fs.h:44
FramePtr readJpeg(FileSystem &fs, const char *path, const JpegConfig &config, string *error) FL_NO_EXCEPT
Decode a JPEG into a Frame. Null on failure; error receives why.
Definition read.cpp.hpp:14
#define FL_NO_EXCEPT

Bodies live in read.cpp.hpp. These forward to the corresponding FileSystem members, which remain for source compatibility. New code should prefer the free functions: adding a format then costs one function here and no change to FileSystem, where today it widens the class every time.

Definition in file read.h.

#include "fl/codec/jpeg.h"
#include "fl/fs/fs.h"
#include "fl/fx/video.h"
#include "fl/stl/noexcept.h"
+ Include dependency graph for read.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  fl
 Base definition for an LED controller.
 

Functions

Fled fl::readFled (FileSystem &fs, const char *path) FL_NO_EXCEPT
 Load a .fled container.
 
FramePtr fl::readJpeg (FileSystem &fs, const char *path, const JpegConfig &config=JpegConfig(), string *error=nullptr) FL_NO_EXCEPT
 Decode a JPEG into a Frame. Null on failure; error receives why.
 
bool fl::readJson (FileSystem &fs, const char *path, json *doc) FL_NO_EXCEPT
 Parse a file as JSON.
 
Mp3DecoderPtr fl::readMp3 (FileSystem &fs, const char *path, string *error=nullptr) FL_NO_EXCEPT
 Streaming MP3 decoder over a file. Null on failure.
 
Video fl::readMpeg1Video (FileSystem &fs, const char *path, fl::size pixelsPerFrame, float fps=30.0f, fl::size nFrameHistory=0) FL_NO_EXCEPT
 MPEG1 video. Null if the file could not be opened.
 
bool fl::readScreenMap (FileSystem &fs, const char *path, const char *name, ScreenMap *out, string *error=nullptr) FL_NO_EXCEPT
 One named screen map from a screenmap JSON file.
 
bool fl::readScreenMaps (FileSystem &fs, const char *path, fl::flat_map< string, ScreenMap > *out, string *error=nullptr) FL_NO_EXCEPT
 Every screen map in a screenmap JSON file, keyed by name.
 
bool fl::readText (FileSystem &fs, const char *path, string *out) FL_NO_EXCEPT
 Whole file as text.
 
Video fl::readVideo (FileSystem &fs, const char *path, fl::size pixelsPerFrame, float fps=30.0f, fl::size nFrameHistory=0) FL_NO_EXCEPT
 Raw-frame video. Null if the file could not be opened.