fix corner case of libnvcuvid

* detect header automatically and not based on version number
pull/17527/head
Tomoaki Teshima 5 years ago
parent 476aa443c6
commit d4af89781b
  1. 21
      cmake/OpenCVDetectCUDA.cmake
  2. 2
      cmake/templates/cvconfig.h.in
  3. 4
      modules/cudacodec/src/cuvid_video_source.hpp
  4. 4
      modules/cudacodec/src/frame_queue.hpp
  5. 4
      modules/cudacodec/src/precomp.hpp
  6. 4
      modules/cudacodec/src/video_decoder.hpp
  7. 4
      modules/cudacodec/src/video_parser.hpp

@ -38,11 +38,30 @@ if(CUDA_FOUND)
endif()
if(WITH_NVCUVID)
macro(SEARCH_NVCUVID_HEADER _filename _result)
# place header file under CUDA_TOOLKIT_TARGET_DIR or CUDA_TOOLKIT_ROOT_DIR
find_path(_header_result
${_filename}
PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"
ENV CUDA_PATH
ENV CUDA_INC_PATH
PATH_SUFFIXES include
NO_DEFAULT_PATH
)
if("x${_header_result}" STREQUAL "x_header_result-NOTFOUND")
set(${_result} 0)
else()
set(${_result} 1)
endif()
endmacro()
SEARCH_NVCUVID_HEADER("nvcuvid.h" HAVE_NVCUVID_HEADER)
SEARCH_NVCUVID_HEADER("dynlink_nvcuvid.h" HAVE_DYNLINK_NVCUVID_HEADER)
find_cuda_helper_libs(nvcuvid)
if(WIN32)
find_cuda_helper_libs(nvcuvenc)
endif()
if(CUDA_nvcuvid_LIBRARY)
if(CUDA_nvcuvid_LIBRARY AND (${HAVE_NVCUVID_HEADER} OR ${HAVE_DYNLINK_NVCUVID_HEADER}))
# make sure to have both header and library before enabling
set(HAVE_NVCUVID 1)
endif()
if(CUDA_nvcuvenc_LIBRARY)

@ -127,6 +127,8 @@
/* NVIDIA Video Decoding API*/
#cmakedefine HAVE_NVCUVID
#cmakedefine HAVE_NVCUVID_HEADER
#cmakedefine HAVE_DYNLINK_NVCUVID_HEADER
/* NVIDIA Video Encoding API*/
#cmakedefine HAVE_NVCUVENC

@ -44,9 +44,9 @@
#ifndef __CUVID_VIDEO_SOURCE_HPP__
#define __CUVID_VIDEO_SOURCE_HPP__
#if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
#if defined(HAVE_DYNLINK_NVCUVID_HEADER)
#include <dynlink_nvcuvid.h>
#else
#elif defined(HAVE_NVCUVID_HEADER)
#include <nvcuvid.h>
#endif
#include "opencv2/core/private.cuda.hpp"

@ -47,9 +47,9 @@
#include "opencv2/core/utility.hpp"
#include "opencv2/core/private.cuda.hpp"
#if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
#if defined(HAVE_DYNLINK_NVCUVID_HEADER)
#include <dynlink_nvcuvid.h>
#else
#elif defined(HAVE_NVCUVID_HEADER)
#include <nvcuvid.h>
#endif

@ -56,9 +56,9 @@
#include "opencv2/core/private.cuda.hpp"
#ifdef HAVE_NVCUVID
#if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
#if defined(HAVE_DYNLINK_NVCUVID_HEADER)
#include <dynlink_nvcuvid.h>
#else
#elif defined(HAVE_NVCUVID_HEADER)
#include <nvcuvid.h>
#endif

@ -44,9 +44,9 @@
#ifndef __VIDEO_DECODER_HPP__
#define __VIDEO_DECODER_HPP__
#if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
#if defined(HAVE_DYNLINK_NVCUVID_HEADER)
#include <dynlink_nvcuvid.h>
#else
#elif defined(HAVE_NVCUVID_HEADER)
#include <nvcuvid.h>
#endif

@ -44,9 +44,9 @@
#ifndef __VIDEO_PARSER_HPP__
#define __VIDEO_PARSER_HPP__
#if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
#if defined(HAVE_DYNLINK_NVCUVID_HEADER)
#include <dynlink_nvcuvid.h>
#else
#elif defined(HAVE_NVCUVID_HEADER)
#include <nvcuvid.h>
#endif

Loading…
Cancel
Save