update for linux.

This commit is contained in:
amass 2024-10-02 03:13:15 +08:00
parent 7c3dbcedfe
commit 149ae2a212
5 changed files with 8 additions and 9 deletions

View File

@ -5,11 +5,9 @@
#include <cstdlib>
#include <filesystem>
#include <fstream>
#ifdef Q_OS_WIN
#ifdef WIN32
#include <mfapi.h>
#include <mfcaptureengine.h>
#include <mfidl.h>
#include <mfreadwrite.h>
#else
#include <fcntl.h>
#include <linux/videodev2.h>
@ -28,7 +26,7 @@ void SafeRelease(T **ppT) {
DeviceDiscovery::DeviceDiscovery() {
}
#ifdef Q_OS_WIN
#ifdef WIN32
static std::string deviceName(IMFActivate *device) {
std::string ret;
WCHAR *friendlyName = nullptr;

View File

@ -5,6 +5,10 @@
#include <string>
#include <system_error>
#include <vector>
#ifdef WIN32
#include <mfidl.h>
#include <mfreadwrite.h>
#endif
class DeviceDiscovery {
constexpr static int32_t OtaSpecificWidth = 96;
@ -13,7 +17,7 @@ public:
constexpr static auto DeviceName = "UVC Camera";
struct Device {
~Device();
#ifdef Q_OS_WIN
#ifdef WIN32
Device(IMFMediaSource *source);
IMFMediaSource *source = nullptr;
IMFSourceReader *reader = nullptr;

View File

@ -13,7 +13,6 @@ target_compile_definitions(UnitTest
)
target_link_libraries(UnitTest
PRIVATE Boost::unit_test_framework
PRIVATE DataStructure
PRIVATE Peripheral
PRIVATE Universal

View File

@ -6,8 +6,6 @@ BOOST_AUTO_TEST_CASE(EnumDevice) {
std::error_code error;
DeviceDiscovery discovery;
auto device = discovery.find("UVC Camera", error);
LOG(info) << device->name;
auto devices = discovery.devices();
for (int i = 0; i < devices.size(); i++) {
LOG(info) << "device[" << i << "] " << devices.at(i);

View File

@ -1,2 +1,2 @@
#define BOOST_TEST_MODULE KylinLibraryTest
#include "boost/test/included/unit_test.hpp"
#include <boost/test/included/unit_test.hpp>