Make build on win

This commit is contained in:
John Zhao
2018-04-23 23:11:11 +08:00
parent 145046249d
commit 9cf58f6e70
21 changed files with 317 additions and 45 deletions

View File

@@ -17,7 +17,7 @@ struct context;
class Device;
class Context {
class MYNTEYE_API Context {
public:
Context();
~Context();

View File

@@ -33,7 +33,7 @@ class Channels;
class Motions;
class Streams;
class Device {
class MYNTEYE_API Device {
public:
using stream_callback_t = device::StreamCallback;
using motion_callback_t = device::MotionCallback;

View File

@@ -21,7 +21,7 @@ struct xu;
} // namespace uvc
class Channels {
class MYNTEYE_API Channels {
public:
typedef enum Channel {
CHANNEL_CAM_CTRL = 0x0100,

View File

@@ -10,7 +10,7 @@ MYNTEYE_BEGIN_NAMESPACE
namespace files {
bool mkdir(const std::string &path);
MYNTEYE_API bool mkdir(const std::string &path);
} // namespace files

View File

@@ -11,7 +11,7 @@
MYNTEYE_BEGIN_NAMESPACE
class strings_error : public std::runtime_error {
class MYNTEYE_API strings_error : public std::runtime_error {
public:
explicit strings_error(const std::string &what_arg) noexcept
: std::runtime_error(std::move(what_arg)) {}
@@ -21,17 +21,21 @@ class strings_error : public std::runtime_error {
namespace strings {
MYNTEYE_API
int hex2int(const std::string &text);
MYNTEYE_API
bool starts_with(const std::string &text, const std::string &prefix);
MYNTEYE_API
std::vector<std::string> split(
const std::string &text, const std::string &delimiters);
void ltrim(std::string &s); // NOLINT
void rtrim(std::string &s); // NOLINT
void trim(std::string &s); // NOLINT
MYNTEYE_API void ltrim(std::string &s); // NOLINT
MYNTEYE_API void rtrim(std::string &s); // NOLINT
MYNTEYE_API void trim(std::string &s); // NOLINT
MYNTEYE_API
std::string trim_copy(const std::string &text);
} // namespace strings

View File

@@ -28,7 +28,7 @@ MYNTEYE_BEGIN_NAMESPACE
/**
* Version.
*/
class Version {
class MYNTEYE_API Version {
public:
using size_t = std::size_t;
using value_t = std::uint8_t;
@@ -77,7 +77,7 @@ class Version {
/**
* Hardware version.
*/
class HardwareVersion : public Version {
class MYNTEYE_API HardwareVersion : public Version {
public:
using flag_t = std::bitset<8>;
@@ -93,7 +93,7 @@ class HardwareVersion : public Version {
/**
* Type.
*/
class Type {
class MYNTEYE_API Type {
public:
using size_t = std::size_t;
using value_t = std::uint16_t;
@@ -115,7 +115,7 @@ class Type {
* @ingroup datatypes
* Device infomation.
*/
struct DeviceInfo {
struct MYNTEYE_API DeviceInfo {
std::string name;
std::string serial_number;
Version firmware_version;

116
src/uvc/uvc-wmf.cc Normal file
View File

@@ -0,0 +1,116 @@
#include "uvc/uvc.h" // NOLINT
#include <glog/logging.h>
MYNTEYE_BEGIN_NAMESPACE
namespace uvc {
struct context {
context() {
VLOG(2) << __func__;
}
~context() {
VLOG(2) << __func__;
}
};
struct device {
const std::shared_ptr<context> parent;
int vid, pid;
device(std::shared_ptr<context> parent) : parent(parent) {
VLOG(2) << __func__;
}
~device() {
VLOG(2) << __func__;
}
};
std::shared_ptr<context> create_context() {
return std::make_shared<context>();
}
std::vector<std::shared_ptr<device>> query_devices(
std::shared_ptr<context> context) {
std::vector<std::shared_ptr<device>> devices;
UNUSED(context)
return devices;
}
int get_vendor_id(const device &device) {
return device.vid;
}
int get_product_id(const device &device) {
return device.pid;
}
std::string get_name(const device &device) {
UNUSED(device)
return "";
}
std::string get_video_name(const device &device) {
UNUSED(device)
return "";
}
bool pu_control_range(
const device &device, Option option, int32_t *min, int32_t *max,
int32_t *def) {
UNUSED(device)
UNUSED(option)
UNUSED(min)
UNUSED(max)
UNUSED(def)
return false;
}
bool pu_control_query(
const device &device, Option option, pu_query query, int32_t *value) {
UNUSED(device)
UNUSED(option)
UNUSED(query)
UNUSED(value)
return false;
}
bool xu_control_query(
const device &device, const xu &xu, uint8_t selector, xu_query query,
uint16_t size, uint8_t *data) {
UNUSED(device)
UNUSED(xu)
UNUSED(selector)
UNUSED(query)
UNUSED(size)
UNUSED(data)
return false;
}
void set_device_mode(
device &device, int width, int height, int fourcc, int fps, // NOLINT
video_channel_callback callback) {
UNUSED(device)
UNUSED(width)
UNUSED(height)
UNUSED(fourcc)
UNUSED(fps)
UNUSED(callback)
}
void start_streaming(device &device, int num_transfer_bufs) { // NOLINT
UNUSED(device)
UNUSED(num_transfer_bufs)
}
void stop_streaming(device &device) { // NOLINT
UNUSED(device)
}
} // namespace uvc
MYNTEYE_END_NAMESPACE

View File

@@ -24,7 +24,7 @@ typedef enum pu_query {
} pu_query;
// Extension Unit
struct xu {
struct MYNTEYE_API xu {
uint8_t unit;
};
@@ -42,40 +42,40 @@ struct context; // Opaque type representing access to the underlying UVC
struct device; // Opaque type representing access to a specific UVC device
// Enumerate devices
std::shared_ptr<context> create_context();
std::vector<std::shared_ptr<device>> query_devices(
MYNTEYE_API std::shared_ptr<context> create_context();
MYNTEYE_API std::vector<std::shared_ptr<device>> query_devices(
std::shared_ptr<context> context);
// Static device properties
std::string get_name(const device &device);
int get_vendor_id(const device &device);
int get_product_id(const device &device);
MYNTEYE_API std::string get_name(const device &device);
MYNTEYE_API int get_vendor_id(const device &device);
MYNTEYE_API int get_product_id(const device &device);
std::string get_video_name(const device &device);
MYNTEYE_API std::string get_video_name(const device &device);
// Access PU (Processing Unit) controls
inline bool is_pu_control(Option option) {
return option >= Option::GAIN && option <= Option::CONTRAST;
}
bool pu_control_range(
MYNTEYE_API bool pu_control_range(
const device &device, Option option, int32_t *min, int32_t *max,
int32_t *def);
bool pu_control_query(
MYNTEYE_API bool pu_control_query(
const device &device, Option option, pu_query query, int32_t *value);
// Access XU (Extension Unit) controls
bool xu_control_query(
MYNTEYE_API bool xu_control_query(
const device &device, const xu &xu, uint8_t selector, xu_query query,
uint16_t size, uint8_t *data);
// Control streaming
typedef std::function<void(const void *frame)> video_channel_callback;
void set_device_mode(
MYNTEYE_API void set_device_mode(
device &device, int width, int height, int fourcc, int fps, // NOLINT
video_channel_callback callback);
void start_streaming(device &device, int num_transfer_bufs); // NOLINT
void stop_streaming(device &device); // NOLINT
MYNTEYE_API void start_streaming(device &device, int num_transfer_bufs); // NOLINT
MYNTEYE_API void stop_streaming(device &device); // NOLINT
} // namespace uvc