Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
0661d2e7
Commit
0661d2e7
authored
Dec 19, 2000
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GetChunk() : reads n bytes from the elementary stream and places them
in a big buffer (a gift for Sam).
parent
deff6eb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
include/input_ext-dec.h
include/input_ext-dec.h
+45
-0
No files found.
include/input_ext-dec.h
View file @
0661d2e7
...
@@ -361,6 +361,51 @@ static __inline__ void RealignBits( bit_stream_t * p_bit_stream )
...
@@ -361,6 +361,51 @@ static __inline__ void RealignBits( bit_stream_t * p_bit_stream )
}
}
/*
* Philosophy of the third implementation : the decoder asks for n bytes,
* and we will copy them in its buffer.
*/
/*****************************************************************************
* GetChunk : reads a large chunk of data
*****************************************************************************
* The position in the stream must be byte-aligned, if unsure call
* RealignBits(). p_buffer must to a buffer at least as big as i_buf_len
* otherwise your code will crash.
*****************************************************************************/
static
__inline__
void
GetChunk
(
bit_stream_t
*
p_bit_stream
,
byte_t
*
p_buffer
,
size_t
i_buf_len
)
{
int
i_available
;
if
(
(
i_available
=
p_bit_stream
->
p_end
-
p_bit_stream
->
p_byte
)
>=
i_buf_len
)
{
memcpy
(
p_buffer
,
p_bit_stream
->
p_byte
,
i_buf_len
);
p_bit_stream
->
p_byte
+=
i_buf_len
;
}
else
{
do
{
memcpy
(
p_buffer
,
p_bit_stream
->
p_byte
,
i_available
);
p_bit_stream
->
p_byte
=
p_bit_stream
->
p_end
;
p_buffer
+=
i_available
;
i_buf_len
-=
i_available
;
p_bit_stream
->
pf_next_data_packet
(
p_bit_stream
);
}
while
(
(
i_available
=
p_bit_stream
->
p_end
-
p_bit_stream
->
p_byte
)
<=
i_buf_len
);
if
(
i_buf_len
)
{
memcpy
(
p_buffer
,
p_bit_stream
->
p_byte
,
i_buf_len
);
p_bit_stream
->
p_byte
+=
i_buf_len
;
}
}
}
/*
/*
* Communication interface between input and decoders
* Communication interface between input and decoders
*/
*/
...
...
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