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
c064a7f7
Commit
c064a7f7
authored
Jan 05, 2016
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
block_helper: add startcode helper callback
parent
000d5d3f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
include/vlc_block_helper.h
include/vlc_block_helper.h
+19
-1
modules/packetizer/dirac.c
modules/packetizer/dirac.c
+1
-1
modules/packetizer/packetizer_helper.h
modules/packetizer/packetizer_helper.h
+2
-2
No files found.
include/vlc_block_helper.h
View file @
c064a7f7
...
...
@@ -438,9 +438,12 @@ static inline int block_PeekOffsetBytes( block_bytestream_t *p_bytestream,
return
VLC_SUCCESS
;
}
typedef
const
uint8_t
*
(
*
block_startcode_helper_t
)(
const
uint8_t
*
,
const
uint8_t
*
);
static
inline
int
block_FindStartcodeFromOffset
(
block_bytestream_t
*
p_bytestream
,
size_t
*
pi_offset
,
const
uint8_t
*
p_startcode
,
int
i_startcode_length
)
const
uint8_t
*
p_startcode
,
int
i_startcode_length
,
block_startcode_helper_t
p_startcode_helper
)
{
block_t
*
p_block
,
*
p_block_backup
=
0
;
int
i_size
=
0
;
...
...
@@ -472,6 +475,21 @@ static inline int block_FindStartcodeFromOffset(
{
for
(
i_offset
=
i_size
;
i_offset
<
p_block
->
i_buffer
;
i_offset
++
)
{
/* Use optimized helper when possible */
if
(
p_startcode_helper
&&
!
i_match
&&
(
p_block
->
i_buffer
-
i_offset
)
>
((
size_t
)
i_startcode_length
-
1
)
)
{
const
uint8_t
*
p_res
=
p_startcode_helper
(
&
p_block
->
p_buffer
[
i_offset
],
&
p_block
->
p_buffer
[
p_block
->
i_buffer
]
);
if
(
p_res
)
{
*
pi_offset
+=
i_offset
+
(
p_res
-
&
p_block
->
p_buffer
[
i_offset
]);
return
VLC_SUCCESS
;
}
/* Then parsing boundary with legacy code */
i_offset
=
p_block
->
i_buffer
-
(
i_startcode_length
-
1
);
}
if
(
p_block
->
p_buffer
[
i_offset
]
==
p_startcode
[
i_match
]
)
{
if
(
!
i_match
)
...
...
modules/packetizer/dirac.c
View file @
c064a7f7
...
...
@@ -677,7 +677,7 @@ static block_t *dirac_DoSync( decoder_t *p_dec )
case
NOT_SYNCED
:
{
if
(
VLC_SUCCESS
!=
block_FindStartcodeFromOffset
(
&
p_sys
->
bytestream
,
&
p_sys
->
i_offset
,
p_parsecode
,
4
)
)
block_FindStartcodeFromOffset
(
&
p_sys
->
bytestream
,
&
p_sys
->
i_offset
,
p_parsecode
,
4
,
NULL
)
)
{
/* p_sys->i_offset will have been set to:
* end of bytestream - amount of prefix found
...
...
modules/packetizer/packetizer_helper.h
View file @
c064a7f7
...
...
@@ -132,7 +132,7 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
case
STATE_NOSYNC
:
/* Find a startcode */
if
(
!
block_FindStartcodeFromOffset
(
&
p_pack
->
bytestream
,
&
p_pack
->
i_offset
,
p_pack
->
p_startcode
,
p_pack
->
i_startcode
)
)
p_pack
->
p_startcode
,
p_pack
->
i_startcode
,
NULL
)
)
p_pack
->
i_state
=
STATE_NEXT_SYNC
;
if
(
p_pack
->
i_offset
)
...
...
@@ -150,7 +150,7 @@ static inline block_t *packetizer_Packetize( packetizer_t *p_pack, block_t **pp_
case
STATE_NEXT_SYNC
:
/* Find the next startcode */
if
(
block_FindStartcodeFromOffset
(
&
p_pack
->
bytestream
,
&
p_pack
->
i_offset
,
p_pack
->
p_startcode
,
p_pack
->
i_startcode
)
)
p_pack
->
p_startcode
,
p_pack
->
i_startcode
,
NULL
)
)
{
if
(
!
p_pack
->
b_flushing
||
!
p_pack
->
bytestream
.
p_chain
)
return
NULL
;
/* Need more data */
...
...
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