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
b6d53048
Commit
b6d53048
authored
Dec 11, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packetize: move annexb stripping to common helpers
parent
933a5159
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
23 deletions
+25
-23
modules/packetizer/h264_nal.c
modules/packetizer/h264_nal.c
+2
-23
modules/packetizer/hxxx_nal.h
modules/packetizer/hxxx_nal.h
+23
-0
No files found.
modules/packetizer/h264_nal.c
View file @
b6d53048
...
...
@@ -39,27 +39,6 @@ bool h264_isavcC( const uint8_t *p_buf, size_t i_buf )
(
p_buf
[
5
]
&
0xE0
)
==
0xE0
);
}
static
inline
bool
strip_AnnexB_startcode
(
const
uint8_t
**
pp_data
,
size_t
*
pi_data
)
{
const
uint8_t
*
p_data
=
*
pp_data
;
if
(
*
pi_data
<
4
)
{
return
false
;
}
else
if
(
p_data
[
0
]
==
!!
memcmp
(
&
p_data
[
1
],
annexb_startcode3
,
3
)
)
{
*
pp_data
+=
4
;
*
pi_data
-=
4
;
}
else
if
(
!
memcmp
(
p_data
,
annexb_startcode4
,
3
)
)
{
*
pp_data
+=
3
;
*
pi_data
-=
3
;
}
else
return
false
;
return
true
;
}
static
size_t
get_avcC_to_AnnexB_NAL_size
(
const
uint8_t
*
p_buf
,
size_t
i_buf
)
{
size_t
i_total
=
0
;
...
...
@@ -715,8 +694,8 @@ block_t *h264_AnnexB_NAL_to_avcC( uint8_t i_nal_length_size,
if
(
i_pps_size
>
UINT16_MAX
||
i_sps_size
>
UINT16_MAX
)
return
NULL
;
if
(
!
strip_AnnexB_startcode
(
&
p_sps_buf
,
&
i_sps_size
)
||
!
strip_AnnexB_startcode
(
&
p_pps_buf
,
&
i_pps_size
)
)
if
(
!
hxxx_
strip_AnnexB_startcode
(
&
p_sps_buf
,
&
i_sps_size
)
||
!
hxxx_
strip_AnnexB_startcode
(
&
p_pps_buf
,
&
i_pps_size
)
)
return
NULL
;
/* The length of the NAL size is encoded using 1, 2 or 4 bytes */
...
...
modules/packetizer/hxxx_nal.h
View file @
b6d53048
...
...
@@ -29,6 +29,29 @@
static
const
uint8_t
annexb_startcode4
[]
=
{
0x00
,
0x00
,
0x00
,
0x01
};
#define annexb_startcode3 (&annexb_startcode4[1])
static
inline
bool
hxxx_strip_AnnexB_startcode
(
const
uint8_t
**
pp_data
,
size_t
*
pi_data
)
{
const
uint8_t
*
p_data
=
*
pp_data
;
if
(
*
pi_data
<
4
||
p_data
[
0
])
return
false
;
/* Skip 4 bytes startcode */
if
(
!
memcmp
(
&
p_data
[
1
],
&
annexb_startcode4
[
1
],
3
)
)
{
*
pp_data
+=
4
;
*
pi_data
-=
4
;
}
/* Skip 3 bytes startcode */
else
if
(
!
memcmp
(
&
p_data
[
1
],
&
annexb_startcode4
[
2
],
2
)
)
{
*
pp_data
+=
3
;
*
pi_data
-=
3
;
}
else
return
false
;
return
true
;
}
/* Discards emulation prevention three bytes */
static
inline
uint8_t
*
hxxx_ep3b_to_rbsp
(
const
uint8_t
*
p_src
,
size_t
i_src
,
size_t
*
pi_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