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

Method decodeFrame

src/fl/codec/mp3.cpp.hpp:65–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65int Mp3HelixDecoder::decodeFrame(const fl::u8** inbuf, fl::size* bytes_left) {
66 if (!mDecoder || !mPcmBuffer) {
67 return ERR_MP3_NULL_POINTER;
68 }
69
70 // Decode one frame
71 int result = MP3Decode(
72 static_cast<HMP3Decoder>(mDecoder),
73 inbuf,
74 bytes_left,
75 fl::bit_cast<short*>(mPcmBuffer.get()),
76 0 // useSize = 0 (use default)
77 );
78
79 if (result == ERR_MP3_NONE) {
80 // Get frame info
81 MP3FrameInfo helix_info;
82 MP3GetLastFrameInfo(static_cast<HMP3Decoder>(mDecoder), &helix_info);
83
84 mFrameInfo.bitrate = helix_info.bitrate;
85 mFrameInfo.nChans = helix_info.nChans;
86 mFrameInfo.samprate = helix_info.samprate;
87 mFrameInfo.bitsPerSample = helix_info.bitsPerSample;
88 mFrameInfo.outputSamps = helix_info.outputSamps;
89 mFrameInfo.layer = helix_info.layer;
90 mFrameInfo.version = helix_info.version;
91 }
92
93 return result;
94}
95
96fl::vector<audio::Sample> Mp3HelixDecoder::decodeToAudioSamples(const fl::u8* data, fl::size len) {
97 fl::vector<audio::Sample> samples;

Callers 2

findAndDecodeFrameMethod · 0.80
parseMp3InfoMethod · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected