| 446 | } |
| 447 | |
| 448 | void seekFrame(int nDiff) |
| 449 | { |
| 450 | XnStatus nRetVal = XN_STATUS_OK; |
| 451 | if (isPlayerOn()) |
| 452 | { |
| 453 | const XnChar* strNodeName = NULL; |
| 454 | if (g_pPrimary != NULL) |
| 455 | { |
| 456 | strNodeName = g_pPrimary->GetName(); |
| 457 | } |
| 458 | else if (g_Depth.IsValid()) |
| 459 | { |
| 460 | strNodeName = g_Depth.GetName(); |
| 461 | } |
| 462 | else if (g_Image.IsValid()) |
| 463 | { |
| 464 | strNodeName = g_Image.GetName(); |
| 465 | } |
| 466 | else if (g_IR.IsValid()) |
| 467 | { |
| 468 | strNodeName = g_IR.GetName(); |
| 469 | } |
| 470 | else if (g_Audio.IsValid()) |
| 471 | { |
| 472 | strNodeName = g_Audio.GetName(); |
| 473 | } |
| 474 | |
| 475 | nRetVal = g_Player.SeekToFrame(strNodeName, nDiff, XN_PLAYER_SEEK_CUR); |
| 476 | if (nRetVal != XN_STATUS_OK) |
| 477 | { |
| 478 | displayMessage("Failed to seek: %s", xnGetStatusString(nRetVal)); |
| 479 | return; |
| 480 | } |
| 481 | |
| 482 | XnUInt32 nFrame = 0; |
| 483 | XnUInt32 nNumFrames = 0; |
| 484 | nRetVal = g_Player.TellFrame(strNodeName, nFrame); |
| 485 | if (nRetVal != XN_STATUS_OK) |
| 486 | { |
| 487 | displayMessage("Failed to tell frame: %s", xnGetStatusString(nRetVal)); |
| 488 | return; |
| 489 | } |
| 490 | |
| 491 | nRetVal = g_Player.GetNumFrames(strNodeName, nNumFrames); |
| 492 | if (nRetVal != XN_STATUS_OK) |
| 493 | { |
| 494 | displayMessage("Failed to get number of frames: %s", xnGetStatusString(nRetVal)); |
| 495 | return; |
| 496 | } |
| 497 | |
| 498 | displayMessage("Seeked %s to frame %u/%u", strNodeName, nFrame, nNumFrames); |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | bool isDepthOn() |
| 503 | { |
no test coverage detected