[FFmpeg-devel,2/3] cuvid: Modify cuvid headers to be usable

Submitted by Philip Langdale on Sept. 21, 2016, 4:38 a.m.

Details

Message ID 1474432738-13024-3-git-send-email-philipl@overt.org
State New
Headers show

Commit Message

Philip Langdale Sept. 21, 2016, 4:38 a.m.
We remove the dynlink fanciness with normal function prototypes and
update the include paths.

Signed-off-by: Philip Langdale <philipl@overt.org>
---
 compat/cuda/cuviddec.h | 53 +++++++++++++++++---------------------------------
 compat/cuda/nvcuvid.h  | 34 +++++++++++---------------------
 2 files changed, 29 insertions(+), 58 deletions(-)

Patch hide | download patch | download mbox

diff --git a/compat/cuda/cuviddec.h b/compat/cuda/cuviddec.h
index 6ef95bd..a66826f 100644
--- a/compat/cuda/cuviddec.h
+++ b/compat/cuda/cuviddec.h
@@ -35,9 +35,9 @@ 
 #if !defined(__CUDA_VIDEO_H__)
 #define __CUDA_VIDEO_H__
 
-#ifndef __dynlink_cuda_h__
-#include "dynlink_cuda.h"
-#endif // __dynlink_cuda_h__
+#ifndef __cuda_cuda_h__
+#include <cuda.h>
+#endif // __cuda_cuda_h__
 
 #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
 #if (CUDA_VERSION >= 3020) && (!defined(CUDA_FORCE_API_VERSION) || (CUDA_FORCE_API_VERSION >= 3020))
@@ -715,19 +715,19 @@  typedef struct _CUVIDPROCPARAMS
  * \fn CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci)
  * Create the decoder object
  */
-typedef CUresult CUDAAPI tcuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci);
+CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci);
 
 /**
  * \fn CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder)
  * Destroy the decoder object
  */
-typedef CUresult CUDAAPI tcuvidDestroyDecoder(CUvideodecoder hDecoder);
+CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder);
 
 /**
  * \fn CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams)
  * Decode a single picture (field or frame)
  */
-typedef CUresult CUDAAPI tcuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams);
+CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams);
 
 
 #if !defined(__CUVID_DEVPTR64) || defined(__CUVID_INTERNAL)
@@ -735,7 +735,7 @@  typedef CUresult CUDAAPI tcuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPA
  * \fn CUresult CUDAAPI cuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx, unsigned int *pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS *pVPP);
  * Post-process and map a video frame for use in cuda
  */
-typedef CUresult CUDAAPI tcuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx,
+CUresult CUDAAPI cuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx,
                                            unsigned int *pDevPtr, unsigned int *pPitch,
                                            CUVIDPROCPARAMS *pVPP);
 
@@ -743,7 +743,7 @@  typedef CUresult CUDAAPI tcuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicId
  * \fn CUresult CUDAAPI cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr)
  * Unmap a previously mapped video frame
  */
-typedef CUresult CUDAAPI tcuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr);
+CUresult CUDAAPI cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr);
 #endif
 
 #if defined(WIN64) || defined(_WIN64) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
@@ -751,18 +751,18 @@  typedef CUresult CUDAAPI tcuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned
  * \fn CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS *pVPP);
  * map a video frame
  */
-typedef CUresult CUDAAPI tcuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr,
+CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder, int nPicIdx, unsigned long long *pDevPtr,
                                              unsigned int *pPitch, CUVIDPROCPARAMS *pVPP);
 
 /**
  * \fn CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr);
  * Unmap a previously mapped video frame
  */
-typedef CUresult CUDAAPI tcuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr);
+CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsigned long long DevPtr);
 
 #if defined(__CUVID_DEVPTR64) && !defined(__CUVID_INTERNAL)
-#define tcuvidMapVideoFrame      tcuvidMapVideoFrame64
-#define tcuvidUnmapVideoFrame    tcuvidUnmapVideoFrame64
+#define cuvidMapVideoFrame      cuvidMapVideoFrame64
+#define cuvidUnmapVideoFrame    cuvidUnmapVideoFrame64
 #endif
 #endif
 
@@ -787,26 +787,28 @@  typedef CUresult CUDAAPI tcuvidUnmapVideoFrame64(CUvideodecoder hDecoder, unsign
 /**
  * \fn CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx)
  */
-typedef CUresult CUDAAPI tcuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx);
+CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx);
 
 /**
  * \fn CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck)
  */
-typedef CUresult CUDAAPI tcuvidCtxLockDestroy(CUvideoctxlock lck);
+CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck);
 
 /**
  * \fn CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags)
  */
-typedef CUresult CUDAAPI tcuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags);
+CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags);
 
 /**
  * \fn CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags)
  */
-typedef CUresult CUDAAPI tcuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags);
+CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags);
 
 /** @} */  /* End VIDEO_DECODER */
 ////////////////////////////////////////////////////////////////////////////////////////////////
 
+#if defined(__cplusplus)
+
 // Auto-lock helper for C++ applications
 class CCtxAutoLock
 {
@@ -817,25 +819,6 @@  public:
     ~CCtxAutoLock();
 };
 
