aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/flac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-11 20:34:59 +0100
committerMax Kellermann <max@duempel.org>2009-11-11 20:44:21 +0100
commit37181c91815d6807df77d6920973b924dba05f1f (patch)
treed3178e76d8ab9379ce615c5e92729592e605f11a /src/decoder/flac_plugin.c
parent08b139f37c891b9b5f43f12910efda439add3f5b (diff)
downloadmpd-37181c91815d6807df77d6920973b924dba05f1f.tar.gz
mpd-37181c91815d6807df77d6920973b924dba05f1f.tar.xz
mpd-37181c91815d6807df77d6920973b924dba05f1f.zip
decoder/flac: moved code to flac_data_get_audio_format()
Remove the audio_format attribute, add "frame_size" instead. The audio_format initialization and check is moved both to flac_data_get_audio_format().
Diffstat (limited to 'src/decoder/flac_plugin.c')
-rw-r--r--src/decoder/flac_plugin.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index 1841c3f72..2d14ab9df 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -391,28 +391,20 @@ static bool
flac_decoder_initialize(struct flac_data *data, FLAC__StreamDecoder *sd,
bool seekable, FLAC__uint64 duration)
{
+ struct audio_format audio_format;
+
if (!FLAC__stream_decoder_process_until_end_of_metadata(sd)) {
g_warning("problem reading metadata");
return false;
}
- if (!data->have_stream_info) {
- g_warning("no STREAMINFO packet found");
+ if (!flac_data_get_audio_format(data, &audio_format))
return false;
- }
-
- if (!audio_format_valid(&data->audio_format)) {
- g_warning("Invalid audio format: %u:%u:%u\n",
- data->audio_format.sample_rate,
- data->audio_format.bits,
- data->audio_format.channels);
- return false;
- }
if (duration == 0)
duration = data->stream_info.total_samples;
- decoder_initialized(data->decoder, &data->audio_format,
+ decoder_initialized(data->decoder, &audio_format,
seekable,
(float)duration /
(float)data->stream_info.sample_rate);