MCPcopy Create free account
hub / github.com/FastLED/FastLED / openMp3

Method openMp3

src/fl/codec/file_system_codecs.cpp.hpp:142–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142fl::Mp3DecoderPtr FileSystem::openMp3(const char *path, fl::string *error_message) {
143 fl::ifstream file = openRead(path);
144 if (!file.is_open()) {
145 if (error_message) { *error_message = "Failed to open file: "; error_message->append(path); }
146 FL_WARN("Failed to open MP3 file: " << path); return fl::Mp3DecoderPtr();
147 }
148 fl::Mp3DecoderPtr decoder = fl::Mp3::createDecoder(error_message);
149 if (!decoder->begin(file.rdbuf())) {
150 fl::string decoder_error; decoder->hasError(&decoder_error);
151 if (error_message) { *error_message = "Failed to initialize MP3 decoder: "; error_message->append(decoder_error); }
152 FL_WARN("Failed to initialize MP3 decoder for: " << path); return fl::Mp3DecoderPtr();
153 }
154 return decoder;
155}
156
157} // namespace fl

Callers

nothing calls this directly

Calls 5

is_openMethod · 0.45
appendMethod · 0.45
beginMethod · 0.45
rdbufMethod · 0.45
hasErrorMethod · 0.45

Tested by

no test coverage detected