Seek to a specific position in the file.
568{
569 if (position.empty())
570 return false;
571
572 const uint64_t target_frame = position[0];
573
575
576 std::shared_ptr<VideoStreamContext> video;
577 std::shared_ptr<FFmpegDemuxContext> demux;
578 {
581 set_error(
"Cannot seek: reader not open");
582 return false;
583 }
586 }
587
589 return false;
590
592
594 if (!vc)
595 return true;
596
597 vc->invalidate_ring();
598 vc->set_read_position({ target_frame });
599
600 const uint64_t total = vc->get_total_source_frames();
601 const uint64_t batch = std::min(
603 total > target_frame ? total - target_frame : 0UL);
604
606
609
610 return true;
611}
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