in tools/k4afastcapture_streaming/main.cpp [71:190]
int main(int argc, char *argv[])
{
// default values
const char *fileDirectory = ".";
int streamingLength = 60; // the length of time for streaming from the sensors until automatically exit.
int shiftValue = 4;
int absoluteExposureValue = 0;
if (argc == 1)
{
std::cout << " ** fastcapture_streaming.exe -help for usage information" << std::endl;
std::cout << " ** -----------------------------------------------------" << std::endl;
}
for (int i = 0; i < argc; i++)
{
if ((0 == string_compare("-PrintUsage", argv[i])) || (0 == string_compare("/PrintUsage", argv[i])) ||
(0 == string_compare("-help", argv[i])) || (0 == string_compare("/help", argv[i])) ||
(0 == string_compare("/?", argv[i])) || (0 == string_compare("/h", argv[i])) ||
(0 == string_compare("-h", argv[i])))
{
PrintBasicUsage();
return 0;
}
else if ((0 == string_compare("-DirectoryPath", argv[i])) || (0 == string_compare("-Directory", argv[i])) ||
(0 == string_compare("-d", argv[i])) || (0 == string_compare("/d", argv[i])))
{
i++;
if (i >= argc)
{
return EINVAL;
}
fileDirectory = argv[i];
}
else if ((0 == string_compare("-StreamingLength", argv[i])) || (0 == string_compare("-Length", argv[i])) ||
(0 == string_compare("-l", argv[i])) || (0 == string_compare("/l", argv[i])))
{
i++;
if (i >= argc)
{
return EINVAL;
}
streamingLength = atoi(argv[i]);
if (streamingLength < 0)
{
std::wcout << "Recording length should be positive; Using 60s" << std::endl;
streamingLength = 60;
}
}
else if ((0 == string_compare("-ExposureValue", argv[i])) || (0 == string_compare("-Exposure", argv[i])) ||
(0 == string_compare("-e", argv[i])) || (0 == string_compare("/e", argv[i])))
{
i++;
if (i >= argc)
{
return EINVAL;
}
int exposureValue = atoi(argv[i]);
if (exposureValue < 2 && exposureValue > -12)
{
std::wcout << exposureValue << " <exposure value>" << std::endl;
absoluteExposureValue = (int32_t)(exp2f((float)exposureValue) * 1000000.0f);
}
else
{
std::wcout << " !! incorrect exposure value provided [ exposure value range -11 to 1].... Using Auto "
"exposure...."
<< std::endl;
}
}
else if ((0 == string_compare("-PcmShift", argv[i])) || (0 == string_compare("-Shift", argv[i])) ||
(0 == string_compare("-s", argv[i])) || (0 == string_compare("/s", argv[i])))
{
i++;
if (i >= argc)
{
return EINVAL;
}
shiftValue = atoi(argv[i]);
if (shiftValue < 9 && shiftValue > -1)
{
std::wcout << shiftValue << " <pcm shift value>" << std::endl;
}
else
{
shiftValue = 4;
std::wcout << " !! incorrect pcm shift value provided [ range 0 to 8].... Using 4 as pcm shift value"
<< std::endl;
}
}
}
// Handle the CTRL-C signal.
#ifdef _WIN32
SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE);
#else
struct sigaction saHandle;
sigemptyset(&saHandle.sa_mask);
saHandle.sa_flags = 0;
saHandle.sa_handler = IntHandler;
sigaction(SIGINT, &saHandle, NULL);
#endif
std::cout << fileDirectory << " <Directory>" << std::endl;
if (streamingLength > 0)
{
std::cout << streamingLength << " <Streaming Length in seconds>" << std::endl;
}
if (Capturer.Configure(fileDirectory, absoluteExposureValue, shiftValue))
{
Capturer.Run(streamingLength);
}
else
std::cout << "Configuration Failed." << std::endl;
return 0;
}