diff --git a/src/decoder/plugins/FlacCommon.cxx b/src/decoder/plugins/FlacCommon.cxx index e86f85569..18678a90a 100644 --- a/src/decoder/plugins/FlacCommon.cxx +++ b/src/decoder/plugins/FlacCommon.cxx @@ -33,7 +33,7 @@ flac_data::flac_data(Decoder &_decoder, InputStream &_input_stream) :FlacInput(_input_stream, &_decoder), initialized(false), unsupported(false), - total_frames(0), first_frame(0), next_frame(0), position(0), + total_frames(0), position(0), decoder(_decoder), input_stream(_input_stream) { } @@ -176,7 +176,6 @@ flac_common_write(struct flac_data *data, const FLAC__Frame * frame, auto cmd = decoder_data(data->decoder, data->input_stream, buffer, buffer_size, bit_rate); - data->next_frame += frame->header.blocksize; switch (cmd) { case DecoderCommand::NONE: case DecoderCommand::START: diff --git a/src/decoder/plugins/FlacCommon.hxx b/src/decoder/plugins/FlacCommon.hxx index 34ce0a3fc..49af9f560 100644 --- a/src/decoder/plugins/FlacCommon.hxx +++ b/src/decoder/plugins/FlacCommon.hxx @@ -61,17 +61,6 @@ struct flac_data : public FlacInput { */ FLAC__uint64 total_frames; - /** - * The number of the first frame in this song. This is only - * non-zero if playing sub songs from a CUE sheet. - */ - FLAC__uint64 first_frame; - - /** - * The number of the next frame which is going to be decoded. - */ - FLAC__uint64 next_frame; - FLAC__uint64 position; Decoder &decoder; diff --git a/src/decoder/plugins/FlacDecoderPlugin.cxx b/src/decoder/plugins/FlacDecoderPlugin.cxx index c40bd2243..bb9ebbea8 100644 --- a/src/decoder/plugins/FlacDecoderPlugin.cxx +++ b/src/decoder/plugins/FlacDecoderPlugin.cxx @@ -167,13 +167,10 @@ flac_decoder_initialize(struct flac_data *data, FLAC__StreamDecoder *sd, } static void -flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec, - FLAC__uint64 t_start, FLAC__uint64 t_end) +flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec) { Decoder &decoder = data->decoder; - data->first_frame = t_start; - while (true) { DecoderCommand cmd; if (!data->tag.IsEmpty()) { @@ -184,12 +181,9 @@ flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec, cmd = decoder_get_command(decoder); if (cmd == DecoderCommand::SEEK) { - FLAC__uint64 seek_sample = t_start + + FLAC__uint64 seek_sample = decoder_seek_where_frame(decoder); - if (seek_sample >= t_start && - (t_end == 0 || seek_sample <= t_end) && - FLAC__stream_decoder_seek_absolute(flac_dec, seek_sample)) { - data->next_frame = seek_sample; + if (FLAC__stream_decoder_seek_absolute(flac_dec, seek_sample)) { data->position = 0; decoder_command_finished(decoder); } else @@ -230,10 +224,6 @@ flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec, return; } - if (t_end != 0 && data->next_frame >= t_end) - /* end of this sub track */ - break; - if (!FLAC__stream_decoder_process_single(flac_dec) && decoder_get_command(decoder) == DecoderCommand::NONE) { /* a failure that was not triggered by a @@ -310,7 +300,7 @@ flac_decode_internal(Decoder &decoder, return; } - flac_decoder_loop(&data, flac_dec, 0, 0); + flac_decoder_loop(&data, flac_dec); FLAC__stream_decoder_finish(flac_dec); FLAC__stream_decoder_delete(flac_dec);