Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
eac9fabd
Commit
eac9fabd
authored
Jan 06, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DecoderBuffer: add method _clear()
parent
e2a08fa8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
DecoderBuffer.cxx
src/DecoderBuffer.cxx
+6
-0
DecoderBuffer.hxx
src/DecoderBuffer.hxx
+3
-0
FaadDecoderPlugin.cxx
src/decoder/FaadDecoderPlugin.cxx
+3
-8
No files found.
src/DecoderBuffer.cxx
View file @
eac9fabd
...
...
@@ -82,6 +82,12 @@ decoder_buffer_is_full(const DecoderBuffer *buffer)
return
buffer
->
consumed
==
0
&&
buffer
->
length
==
buffer
->
size
;
}
void
decoder_buffer_clear
(
DecoderBuffer
*
buffer
)
{
buffer
->
length
=
buffer
->
consumed
=
0
;
}
static
void
decoder_buffer_shift
(
DecoderBuffer
*
buffer
)
{
...
...
src/DecoderBuffer.hxx
View file @
eac9fabd
...
...
@@ -56,6 +56,9 @@ decoder_buffer_is_empty(const DecoderBuffer *buffer);
bool
decoder_buffer_is_full
(
const
DecoderBuffer
*
buffer
);
void
decoder_buffer_clear
(
DecoderBuffer
*
buffer
);
/**
* Read data from the input_stream and append it to the buffer.
*
...
...
src/decoder/FaadDecoderPlugin.cxx
View file @
eac9fabd
...
...
@@ -84,7 +84,7 @@ adts_find_frame(DecoderBuffer *buffer)
const
uint8_t
*
p
=
(
const
uint8_t
*
)
memchr
(
data
,
0xff
,
length
);
if
(
p
==
nullptr
)
{
/* no marker - discard the buffer */
decoder_buffer_c
onsume
(
buffer
,
length
);
decoder_buffer_c
lear
(
buffer
);
continue
;
}
...
...
@@ -111,10 +111,7 @@ adts_find_frame(DecoderBuffer *buffer)
/* not enough data; discard this frame
to prevent a possible buffer
overflow */
data
=
(
const
uint8_t
*
)
decoder_buffer_read
(
buffer
,
&
length
);
if
(
data
!=
nullptr
)
decoder_buffer_consume
(
buffer
,
length
);
decoder_buffer_clear
(
buffer
);
}
continue
;
...
...
@@ -196,9 +193,7 @@ faad_song_duration(DecoderBuffer *buffer, InputStream &is)
is
.
LockSeek
(
tagsize
,
SEEK_SET
,
IgnoreError
());
data
=
(
const
uint8_t
*
)
decoder_buffer_read
(
buffer
,
&
length
);
if
(
data
!=
nullptr
)
decoder_buffer_consume
(
buffer
,
length
);
decoder_buffer_clear
(
buffer
);
decoder_buffer_fill
(
buffer
);
return
song_length
;
...
...
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