Seek to a specific position in the file.
573{
575 return false;
576
577 const uint64_t target_frame =
position[0];
578
580
581 std::shared_ptr<VideoStreamContext> video;
582 std::shared_ptr<FFmpegDemuxContext> demux;
583 {
586 set_error(
"Cannot seek: reader not open");
587 return false;
588 }
591 }
592
594 return false;
595
597
599 if (!vc)
600 return true;
601
602 vc->invalidate_ring();
603 vc->set_read_position({ target_frame });
604
605 const uint64_t total = vc->get_total_source_frames();
606 const uint64_t batch = std::min(
608 total > target_frame ? total - target_frame : 0UL);
609
611
614
615 return true;
616}
uint64_t decode_batch(Kakshya::VideoFileContainer &vc, uint64_t batch_size)
Decode up to batch_size frames starting at m_decode_head.
void set_error(const std::string &msg) const
void start_decode_thread()
uint32_t m_decode_batch_size
std::weak_ptr< Kakshya::VideoFileContainer > m_container_ref
std::shared_ptr< FFmpegDemuxContext > m_demux
bool seek_internal(const std::shared_ptr< FFmpegDemuxContext > &demux, const std::shared_ptr< VideoStreamContext > &video, uint64_t frame_position)
std::shared_mutex m_context_mutex
std::shared_ptr< VideoStreamContext > m_video
void stop_decode_thread()
std::atomic< uint64_t > m_decode_head