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
10da9ee7
Commit
10da9ee7
authored
Aug 02, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/mad: refactor local variables in FillBuffer()
parent
f9eff312
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+14
-9
No files found.
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
10da9ee7
...
...
@@ -223,26 +223,31 @@ MadDecoder::Seek(long offset)
inline
bool
MadDecoder
::
FillBuffer
()
{
size_t
remaining
=
0
,
length
=
sizeof
(
input_buffer
);
/* amount of rest data still residing in the buffer */
size_t
rest_size
=
0
;
size_t
max_read_size
=
sizeof
(
input_buffer
);
unsigned
char
*
dest
=
input_buffer
;
if
(
stream
.
next_frame
!=
nullptr
)
{
re
maining
=
stream
.
bufend
-
stream
.
next_frame
;
memmove
(
input_buffer
,
stream
.
next_frame
,
re
maining
);
dest
+=
re
maining
;
length
-=
remaining
;
re
st_size
=
stream
.
bufend
-
stream
.
next_frame
;
memmove
(
input_buffer
,
stream
.
next_frame
,
re
st_size
);
dest
+=
re
st_size
;
max_read_size
-=
rest_size
;
}
/* we've exhausted the read buffer, so give up!, these potential
* mp3 frames are way too big, and thus unlikely to be mp3 frames */
if
(
length
==
0
)
if
(
max_read_size
==
0
)
return
false
;
length
=
decoder_read
(
client
,
input_stream
,
dest
,
length
);
if
(
length
==
0
)
size_t
nbytes
=
decoder_read
(
client
,
input_stream
,
dest
,
max_read_size
);
if
(
nbytes
==
0
)
{
return
false
;
}
mad_stream_buffer
(
&
stream
,
input_buffer
,
length
+
remaining
);
mad_stream_buffer
(
&
stream
,
input_buffer
,
rest_size
+
nbytes
);
stream
.
error
=
MAD_ERROR_NONE
;
return
true
;
...
...
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