MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / parseFrameFilename

Function parseFrameFilename

src/libfreenect2.cpp:1510–1549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1508}
1509
1510bool parseFrameFilename(const std::string& frame_filename, size_t timestamp_sequence[2])
1511{
1512 LOG_DEBUG << "parsing: " << frame_filename;
1513
1514 if (!hasSuffix(frame_filename, ".depth") &&
1515 !hasSuffix(frame_filename, ".jpg") &&
1516 !hasSuffix(frame_filename, ".jpeg"))
1517 {
1518 LOG_ERROR << "wrong suffix in the filename; need .depth, .jpg, or .jpeg";
1519 return false;
1520 }
1521
1522 size_t ix1 = frame_filename.find("_");
1523 size_t ix2 = frame_filename.find("_", ix1 + 1);
1524 size_t ix3 = frame_filename.find(".", ix2 + 1);
1525
1526 std::string ts = frame_filename.substr(0, ix1);
1527 std::string seq = frame_filename.substr(ix2 + 1, ix3);
1528
1529 LOG_DEBUG << "ts: " << ts << ", seq: " << seq;
1530
1531 if(ts.size() == 0 || seq.size() == 0)
1532 {
1533 LOG_ERROR << "could not extract timestamp or sequence";
1534 return false;
1535 }
1536
1537 timestamp_sequence[0] = atoi(ts.c_str());
1538 timestamp_sequence[1] = atoi(seq.c_str());
1539
1540 LOG_DEBUG << "ts: " << timestamp_sequence[0] << ", seq: " << timestamp_sequence[1];
1541
1542 if(timestamp_sequence[0] == 0)
1543 {
1544 LOG_WARNING << "invalid timestamp";
1545 return false;
1546 }
1547
1548 return true;
1549}
1550
1551void Freenect2ReplayDevice::run()
1552{

Callers 1

runMethod · 0.85

Calls 2

hasSuffixFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected