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

◆ plm_decode()

void fl::third_party::plm_decode ( plm_t * self,
double seconds )

Definition at line 474 of file pl_mpeg.hpp.

474 {
475 if (!plm_init_decoders(self)) {
476 return;
477 }
478
479 int decode_video = (self->video_decode_callback && self->video_packet_type);
480 int decode_audio = (self->audio_decode_callback && self->audio_packet_type);
481
482 if (!decode_video && !decode_audio) {
483 // Nothing to do here
484 return;
485 }
486
487 int did_decode = FALSE;
488 int decode_video_failed = FALSE;
489 int decode_audio_failed = FALSE;
490
491 double video_target_time = self->time + tick;
492 double audio_target_time = self->time + tick + self->audio_lead_time;
493
494 do {
495 did_decode = FALSE;
496
497 if (decode_video && plm_video_get_time(self->video_decoder) < video_target_time) {
498 plm_frame_t *frame = plm_video_decode(self->video_decoder);
499 if (frame) {
501 did_decode = TRUE;
502 }
503 else {
504 decode_video_failed = TRUE;
505 }
506 }
507
508 if (decode_audio && plm_audio_get_time(self->audio_decoder) < audio_target_time) {
510 if (samples) {
511 self->audio_decode_callback(self, samples, self->audio_decode_callback_user_data);
512 did_decode = TRUE;
513 }
514 else {
515 decode_audio_failed = TRUE;
516 }
517 }
518 } while (did_decode);
519
520 // Did all sources we wanted to decode fail and the demuxer is at the end?
521 if (
522 (!decode_video || decode_video_failed) &&
523 (!decode_audio || decode_audio_failed) &&
525 ) {
526 plm_handle_end(self);
527 return;
528 }
529
530 self->time += tick;
531}
double plm_audio_get_time(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3275
void plm_handle_end(plm_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:571
plm_samples_t * plm_audio_decode(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3296
int plm_init_decoders(plm_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:261
double plm_video_get_time(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2176
plm_frame_t * plm_video_decode(plm_video_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:2197
int plm_demux_has_ended(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1293
void * audio_decode_callback_user_data
Definition pl_mpeg.hpp:218
void * video_decode_callback_user_data
Definition pl_mpeg.hpp:215
plm_video_decode_callback video_decode_callback
Definition pl_mpeg.hpp:214
plm_video_t * video_decoder
Definition pl_mpeg.hpp:205
plm_audio_decode_callback audio_decode_callback
Definition pl_mpeg.hpp:217
plm_demux_t * demux
Definition pl_mpeg.hpp:196
plm_audio_t * audio_decoder
Definition pl_mpeg.hpp:212
#define TRUE
Definition pl_mpeg.hpp:174
#define FALSE
Definition pl_mpeg.hpp:175

References FALSE, FL_NOEXCEPT, plm_audio_decode(), plm_audio_get_time(), plm_demux_has_ended(), plm_handle_end(), plm_init_decoders(), plm_video_decode(), plm_video_get_time(), and TRUE.

Referenced by fl::third_party::SoftwareMpeg1Decoder::decodeNextFrame(), fl::third_party::SoftwareMpeg1Decoder::initializeDecoder(), and plm_seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: