Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
df615efc
Commit
df615efc
authored
Aug 28, 2016
by
Timo Rothenpieler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/nvenc: check maximum driver API version
parent
a19989ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
nvenc.c
libavcodec/nvenc.c
+18
-0
nvenc.h
libavcodec/nvenc.h
+1
-0
No files found.
libavcodec/nvenc.c
View file @
df615efc
...
@@ -155,8 +155,10 @@ static av_cold int nvenc_load_libraries(AVCodecContext *avctx)
...
@@ -155,8 +155,10 @@ static av_cold int nvenc_load_libraries(AVCodecContext *avctx)
{
{
NvencContext
*
ctx
=
avctx
->
priv_data
;
NvencContext
*
ctx
=
avctx
->
priv_data
;
NvencDynLoadFunctions
*
dl_fn
=
&
ctx
->
nvenc_dload_funcs
;
NvencDynLoadFunctions
*
dl_fn
=
&
ctx
->
nvenc_dload_funcs
;
PNVENCODEAPIGETMAXSUPPORTEDVERSION
nvenc_get_max_ver
;
PNVENCODEAPICREATEINSTANCE
nvenc_create_instance
;
PNVENCODEAPICREATEINSTANCE
nvenc_create_instance
;
NVENCSTATUS
err
;
NVENCSTATUS
err
;
uint32_t
nvenc_max_ver
;
#if CONFIG_CUDA
#if CONFIG_CUDA
dl_fn
->
cu_init
=
cuInit
;
dl_fn
->
cu_init
=
cuInit
;
...
@@ -183,9 +185,25 @@ static av_cold int nvenc_load_libraries(AVCodecContext *avctx)
...
@@ -183,9 +185,25 @@ static av_cold int nvenc_load_libraries(AVCodecContext *avctx)
LOAD_LIBRARY
(
dl_fn
->
nvenc
,
NVENC_LIBNAME
);
LOAD_LIBRARY
(
dl_fn
->
nvenc
,
NVENC_LIBNAME
);
LOAD_SYMBOL
(
nvenc_get_max_ver
,
dl_fn
->
nvenc
,
"NvEncodeAPIGetMaxSupportedVersion"
);
LOAD_SYMBOL
(
nvenc_create_instance
,
dl_fn
->
nvenc
,
LOAD_SYMBOL
(
nvenc_create_instance
,
dl_fn
->
nvenc
,
"NvEncodeAPICreateInstance"
);
"NvEncodeAPICreateInstance"
);
err
=
nvenc_get_max_ver
(
&
nvenc_max_ver
);
if
(
err
!=
NV_ENC_SUCCESS
)
return
nvenc_print_error
(
avctx
,
err
,
"Failed to query nvenc max version"
);
av_log
(
avctx
,
AV_LOG_VERBOSE
,
"Loaded Nvenc version %d.%d
\n
"
,
nvenc_max_ver
>>
4
,
nvenc_max_ver
&
0xf
);
if
((
NVENCAPI_MAJOR_VERSION
<<
4
|
NVENCAPI_MINOR_VERSION
)
>
nvenc_max_ver
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Driver does not support the required nvenc API version. "
"Required: %d.%d Found: %d.%d
\n
"
,
NVENCAPI_MAJOR_VERSION
,
NVENCAPI_MINOR_VERSION
,
nvenc_max_ver
>>
4
,
nvenc_max_ver
&
0xf
);
return
AVERROR
(
ENOSYS
);
}
dl_fn
->
nvenc_funcs
.
version
=
NV_ENCODE_API_FUNCTION_LIST_VER
;
dl_fn
->
nvenc_funcs
.
version
=
NV_ENCODE_API_FUNCTION_LIST_VER
;
err
=
nvenc_create_instance
(
&
dl_fn
->
nvenc_funcs
);
err
=
nvenc_create_instance
(
&
dl_fn
->
nvenc_funcs
);
...
...
libavcodec/nvenc.h
View file @
df615efc
...
@@ -72,6 +72,7 @@ typedef CUresult(CUDAAPI *PCUCTXCREATE)(CUcontext *pctx, unsigned int flags, CUd
...
@@ -72,6 +72,7 @@ typedef CUresult(CUDAAPI *PCUCTXCREATE)(CUcontext *pctx, unsigned int flags, CUd
typedef
CUresult
(
CUDAAPI
*
PCUCTXPOPCURRENT
)(
CUcontext
*
pctx
);
typedef
CUresult
(
CUDAAPI
*
PCUCTXPOPCURRENT
)(
CUcontext
*
pctx
);
typedef
CUresult
(
CUDAAPI
*
PCUCTXDESTROY
)(
CUcontext
ctx
);
typedef
CUresult
(
CUDAAPI
*
PCUCTXDESTROY
)(
CUcontext
ctx
);
typedef
NVENCSTATUS
(
NVENCAPI
*
PNVENCODEAPIGETMAXSUPPORTEDVERSION
)(
uint32_t
*
version
);
typedef
NVENCSTATUS
(
NVENCAPI
*
PNVENCODEAPICREATEINSTANCE
)(
NV_ENCODE_API_FUNCTION_LIST
*
functionList
);
typedef
NVENCSTATUS
(
NVENCAPI
*
PNVENCODEAPICREATEINSTANCE
)(
NV_ENCODE_API_FUNCTION_LIST
*
functionList
);
typedef
struct
NvencDynLoadFunctions
typedef
struct
NvencDynLoadFunctions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment