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
bc3f7677
Commit
bc3f7677
authored
Jan 16, 2015
by
Timo Rothenpieler
Committed by
Michael Niedermayer
Jan 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/nvenc: Add support for nvenc api version 5
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
8de0990e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
nvenc.c
libavcodec/nvenc.c
+12
-1
No files found.
libavcodec/nvenc.c
View file @
bc3f7677
...
@@ -67,7 +67,9 @@ typedef CUresult(CUDAAPI *PCUCTXDESTROY)(CUcontext ctx);
...
@@ -67,7 +67,9 @@ typedef CUresult(CUDAAPI *PCUCTXDESTROY)(CUcontext ctx);
typedef
NVENCSTATUS
(
NVENCAPI
*
PNVENCODEAPICREATEINSTANCE
)(
NV_ENCODE_API_FUNCTION_LIST
*
functionList
);
typedef
NVENCSTATUS
(
NVENCAPI
*
PNVENCODEAPICREATEINSTANCE
)(
NV_ENCODE_API_FUNCTION_LIST
*
functionList
);
#if NVENCAPI_MAJOR_VERSION < 5
static
const
GUID
dummy_license
=
{
0x0
,
0x0
,
0x0
,
{
0x0
,
0x0
,
0x0
,
0x0
,
0x0
,
0x0
,
0x0
,
0x0
}
};
static
const
GUID
dummy_license
=
{
0x0
,
0x0
,
0x0
,
{
0x0
,
0x0
,
0x0
,
0x0
,
0x0
,
0x0
,
0x0
,
0x0
}
};
#endif
typedef
struct
NvencInputSurface
typedef
struct
NvencInputSurface
{
{
...
@@ -466,13 +468,16 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
...
@@ -466,13 +468,16 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
CUcontext
cu_context_curr
;
CUcontext
cu_context_curr
;
CUresult
cu_res
;
CUresult
cu_res
;
GUID
encoder_preset
=
NV_ENC_PRESET_HQ_GUID
;
GUID
encoder_preset
=
NV_ENC_PRESET_HQ_GUID
;
GUID
license
=
dummy_license
;
NVENCSTATUS
nv_status
=
NV_ENC_SUCCESS
;
NVENCSTATUS
nv_status
=
NV_ENC_SUCCESS
;
int
surfaceCount
=
0
;
int
surfaceCount
=
0
;
int
i
,
num_mbs
;
int
i
,
num_mbs
;
int
isLL
=
0
;
int
isLL
=
0
;
int
res
=
0
;
int
res
=
0
;
#if NVENCAPI_MAJOR_VERSION < 5
GUID
license
=
dummy_license
;
#endif
NvencContext
*
ctx
=
avctx
->
priv_data
;
NvencContext
*
ctx
=
avctx
->
priv_data
;
NvencDynLoadFunctions
*
dl_fn
=
&
ctx
->
nvenc_dload_funcs
;
NvencDynLoadFunctions
*
dl_fn
=
&
ctx
->
nvenc_dload_funcs
;
NV_ENCODE_API_FUNCTION_LIST
*
p_nvenc
=
&
dl_fn
->
nvenc_funcs
;
NV_ENCODE_API_FUNCTION_LIST
*
p_nvenc
=
&
dl_fn
->
nvenc_funcs
;
...
@@ -494,7 +499,10 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
...
@@ -494,7 +499,10 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
preset_config
.
presetCfg
.
version
=
NV_ENC_CONFIG_VER
;
preset_config
.
presetCfg
.
version
=
NV_ENC_CONFIG_VER
;
encode_session_params
.
version
=
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER
;
encode_session_params
.
version
=
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER
;
encode_session_params
.
apiVersion
=
NVENCAPI_VERSION
;
encode_session_params
.
apiVersion
=
NVENCAPI_VERSION
;
#if NVENCAPI_MAJOR_VERSION < 5
encode_session_params
.
clientKeyPtr
=
&
license
;
encode_session_params
.
clientKeyPtr
=
&
license
;
#endif
if
(
ctx
->
gpu
>=
dl_fn
->
nvenc_device_count
)
{
if
(
ctx
->
gpu
>=
dl_fn
->
nvenc_device_count
)
{
av_log
(
avctx
,
AV_LOG_FATAL
,
"Requested GPU %d, but only %d GPUs are available!
\n
"
,
ctx
->
gpu
,
dl_fn
->
nvenc_device_count
);
av_log
(
avctx
,
AV_LOG_FATAL
,
"Requested GPU %d, but only %d GPUs are available!
\n
"
,
ctx
->
gpu
,
dl_fn
->
nvenc_device_count
);
...
@@ -1065,7 +1073,10 @@ static int nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -1065,7 +1073,10 @@ static int nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
pic_params
.
inputDuration
=
0
;
pic_params
.
inputDuration
=
0
;
pic_params
.
codecPicParams
.
h264PicParams
.
sliceMode
=
ctx
->
encode_config
.
encodeCodecConfig
.
h264Config
.
sliceMode
;
pic_params
.
codecPicParams
.
h264PicParams
.
sliceMode
=
ctx
->
encode_config
.
encodeCodecConfig
.
h264Config
.
sliceMode
;
pic_params
.
codecPicParams
.
h264PicParams
.
sliceModeData
=
ctx
->
encode_config
.
encodeCodecConfig
.
h264Config
.
sliceModeData
;
pic_params
.
codecPicParams
.
h264PicParams
.
sliceModeData
=
ctx
->
encode_config
.
encodeCodecConfig
.
h264Config
.
sliceModeData
;
#if NVENCAPI_MAJOR_VERSION < 5
memcpy
(
&
pic_params
.
rcParams
,
&
ctx
->
encode_config
.
rcParams
,
sizeof
(
NV_ENC_RC_PARAMS
));
memcpy
(
&
pic_params
.
rcParams
,
&
ctx
->
encode_config
.
rcParams
,
sizeof
(
NV_ENC_RC_PARAMS
));
#endif
res
=
timestamp_queue_enqueue
(
&
ctx
->
timestamp_list
,
frame
->
pts
);
res
=
timestamp_queue_enqueue
(
&
ctx
->
timestamp_list
,
frame
->
pts
);
...
...
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