diff options
Diffstat (limited to 'src/decoder/_flac_common.h')
-rw-r--r-- | src/decoder/_flac_common.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/decoder/_flac_common.h b/src/decoder/_flac_common.h index 68de7e969..5f83acc70 100644 --- a/src/decoder/_flac_common.h +++ b/src/decoder/_flac_common.h @@ -24,7 +24,8 @@ #ifndef MPD_FLAC_COMMON_H #define MPD_FLAC_COMMON_H -#include "../decoder_api.h" +#include "decoder_api.h" +#include "pcm_buffer.h" #include "config.h" #include <glib.h> @@ -145,7 +146,8 @@ typedef size_t flac_read_status_size_t; #define FLAC_CHUNK_SIZE 4080 struct flac_data { - unsigned char chunk[FLAC_CHUNK_SIZE]; + struct pcm_buffer buffer; + float time; unsigned int bit_rate; struct audio_format audio_format; @@ -157,11 +159,21 @@ struct flac_data { struct tag *tag; }; +static inline unsigned +flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info) +{ + return (stream_info->total_samples + stream_info->sample_rate - 1) / + stream_info->sample_rate; +} + /* initializes a given FlacData struct */ void flac_data_init(struct flac_data *data, struct decoder * decoder, struct input_stream *input_stream); +void +flac_data_deinit(struct flac_data *data); + void flac_metadata_common_cb(const FLAC__StreamMetadata * block, struct flac_data *data); @@ -170,8 +182,8 @@ void flac_error_common_cb(const char *plugin, struct flac_data *data); void -flac_vorbis_comments_to_tag(struct tag *tag, const char *char_tnum, - const FLAC__StreamMetadata *block); +flac_tag_apply_metadata(struct tag *tag, const char *track, + const FLAC__StreamMetadata *block); FLAC__StreamDecoderWriteStatus flac_common_write(struct flac_data *data, const FLAC__Frame * frame, |