From 56941763fe39b14a7cd284a995d6d874eb29cd9b Mon Sep 17 00:00:00 2001 From: Jack Morrison Date: Sun, 3 Nov 2013 19:28:36 -0500 Subject: [PATCH 1/3] Adds option to disable CMake package exporting. --- src/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aee39fa9c..b2a7ac3be 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -299,7 +299,12 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake @ONLY ) # Add package to CMake package registery for use from the build tree -export( PACKAGE ${PROJECT_NAME} ) +option( EXPORT_${PROJECT_NAME} + "Should the ${PROJECT_NAME} package be exported for use by other software" ON ) + +if( EXPORT_${PROJECT_NAME} ) + export( PACKAGE ${PROJECT_NAME} ) +endif() ####################################################### ## Install headers / targets From 18c4e141005593e2f55c4bb59668ded683a277be Mon Sep 17 00:00:00 2001 From: Jack Morrison Date: Mon, 4 Nov 2013 09:18:51 -0500 Subject: [PATCH 2/3] Set Pangolin_DIR for examples. - Otherwise, it might not use the correct Pangolin or it won't find it if we don't export the package. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47181548d..8f99b4d48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,5 +41,6 @@ add_custom_target(uninstall add_subdirectory("src") if(BUILD_EXAMPLES) + set(Pangolin_DIR ${Pangolin_BINARY_DIR}/src) add_subdirectory(examples) endif() From 3a6dae2dfd3d0f69f2fe1623a5559da039a4142e Mon Sep 17 00:00:00 2001 From: David Gossow Date: Sun, 1 Dec 2013 11:28:07 -0800 Subject: [PATCH 3/3] Added support for 'size' parameter for v4l video. --- include/pangolin/video/v4l.h | 2 +- src/video.cpp | 3 ++- src/video/v4l.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/pangolin/video/v4l.h b/include/pangolin/video/v4l.h index 25f5c8ab0..1eb3cf967 100644 --- a/include/pangolin/video/v4l.h +++ b/include/pangolin/video/v4l.h @@ -51,7 +51,7 @@ struct buffer { class V4lVideo : public VideoInterface { public: - V4lVideo(const char* dev_name, io_method io = IO_METHOD_MMAP); + V4lVideo(const char* dev_name, io_method io = IO_METHOD_MMAP, unsigned iwidth=0, unsigned iheight=0); ~V4lVideo(); //! Implement VideoInput::Start() diff --git a/src/video.cpp b/src/video.cpp index fe9a11c0d..8c1963a0f 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -224,6 +224,7 @@ VideoInterface* OpenVideo(std::string str_uri) #ifdef HAVE_V4L if(!uri.scheme.compare("v4l")) { const std::string smethod = uri.Get("method","mmap"); + const ImageDim desired_dim = uri.Get("size", ImageDim(0,0)); io_method method = IO_METHOD_MMAP; @@ -235,7 +236,7 @@ VideoInterface* OpenVideo(std::string str_uri) method = IO_METHOD_USERPTR; } - video = new V4lVideo(uri.url.c_str(), method); + video = new V4lVideo(uri.url.c_str(), method, desired_dim.x, desired_dim.y ); }else #endif // HAVE_V4L #ifdef HAVE_DC1394 diff --git a/src/video/v4l.cpp b/src/video/v4l.cpp index 142d70026..819174620 100644 --- a/src/video/v4l.cpp +++ b/src/video/v4l.cpp @@ -71,11 +71,11 @@ inline std::string V4lToString(int32_t v) return std::string(cc); } -V4lVideo::V4lVideo(const char* dev_name, io_method io) +V4lVideo::V4lVideo(const char* dev_name, io_method io, unsigned iwidth, unsigned iheight) : io(io), fd(-1), buffers(0), n_buffers(0), running(false) { open_device(dev_name); - init_device(dev_name,0,0,0); + init_device(dev_name,iwidth,iheight,0); Start(); }