2009-03-13 18:43:16 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2003-2009 The Music Player Daemon Project
|
|
|
|
* http://www.musicpd.org
|
2006-03-16 07:52:46 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2009-03-13 18:43:16 +01:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Common data structures and functions used by FLAC and OggFLAC
|
2006-03-16 07:52:46 +01:00
|
|
|
*/
|
|
|
|
|
2008-10-31 09:19:53 +01:00
|
|
|
#ifndef MPD_FLAC_COMMON_H
|
|
|
|
#define MPD_FLAC_COMMON_H
|
2006-03-16 07:52:46 +01:00
|
|
|
|
2009-11-10 21:46:10 +01:00
|
|
|
#include "decoder_api.h"
|
|
|
|
#include "pcm_buffer.h"
|
2006-03-16 07:52:46 +01:00
|
|
|
|
2008-11-21 20:15:50 +01:00
|
|
|
#include <glib.h>
|
|
|
|
|
2009-11-11 16:43:34 +01:00
|
|
|
#include <FLAC/stream_decoder.h>
|
2006-03-16 07:52:46 +01:00
|
|
|
#include <FLAC/metadata.h>
|
|
|
|
|
2009-11-11 16:43:34 +01:00
|
|
|
#undef G_LOG_DOMAIN
|
|
|
|
#define G_LOG_DOMAIN "flac"
|
2006-03-16 07:52:46 +01:00
|
|
|
|
2009-01-15 19:50:28 +01:00
|
|
|
struct flac_data {
|
2009-11-10 21:46:10 +01:00
|
|
|
struct pcm_buffer buffer;
|
|
|
|
|
2009-11-11 15:09:24 +01:00
|
|
|
/**
|
|
|
|
* The number of the next frame which is going to be decoded.
|
|
|
|
*/
|
|
|
|
FLAC__uint64 next_frame;
|
|
|
|
|
2006-03-16 07:52:46 +01:00
|
|
|
float time;
|
2009-01-15 19:50:28 +01:00
|
|
|
unsigned int bit_rate;
|
2008-09-07 19:19:55 +02:00
|
|
|
struct audio_format audio_format;
|
2008-08-26 08:27:05 +02:00
|
|
|
float total_time;
|
2006-03-16 07:52:46 +01:00
|
|
|
FLAC__uint64 position;
|
2008-08-26 08:27:04 +02:00
|
|
|
struct decoder *decoder;
|
2009-01-15 19:50:28 +01:00
|
|
|
struct input_stream *input_stream;
|
|
|
|
struct replay_gain_info *replay_gain_info;
|
2008-08-29 09:38:11 +02:00
|
|
|
struct tag *tag;
|
2009-01-15 19:50:28 +01:00
|
|
|
};
|
2006-03-16 07:52:46 +01:00
|
|
|
|
|
|
|
/* initializes a given FlacData struct */
|
2009-01-15 19:50:28 +01:00
|
|
|
void
|
|
|
|
flac_data_init(struct flac_data *data, struct decoder * decoder,
|
|
|
|
struct input_stream *input_stream);
|
|
|
|
|
2009-11-10 21:42:15 +01:00
|
|
|
void
|
|
|
|
flac_data_deinit(struct flac_data *data);
|
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
|
2009-01-15 19:50:28 +01:00
|
|
|
struct flac_data *data);
|
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
void flac_error_common_cb(const char *plugin,
|
|
|
|
FLAC__StreamDecoderErrorStatus status,
|
2009-01-15 19:50:28 +01:00
|
|
|
struct flac_data *data);
|
2006-03-16 07:52:46 +01:00
|
|
|
|
2008-09-23 23:59:54 +02:00
|
|
|
FLAC__StreamDecoderWriteStatus
|
2009-01-15 19:50:28 +01:00
|
|
|
flac_common_write(struct flac_data *data, const FLAC__Frame * frame,
|
2008-09-23 23:59:54 +02:00
|
|
|
const FLAC__int32 *const buf[]);
|
2006-03-16 07:52:46 +01:00
|
|
|
|
2009-03-08 20:16:53 +01:00
|
|
|
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
|
|
|
|
|
|
|
|
char*
|
|
|
|
flac_cue_track( const char* pathname,
|
|
|
|
const unsigned int tnum);
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
flac_vtrack_tnum( const char*);
|
|
|
|
|
|
|
|
#endif /* FLAC_API_VERSION_CURRENT >= 7 */
|
|
|
|
|
2006-07-20 20:53:56 +02:00
|
|
|
#endif /* _FLAC_COMMON_H */
|