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
a6f8776c
Commit
a6f8776c
authored
Oct 29, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mp3: moved code to mp3_time_to_frame()
Break the large function mp3_read() into smaller pieces.
parent
ec308394
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
mp3_plugin.c
src/decoder/mp3_plugin.c
+21
-11
No files found.
src/decoder/mp3_plugin.c
View file @
a6f8776c
...
...
@@ -820,6 +820,22 @@ mp3_open(struct input_stream *is, struct mp3_data *data,
return
true
;
}
static
long
mp3_time_to_frame
(
const
struct
mp3_data
*
data
,
double
t
)
{
unsigned
long
i
;
for
(
i
=
0
;
i
<
data
->
highest_frame
;
++
i
)
{
double
frame_time
=
mad_timer_count
(
data
->
times
[
i
],
MAD_UNITS_MILLISECONDS
)
/
1000
.;
if
(
frame_time
>=
t
)
break
;
}
return
i
;
}
static
enum
mp3_action
mp3_read
(
struct
mp3_data
*
data
,
ReplayGainInfo
**
replay_gain_info_r
)
{
...
...
@@ -951,18 +967,12 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
return
DECODE_BREAK
;
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
)
{
unsigned
long
j
=
0
;
unsigned
long
j
;
assert
(
data
->
input_stream
->
seekable
);
data
->
mute_frame
=
MUTEFRAME_SEEK
;
while
(
j
<
data
->
highest_frame
&&
decoder_seek_where
(
decoder
)
>
((
float
)
mad_timer_count
(
data
->
times
[
j
],
MAD_UNITS_MILLISECONDS
))
/
1000
)
{
j
++
;
}
j
=
mp3_time_to_frame
(
data
,
decoder_seek_where
(
decoder
));
if
(
j
<
data
->
highest_frame
)
{
if
(
mp3_seek
(
data
,
data
->
frame_offsets
[
j
]))
{
decoder_clear
(
decoder
);
...
...
@@ -970,8 +980,8 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
decoder_command_finished
(
decoder
);
}
else
decoder_seek_error
(
decoder
);
data
->
mute_frame
=
MUTEFRAME_NONE
;
}
}
else
data
->
mute_frame
=
MUTEFRAME_SEEK
;
}
}
...
...
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