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
69b5929c
Commit
69b5929c
authored
Aug 26, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/mad: use integer seek times
Avoid roundtrips to floating point.
parent
316c72a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+9
-10
No files found.
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
69b5929c
...
...
@@ -116,8 +116,8 @@ struct MadDecoder {
unsigned
char
input_buffer
[
READ_BUFFER_SIZE
];
int32_t
output_buffer
[
MP3_DATA_OUTPUT_BUFFER_SIZE
];
float
total_time
;
float
elapsed_time
;
float
seek_where
;
unsigned
elapsed_time
;
unsigned
seek_where
;
enum
muteframe
mute_frame
;
long
*
frame_offsets
;
mad_timer_t
*
times
;
...
...
@@ -159,7 +159,7 @@ struct MadDecoder {
bool
DecodeFirstFrame
(
Tag
**
tag
);
gcc_pure
long
TimeToFrame
(
double
t
)
const
;
long
TimeToFrame
(
unsigned
t
)
const
;
void
UpdateTimerNextFrame
();
...
...
@@ -847,14 +847,13 @@ mad_decoder_total_file_time(InputStream &is)
}
long
MadDecoder
::
TimeToFrame
(
double
t
)
const
MadDecoder
::
TimeToFrame
(
unsigned
t
)
const
{
unsigned
long
i
;
for
(
i
=
0
;
i
<
highest_frame
;
++
i
)
{
double
frame_time
=
mad_timer_count
(
times
[
i
],
MAD_UNITS_MILLISECONDS
)
/
1000.
;
unsigned
frame_time
=
mad_timer_count
(
times
[
i
],
MAD_UNITS_MILLISECONDS
);
if
(
frame_time
>=
t
)
break
;
}
...
...
@@ -885,7 +884,7 @@ MadDecoder::UpdateTimerNextFrame()
timer
=
times
[
current_frame
];
current_frame
++
;
elapsed_time
=
mad_timer_count
(
timer
,
MAD_UNITS_MILLISECONDS
)
/
1000.0
;
elapsed_time
=
mad_timer_count
(
timer
,
MAD_UNITS_MILLISECONDS
);
}
DecoderCommand
...
...
@@ -990,7 +989,7 @@ MadDecoder::Read()
assert
(
input_stream
.
IsSeekable
());
unsigned
long
j
=
TimeToFrame
(
decoder_seek_where
(
*
decoder
));
TimeToFrame
(
decoder_seek_where
_ms
(
*
decoder
));
if
(
j
<
highest_frame
)
{
if
(
Seek
(
frame_offsets
[
j
]))
{
current_frame
=
j
;
...
...
@@ -998,7 +997,7 @@ MadDecoder::Read()
}
else
decoder_seek_error
(
*
decoder
);
}
else
{
seek_where
=
decoder_seek_where
(
*
decoder
);
seek_where
=
decoder_seek_where
_ms
(
*
decoder
);
mute_frame
=
MUTEFRAME_SEEK
;
decoder_command_finished
(
*
decoder
);
}
...
...
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