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
820a4483
Commit
820a4483
authored
May 07, 2017
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vaapi_h264: Add support for AUD NAL units
Adds a new private option to enable them (off by default).
parent
7a4fac5e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
vaapi_encode_h264.c
libavcodec/vaapi_encode_h264.c
+33
-0
No files found.
libavcodec/vaapi_encode_h264.c
View file @
820a4483
...
...
@@ -53,6 +53,7 @@ typedef struct VAAPIEncodeH264Context {
int
fixed_qp_p
;
int
fixed_qp_b
;
H264RawAUD
aud
;
H264RawSPS
sps
;
H264RawPPS
pps
;
H264RawSEI
sei
;
...
...
@@ -77,6 +78,7 @@ typedef struct VAAPIEncodeH264Context {
CodedBitstreamContext
cbc
;
CodedBitstreamFragment
current_access_unit
;
int
aud_needed
;
int
sei_needed
;
}
VAAPIEncodeH264Context
;
...
...
@@ -84,6 +86,7 @@ typedef struct VAAPIEncodeH264Options {
int
qp
;
int
quality
;
int
low_power
;
int
aud
;
int
sei
;
}
VAAPIEncodeH264Options
;
...
...
@@ -143,6 +146,13 @@ static int vaapi_encode_h264_write_sequence_header(AVCodecContext *avctx,
CodedBitstreamFragment
*
au
=
&
priv
->
current_access_unit
;
int
err
;
if
(
priv
->
aud_needed
)
{
err
=
vaapi_encode_h264_add_nal
(
avctx
,
au
,
&
priv
->
aud
);
if
(
err
<
0
)
goto
fail
;
priv
->
aud_needed
=
0
;
}
err
=
vaapi_encode_h264_add_nal
(
avctx
,
au
,
&
priv
->
sps
);
if
(
err
<
0
)
goto
fail
;
...
...
@@ -167,6 +177,13 @@ static int vaapi_encode_h264_write_slice_header(AVCodecContext *avctx,
CodedBitstreamFragment
*
au
=
&
priv
->
current_access_unit
;
int
err
;
if
(
priv
->
aud_needed
)
{
err
=
vaapi_encode_h264_add_nal
(
avctx
,
au
,
&
priv
->
aud
);
if
(
err
<
0
)
goto
fail
;
priv
->
aud_needed
=
0
;
}
err
=
vaapi_encode_h264_add_nal
(
avctx
,
au
,
&
priv
->
slice
);
if
(
err
<
0
)
goto
fail
;
...
...
@@ -189,6 +206,11 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
int
err
,
i
;
if
(
priv
->
sei_needed
)
{
if
(
priv
->
aud_needed
)
{
vaapi_encode_h264_add_nal
(
avctx
,
au
,
&
priv
->
aud
);
priv
->
aud_needed
=
0
;
}
memset
(
&
priv
->
sei
,
0
,
sizeof
(
priv
->
sei
));
priv
->
sei
.
nal_unit_header
.
nal_unit_type
=
H264_NAL_SEI
;
...
...
@@ -569,6 +591,14 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
priv
->
pic_order_cnt
=
pic
->
display_order
-
priv
->
last_idr_frame
;
priv
->
dpb_delay
=
pic
->
display_order
-
pic
->
encode_order
+
1
;
if
(
opt
->
aud
)
{
priv
->
aud_needed
=
1
;
priv
->
aud
.
nal_unit_header
.
nal_unit_type
=
H264_NAL_AUD
;
priv
->
aud
.
primary_pic_type
=
priv
->
primary_pic_type
;
}
else
{
priv
->
aud_needed
=
0
;
}
if
(
opt
->
sei
&
SEI_IDENTIFIER
&&
pic
->
encode_order
==
0
)
priv
->
sei_needed
=
1
;
...
...
@@ -915,6 +945,9 @@ static const AVOption vaapi_encode_h264_options[] = {
"on some platforms, does not support all features)"
,
OFFSET
(
low_power
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
1
,
FLAGS
},
{
"aud"
,
"Include AUD"
,
OFFSET
(
aud
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
1
,
FLAGS
},
{
"sei"
,
"Set SEI to include"
,
OFFSET
(
sei
),
AV_OPT_TYPE_FLAGS
,
{
.
i64
=
SEI_IDENTIFIER
|
SEI_TIMING
},
...
...
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