Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
a9a43356
Commit
a9a43356
authored
Jul 29, 2018
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/h264_mp4toannexb_bsf: use enum constants for the NAL unit type values
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
ec517ad9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
h264_mp4toannexb_bsf.c
libavcodec/h264_mp4toannexb_bsf.c
+8
-7
No files found.
libavcodec/h264_mp4toannexb_bsf.c
View file @
a9a43356
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "avcodec.h"
#include "avcodec.h"
#include "bsf.h"
#include "bsf.h"
#include "h264.h"
typedef
struct
H264BSFContext
{
typedef
struct
H264BSFContext
{
int32_t
sps_offset
;
int32_t
sps_offset
;
...
@@ -209,9 +210,9 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
...
@@ -209,9 +210,9 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
if
(
nal_size
>
buf_end
-
buf
||
nal_size
<
0
)
if
(
nal_size
>
buf_end
-
buf
||
nal_size
<
0
)
goto
fail
;
goto
fail
;
if
(
unit_type
==
7
)
if
(
unit_type
==
H264_NAL_SPS
)
s
->
idr_sps_seen
=
s
->
new_idr
=
1
;
s
->
idr_sps_seen
=
s
->
new_idr
=
1
;
else
if
(
unit_type
==
8
)
{
else
if
(
unit_type
==
H264_NAL_PPS
)
{
s
->
idr_pps_seen
=
s
->
new_idr
=
1
;
s
->
idr_pps_seen
=
s
->
new_idr
=
1
;
/* if SPS has not been seen yet, prepend the AVCC one to PPS */
/* if SPS has not been seen yet, prepend the AVCC one to PPS */
if
(
!
s
->
idr_sps_seen
)
{
if
(
!
s
->
idr_sps_seen
)
{
...
@@ -232,18 +233,18 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
...
@@ -232,18 +233,18 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
/* if this is a new IDR picture following an IDR picture, reset the idr flag.
/* if this is a new IDR picture following an IDR picture, reset the idr flag.
* Just check first_mb_in_slice to be 0 as this is the simplest solution.
* Just check first_mb_in_slice to be 0 as this is the simplest solution.
* This could be checking idr_pic_id instead, but would complexify the parsing. */
* This could be checking idr_pic_id instead, but would complexify the parsing. */
if
(
!
s
->
new_idr
&&
unit_type
==
5
&&
(
buf
[
1
]
&
0x80
))
if
(
!
s
->
new_idr
&&
unit_type
==
H264_NAL_IDR_SLICE
&&
(
buf
[
1
]
&
0x80
))
s
->
new_idr
=
1
;
s
->
new_idr
=
1
;
/* prepend only to the first type 5 NAL unit of an IDR picture, if no sps/pps are already present */
/* prepend only to the first type 5 NAL unit of an IDR picture, if no sps/pps are already present */
if
(
s
->
new_idr
&&
unit_type
==
5
&&
!
s
->
idr_sps_seen
&&
!
s
->
idr_pps_seen
)
{
if
(
s
->
new_idr
&&
unit_type
==
H264_NAL_IDR_SLICE
&&
!
s
->
idr_sps_seen
&&
!
s
->
idr_pps_seen
)
{
if
((
ret
=
alloc_and_copy
(
out
,
if
((
ret
=
alloc_and_copy
(
out
,
ctx
->
par_out
->
extradata
,
ctx
->
par_out
->
extradata_size
,
ctx
->
par_out
->
extradata
,
ctx
->
par_out
->
extradata_size
,
buf
,
nal_size
,
1
))
<
0
)
buf
,
nal_size
,
1
))
<
0
)
goto
fail
;
goto
fail
;
s
->
new_idr
=
0
;
s
->
new_idr
=
0
;
/* if only SPS has been seen, also insert PPS */
/* if only SPS has been seen, also insert PPS */
}
else
if
(
s
->
new_idr
&&
unit_type
==
5
&&
s
->
idr_sps_seen
&&
!
s
->
idr_pps_seen
)
{
}
else
if
(
s
->
new_idr
&&
unit_type
==
H264_NAL_IDR_SLICE
&&
s
->
idr_sps_seen
&&
!
s
->
idr_pps_seen
)
{
if
(
s
->
pps_offset
==
-
1
)
{
if
(
s
->
pps_offset
==
-
1
)
{
av_log
(
ctx
,
AV_LOG_WARNING
,
"PPS not present in the stream, nor in AVCC, stream may be unreadable
\n
"
);
av_log
(
ctx
,
AV_LOG_WARNING
,
"PPS not present in the stream, nor in AVCC, stream may be unreadable
\n
"
);
if
((
ret
=
alloc_and_copy
(
out
,
NULL
,
0
,
buf
,
nal_size
,
0
))
<
0
)
if
((
ret
=
alloc_and_copy
(
out
,
NULL
,
0
,
buf
,
nal_size
,
0
))
<
0
)
...
@@ -253,9 +254,9 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
...
@@ -253,9 +254,9 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
buf
,
nal_size
,
1
))
<
0
)
buf
,
nal_size
,
1
))
<
0
)
goto
fail
;
goto
fail
;
}
else
{
}
else
{
if
((
ret
=
alloc_and_copy
(
out
,
NULL
,
0
,
buf
,
nal_size
,
unit_type
==
7
||
unit_type
==
8
))
<
0
)
if
((
ret
=
alloc_and_copy
(
out
,
NULL
,
0
,
buf
,
nal_size
,
unit_type
==
H264_NAL_SPS
||
unit_type
==
H264_NAL_PPS
))
<
0
)
goto
fail
;
goto
fail
;
if
(
!
s
->
new_idr
&&
unit_type
==
1
)
{
if
(
!
s
->
new_idr
&&
unit_type
==
H264_NAL_SLICE
)
{
s
->
new_idr
=
1
;
s
->
new_idr
=
1
;
s
->
idr_sps_seen
=
0
;
s
->
idr_sps_seen
=
0
;
s
->
idr_pps_seen
=
0
;
s
->
idr_pps_seen
=
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