Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
b9d7a754
Commit
b9d7a754
authored
Jan 15, 2016
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packetizer: hevc: add NALType and hvcC nal length helpers
parent
bc2c083d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
6 deletions
+16
-6
modules/demux/mpeg/h26x.c
modules/demux/mpeg/h26x.c
+1
-1
modules/mux/mp4/libmp4mux.c
modules/mux/mp4/libmp4mux.c
+1
-1
modules/packetizer/hevc.c
modules/packetizer/hevc.c
+1
-1
modules/packetizer/hevc_nal.c
modules/packetizer/hevc_nal.c
+3
-3
modules/packetizer/hevc_nal.h
modules/packetizer/hevc_nal.h
+10
-0
No files found.
modules/demux/mpeg/h26x.c
View file @
b9d7a754
...
@@ -117,7 +117,7 @@ static int ProbeHEVC( const uint8_t *p_peek, size_t i_peek, void *p_priv )
...
@@ -117,7 +117,7 @@ static int ProbeHEVC( const uint8_t *p_peek, size_t i_peek, void *p_priv )
if
(
p_peek
[
0
]
&
0x80
)
if
(
p_peek
[
0
]
&
0x80
)
return
-
1
;
return
-
1
;
const
uint8_t
i_type
=
(
p_peek
[
0
]
&
0x7E
)
>>
1
;
const
uint8_t
i_type
=
hevc_getNALType
(
p_peek
)
;
const
uint8_t
i_layer
=
hevc_getNALLayer
(
p_peek
);
const
uint8_t
i_layer
=
hevc_getNALLayer
(
p_peek
);
if
(
i_type
==
HEVC_NAL_VPS
)
/* VPS */
if
(
i_type
==
HEVC_NAL_VPS
)
/* VPS */
...
...
modules/mux/mp4/libmp4mux.c
View file @
b9d7a754
...
@@ -620,7 +620,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt, bool b_completeness)
...
@@ -620,7 +620,7 @@ static bo_t *GetHvcCTag(es_format_t *p_fmt, bool b_completeness)
if
(
p_nal
)
if
(
p_nal
)
p_nal
->
i_buffer
=
p_buffer
-
p_nal
->
p_buffer
-
((
i_buffer
)
?
3
:
0
);
p_nal
->
i_buffer
=
p_buffer
-
p_nal
->
p_buffer
-
((
i_buffer
)
?
3
:
0
);
switch
(
(
*
p_buffer
&
0x7E
)
>>
1
)
{
switch
(
hevc_getNALType
(
p_buffer
)
)
{
case
HEVC_NAL_VPS
:
case
HEVC_NAL_VPS
:
if
(
i_vps
==
HEVC_VPS_MAX
)
if
(
i_vps
==
HEVC_VPS_MAX
)
...
...
modules/packetizer/hevc.c
View file @
b9d7a754
...
@@ -421,7 +421,7 @@ static block_t *ParseNALBlock(decoder_t *p_dec, bool *pb_ts_used, block_t *p_fra
...
@@ -421,7 +421,7 @@ static block_t *ParseNALBlock(decoder_t *p_dec, bool *pb_ts_used, block_t *p_fra
}
}
/* Get NALU type */
/* Get NALU type */
uint8_t
i_nal_type
=
((
p_frag
->
p_buffer
[
4
]
&
0x7E
)
>>
1
);
uint8_t
i_nal_type
=
hevc_getNALType
(
&
p_frag
->
p_buffer
[
4
]
);
if
(
i_nal_type
<
HEVC_NAL_VPS
)
if
(
i_nal_type
<
HEVC_NAL_VPS
)
{
{
/* NAL is a VCL NAL */
/* NAL is a VCL NAL */
...
...
modules/packetizer/hevc_nal.c
View file @
b9d7a754
...
@@ -364,7 +364,7 @@ uint8_t * hevc_hvcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
...
@@ -364,7 +364,7 @@ uint8_t * hevc_hvcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
return
NULL
;
return
NULL
;
if
(
pi_nal_length_size
)
if
(
pi_nal_length_size
)
*
pi_nal_length_size
=
(
p_buf
[
21
]
&
0x03
)
+
1
;
*
pi_nal_length_size
=
hevc_getNALLengthSize
(
p_buf
)
;
uint8_t
*
p_ret
;
uint8_t
*
p_ret
;
uint8_t
*
p_out_buf
=
p_ret
=
malloc
(
*
pi_result
);
uint8_t
*
p_out_buf
=
p_ret
=
malloc
(
*
pi_result
);
...
@@ -504,7 +504,7 @@ bool hevc_get_xps_id(const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id)
...
@@ -504,7 +504,7 @@ bool hevc_get_xps_id(const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id)
if
(
unlikely
(
!
hxxx_strip_AnnexB_startcode
(
&
p_buf
,
&
i_buf
)
||
i_buf
<
3
))
if
(
unlikely
(
!
hxxx_strip_AnnexB_startcode
(
&
p_buf
,
&
i_buf
)
||
i_buf
<
3
))
return
false
;
return
false
;
/* No need to lookup convert from emulation for that data */
/* No need to lookup convert from emulation for that data */
uint8_t
i_nal_type
=
((
p_buf
[
0
]
&
0x7E
)
>>
1
);
uint8_t
i_nal_type
=
hevc_getNALType
(
p_buf
);
bs_t
bs
;
bs_t
bs
;
bs_init
(
&
bs
,
&
p_buf
[
2
],
i_buf
-
2
);
bs_init
(
&
bs
,
&
p_buf
[
2
],
i_buf
-
2
);
if
(
i_nal_type
==
HEVC_NAL_PPS
)
if
(
i_nal_type
==
HEVC_NAL_PPS
)
...
@@ -1114,7 +1114,7 @@ hevc_slice_segment_header_t * hevc_decode_slice_header( const uint8_t *p_buf, si
...
@@ -1114,7 +1114,7 @@ hevc_slice_segment_header_t * hevc_decode_slice_header( const uint8_t *p_buf, si
hevc_slice_segment_header_t
*
p_sh
=
calloc
(
1
,
sizeof
(
hevc_slice_segment_header_t
));
hevc_slice_segment_header_t
*
p_sh
=
calloc
(
1
,
sizeof
(
hevc_slice_segment_header_t
));
if
(
likely
(
p_sh
))
if
(
likely
(
p_sh
))
{
{
uint8_t
i_nal_type
=
((
p_buf
[
0
]
&
0x7E
)
>>
1
);
uint8_t
i_nal_type
=
hevc_getNALType
(
p_buf
);
bs_t
bs
;
bs_t
bs
;
bs_init
(
&
bs
,
p_buf
,
i_buf
);
bs_init
(
&
bs
,
p_buf
,
i_buf
);
unsigned
i_bitflow
=
0
;
unsigned
i_bitflow
=
0
;
...
...
modules/packetizer/hevc_nal.h
View file @
b9d7a754
...
@@ -135,6 +135,16 @@ static inline bool hevc_ishvcC( const uint8_t *p_buf, size_t i_buf )
...
@@ -135,6 +135,16 @@ static inline bool hevc_ishvcC( const uint8_t *p_buf, size_t i_buf )
);
);
}
}
static
inline
uint8_t
hevc_getNALLengthSize
(
const
uint8_t
*
p_hvcC
)
{
return
(
p_hvcC
[
21
]
&
0x03
)
+
1
;
}
static
inline
uint8_t
hevc_getNALType
(
const
uint8_t
*
p_buf
)
{
return
((
p_buf
[
0
]
&
0x7E
)
>>
1
);
}
static
inline
uint8_t
hevc_getNALLayer
(
const
uint8_t
*
p_buf
)
static
inline
uint8_t
hevc_getNALLayer
(
const
uint8_t
*
p_buf
)
{
{
return
((
p_buf
[
0
]
&
0x01
)
<<
6
)
|
(
p_buf
[
1
]
>>
3
);
return
((
p_buf
[
0
]
&
0x01
)
<<
6
)
|
(
p_buf
[
1
]
>>
3
);
...
...
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