decoder/flac: eliminate redundant FlacDecoder attributes

This commit is contained in:
Max Kellermann 2016-07-10 21:53:47 +02:00
parent 657d6edff7
commit 631baa7120
3 changed files with 9 additions and 13 deletions

View File

@ -33,8 +33,7 @@ FlacDecoder::FlacDecoder(Decoder &_decoder,
InputStream &_input_stream)
:FlacInput(_input_stream, &_decoder),
initialized(false), unsupported(false),
position(0),
decoder(_decoder), input_stream(_input_stream)
position(0)
{
}
@ -83,8 +82,8 @@ FlacDecoder::Initialize(unsigned sample_rate, unsigned bits_per_sample,
audio_format.sample_rate)
: SignedSongTime::Negative();
decoder_initialized(decoder, audio_format,
input_stream.IsSeekable(),
decoder_initialized(*GetDecoder(), audio_format,
GetInputStream().IsSeekable(),
duration);
initialized = true;
@ -119,9 +118,9 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
if (flac_parse_replay_gain(rgi, block->data.vorbis_comment))
decoder_replay_gain(data->decoder, &rgi);
decoder_replay_gain(*data->GetDecoder(), &rgi);
decoder_mixramp(data->decoder,
decoder_mixramp(*data->GetDecoder(),
flac_parse_mixramp(block->data.vorbis_comment));
data->tag = flac_vorbis_comments_to_tag(&block->data.vorbis_comment);
@ -172,7 +171,7 @@ flac_common_write(FlacDecoder *data, const FLAC__Frame * frame,
unsigned bit_rate = nbytes * 8 * frame->header.sample_rate /
(1000 * frame->header.blocksize);
auto cmd = decoder_data(data->decoder, data->input_stream,
auto cmd = decoder_data(*data->GetDecoder(), data->GetInputStream(),
buffer, buffer_size,
bit_rate);
switch (cmd) {

View File

@ -60,9 +60,6 @@ struct FlacDecoder : public FlacInput {
*/
FLAC__uint64 position;
Decoder &decoder;
InputStream &input_stream;
Tag tag;
FlacDecoder(Decoder &decoder, InputStream &input_stream);

View File

@ -146,7 +146,7 @@ flac_decoder_initialize(FlacDecoder *data, FLAC__StreamDecoder *sd)
return true;
}
if (data->input_stream.IsSeekable())
if (data->GetInputStream().IsSeekable())
/* allow the workaround below only for nonseekable
streams*/
return false;
@ -160,12 +160,12 @@ flac_decoder_initialize(FlacDecoder *data, FLAC__StreamDecoder *sd)
static void
flac_decoder_loop(FlacDecoder *data, FLAC__StreamDecoder *flac_dec)
{
Decoder &decoder = data->decoder;
Decoder &decoder = *data->GetDecoder();
while (true) {
DecoderCommand cmd;
if (!data->tag.IsEmpty()) {
cmd = decoder_tag(data->decoder, data->input_stream,
cmd = decoder_tag(decoder, data->GetInputStream(),
std::move(data->tag));
data->tag.Clear();
} else