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
502dacdc
Commit
502dacdc
authored
Apr 22, 2020
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/h264_metadata: filter parameter sets in packet side data
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
3921eed3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
h264_metadata_bsf.c
libavcodec/h264_metadata_bsf.c
+47
-0
No files found.
libavcodec/h264_metadata_bsf.c
View file @
502dacdc
...
...
@@ -275,6 +275,49 @@ static int h264_metadata_update_sps(AVBSFContext *bsf,
return
0
;
}
static
int
h264_metadata_update_side_data
(
AVBSFContext
*
bsf
,
AVPacket
*
pkt
)
{
H264MetadataContext
*
ctx
=
bsf
->
priv_data
;
CodedBitstreamFragment
*
au
=
&
ctx
->
access_unit
;
uint8_t
*
side_data
;
int
side_data_size
;
int
err
,
i
;
side_data
=
av_packet_get_side_data
(
pkt
,
AV_PKT_DATA_NEW_EXTRADATA
,
&
side_data_size
);
if
(
!
side_data_size
)
return
0
;
err
=
ff_cbs_read
(
ctx
->
cbc
,
au
,
side_data
,
side_data_size
);
if
(
err
<
0
)
{
av_log
(
bsf
,
AV_LOG_ERROR
,
"Failed to read extradata from packet side data.
\n
"
);
return
err
;
}
for
(
i
=
0
;
i
<
au
->
nb_units
;
i
++
)
{
if
(
au
->
units
[
i
].
type
==
H264_NAL_SPS
)
{
err
=
h264_metadata_update_sps
(
bsf
,
au
->
units
[
i
].
content
);
if
(
err
<
0
)
return
err
;
}
}
err
=
ff_cbs_write_fragment_data
(
ctx
->
cbc
,
au
);
if
(
err
<
0
)
{
av_log
(
bsf
,
AV_LOG_ERROR
,
"Failed to write extradata into packet side data.
\n
"
);
return
err
;
}
side_data
=
av_packet_new_side_data
(
pkt
,
AV_PKT_DATA_NEW_EXTRADATA
,
au
->
data_size
);
if
(
!
side_data
)
return
AVERROR
(
ENOMEM
);
memcpy
(
side_data
,
au
->
data
,
au
->
data_size
);
ff_cbs_fragment_reset
(
ctx
->
cbc
,
au
);
return
0
;
}
static
int
h264_metadata_filter
(
AVBSFContext
*
bsf
,
AVPacket
*
pkt
)
{
H264MetadataContext
*
ctx
=
bsf
->
priv_data
;
...
...
@@ -286,6 +329,10 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
if
(
err
<
0
)
return
err
;
err
=
h264_metadata_update_side_data
(
bsf
,
pkt
);
if
(
err
<
0
)
goto
fail
;
err
=
ff_cbs_read_packet
(
ctx
->
cbc
,
au
,
pkt
);
if
(
err
<
0
)
{
av_log
(
bsf
,
AV_LOG_ERROR
,
"Failed to read packet.
\n
"
);
...
...
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