MCPcopy Create free account
hub / github.com/IENT/YUView / loadFrame

Method loadFrame

YUViewLib/src/playlistitem/playlistItemCompressedVideo.cpp:1229–1279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1227}
1228
1229void playlistItemCompressedVideo::loadFrame(int frameIdx,
1230 bool playing,
1231 bool loadRawdata,
1232 bool emitSignals)
1233{
1234 // The current thread must never be the main thread but one of the interactive threads.
1235 Q_ASSERT(QThread::currentThread() != QApplication::instance()->thread());
1236
1237 auto stateYUV = this->video->needsLoading(frameIdx, loadRawdata);
1238 auto stateStat = this->statisticsData.needsLoading(frameIdx);
1239
1240 if (stateYUV == ItemLoadingState::LoadingNeeded || stateStat == ItemLoadingState::LoadingNeeded)
1241 {
1242 this->isFrameLoading = true;
1243 if (stateYUV == ItemLoadingState::LoadingNeeded)
1244 {
1245 // Load the requested current frame
1246 DEBUG_COMPRESSED("playlistItemCompressedVideo::loadFrame loading frame "
1247 << frameIdx << (playing ? " (playing)" : ""));
1248 this->video->loadFrame(frameIdx);
1249 }
1250 if (stateStat == ItemLoadingState::LoadingNeeded)
1251 {
1252 DEBUG_COMPRESSED("playlistItemCompressedVideo::loadFrame loading statistics "
1253 << frameIdx << (playing ? " (playing)" : ""));
1254 this->loadStatistics(frameIdx);
1255 }
1256
1257 this->isFrameLoading = false;
1258 if (emitSignals)
1259 emit SignalItemChanged(true, RECACHE_NONE);
1260 }
1261
1262 if (playing && (stateYUV == ItemLoadingState::LoadingNeeded ||
1263 stateYUV == ItemLoadingState::LoadingNeededDoubleBuffer))
1264 {
1265 // Load the next frame into the double buffer
1266 int nextFrameIdx = frameIdx + 1;
1267 if (nextFrameIdx <= this->properties().startEndRange.second)
1268 {
1269 DEBUG_COMPRESSED("playlistItplaylistItemCompressedVideoemRawFile::loadFrame loading frame "
1270 "into double buffer "
1271 << nextFrameIdx << (playing ? " (playing)" : ""));
1272 this->isFrameLoadingDoubleBuffer = true;
1273 this->video->loadFrame(nextFrameIdx, true);
1274 this->isFrameLoadingDoubleBuffer = false;
1275 if (emitSignals)
1276 emit signalItemDoubleBufferLoaded();
1277 }
1278 }
1279}
1280
1281void playlistItemCompressedVideo::displaySignalComboBoxChanged(int idx)
1282{

Callers

nothing calls this directly

Calls 3

loadStatisticsMethod · 0.95
propertiesMethod · 0.80
needsLoadingMethod · 0.45

Tested by

no test coverage detected