From 550c9319e9f6e68a7f7cc72054de657e6e921072 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 5 Jan 2010 21:46:12 +0100 Subject: decoder/flac: moved decoder initialization to _flac_common.c Invoke decoder_initialized() in the libFLAC metadata callback. This merges code from the FLAC and the OggFLAC decoder plugin into the common library. --- src/decoder/flac_decoder_plugin.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/decoder/flac_decoder_plugin.c') diff --git a/src/decoder/flac_decoder_plugin.c b/src/decoder/flac_decoder_plugin.c index 1a81e3fd4..d139354b8 100644 --- a/src/decoder/flac_decoder_plugin.c +++ b/src/decoder/flac_decoder_plugin.c @@ -238,26 +238,16 @@ flac_decoder_new(void) static bool flac_decoder_initialize(struct flac_data *data, FLAC__StreamDecoder *sd, - bool seekable, FLAC__uint64 duration) + FLAC__uint64 duration) { - struct audio_format audio_format; + data->total_frames = duration; if (!FLAC__stream_decoder_process_until_end_of_metadata(sd)) { g_warning("problem reading metadata"); return false; } - if (!flac_data_get_audio_format(data, &audio_format)) - return false; - - if (duration == 0) - duration = data->total_frames; - - decoder_initialized(data->decoder, &audio_format, - seekable, - (float)duration / - (float)data->audio_format.sample_rate); - return true; + return data->initialized; } static void @@ -365,8 +355,7 @@ flac_decode_internal(struct decoder * decoder, } } - if (!flac_decoder_initialize(&data, flac_dec, - input_stream->seekable, 0)) { + if (!flac_decoder_initialize(&data, flac_dec, 0)) { flac_data_deinit(&data); FLAC__stream_decoder_delete(flac_dec); return; -- cgit v1.2.3