Skip to content
Closed
  •  
  •  
  •  
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ target_compile_features(lslboost PUBLIC cxx_std_11 cxx_lambda_init_captures)
target_compile_definitions(lslboost
PUBLIC
BOOST_ALL_NO_LIB
BOOST_ASIO_STANDALONE
)
target_include_directories(lslboost SYSTEM PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lslboost>)
Expand All @@ -194,10 +193,12 @@ target_include_directories(lslobj
target_include_directories(lslobj
SYSTEM PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/thirdparty/loguru>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/thirdparty/asio>
)
target_compile_definitions(lslobj PRIVATE
LIBLSL_EXPORTS
LOGURU_DEBUG_LOGGING=$<BOOL:${LSL_DEBUGLOG}>
PUBLIC ASIO_NO_DEPRECATED
)

# platform specific configuration
Expand All @@ -212,14 +213,11 @@ if(UNIX AND NOT APPLE)
target_link_libraries(lslobj PRIVATE dl)
endif()
elseif(WIN32)
target_link_libraries(lslobj PRIVATE iphlpapi winmm)
target_link_libraries(lslboost PRIVATE mswsock ws2_32)
target_link_libraries(lslobj PRIVATE iphlpapi winmm mswsock ws2_32)
target_compile_definitions(lslobj
PRIVATE _CRT_SECURE_NO_WARNINGS
PUBLIC LSLNOAUTOLINK # don't use #pragma(lib) in CMake builds
)
target_compile_definitions(lslboost
PUBLIC _WIN32_WINNT=${LSL_WINVER}
_WIN32_WINNT=${LSL_WINVER}
)
endif()

Expand Down Expand Up @@ -250,8 +248,8 @@ if(LSL_OPTIMIZATIONS)
else()
# build one object file for Asio instead of once every time an Asio function is called. See
# https://think-async.com/Asio/asio-1.18.2/doc/asio/using.html#asio.using.optional_separate_compilation
target_sources(lslboost PRIVATE lslboost/asio_objects.cpp)
target_compile_definitions(lslboost PUBLIC BOOST_ASIO_SEPARATE_COMPILATION)
target_sources(lslobj PRIVATE thirdparty/asio_objects.cpp)
target_compile_definitions(lslobj PUBLIC ASIO_SEPARATE_COMPILATION)
endif()


Expand Down
15 changes: 15 additions & 0 deletions include/lsl/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,21 @@ typedef enum {
_lsl_error_code_maxval = 0x7f000000
} lsl_error_code_t;

/// Flags for outlet_ex and inlet_ex
typedef enum {
/// Keep legacy behavior: max_buffered / max_buflen is in seconds; use asynch transfer.
transp_default = 0,

/// The supplied max_buf value is in samples.
transp_bufsize_samples = 1,

/// The supplied max_buf should be scaled by 0.001.
transp_bufsize_thousandths = 2,

// prevent compilers from assuming an instance fits in a single byte
_lsl_transport_options_maxval = 0x7f000000
} lsl_transport_options_t;

/// Return an explanation for the last error
extern LIBLSL_C_API const char *lsl_last_error(void);

Expand Down
5 changes: 5 additions & 0 deletions include/lsl/inlet.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
* @return A newly created lsl_inlet handle or NULL in the event that an error occurred.
*/
extern LIBLSL_C_API lsl_inlet lsl_create_inlet(lsl_streaminfo info, int32_t max_buflen, int32_t max_chunklen, int32_t recover);
/** @copydoc lsl_create_inlet()
* @param flags An integer that is the result of bitwise OR'ing one or more options from
* #lsl_transport_options_t together (e.g., #transp_bufsize_samples)
*/
extern LIBLSL_C_API lsl_inlet lsl_create_inlet_ex(lsl_streaminfo info, int32_t max_buflen, int32_t max_chunklen, int32_t recover, uint32_t flags);

/**
* Destructor.
Expand Down
5 changes: 5 additions & 0 deletions include/lsl/outlet.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
* @return A newly created lsl_outlet handle or NULL in the event that an error occurred.
*/
extern LIBLSL_C_API lsl_outlet lsl_create_outlet(lsl_streaminfo info, int32_t chunk_size, int32_t max_buffered);
/** @copydoc lsl_create_outlet()
* @param flags An integer that is the result of bitwise OR'ing one or more options from
* #lsl_transport_options_t together (e.g., #transp_bufsize_samples|#transp_bufsize_thousandths)
*/
extern LIBLSL_C_API lsl_outlet lsl_create_outlet_ex(lsl_streaminfo info, int32_t chunk_size, int32_t max_buffered, uint32_t flags);

/**
* Destroy an outlet.
Expand Down
8 changes: 4 additions & 4 deletions include/lsl_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,10 @@ class stream_outlet {
* @param max_buffered Optionally the maximum amount of data to buffer (in seconds if there is a
* nominal sampling rate, otherwise x100 in samples). The default is 6 minutes of data.
*/
stream_outlet(const stream_info &info, int32_t chunk_size = 0, int32_t max_buffered = 360)
stream_outlet(const stream_info &info, int32_t chunk_size = 0, int32_t max_buffered = 360, uint32_t flags = transp_default)
: channel_count(info.channel_count()),
sample_rate(info.nominal_srate()),
obj(lsl_create_outlet(info.handle().get(), chunk_size, max_buffered), &lsl_destroy_outlet) {}
obj(lsl_create_outlet_ex(info.handle().get(), chunk_size, max_buffered, flags), &lsl_destroy_outlet) {}

// ========================================
// === Pushing a sample into the outlet ===
Expand Down Expand Up @@ -900,9 +900,9 @@ class stream_inlet {
* lsl::lost_error if the stream's source is lost (e.g., due to an app or computer crash).
*/
stream_inlet(const stream_info &info, int32_t max_buflen = 360, int32_t max_chunklen = 0,
bool recover = true)
bool recover = true, uint32_t flags = transp_default)
: channel_count(info.channel_count()),
obj(lsl_create_inlet(info.handle().get(), max_buflen, max_chunklen, recover), &lsl_destroy_inlet) {}
obj(lsl_create_inlet_ex(info.handle().get(), max_buflen, max_chunklen, recover, flags), &lsl_destroy_inlet) {}

/// Return a shared pointer to pass to C-API functions that aren't wrapped yet
///
Expand Down
181 changes: 0 additions & 181 deletions lslboost/boost/asio.hpp

This file was deleted.

73 changes: 0 additions & 73 deletions lslboost/boost/asio/any_io_executor.hpp

This file was deleted.

Loading