MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / run_sync

Function run_sync

modules/data/mp3/libmad/decoder.c:316–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316static
317int run_sync(struct mad_decoder *decoder)
318{
319 enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
320 void *error_data;
321 int bad_last_frame = 0;
322 struct mad_stream *stream;
323 struct mad_frame *frame;
324 struct mad_synth *synth;
325 int result = 0;
326 stack(__FUNCTION__, __FILE__, __LINE__);
327
328 if (decoder->input_func == 0)
329 return 0;
330
331 if (decoder->error_func) {
332 error_func = decoder->error_func;
333 error_data = decoder->cb_data;
334 }
335 else {
336 error_func = error_default;
337 error_data = &bad_last_frame;
338 }
339
340 stream = &decoder->sync->stream;
341 frame = &decoder->sync->frame;
342 synth = &decoder->sync->synth;
343
344 mad_stream_init(stream);
345 mad_frame_init(frame);
346 mad_synth_init(synth);
347
348 mad_stream_options(stream, decoder->options);
349
350 do {
351 switch (decoder->input_func(decoder->cb_data, stream)) {
352 case MAD_FLOW_STOP:
353 goto done;
354 case MAD_FLOW_BREAK:
355 goto fail;
356 case MAD_FLOW_IGNORE:
357 continue;
358 case MAD_FLOW_CONTINUE:
359 break;
360 }
361
362 while (1) {
363# if defined(USE_ASYNC)
364 if (decoder->mode == MAD_DECODER_MODE_ASYNC) {
365 switch (check_message(decoder)) {
366 case MAD_FLOW_IGNORE:
367 case MAD_FLOW_CONTINUE:
368 break;
369 case MAD_FLOW_BREAK:
370 goto fail;
371 case MAD_FLOW_STOP:
372 goto done;
373 }

Callers 1

run_asyncFunction · 0.85

Calls 9

mad_stream_initFunction · 0.85
mad_frame_initFunction · 0.85
mad_synth_initFunction · 0.85
check_messageFunction · 0.85
mad_header_decodeFunction · 0.85
mad_frame_decodeFunction · 0.85
mad_synth_frameFunction · 0.85
mad_frame_finishFunction · 0.85
mad_stream_finishFunction · 0.85

Tested by

no test coverage detected