| 328 | } |
| 329 | |
| 330 | XnStatus PlayerNode::SeekToFrameAbsolute(XnUInt32 nNodeID, XnUInt32 nDestFrame) |
| 331 | { |
| 332 | XN_ASSERT((nNodeID != INVALID_NODE_ID) && (nNodeID < m_nMaxNodes)); |
| 333 | PlayerNodeInfo* pPlayerNodeInfo = &m_pNodeInfoMap[nNodeID]; |
| 334 | XN_ASSERT((nDestFrame > 0) && (nDestFrame <= pPlayerNodeInfo->nFrames)); |
| 335 | XN_VALIDATE_INPUT_PTR(m_pNodeNotifications); |
| 336 | |
| 337 | XnStatus nRetVal = XN_STATUS_OK; |
| 338 | |
| 339 | if (nDestFrame == pPlayerNodeInfo->nCurFrame) |
| 340 | { |
| 341 | //Just go back to position of current frame |
| 342 | nRetVal = SeekStream(XN_OS_SEEK_SET, pPlayerNodeInfo->nLastDataPos); |
| 343 | XN_IS_STATUS_OK(nRetVal); |
| 344 | // and re-read it |
| 345 | nRetVal = ReadNext(); |
| 346 | XN_IS_STATUS_OK(nRetVal); |
| 347 | |
| 348 | return XN_STATUS_OK; |
| 349 | } |
| 350 | |
| 351 | // not same frame. Find seek locations of each stream |
| 352 | DataIndexEntry** pDataIndex = GetSeekLocationsFromDataIndex(nNodeID, nDestFrame); |
| 353 | if (pDataIndex != NULL) |
| 354 | { |
| 355 | XnUInt64 nLastPos = 0; |
| 356 | |
| 357 | // move each node to its relevant data |
| 358 | for (XnUInt32 i = 0; i < m_nMaxNodes; i++) |
| 359 | { |
| 360 | if (m_aSeekTempArray[i] != NULL) |
| 361 | { |
| 362 | // read data |
| 363 | nRetVal = SeekStream(XN_OS_SEEK_SET, m_aSeekTempArray[i]->nSeekPos); |
| 364 | XN_IS_STATUS_OK(nRetVal); |
| 365 | nRetVal = ReadNext(); |
| 366 | XN_IS_STATUS_OK(nRetVal); |
| 367 | |
| 368 | // check for latest position. This will be directly after the frame we seeked to. |
| 369 | XnUInt64 nPos = TellStream(); |
| 370 | if (nPos > nLastPos) |
| 371 | { |
| 372 | nLastPos = nPos; |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | // now seek to directly after last position |
| 378 | SeekStream(XN_OS_SEEK_SET, nLastPos); |
| 379 | } |
| 380 | else |
| 381 | { |
| 382 | // perform old seek (no data indexes) |
| 383 | XnUInt64 nStartPos = TellStream(); |
| 384 | XnUInt32 nNextFrame = pPlayerNodeInfo->nCurFrame + 1; |
| 385 | XnStatus nRetVal = XN_STATUS_OK; |
| 386 | |
| 387 | if (nDestFrame < nNextFrame) |
nothing calls this directly
no test coverage detected