diff options
author | Max Kellermann <max@duempel.org> | 2010-01-05 21:46:12 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-01-06 09:50:34 +0100 |
commit | 550c9319e9f6e68a7f7cc72054de657e6e921072 (patch) | |
tree | 017e991cf5065ef62e08fbf2ecde05b774e78602 /src/decoder/flac_decoder_plugin.c | |
parent | ae9c02b3a854cd8520eee696cdd68d0b0c32923f (diff) | |
download | mpd-550c9319e9f6e68a7f7cc72054de657e6e921072.tar.gz mpd-550c9319e9f6e68a7f7cc72054de657e6e921072.tar.xz mpd-550c9319e9f6e68a7f7cc72054de657e6e921072.zip |
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.
Diffstat (limited to 'src/decoder/flac_decoder_plugin.c')
-rw-r--r-- | src/decoder/flac_decoder_plugin.c | 19 |
1 files changed, 4 insertions, 15 deletions
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; |