forked from labstreaminglayer/App-LabRecorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RecorderLib.cpp
58 lines (51 loc) · 1.76 KB
/
RecorderLib.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifdef _WIN32
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include "RecorderLib.h"
#include "../../LSL/liblsl/include/lsl_c.h"
#include "recording.h"
#include <boost/algorithm/string.hpp>
//#ifdef _WIN32
//RECORDERLIB_API rl_recording rl_start_recording(char *filename, void **recordfrom, unsigned num_recordfrom, char *watchforc, int collect_offsets) {
//#else
rl_recording rl_start_recording(char *filename, std::vector<lsl::stream_info>recordfrom, unsigned num_recordfrom, char *watchforc, int collect_offsets) {
//#endif
// first remap the C API streaminfo array to a vector<lsl::streaminfo>
//std::vector<lsl::stream_info> streams;
//for (std::size_t k=0; k<num_recordfrom; k++)
// streams.push_back(lsl::stream_info((lsl_streaminfo)recordfrom[k]));
// then parse split the watchfor string
std::vector<std::string> watchfor;
boost::algorithm::split(watchfor,watchforc,boost::algorithm::is_any_of("|"));
for (std::size_t k=0; k<watchfor.size(); k++)
boost::algorithm::trim(watchfor[k]);
// lastly instantiate a new recording
recording *result = new recording(filename,streams,watchfor,collect_offsets != 0);
return (rl_recording)result;
}
//#ifdef _WIN32
//RECORDERLIB_API void rl_end_recording(rl_recording rec) { delete (recording*)rec; }
//#else
void rl_end_recording(rl_recording rec) { delete (recording*)rec; }
//#endif
//#ifdef _WIN32
//BOOL APIENTRY DllMain( HMODULE hModule,
// DWORD ul_reason_for_call,
// LPVOID lpReserved
// )
//{
// switch (ul_reason_for_call)
// {
// case DLL_PROCESS_ATTACH:
// case DLL_THREAD_ATTACH:
// case DLL_THREAD_DETACH:
// case DLL_PROCESS_DETACH:
// break;
// }
// return TRUE;
//}
//#endif
// .so (shared object) and .dylib (Mac's dynamic library) don't use a DLLMain