MCPcopy Create free account
hub / github.com/FFMS/ffms2 / ClosestFrameFromPTS

Method ClosestFrameFromPTS

src/core/track.cpp:180–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180int FFMS_Track::ClosestFrameFromPTS(int64_t PTS) const {
181 FrameInfo F;
182 F.PTS = PTS;
183
184 auto Pos = std::lower_bound(begin(), end(), F, PTSComparison);
185 while (Pos != end() && Pos->Skipped() && Pos->PTS == PTS)
186 Pos++;
187
188 if (Pos == end())
189 return static_cast<int>(size() - 1);
190 size_t Frame = std::distance(begin(), Pos);
191 if (Pos == begin() || FFABS(Pos->PTS - PTS) <= FFABS((Pos - 1)->PTS - PTS))
192 return static_cast<int>(Frame);
193 return static_cast<int>(Frame - 1);
194}
195
196int FFMS_Track::FindClosestVideoKeyFrame(int Frame) const {
197 frame_vec &Frames = Data->Frames;

Callers 2

GetFrameByTimeMethod · 0.80
GetFrameMethod · 0.80

Calls 1

SkippedMethod · 0.80

Tested by

no test coverage detected