MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ seek_internal()

bool MayaFlux::IO::VideoFileReader::seek_internal ( const std::shared_ptr< FFmpegDemuxContext > &  demux,
const std::shared_ptr< VideoStreamContext > &  video,
uint64_t  frame_position 
)
private

Definition at line 624 of file VideoFileReader.cpp.

628{
629 if (frame_position > video->total_frames)
630 frame_position = video->total_frames;
631
632 if (video->frame_rate <= 0.0) {
633 set_error("Invalid frame rate for seeking");
634 return false;
635 }
636
637 AVStream* stream = demux->get_stream(video->stream_index);
638 if (!stream) {
639 set_error("Invalid stream index");
640 return false;
641 }
642
643 double target_seconds = static_cast<double>(frame_position) / video->frame_rate;
644 auto ts = static_cast<int64_t>(target_seconds / av_q2d(stream->time_base));
645
646 if (!demux->seek(video->stream_index, ts)) {
647 set_error(demux->last_error());
648 return false;
649 }
650
651 video->flush_codec();
652 return true;
653}
Core::GlobalStreamInfo stream
Definition Config.cpp:36
void set_error(const std::string &msg) const

References set_error(), and stream.

Referenced by seek().

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