aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/_flac_common.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-11 19:25:15 +0100
committerMax Kellermann <max@duempel.org>2009-11-11 19:25:15 +0100
commit7b13776f2dd2feeb4bd28e8cf023ec81474e4eaa (patch)
treee8d91ee2f20a4af43a2fce380f5a5c744f0b61d8 /src/decoder/_flac_common.h
parentf937ec9a7c6b2439cda68c9cfdaa603258f8a0d4 (diff)
downloadmpd-7b13776f2dd2feeb4bd28e8cf023ec81474e4eaa.tar.gz
mpd-7b13776f2dd2feeb4bd28e8cf023ec81474e4eaa.tar.xz
mpd-7b13776f2dd2feeb4bd28e8cf023ec81474e4eaa.zip
decoder/flac: store the whole stream info object, not duration
We don't want to work with floating point values if possible. Get the integer number of frames from the FLAC__StreamMetadata_StreamInfo object, and convert it into a float duration on demand. This patch adds a check if the STREAMINFO packet has been received yet.
Diffstat (limited to '')
-rw-r--r--src/decoder/_flac_common.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/decoder/_flac_common.h b/src/decoder/_flac_common.h
index e1e76932b..895cdf1b9 100644
--- a/src/decoder/_flac_common.h
+++ b/src/decoder/_flac_common.h
@@ -39,6 +39,19 @@ struct flac_data {
struct pcm_buffer buffer;
/**
+ * Is the #stream_info member valid?
+ */
+ bool have_stream_info;
+
+ /**
+ * A copy of the stream info object passed to the metadata
+ * callback. Once we drop support for libFLAC 1.1.2, we can
+ * remove this attribute, and use
+ * FLAC__stream_decoder_get_total_samples() etc.
+ */
+ FLAC__StreamMetadata_StreamInfo stream_info;
+
+ /**
* The number of the next frame which is going to be decoded.
*/
FLAC__uint64 next_frame;
@@ -46,7 +59,6 @@ struct flac_data {
float time;
unsigned int bit_rate;
struct audio_format audio_format;
- float total_time;
FLAC__uint64 position;
struct decoder *decoder;
struct input_stream *input_stream;