MayaFlux 0.2.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 613 of file VideoFileReader.cpp.

617{
618 if (frame_position > video->total_frames)
619 frame_position = video->total_frames;
620
621 if (video->frame_rate <= 0.0) {
622 set_error("Invalid frame rate for seeking");
623 return false;
624 }
625
626 AVStream* stream = demux->get_stream(video->stream_index);
627 if (!stream) {
628 set_error("Invalid stream index");
629 return false;
630 }
631
632 double target_seconds = static_cast<double>(frame_position) / video->frame_rate;
633 auto ts = static_cast<int64_t>(target_seconds / av_q2d(stream->time_base));
634
635 if (!demux->seek(video->stream_index, ts)) {
636 set_error(demux->last_error());
637 return false;
638 }
639
640 video->flush_codec();
641 return true;
642}
void set_error(const std::string &msg) const

References set_error().

Referenced by seek().

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