From d01cbe93208335204cfe314e713013853a4dc641 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 16 Jun 2020 02:14:04 +0000 Subject: [PATCH] cudacodec(build): fix detection in CMake, cleanup duplicate includes --- cmake/OpenCVDetectCUDA.cmake | 1 + modules/cudacodec/src/cuvid_video_source.hpp | 10 +--------- modules/cudacodec/src/frame_queue.hpp | 10 +--------- modules/cudacodec/src/video_decoder.hpp | 12 +----------- modules/cudacodec/src/video_parser.hpp | 11 +---------- modules/cudacodec/src/video_source.hpp | 5 +---- 6 files changed, 6 insertions(+), 43 deletions(-) diff --git a/cmake/OpenCVDetectCUDA.cmake b/cmake/OpenCVDetectCUDA.cmake index 37a77cd660..22879f3152 100644 --- a/cmake/OpenCVDetectCUDA.cmake +++ b/cmake/OpenCVDetectCUDA.cmake @@ -53,6 +53,7 @@ if(CUDA_FOUND) else() set(${_result} 1) endif() + unset(_header_result CACHE) endmacro() SEARCH_NVCUVID_HEADER("nvcuvid.h" HAVE_NVCUVID_HEADER) SEARCH_NVCUVID_HEADER("dynlink_nvcuvid.h" HAVE_DYNLINK_NVCUVID_HEADER) diff --git a/modules/cudacodec/src/cuvid_video_source.hpp b/modules/cudacodec/src/cuvid_video_source.hpp index 4dd7761620..d36d856611 100644 --- a/modules/cudacodec/src/cuvid_video_source.hpp +++ b/modules/cudacodec/src/cuvid_video_source.hpp @@ -44,17 +44,9 @@ #ifndef __CUVID_VIDEO_SOURCE_HPP__ #define __CUVID_VIDEO_SOURCE_HPP__ -#if defined(HAVE_DYNLINK_NVCUVID_HEADER) - #include -#elif defined(HAVE_NVCUVID_HEADER) - #include -#endif -#include "opencv2/core/private.cuda.hpp" -#include "opencv2/cudacodec.hpp" #include "video_source.hpp" -namespace cv { namespace cudacodec { namespace detail -{ +namespace cv { namespace cudacodec { namespace detail { class CuvidVideoSource : public VideoSource { diff --git a/modules/cudacodec/src/frame_queue.hpp b/modules/cudacodec/src/frame_queue.hpp index f7fe7ad57d..3051a1e450 100644 --- a/modules/cudacodec/src/frame_queue.hpp +++ b/modules/cudacodec/src/frame_queue.hpp @@ -45,16 +45,8 @@ #define __FRAME_QUEUE_HPP__ #include "opencv2/core/utility.hpp" -#include "opencv2/core/private.cuda.hpp" -#if defined(HAVE_DYNLINK_NVCUVID_HEADER) - #include -#elif defined(HAVE_NVCUVID_HEADER) - #include -#endif - -namespace cv { namespace cudacodec { namespace detail -{ +namespace cv { namespace cudacodec { namespace detail { class FrameQueue { diff --git a/modules/cudacodec/src/video_decoder.hpp b/modules/cudacodec/src/video_decoder.hpp index 46caccaf83..e41b1a655f 100644 --- a/modules/cudacodec/src/video_decoder.hpp +++ b/modules/cudacodec/src/video_decoder.hpp @@ -44,17 +44,7 @@ #ifndef __VIDEO_DECODER_HPP__ #define __VIDEO_DECODER_HPP__ -#if defined(HAVE_DYNLINK_NVCUVID_HEADER) - #include -#elif defined(HAVE_NVCUVID_HEADER) - #include -#endif - -#include "opencv2/core/private.cuda.hpp" -#include "opencv2/cudacodec.hpp" - -namespace cv { namespace cudacodec { namespace detail -{ +namespace cv { namespace cudacodec { namespace detail { class VideoDecoder { diff --git a/modules/cudacodec/src/video_parser.hpp b/modules/cudacodec/src/video_parser.hpp index 03fff8e96a..91e50b3e2b 100644 --- a/modules/cudacodec/src/video_parser.hpp +++ b/modules/cudacodec/src/video_parser.hpp @@ -44,19 +44,10 @@ #ifndef __VIDEO_PARSER_HPP__ #define __VIDEO_PARSER_HPP__ -#if defined(HAVE_DYNLINK_NVCUVID_HEADER) - #include -#elif defined(HAVE_NVCUVID_HEADER) - #include -#endif - -#include "opencv2/core/private.cuda.hpp" -#include "opencv2/cudacodec.hpp" #include "frame_queue.hpp" #include "video_decoder.hpp" -namespace cv { namespace cudacodec { namespace detail -{ +namespace cv { namespace cudacodec { namespace detail { class VideoParser { diff --git a/modules/cudacodec/src/video_source.hpp b/modules/cudacodec/src/video_source.hpp index 9f2ed29d58..887ac04679 100644 --- a/modules/cudacodec/src/video_source.hpp +++ b/modules/cudacodec/src/video_source.hpp @@ -44,12 +44,9 @@ #ifndef __CUDACODEC_VIDEO_SOURCE_H__ #define __CUDACODEC_VIDEO_SOURCE_H__ -#include "opencv2/core/private.cuda.hpp" -#include "opencv2/cudacodec.hpp" #include "thread.hpp" -namespace cv { namespace cudacodec { namespace detail -{ +namespace cv { namespace cudacodec { namespace detail { class VideoParser;