decoder/flac: rename struct flac_data to FlacDecoder

This commit is contained in:
Max Kellermann 2016-07-10 21:50:38 +02:00
parent c5fb56f90f
commit 737c5a9549
3 changed files with 21 additions and 21 deletions

View File

@ -29,8 +29,8 @@
#include "util/Error.hxx" #include "util/Error.hxx"
#include "Log.hxx" #include "Log.hxx"
flac_data::flac_data(Decoder &_decoder, 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),
@ -60,8 +60,8 @@ flac_sample_format(unsigned bits_per_sample)
} }
bool bool
flac_data::Initialize(unsigned sample_rate, unsigned bits_per_sample, FlacDecoder::Initialize(unsigned sample_rate, unsigned bits_per_sample,
unsigned channels, FLAC__uint64 total_frames) unsigned channels, FLAC__uint64 total_frames)
{ {
assert(!initialized); assert(!initialized);
assert(!unsupported); assert(!unsupported);
@ -92,7 +92,7 @@ flac_data::Initialize(unsigned sample_rate, unsigned bits_per_sample,
} }
static void static void
flac_got_stream_info(struct flac_data *data, flac_got_stream_info(FlacDecoder *data,
const FLAC__StreamMetadata_StreamInfo *stream_info) const FLAC__StreamMetadata_StreamInfo *stream_info)
{ {
if (data->initialized || data->unsupported) if (data->initialized || data->unsupported)
@ -105,7 +105,7 @@ flac_got_stream_info(struct flac_data *data,
} }
void flac_metadata_common_cb(const FLAC__StreamMetadata * block, void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
struct flac_data *data) FlacDecoder *data)
{ {
if (data->unsupported) if (data->unsupported)
return; return;
@ -140,7 +140,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
* (e.g. when seeking with SqueezeBox Server). * (e.g. when seeking with SqueezeBox Server).
*/ */
static bool static bool
flac_got_first_frame(struct flac_data *data, const FLAC__FrameHeader *header) flac_got_first_frame(FlacDecoder *data, const FLAC__FrameHeader *header)
{ {
if (data->unsupported) if (data->unsupported)
return false; return false;
@ -153,7 +153,7 @@ flac_got_first_frame(struct flac_data *data, const FLAC__FrameHeader *header)
} }
FLAC__StreamDecoderWriteStatus FLAC__StreamDecoderWriteStatus
flac_common_write(struct flac_data *data, const FLAC__Frame * frame, flac_common_write(FlacDecoder *data, const FLAC__Frame * frame,
const FLAC__int32 *const buf[], const FLAC__int32 *const buf[],
FLAC__uint64 nbytes) FLAC__uint64 nbytes)
{ {

View File

@ -30,7 +30,7 @@
#include <FLAC/stream_decoder.h> #include <FLAC/stream_decoder.h>
struct flac_data : public FlacInput { struct FlacDecoder : public FlacInput {
PcmBuffer buffer; PcmBuffer buffer;
/** /**
@ -65,7 +65,7 @@ struct flac_data : public FlacInput {
Tag tag; Tag tag;
flac_data(Decoder &decoder, InputStream &input_stream); FlacDecoder(Decoder &decoder, InputStream &input_stream);
/** /**
* Wrapper for decoder_initialized(). * Wrapper for decoder_initialized().
@ -75,10 +75,10 @@ struct flac_data : public FlacInput {
}; };
void flac_metadata_common_cb(const FLAC__StreamMetadata * block, void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
struct flac_data *data); FlacDecoder *data);
FLAC__StreamDecoderWriteStatus FLAC__StreamDecoderWriteStatus
flac_common_write(struct flac_data *data, const FLAC__Frame * frame, flac_common_write(FlacDecoder *data, const FLAC__Frame * frame,
const FLAC__int32 *const buf[], const FLAC__int32 *const buf[],
FLAC__uint64 nbytes); FLAC__uint64 nbytes);

View File

@ -56,14 +56,14 @@ static void flacPrintErroredState(FLAC__StreamDecoderState state)
static void flacMetadata(gcc_unused const FLAC__StreamDecoder * dec, static void flacMetadata(gcc_unused const FLAC__StreamDecoder * dec,
const FLAC__StreamMetadata * block, void *vdata) const FLAC__StreamMetadata * block, void *vdata)
{ {
flac_metadata_common_cb(block, (struct flac_data *) vdata); flac_metadata_common_cb(block, (FlacDecoder *) vdata);
} }
static FLAC__StreamDecoderWriteStatus static FLAC__StreamDecoderWriteStatus
flac_write_cb(const FLAC__StreamDecoder *dec, const FLAC__Frame *frame, flac_write_cb(const FLAC__StreamDecoder *dec, const FLAC__Frame *frame,
const FLAC__int32 *const buf[], void *vdata) const FLAC__int32 *const buf[], void *vdata)
{ {
struct flac_data *data = (struct flac_data *) vdata; FlacDecoder *data = (FlacDecoder *) vdata;
FLAC__uint64 nbytes = 0; FLAC__uint64 nbytes = 0;
if (FLAC__stream_decoder_get_decode_position(dec, &nbytes)) { if (FLAC__stream_decoder_get_decode_position(dec, &nbytes)) {
@ -133,7 +133,7 @@ flac_decoder_new(void)
} }
static bool static bool
flac_decoder_initialize(struct flac_data *data, FLAC__StreamDecoder *sd) flac_decoder_initialize(FlacDecoder *data, FLAC__StreamDecoder *sd)
{ {
if (!FLAC__stream_decoder_process_until_end_of_metadata(sd)) { if (!FLAC__stream_decoder_process_until_end_of_metadata(sd)) {
if (FLAC__stream_decoder_get_state(sd) != FLAC__STREAM_DECODER_END_OF_STREAM) if (FLAC__stream_decoder_get_state(sd) != FLAC__STREAM_DECODER_END_OF_STREAM)
@ -158,7 +158,7 @@ flac_decoder_initialize(struct flac_data *data, FLAC__StreamDecoder *sd)
} }
static void static void
flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec) flac_decoder_loop(FlacDecoder *data, FLAC__StreamDecoder *flac_dec)
{ {
Decoder &decoder = data->decoder; Decoder &decoder = data->decoder;
@ -226,7 +226,7 @@ flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec)
} }
static FLAC__StreamDecoderInitStatus static FLAC__StreamDecoderInitStatus
stream_init_oggflac(FLAC__StreamDecoder *flac_dec, struct flac_data *data) stream_init_oggflac(FLAC__StreamDecoder *flac_dec, FlacDecoder *data)
{ {
return FLAC__stream_decoder_init_ogg_stream(flac_dec, return FLAC__stream_decoder_init_ogg_stream(flac_dec,
FlacInput::Read, FlacInput::Read,
@ -241,7 +241,7 @@ stream_init_oggflac(FLAC__StreamDecoder *flac_dec, struct flac_data *data)
} }
static FLAC__StreamDecoderInitStatus static FLAC__StreamDecoderInitStatus
stream_init_flac(FLAC__StreamDecoder *flac_dec, struct flac_data *data) stream_init_flac(FLAC__StreamDecoder *flac_dec, FlacDecoder *data)
{ {
return FLAC__stream_decoder_init_stream(flac_dec, return FLAC__stream_decoder_init_stream(flac_dec,
FlacInput::Read, FlacInput::Read,
@ -256,7 +256,7 @@ stream_init_flac(FLAC__StreamDecoder *flac_dec, struct flac_data *data)
} }
static FLAC__StreamDecoderInitStatus static FLAC__StreamDecoderInitStatus
stream_init(FLAC__StreamDecoder *flac_dec, struct flac_data *data, bool is_ogg) stream_init(FLAC__StreamDecoder *flac_dec, FlacDecoder *data, bool is_ogg)
{ {
return is_ogg return is_ogg
? stream_init_oggflac(flac_dec, data) ? stream_init_oggflac(flac_dec, data)
@ -264,7 +264,7 @@ stream_init(FLAC__StreamDecoder *flac_dec, struct flac_data *data, bool is_ogg)
} }
static bool static bool
FlacInitAndDecode(struct flac_data &data, FLAC__StreamDecoder *sd, bool is_ogg) FlacInitAndDecode(FlacDecoder &data, FLAC__StreamDecoder *sd, bool is_ogg)
{ {
auto init_status = stream_init(sd, &data, is_ogg); auto init_status = stream_init(sd, &data, is_ogg);
if (init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) { if (init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
@ -292,7 +292,7 @@ flac_decode_internal(Decoder &decoder,
if (flac_dec == nullptr) if (flac_dec == nullptr)
return; return;
struct flac_data data(decoder, input_stream); FlacDecoder data(decoder, input_stream);
FlacInitAndDecode(data, flac_dec, is_ogg); FlacInitAndDecode(data, flac_dec, is_ogg);