MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / captureFrame

Function captureFrame

Samples/NiViewer/Capture.cpp:307–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307XnStatus captureFrame()
308{
309 XnStatus nRetVal = XN_STATUS_OK;
310
311 if (g_Capture.State == SHOULD_CAPTURE)
312 {
313 XnUInt64 nNow;
314 xnOSGetTimeStamp(&nNow);
315 nNow /= 1000;
316
317 // check if time has arrived
318 if (nNow >= g_Capture.nStartOn)
319 {
320 // check if we need to discard first frame
321 if (g_Capture.bSkipFirstFrame)
322 {
323 g_Capture.bSkipFirstFrame = false;
324 }
325 else
326 {
327 // start recording
328 for (int i = 0; i < CAPTURE_NODE_COUNT; ++i)
329 {
330 g_Capture.nodes[i].nCapturedFrames = 0;
331 g_Capture.nodes[i].bRecording = false;
332 }
333 g_Capture.State = CAPTURING;
334
335 // add all captured nodes
336 if (getDevice() != NULL)
337 {
338 nRetVal = g_Capture.pRecorder->AddNodeToRecording(*getDevice(), XN_CODEC_UNCOMPRESSED);
339 START_CAPTURE_CHECK_RC(nRetVal, "add device node");
340 }
341
342 if (isDepthOn() && (g_Capture.nodes[CAPTURE_DEPTH_NODE].captureFormat != CODEC_DONT_CAPTURE))
343 {
344 nRetVal = g_Capture.pRecorder->AddNodeToRecording(*getDepthGenerator(), g_Capture.nodes[CAPTURE_DEPTH_NODE].captureFormat);
345 START_CAPTURE_CHECK_RC(nRetVal, "add depth node");
346 g_Capture.nodes[CAPTURE_DEPTH_NODE].bRecording = TRUE;
347 g_Capture.nodes[CAPTURE_DEPTH_NODE].pGenerator = getDepthGenerator();
348 }
349
350 if (isImageOn() && (g_Capture.nodes[CAPTURE_IMAGE_NODE].captureFormat != CODEC_DONT_CAPTURE))
351 {
352 nRetVal = g_Capture.pRecorder->AddNodeToRecording(*getImageGenerator(), g_Capture.nodes[CAPTURE_IMAGE_NODE].captureFormat);
353 START_CAPTURE_CHECK_RC(nRetVal, "add image node");
354 g_Capture.nodes[CAPTURE_IMAGE_NODE].bRecording = TRUE;
355 g_Capture.nodes[CAPTURE_IMAGE_NODE].pGenerator = getImageGenerator();
356 }
357
358 if (isIROn() && (g_Capture.nodes[CAPTURE_IR_NODE].captureFormat != CODEC_DONT_CAPTURE))
359 {
360 nRetVal = g_Capture.pRecorder->AddNodeToRecording(*getIRGenerator(), g_Capture.nodes[CAPTURE_IR_NODE].captureFormat);
361 START_CAPTURE_CHECK_RC(nRetVal, "add IR stream");
362 g_Capture.nodes[CAPTURE_IR_NODE].bRecording = TRUE;
363 g_Capture.nodes[CAPTURE_IR_NODE].pGenerator = getIRGenerator();
364 }

Callers 1

IdleCallbackFunction · 0.85

Calls 13

getDeviceFunction · 0.85
isDepthOnFunction · 0.85
getDepthGeneratorFunction · 0.85
isImageOnFunction · 0.85
getImageGeneratorFunction · 0.85
isIROnFunction · 0.85
getIRGeneratorFunction · 0.85
isAudioOnFunction · 0.85
getAudioGeneratorFunction · 0.85
xnOSGetTimeStampFunction · 0.50
AddNodeToRecordingMethod · 0.45
RecordMethod · 0.45

Tested by

no test coverage detected