| 439 | } |
| 440 | |
| 441 | XnStatus RecorderNode::FinalizeStream() |
| 442 | { |
| 443 | XN_VALIDATE_INPUT_PTR(m_pOutputStream); |
| 444 | EndRecord endRecord(m_pRecordBuffer, RECORD_MAX_SIZE, FALSE); |
| 445 | XnStatus nRetVal = endRecord.Encode(); |
| 446 | XN_IS_STATUS_OK(nRetVal); |
| 447 | /* Write End Record */ |
| 448 | nRetVal = WriteRecordToStream(NULL, endRecord); |
| 449 | XN_IS_STATUS_OK(nRetVal); |
| 450 | |
| 451 | /* Remove all nodes in the map. When each node is removed, we write its number of frames and max time stamp */ |
| 452 | RecordedNodesInfo::ConstIterator it = m_recordedNodesInfo.Begin(); |
| 453 | while (it != m_recordedNodesInfo.End()) |
| 454 | { |
| 455 | RecordedNodesInfo::ConstIterator curr = it; |
| 456 | ++it; |
| 457 | nRetVal = RemoveNode(curr->Key()); |
| 458 | XN_IS_STATUS_OK(nRetVal); |
| 459 | } |
| 460 | |
| 461 | /* Re-write header with correct max timestamp*/ |
| 462 | nRetVal = SeekStream(XN_OS_SEEK_SET, 0); |
| 463 | XN_IS_STATUS_OK(nRetVal); |
| 464 | nRetVal = WriteHeader(m_nGlobalMaxTimeStamp, m_nNumNodes); |
| 465 | XN_IS_STATUS_OK(nRetVal); |
| 466 | |
| 467 | return XN_STATUS_OK; |
| 468 | } |
| 469 | |
| 470 | XnStatus RecorderNode::CloseStream() |
| 471 | { |