diff options
Diffstat (limited to 'src/decoder/mad_decoder_plugin.c')
-rw-r--r-- | src/decoder/mad_decoder_plugin.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/decoder/mad_decoder_plugin.c b/src/decoder/mad_decoder_plugin.c index 62c371642..4e2e03311 100644 --- a/src/decoder/mad_decoder_plugin.c +++ b/src/decoder/mad_decoder_plugin.c @@ -76,9 +76,9 @@ mad_fixed_to_24_sample(mad_fixed_t sample) sample = sample + (1L << (MAD_F_FRACBITS - bits)); /* clip */ - if (sample > MAX) + if (gcc_unlikely(sample > MAX)) sample = MAX; - else if (sample < MIN) + else if (gcc_unlikely(sample < MIN)) sample = MIN; /* quantize */ @@ -359,15 +359,14 @@ static void mp3_parse_id3(struct mp3_data *data, size_t tagsize, struct replay_gain_info rgi; char *mixramp_start; char *mixramp_end; - float replay_gain_db = 0; if (parse_id3_replay_gain_info(&rgi, id3_tag)) { - replay_gain_db = decoder_replay_gain(data->decoder, &rgi); + decoder_replay_gain(data->decoder, &rgi); data->found_replay_gain = true; } if (parse_id3_mixramp(&mixramp_start, &mixramp_end, id3_tag)) - decoder_mixramp(data->decoder, replay_gain_db, + decoder_mixramp(data->decoder, mixramp_start, mixramp_end); } @@ -756,7 +755,7 @@ mp3_frame_duration(const struct mad_frame *frame) static goffset mp3_this_frame_offset(const struct mp3_data *data) { - goffset offset = data->input_stream->offset; + goffset offset = input_stream_get_offset(data->input_stream); if (data->stream.this_frame != NULL) offset -= data->stream.bufend - data->stream.this_frame; @@ -769,7 +768,8 @@ mp3_this_frame_offset(const struct mp3_data *data) static goffset mp3_rest_including_this_frame(const struct mp3_data *data) { - return data->input_stream->size - mp3_this_frame_offset(data); + return input_stream_get_size(data->input_stream) + - mp3_this_frame_offset(data); } /** @@ -842,7 +842,7 @@ mp3_decode_first_frame(struct mp3_data *data, struct tag **tag) if (parse_lame(&lame, &ptr, &bitlen)) { if (gapless_playback && - data->input_stream->seekable) { + input_stream_is_seekable(data->input_stream)) { data->drop_start_samples = lame.encoder_delay + DECODERDELAY; data->drop_end_samples = lame.encoder_padding; @@ -1082,7 +1082,7 @@ mp3_read(struct mp3_data *data) if (cmd == DECODE_COMMAND_SEEK) { unsigned long j; - assert(data->input_stream->seekable); + assert(input_stream_is_seekable(data->input_stream)); j = mp3_time_to_frame(data, decoder_seek_where(decoder)); @@ -1164,7 +1164,8 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream) } decoder_initialized(decoder, &audio_format, - data.input_stream->seekable, data.total_time); + input_stream_is_seekable(input_stream), + data.total_time); if (tag != NULL) { decoder_tag(decoder, input_stream, tag); |