FastLED 3.9.15
Loading...
Searching...
No Matches

◆ stb_vorbis_decode_frame_pushdata()

int32_t fl::third_party::vorbis::stb_vorbis_decode_frame_pushdata ( stb_vorbis * f,
const uint8 * data,
int32_t data_len,
int32_t * channels,
float *** output,
int32_t * samples )

Definition at line 4202 of file stb_vorbis.cpp.hpp.

4209{
4210 int32_t i;
4211 int32_t len,right,left;
4212
4214
4215 if (f->page_crc_tests >= 0) {
4216 *samples = 0;
4217 return vorbis_search_for_page_pushdata(f, (uint8 *) data, data_len);
4218 }
4219
4220 f->stream = (uint8 *) data;
4221 f->stream_end = (uint8 *) data + data_len;
4223
4224 // check that we have the entire packet in memory
4225 if (!is_whole_packet_present(f)) {
4226 *samples = 0;
4227 return 0;
4228 }
4229
4230 if (!vorbis_decode_packet(f, &len, &left, &right)) {
4231 // save the actual error we encountered
4232 enum STBVorbisError error = f->error;
4234 // flush and resynch
4236 while (get8_packet(f) != EOP)
4237 if (f->eof) break;
4238 *samples = 0;
4239 return (int32_t) (f->stream - data);
4240 }
4242 if (f->previous_length == 0) {
4243 // we may be resynching, in which case it's ok to hit one
4244 // of these; just discard the packet
4246 while (get8_packet(f) != EOP)
4247 if (f->eof) break;
4248 *samples = 0;
4249 return (int32_t) (f->stream - data);
4250 }
4251 }
4252 // if we get an error while parsing, what to do?
4253 // well, it DEFINITELY won't work to continue from where we are!
4255 // restore the error that actually made us bail
4256 f->error = error;
4257 *samples = 0;
4258 return 1;
4259 }
4260
4261 // success!
4262 len = vorbis_finish_frame(f, len, left, right);
4263 for (i=0; i < f->channels; ++i)
4264 f->outputs[i] = f->channel_buffers[i] + left;
4265
4266 if (channels) *channels = f->channels;
4267 *samples = len;
4268 *output = f->outputs;
4269 return (int32_t) (f->stream - data);
4270}
static int32_t error(vorb *f, enum STBVorbisError e) FL_NOEXCEPT
static int32_t vorbis_search_for_page_pushdata(vorb *f, uint8 *data, int32_t data_len) FL_NOEXCEPT
static int32_t is_whole_packet_present(stb_vorbis *f) FL_NOEXCEPT
static int32_t vorbis_finish_frame(stb_vorbis *f, int32_t len, int32_t left, int32_t right) FL_NOEXCEPT
static constexpr int32_t EOP
static int32_t vorbis_decode_packet(vorb *f, int32_t *len, int32_t *p_left, int32_t *p_right) FL_NOEXCEPT
void stb_vorbis_flush_pushdata(stb_vorbis *f) FL_NOEXCEPT
static int32_t get8_packet(vorb *f) FL_NOEXCEPT
float * channel_buffers[FL_STB_VORBIS_MAX_CHANNELS]
float * outputs[FL_STB_VORBIS_MAX_CHANNELS]
fl::i32 int32_t
Definition coder.h:220
fl::i32 int32_t
Definition s16x16x4.h:220
#define FL_STBV_IS_PUSH_MODE(f)

References EOP, error(), FL_NOEXCEPT, FL_STBV_IS_PUSH_MODE, get8_packet(), is_whole_packet_present(), stb_vorbis_flush_pushdata(), VORBIS__no_error, VORBIS_bad_packet_type, VORBIS_continued_packet_flag_invalid, vorbis_decode_packet(), vorbis_finish_frame(), VORBIS_invalid_api_mixing, and vorbis_search_for_page_pushdata().

+ Here is the call graph for this function: