decoder/flac: eliminate redundant FlacDecoder attributes
This commit is contained in:
parent
657d6edff7
commit
631baa7120
@ -33,8 +33,7 @@ FlacDecoder::FlacDecoder(Decoder &_decoder,
|
|||||||
InputStream &_input_stream)
|
InputStream &_input_stream)
|
||||||
:FlacInput(_input_stream, &_decoder),
|
:FlacInput(_input_stream, &_decoder),
|
||||||
initialized(false), unsupported(false),
|
initialized(false), unsupported(false),
|
||||||
position(0),
|
position(0)
|
||||||
decoder(_decoder), input_stream(_input_stream)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +82,8 @@ FlacDecoder::Initialize(unsigned sample_rate, unsigned bits_per_sample,
|
|||||||
audio_format.sample_rate)
|
audio_format.sample_rate)
|
||||||
: SignedSongTime::Negative();
|
: SignedSongTime::Negative();
|
||||||
|
|
||||||
decoder_initialized(decoder, audio_format,
|
decoder_initialized(*GetDecoder(), audio_format,
|
||||||
input_stream.IsSeekable(),
|
GetInputStream().IsSeekable(),
|
||||||
duration);
|
duration);
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
@ -119,9 +118,9 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
|
|||||||
|
|
||||||
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
||||||
if (flac_parse_replay_gain(rgi, block->data.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));
|
flac_parse_mixramp(block->data.vorbis_comment));
|
||||||
|
|
||||||
data->tag = flac_vorbis_comments_to_tag(&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 /
|
unsigned bit_rate = nbytes * 8 * frame->header.sample_rate /
|
||||||
(1000 * frame->header.blocksize);
|
(1000 * frame->header.blocksize);
|
||||||
|
|
||||||
auto cmd = decoder_data(data->decoder, data->input_stream,
|
auto cmd = decoder_data(*data->GetDecoder(), data->GetInputStream(),
|
||||||
buffer, buffer_size,
|
buffer, buffer_size,
|
||||||
bit_rate);
|
bit_rate);
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
@ -60,9 +60,6 @@ struct FlacDecoder : public FlacInput {
|
|||||||
*/
|
*/
|
||||||
FLAC__uint64 position;
|
FLAC__uint64 position;
|
||||||
|
|
||||||
Decoder &decoder;
|
|
||||||
InputStream &input_stream;
|
|
||||||
|
|
||||||
Tag tag;
|
Tag tag;
|
||||||
|
|
||||||
FlacDecoder(Decoder &decoder, InputStream &input_stream);
|
FlacDecoder(Decoder &decoder, InputStream &input_stream);
|
||||||
|
@ -146,7 +146,7 @@ flac_decoder_initialize(FlacDecoder *data, FLAC__StreamDecoder *sd)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->input_stream.IsSeekable())
|
if (data->GetInputStream().IsSeekable())
|
||||||
/* allow the workaround below only for nonseekable
|
/* allow the workaround below only for nonseekable
|
||||||
streams*/
|
streams*/
|
||||||
return false;
|
return false;
|
||||||
@ -160,12 +160,12 @@ flac_decoder_initialize(FlacDecoder *data, FLAC__StreamDecoder *sd)
|
|||||||
static void
|
static void
|
||||||
flac_decoder_loop(FlacDecoder *data, FLAC__StreamDecoder *flac_dec)
|
flac_decoder_loop(FlacDecoder *data, FLAC__StreamDecoder *flac_dec)
|
||||||
{
|
{
|
||||||
Decoder &decoder = data->decoder;
|
Decoder &decoder = *data->GetDecoder();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
DecoderCommand cmd;
|
DecoderCommand cmd;
|
||||||
if (!data->tag.IsEmpty()) {
|
if (!data->tag.IsEmpty()) {
|
||||||
cmd = decoder_tag(data->decoder, data->input_stream,
|
cmd = decoder_tag(decoder, data->GetInputStream(),
|
||||||
std::move(data->tag));
|
std::move(data->tag));
|
||||||
data->tag.Clear();
|
data->tag.Clear();
|
||||||
} else
|
} else
|
||||||
|
Loading…
Reference in New Issue
Block a user