““wangle”添加libuvc库
88ff40ebAdd on Mar 23History
diff --git a/libuvc-0.0.7/CMakeLists.txt b/libuvc-0.0.7/CMakeLists.txt
index 8a8b8c7..d5e6f12 100644
--- a/libuvc-0.0.7/CMakeLists.txt
+++ b/libuvc-0.0.7/CMakeLists.txt
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 3.1)
+enable_language(CXX)
 project(libuvc
   VERSION 0.0.7
   LANGUAGES C
 )
@@ -168,6 +169,8 @@ if(BUILD_TEST)
   )

   add_executable(uvc_test src/test.c)
+  set_source_files_properties(src/test.c PROPERTIES LANGUAGE CXX)
+  set_target_properties(uvc_test PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
   target_link_libraries(uvc_test
     PRIVATE
       LibUVC::UVC
diff --git a/libuvc-0.0.7/src/test.c b/libuvc-0.0.7/src/test.c
index 8f7d2a1..e6c3b92 100644
--- a/libuvc-0.0.7/src/test.c
+++ b/libuvc-0.0.7/src/test.c
@@ -19,6 +19,7 @@
 *********************************************************************/
 #include <stdio.h>
 #include <opencv2/highgui/highgui_c.h>
+#include <unistd.h>

 #include "libuvc/libuvc.h"

@@ -27,7 +27,7 @@ void cb(uvc_frame_t *frame, void *ptr) {
   uvc_error_t ret;
   IplImage* cvImg;

-  printf("callback! length = %u, ptr = %d\n", frame->data_bytes, (int) ptr);
+  printf("callback! length = %u, ptr = %p\n", frame->data_bytes, ptr);

   bgr = uvc_allocate_frame(frame->width * frame->height * 3);
   if (!bgr) {
@@ -88,7 +88,7 @@ int main(int argc, char **argv) {
       if (res < 0) {
         uvc_perror(res, "get_mode");
       } else {
-        res = uvc_start_streaming(devh, &ctrl, cb, 12345, 0);
+        res = uvc_start_streaming(devh, &ctrl, cb, (void*)12345, 0);

         if (res < 0) {
           uvc_perror(res, "start_streaming");