From patchwork Wed Sep 21 04:38:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 665 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp757710vsd; Tue, 20 Sep 2016 21:49:50 -0700 (PDT) X-Received: by 10.194.17.6 with SMTP id k6mr36245445wjd.65.1474433390048; Tue, 20 Sep 2016 21:49:50 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ff4si31301066wjb.197.2016.09.20.21.49.44; Tue, 20 Sep 2016 21:49:50 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@overt.org; dkim=neutral (body hash did not verify) header.i=@overt.org; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CDBCD689B31; Wed, 21 Sep 2016 07:49:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from rs224.mailgun.us (rs224.mailgun.us [209.61.151.224]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 742C96898D9 for ; Wed, 21 Sep 2016 07:49:12 +0300 (EEST) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=overt.org; q=dns/txt; s=k1; t=1474433366; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=UIM2bv1j14L4sDdbmKAwbc4V8GGlYAtwBQ/+PoCIclE=; b=xnoT4dRqZPOROAke6/V0u4lpuEMV7rzL85WNMudjL6v32hUYoko+cMeECDu+gh0iiYJjaMoE +2DTR2NVPsL290QOywapILvas03EIxjEXU8IYdVHR6KGhGnlWuExMMictr+rf/fTR7vek4qt uJJtuMrCCE2gDuB4TbRvSVkws4g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=overt.org; s=k1; q=dns; h=Sender: From: To: Cc: Subject: Date: Message-Id: In-Reply-To: References; b=Jt5SjRma9XBg0/QV8CSQx7BnZrzcmokIKglajL/HWVsQKjot44L0i6sUNs8S3Mtf8Wx54b 6s0wbneqpVesxAlQo3dbntd8gkN6j/7dyvCKgTKVQxQV8RUWtEhtr6BEa8T3HTRnGPIwtuI9 g9lCDAVxakRmR/F0RWGSaqyh2VKek= X-Mailgun-Sending-Ip: 209.61.151.224 X-Mailgun-Sid: WyIyM2Q3MCIsICJmZm1wZWctZGV2ZWxAZmZtcGVnLm9yZyIsICI0YTg5NjEiXQ== Received: from mail.overt.org (155.208.178.107.bc.googleusercontent.com [107.178.208.155]) by mxa.mailgun.org with ESMTP id 57e20eea.7f35fc702110-in8; Wed, 21 Sep 2016 04:39:06 -0000 (UTC) Received: from authenticated-user (mail.overt.org [107.178.208.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id DF0CF6AA81; Wed, 21 Sep 2016 04:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1474432746; bh=eikXR+qGI0pk1O+zCutycPFWj3lKJByl7iwjiKUBBPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KMiRzuMSz8ARwoPlIcOXvEC4o0+4niVJ0jt8iucv/DOApXD5l0ufnkzUKW0vdkXaC dkM0BXUtVc7oJM298Ee+WDrECztdOY8lJIaCceErhPJCNNSPOGe2Oz7mPt0uQm9UFf ao1nEHYWMywjADZn7CoWIx++2b+B4whR6hexbGdwVmJG+ymEZgNOHVd1xeg35qKui7 UqyjBgpRjfL/QzaySxCvPvRy/8wvXUmBESo16frkDFy4dpquMjVpCwJfma1lOvuTLA qrDDQp4bGhOOM34Ipuf387vji5dYtiN1z/fnGdDs9Mm1bU53okWTxnVSekujs3gJHO zXWa3qHkbxIpA== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Sep 2016 21:38:57 -0700 Message-Id: <1474432738-13024-3-git-send-email-philipl@overt.org> In-Reply-To: <1474432738-13024-1-git-send-email-philipl@overt.org> References: <1474432738-13024-1-git-send-email-philipl@overt.org> Subject: [FFmpeg-devel] [PATCH 2/3] cuvid: Modify cuvid headers to be usable X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Philip Langdale MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" We remove the dynlink fanciness with normal function prototypes and update the include paths. Signed-off-by: Philip Langdale --- compat/cuda/cuviddec.h | 53 +++++++++++++++++--------------------------------- compat/cuda/nvcuvid.h | 34 +++++++++++--------------------- 2 files changed, 29 insertions(+), 58 deletions(-) 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 +#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 */ ////////////////////////////////////////////////////////////////////////////////////////////////