-extern tcuvidCreateDecoder        *cuvidCreateDecoder;
-extern tcuvidDestroyDecoder       *cuvidDestroyDecoder;
-extern tcuvidDecodePicture        *cuvidDecodePicture;
-extern tcuvidMapVideoFrame        *cuvidMapVideoFrame;
-extern tcuvidUnmapVideoFrame      *cuvidUnmapVideoFrame;
-
-#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
-extern tcuvidMapVideoFrame64      *cuvidMapVideoFrame64;
-extern tcuvidUnmapVideoFrame64    *cuvidUnmapVideoFrame64;
-#endif
-
-//extern tcuvidGetVideoFrameSurface *cuvidGetVideoFrameSurface;
-
-extern tcuvidCtxLockCreate        *cuvidCtxLockCreate;
-extern tcuvidCtxLockDestroy       *cuvidCtxLockDestroy;
-extern tcuvidCtxLock              *cuvidCtxLock;
-extern tcuvidCtxUnlock            *cuvidCtxUnlock;
-
-#if defined(__cplusplus)
 }
 
 #endif /* __cplusplus */
diff --git a/compat/cuda/nvcuvid.h b/compat/cuda/nvcuvid.h
index 228da53..61d66ce 100644
--- a/compat/cuda/nvcuvid.h
+++ b/compat/cuda/nvcuvid.h
@@ -35,7 +35,7 @@ 
 #if !defined(__NVCUVID_H__)
 #define __NVCUVID_H__
 
-#include "dynlink_cuviddec.h"
+#include "compat/cuda/cuviddec.h"
 
 #if defined(__cplusplus)
 extern "C" {
@@ -214,43 +214,43 @@  typedef enum {
  * \fn CUresult CUDAAPI cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams)
  * Create Video Source
  */
-typedef CUresult CUDAAPI tcuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams);
+CUresult CUDAAPI cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams);
 
 /**
  * \fn CUresult CUDAAPI cuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams)
  * Create Video Source
  */
-typedef CUresult CUDAAPI tcuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams);
+CUresult CUDAAPI cuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams);
 
 /**
  * \fn CUresult CUDAAPI cuvidDestroyVideoSource(CUvideosource obj)
  * Destroy Video Source
  */
-typedef CUresult CUDAAPI tcuvidDestroyVideoSource(CUvideosource obj);
+CUresult CUDAAPI cuvidDestroyVideoSource(CUvideosource obj);
 
 /**
  * \fn CUresult CUDAAPI cuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state)
  * Set Video Source state
  */
-typedef CUresult CUDAAPI tcuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state);
+CUresult CUDAAPI cuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state);
 
 /**
  * \fn cudaVideoState CUDAAPI cuvidGetVideoSourceState(CUvideosource obj)
  * Get Video Source state
  */
-typedef cudaVideoState CUDAAPI tcuvidGetVideoSourceState(CUvideosource obj);
+cudaVideoState CUDAAPI cuvidGetVideoSourceState(CUvideosource obj);
 
 /**
  * \fn CUresult CUDAAPI cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags)
  * Get Video Source Format
  */
-typedef CUresult CUDAAPI tcuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags);
+CUresult CUDAAPI cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags);
 
 /**
  * \fn CUresult CUDAAPI cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags)
  * Set Video Source state
  */
-typedef CUresult CUDAAPI tcuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags);
+CUresult CUDAAPI cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags);
 
 #endif
 
@@ -297,29 +297,17 @@  typedef struct _CUVIDPARSERPARAMS
 /**
  * \fn CUresult CUDAAPI cuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams)
  */
-typedef CUresult CUDAAPI tcuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams);
+CUresult CUDAAPI cuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams);
 
 /**
  * \fn CUresult CUDAAPI cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket)
  */
-typedef CUresult CUDAAPI tcuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket);
+CUresult CUDAAPI cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket);
 
 /**
  * \fn CUresult CUDAAPI cuvidDestroyVideoParser(CUvideoparser obj)
  */
-typedef CUresult CUDAAPI tcuvidDestroyVideoParser(CUvideoparser obj);
-
-extern tcuvidCreateVideoSource               *cuvidCreateVideoSource;
-extern tcuvidCreateVideoSourceW              *cuvidCreateVideoSourceW;
-extern tcuvidDestroyVideoSource              *cuvidDestroyVideoSource;
-extern tcuvidSetVideoSourceState             *cuvidSetVideoSourceState;
-extern tcuvidGetVideoSourceState             *cuvidGetVideoSourceState;
-extern tcuvidGetSourceVideoFormat            *cuvidGetSourceVideoFormat;
-extern tcuvidGetSourceAudioFormat            *cuvidGetSourceAudioFormat;
-
-extern tcuvidCreateVideoParser               *cuvidCreateVideoParser;
-extern tcuvidParseVideoData                  *cuvidParseVideoData;
-extern tcuvidDestroyVideoParser              *cuvidDestroyVideoParser;
+CUresult CUDAAPI cuvidDestroyVideoParser(CUvideoparser obj);
 
 /** @} */  /* END VIDEO_PARSER */
 ////////////////////////////////////////////////////////////////////////////////////////////////