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
f10ea03d
Commit
f10ea03d
authored
Aug 19, 2016
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/h264_parser: Factor get_avc_nalsize() out
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
b8b36717
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
21 deletions
+21
-21
h2645_parse.h
libavcodec/h2645_parse.h
+20
-0
h264_parser.c
libavcodec/h264_parser.c
+1
-21
No files found.
libavcodec/h2645_parse.h
View file @
f10ea03d
...
@@ -90,4 +90,24 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
...
@@ -90,4 +90,24 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
*/
*/
void
ff_h2645_packet_uninit
(
H2645Packet
*
pkt
);
void
ff_h2645_packet_uninit
(
H2645Packet
*
pkt
);
static
inline
int
get_nalsize
(
int
nal_length_size
,
const
uint8_t
*
buf
,
int
buf_size
,
int
*
buf_index
,
void
*
logctx
)
{
int
i
,
nalsize
=
0
;
if
(
*
buf_index
>=
buf_size
-
nal_length_size
)
{
// the end of the buffer is reached, refill it
return
AVERROR
(
EAGAIN
);
}
for
(
i
=
0
;
i
<
nal_length_size
;
i
++
)
nalsize
=
((
unsigned
)
nalsize
<<
8
)
|
buf
[(
*
buf_index
)
++
];
if
(
nalsize
<=
0
||
nalsize
>
buf_size
-
*
buf_index
)
{
av_log
(
logctx
,
AV_LOG_ERROR
,
"Invalid nal size %d
\n
"
,
nalsize
);
return
AVERROR_INVALIDDATA
;
}
return
nalsize
;
}
#endif
/* AVCODEC_H2645_PARSE_H */
#endif
/* AVCODEC_H2645_PARSE_H */
libavcodec/h264_parser.c
View file @
f10ea03d
...
@@ -228,26 +228,6 @@ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
...
@@ -228,26 +228,6 @@ static int scan_mmco_reset(AVCodecParserContext *s, GetBitContext *gb,
return
0
;
return
0
;
}
}
static
inline
int
get_avc_nalsize
(
H264ParseContext
*
p
,
const
uint8_t
*
buf
,
int
buf_size
,
int
*
buf_index
,
void
*
logctx
)
{
int
i
,
nalsize
=
0
;
if
(
*
buf_index
>=
buf_size
-
p
->
nal_length_size
)
{
// the end of the buffer is reached, refill it
return
AVERROR
(
EAGAIN
);
}
for
(
i
=
0
;
i
<
p
->
nal_length_size
;
i
++
)
nalsize
=
((
unsigned
)
nalsize
<<
8
)
|
buf
[(
*
buf_index
)
++
];
if
(
nalsize
<=
0
||
nalsize
>
buf_size
-
*
buf_index
)
{
av_log
(
logctx
,
AV_LOG_ERROR
,
"AVC: nal size %d
\n
"
,
nalsize
);
return
AVERROR_INVALIDDATA
;
}
return
nalsize
;
}
/**
/**
* Parse NAL units of found picture and decode some basic information.
* Parse NAL units of found picture and decode some basic information.
*
*
...
@@ -288,7 +268,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
...
@@ -288,7 +268,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
int
src_length
,
consumed
,
nalsize
=
0
;
int
src_length
,
consumed
,
nalsize
=
0
;
if
(
buf_index
>=
next_avc
)
{
if
(
buf_index
>=
next_avc
)
{
nalsize
=
get_
avc_nalsize
(
p
,
buf
,
buf_size
,
&
buf_index
,
avctx
);
nalsize
=
get_
nalsize
(
p
->
nal_length_size
,
buf
,
buf_size
,
&
buf_index
,
avctx
);
if
(
nalsize
<
0
)
if
(
nalsize
<
0
)
break
;
break
;
next_avc
=
buf_index
+
nalsize
;
next_avc
=
buf_index
+
nalsize
;
...
...
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