aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-29 16:13:01 +0100
committerMax Kellermann <max@duempel.org>2008-10-29 16:13:01 +0100
commit0d079ee51532d076da31c19cbfb2695c7c6d3cf6 (patch)
tree73c401c9ba4dbb8c30981c8ef8eb83569f2eddac /src
parenta6f8776c944a91202fcd20acb8c7c1f4aed90685 (diff)
downloadmpd-0d079ee51532d076da31c19cbfb2695c7c6d3cf6.tar.gz
mpd-0d079ee51532d076da31c19cbfb2695c7c6d3cf6.tar.xz
mpd-0d079ee51532d076da31c19cbfb2695c7c6d3cf6.zip
mp3: moved code to mp3_this_frame_offset()
Break the large function mp3_read() into smaller pieces.
Diffstat (limited to 'src')
-rw-r--r--src/decoder/mp3_plugin.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c
index a4fd52738..529e9ced6 100644
--- a/src/decoder/mp3_plugin.c
+++ b/src/decoder/mp3_plugin.c
@@ -657,7 +657,7 @@ mp3_frame_duration(const struct mad_frame *frame)
}
static off_t
-mp3_rest_including_this_frame(const struct mp3_data *data)
+mp3_this_frame_offset(const struct mp3_data *data)
{
off_t offset = data->input_stream->offset;
@@ -666,7 +666,13 @@ mp3_rest_including_this_frame(const struct mp3_data *data)
else
offset -= data->stream.bufend - data->stream.buffer;
- return data->input_stream->size - offset;
+ return offset;
+}
+
+static off_t
+mp3_rest_including_this_frame(const struct mp3_data *data)
+{
+ return data->input_stream->size - mp3_this_frame_offset(data);
}
/**
@@ -853,14 +859,8 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
} else {
data->highest_frame++;
}
- data->frame_offsets[data->current_frame] = data->input_stream->offset;
- if (data->stream.this_frame != NULL) {
- data->frame_offsets[data->current_frame] -=
- data->stream.bufend - data->stream.this_frame;
- } else {
- data->frame_offsets[data->current_frame] -=
- data->stream.bufend - data->stream.buffer;
- }
+ data->frame_offsets[data->current_frame] =
+ mp3_this_frame_offset(data);
data->times[data->current_frame] = data->timer;
} else {
data->timer = data->times[data->current_frame];