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
5a88e8c3
Commit
5a88e8c3
authored
Mar 22, 2018
by
Roman Arzumanyan
Committed by
Timo Rothenpieler
May 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/nvenc: add A53CC support
Signed-off-by:
Timo Rothenpieler
<
timo@rothenpieler.org
>
parent
15537512
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
nvenc.c
libavcodec/nvenc.c
+28
-2
No files found.
libavcodec/nvenc.c
View file @
5a88e8c3
...
@@ -1719,7 +1719,8 @@ static int nvenc_upload_frame(AVCodecContext *avctx, const AVFrame *frame,
...
@@ -1719,7 +1719,8 @@ static int nvenc_upload_frame(AVCodecContext *avctx, const AVFrame *frame,
}
}
static
void
nvenc_codec_specific_pic_params
(
AVCodecContext
*
avctx
,
static
void
nvenc_codec_specific_pic_params
(
AVCodecContext
*
avctx
,
NV_ENC_PIC_PARAMS
*
params
)
NV_ENC_PIC_PARAMS
*
params
,
NV_ENC_SEI_PAYLOAD
*
sei_data
)
{
{
NvencContext
*
ctx
=
avctx
->
priv_data
;
NvencContext
*
ctx
=
avctx
->
priv_data
;
...
@@ -1729,12 +1730,22 @@ static void nvenc_codec_specific_pic_params(AVCodecContext *avctx,
...
@@ -1729,12 +1730,22 @@ static void nvenc_codec_specific_pic_params(AVCodecContext *avctx,
ctx
->
encode_config
.
encodeCodecConfig
.
h264Config
.
sliceMode
;
ctx
->
encode_config
.
encodeCodecConfig
.
h264Config
.
sliceMode
;
params
->
codecPicParams
.
h264PicParams
.
sliceModeData
=
params
->
codecPicParams
.
h264PicParams
.
sliceModeData
=
ctx
->
encode_config
.
encodeCodecConfig
.
h264Config
.
sliceModeData
;
ctx
->
encode_config
.
encodeCodecConfig
.
h264Config
.
sliceModeData
;
if
(
sei_data
)
{
params
->
codecPicParams
.
h264PicParams
.
seiPayloadArray
=
sei_data
;
params
->
codecPicParams
.
h264PicParams
.
seiPayloadArrayCnt
=
1
;
}
break
;
break
;
case
AV_CODEC_ID_HEVC
:
case
AV_CODEC_ID_HEVC
:
params
->
codecPicParams
.
hevcPicParams
.
sliceMode
=
params
->
codecPicParams
.
hevcPicParams
.
sliceMode
=
ctx
->
encode_config
.
encodeCodecConfig
.
hevcConfig
.
sliceMode
;
ctx
->
encode_config
.
encodeCodecConfig
.
hevcConfig
.
sliceMode
;
params
->
codecPicParams
.
hevcPicParams
.
sliceModeData
=
params
->
codecPicParams
.
hevcPicParams
.
sliceModeData
=
ctx
->
encode_config
.
encodeCodecConfig
.
hevcConfig
.
sliceModeData
;
ctx
->
encode_config
.
encodeCodecConfig
.
hevcConfig
.
sliceModeData
;
if
(
sei_data
)
{
params
->
codecPicParams
.
hevcPicParams
.
seiPayloadArray
=
sei_data
;
params
->
codecPicParams
.
hevcPicParams
.
seiPayloadArrayCnt
=
1
;
}
break
;
break
;
}
}
}
}
...
@@ -2036,6 +2047,8 @@ int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
...
@@ -2036,6 +2047,8 @@ int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
NVENCSTATUS
nv_status
;
NVENCSTATUS
nv_status
;
NvencSurface
*
tmp_out_surf
,
*
in_surf
;
NvencSurface
*
tmp_out_surf
,
*
in_surf
;
int
res
,
res2
;
int
res
,
res2
;
NV_ENC_SEI_PAYLOAD
*
sei_data
=
NULL
;
size_t
sei_size
;
NvencContext
*
ctx
=
avctx
->
priv_data
;
NvencContext
*
ctx
=
avctx
->
priv_data
;
NvencDynLoadFunctions
*
dl_fn
=
&
ctx
->
nvenc_dload_funcs
;
NvencDynLoadFunctions
*
dl_fn
=
&
ctx
->
nvenc_dload_funcs
;
...
@@ -2095,7 +2108,19 @@ int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
...
@@ -2095,7 +2108,19 @@ int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
pic_params
.
inputTimeStamp
=
frame
->
pts
;
pic_params
.
inputTimeStamp
=
frame
->
pts
;
nvenc_codec_specific_pic_params
(
avctx
,
&
pic_params
);
if
(
av_frame_get_side_data
(
frame
,
AV_FRAME_DATA_A53_CC
))
{
if
(
ff_alloc_a53_sei
(
frame
,
sizeof
(
NV_ENC_SEI_PAYLOAD
),
(
void
**
)
&
sei_data
,
&
sei_size
)
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Not enough memory for closed captions, skipping
\n
"
);
}
if
(
sei_data
)
{
sei_data
->
payloadSize
=
(
uint32_t
)
sei_size
;
sei_data
->
payloadType
=
4
;
sei_data
->
payload
=
(
uint8_t
*
)(
sei_data
+
1
);
}
}
nvenc_codec_specific_pic_params
(
avctx
,
&
pic_params
,
sei_data
);
}
else
{
}
else
{
pic_params
.
encodePicFlags
=
NV_ENC_PIC_FLAG_EOS
;
pic_params
.
encodePicFlags
=
NV_ENC_PIC_FLAG_EOS
;
ctx
->
encoder_flushing
=
1
;
ctx
->
encoder_flushing
=
1
;
...
@@ -2106,6 +2131,7 @@ int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
...
@@ -2106,6 +2131,7 @@ int ff_nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
return
res
;
return
res
;
nv_status
=
p_nvenc
->
nvEncEncodePicture
(
ctx
->
nvencoder
,
&
pic_params
);
nv_status
=
p_nvenc
->
nvEncEncodePicture
(
ctx
->
nvencoder
,
&
pic_params
);
av_free
(
sei_data
);
res
=
nvenc_pop_context
(
avctx
);
res
=
nvenc_pop_context
(
avctx
);
if
(
res
<
0
)
if
(
res
<
0
)
...
...
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