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
b667252a
Commit
b667252a
authored
Mar 21, 2016
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h2645_parse: add support for parsing h264
parent
52ec149f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
5 deletions
+39
-5
h2645_parse.c
libavcodec/h2645_parse.c
+22
-2
h2645_parse.h
libavcodec/h2645_parse.h
+14
-1
hevc.c
libavcodec/hevc.c
+1
-1
hevc_parser.c
libavcodec/hevc_parser.c
+2
-1
No files found.
libavcodec/h2645_parse.c
View file @
b667252a
...
...
@@ -154,9 +154,26 @@ static int hevc_parse_nal_header(H2645NAL *nal, void *logctx)
return
nuh_layer_id
==
0
;
}
static
int
h264_parse_nal_header
(
H2645NAL
*
nal
,
void
*
logctx
)
{
GetBitContext
*
gb
=
&
nal
->
gb
;
if
(
get_bits1
(
gb
)
!=
0
)
return
AVERROR_INVALIDDATA
;
nal
->
ref_idc
=
get_bits
(
gb
,
2
);
nal
->
type
=
get_bits
(
gb
,
5
);
av_log
(
logctx
,
AV_LOG_DEBUG
,
"nal_unit_type: %d, nal_ref_idc: %d
\n
"
,
nal
->
type
,
nal
->
ref_idc
);
return
1
;
}
int
ff_h2645_packet_split
(
H2645Packet
*
pkt
,
const
uint8_t
*
buf
,
int
length
,
void
*
logctx
,
int
is_nalff
,
int
nal_length_size
)
void
*
logctx
,
int
is_nalff
,
int
nal_length_size
,
enum
AVCodecID
codec_id
)
{
int
consumed
,
ret
=
0
;
...
...
@@ -211,7 +228,10 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
if
(
ret
<
0
)
return
ret
;
ret
=
hevc_parse_nal_header
(
nal
,
logctx
);
if
(
codec_id
==
AV_CODEC_ID_HEVC
)
ret
=
hevc_parse_nal_header
(
nal
,
logctx
);
else
ret
=
h264_parse_nal_header
(
nal
,
logctx
);
if
(
ret
<=
0
)
{
if
(
ret
<
0
)
{
av_log
(
logctx
,
AV_LOG_ERROR
,
"Invalid NAL unit %d, skipping.
\n
"
,
...
...
libavcodec/h2645_parse.h
View file @
b667252a
...
...
@@ -38,8 +38,20 @@ typedef struct H2645NAL {
GetBitContext
gb
;
/**
* NAL unit type
*/
int
type
;
/**
* HEVC only, nuh_temporal_id_plus_1 - 1
*/
int
temporal_id
;
/**
* H264 only, nal_ref_idc
*/
int
ref_idc
;
}
H2645NAL
;
/* an input packet split into unescaped NAL units */
...
...
@@ -59,7 +71,8 @@ int ff_h2645_extract_rbsp(const uint8_t *src, int length,
* Split an input packet into NAL units.
*/
int
ff_h2645_packet_split
(
H2645Packet
*
pkt
,
const
uint8_t
*
buf
,
int
length
,
void
*
logctx
,
int
is_nalff
,
int
nal_length_size
);
void
*
logctx
,
int
is_nalff
,
int
nal_length_size
,
enum
AVCodecID
codec_id
);
/**
* Free all the allocated memory in the packet.
...
...
libavcodec/hevc.c
View file @
b667252a
...
...
@@ -2582,7 +2582,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
/* split the input packet into NAL units, so we know the upper bound on the
* number of slices in the frame */
ret
=
ff_h2645_packet_split
(
&
s
->
pkt
,
buf
,
length
,
s
->
avctx
,
s
->
is_nalff
,
s
->
nal_length_size
);
s
->
nal_length_size
,
s
->
avctx
->
codec_id
);
if
(
ret
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Error splitting the input into NAL units.
\n
"
);
...
...
libavcodec/hevc_parser.c
View file @
b667252a
...
...
@@ -82,7 +82,8 @@ static int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf,
HEVCParserContext
*
ctx
=
s
->
priv_data
;
int
ret
,
i
;
ret
=
ff_h2645_packet_split
(
&
ctx
->
pkt
,
buf
,
buf_size
,
avctx
,
0
,
0
);
ret
=
ff_h2645_packet_split
(
&
ctx
->
pkt
,
buf
,
buf_size
,
avctx
,
0
,
0
,
AV_CODEC_ID_HEVC
);
if
(
ret
<
0
)
return
ret
;
...
...
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