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
ad91bf85
Commit
ad91bf85
authored
Jul 26, 2014
by
Chris \"Koying\" Browet
Committed by
Michael Niedermayer
Jul 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/h264_mp4toannexb_bsf: fix issue when sps/pps are already in the bistream
parent
e97f5bef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
h264_mp4toannexb_bsf.c
libavcodec/h264_mp4toannexb_bsf.c
+11
-3
No files found.
libavcodec/h264_mp4toannexb_bsf.c
View file @
ad91bf85
...
...
@@ -28,6 +28,7 @@
typedef
struct
H264BSFContext
{
uint8_t
length_size
;
uint8_t
first_idr
;
uint8_t
idr_sps_pps_seen
;
int
extradata_parsed
;
}
H264BSFContext
;
...
...
@@ -155,6 +156,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
return
ret
;
ctx
->
length_size
=
ret
;
ctx
->
first_idr
=
1
;
ctx
->
idr_sps_pps_seen
=
0
;
ctx
->
extradata_parsed
=
1
;
}
...
...
@@ -174,8 +176,12 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
if
(
buf
+
nal_size
>
buf_end
||
nal_size
<
0
)
goto
fail
;
/* prepend only to the first type 5 NAL unit of an IDR picture */
if
(
ctx
->
first_idr
&&
(
unit_type
==
5
||
unit_type
==
7
||
unit_type
==
8
))
{
if
(
ctx
->
first_idr
&&
(
unit_type
==
7
||
unit_type
==
8
))
ctx
->
idr_sps_pps_seen
=
1
;
/* prepend only to the first type 5 NAL unit of an IDR picture, if no sps/pps are already present */
if
(
ctx
->
first_idr
&&
unit_type
==
5
&&
!
ctx
->
idr_sps_pps_seen
)
{
if
((
ret
=
alloc_and_copy
(
poutbuf
,
poutbuf_size
,
avctx
->
extradata
,
avctx
->
extradata_size
,
buf
,
nal_size
))
<
0
)
...
...
@@ -185,8 +191,10 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
if
((
ret
=
alloc_and_copy
(
poutbuf
,
poutbuf_size
,
NULL
,
0
,
buf
,
nal_size
))
<
0
)
goto
fail
;
if
(
!
ctx
->
first_idr
&&
unit_type
==
1
)
if
(
!
ctx
->
first_idr
&&
unit_type
==
1
)
{
ctx
->
first_idr
=
1
;
ctx
->
idr_sps_pps_seen
=
0
;
}
}
buf
+=
nal_size
;
...
...
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