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

◆ plm_seek()

int fl::third_party::plm_seek ( plm_t * self,
double time,
int seek_exact )

Definition at line 672 of file pl_mpeg.hpp.

672 {
673 plm_frame_t *frame = plm_seek_frame(self, time, seek_exact);
674
675 if (!frame) {
676 return FALSE;
677 }
678
679 if (self->video_decode_callback) {
681 }
682
683 // If audio is not enabled we are done here.
684 if (!self->audio_packet_type) {
685 return TRUE;
686 }
687
688 // Sync up Audio. This demuxes more packets until the first audio packet
689 // with a PTS greater than the current time is found. plm_decode() is then
690 // called to decode enough audio data to satisfy the audio_lead_time.
691
692 double start_time = plm_demux_get_start_time(self->demux, self->video_packet_type);
694
695 plm_packet_t *packet = NULL;
696 while ((packet = plm_demux_decode(self->demux))) {
697 if (packet->type == self->video_packet_type) {
698 plm_buffer_write(self->video_buffer, packet->data, packet->length);
699 }
700 else if (
701 packet->type == self->audio_packet_type &&
702 packet->pts - start_time > self->time
703 ) {
704 plm_audio_set_time(self->audio_decoder, packet->pts - start_time);
705 plm_buffer_write(self->audio_buffer, packet->data, packet->length);
706 plm_decode(self, 0);
707 break;
708 }
709 }
710
711 return TRUE;
712}
#define NULL
void plm_decode(plm_t *self, double seconds) FL_NOEXCEPT
Definition pl_mpeg.hpp:474
plm_packet_t * plm_demux_decode(plm_demux_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:1517
void plm_audio_rewind(plm_audio_t *self) FL_NOEXCEPT
Definition pl_mpeg.hpp:3285
double plm_demux_get_start_time(plm_demux_t *self, int type) FL_NOEXCEPT
Definition pl_mpeg.hpp:1304
size_t plm_buffer_write(plm_buffer_t *self, uint8_t *bytes, size_t length) FL_NOEXCEPT
Definition pl_mpeg.hpp:877
void plm_audio_set_time(plm_audio_t *self, double time) FL_NOEXCEPT
Definition pl_mpeg.hpp:3279
plm_frame_t * plm_seek_frame(plm_t *self, double time, int seek_exact) FL_NOEXCEPT
Definition pl_mpeg.hpp:617
void * video_decode_callback_user_data
Definition pl_mpeg.hpp:215
plm_video_decode_callback video_decode_callback
Definition pl_mpeg.hpp:214
plm_buffer_t * audio_buffer
Definition pl_mpeg.hpp:211
plm_demux_t * demux
Definition pl_mpeg.hpp:196
plm_audio_t * audio_decoder
Definition pl_mpeg.hpp:212
plm_buffer_t * video_buffer
Definition pl_mpeg.hpp:204
fl::u64 time() FL_NOEXCEPT
Alias for millis64() - returns 64-bit millisecond time.
Definition chrono.h:346
#define TRUE
Definition pl_mpeg.hpp:174
#define FALSE
Definition pl_mpeg.hpp:175

References fl::third_party::plm_packet_t::data, FALSE, FL_NOEXCEPT, fl::third_party::plm_packet_t::length, NULL, plm_audio_rewind(), plm_audio_set_time(), plm_buffer_write(), plm_decode(), plm_demux_decode(), plm_demux_get_start_time(), plm_seek_frame(), fl::third_party::plm_packet_t::pts, fl::time(), TRUE, and fl::third_party::plm_packet_t::type.

+ Here is the call graph for this function: