2009-03-13 18:43:16 +01:00
|
|
|
/*
|
2012-10-02 10:56:44 +02:00
|
|
|
* Copyright (C) 2003-2012 The Music Player Daemon Project
|
2009-03-13 18:43:16 +01:00
|
|
|
* 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
|
|
|
*/
|
|
|
|
|
2012-10-02 10:56:44 +02:00
|
|
|
#ifndef MPD_FLAC_COMMON_HXX
|
|
|
|
#define MPD_FLAC_COMMON_HXX
|
2006-03-16 07:52:46 +01:00
|
|
|
|
2013-05-05 14:19:04 +02:00
|
|
|
#include "FlacInput.hxx"
|
2013-07-28 13:18:48 +02:00
|
|
|
#include "DecoderAPI.hxx"
|
2013-07-29 08:10:10 +02:00
|
|
|
#include "pcm/PcmBuffer.hxx"
|
2006-03-16 07:52:46 +01:00
|
|
|
|
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>
|
|
|
|
|
2013-05-05 14:19:04 +02:00
|
|
|
struct flac_data : public FlacInput {
|
2013-07-29 08:10:10 +02:00
|
|
|
PcmBuffer buffer;
|
2009-11-10 21:46:10 +01:00
|
|
|
|
2009-11-11 20:34:59 +01:00
|
|
|
/**
|
|
|
|
* The size of one frame in the output buffer.
|
|
|
|
*/
|
|
|
|
unsigned frame_size;
|
|
|
|
|
2009-11-11 19:25:15 +01:00
|
|
|
/**
|
2010-01-05 21:46:12 +01:00
|
|
|
* Has decoder_initialized() been called yet?
|
2009-11-11 19:25:15 +01:00
|
|
|
*/
|
2010-01-05 21:46:12 +01:00
|
|
|
bool initialized;
|
2009-11-11 19:25:15 +01:00
|
|
|
|
|
|
|
/**
|
2010-01-06 09:00:32 +01:00
|
|
|
* Does the FLAC file contain an unsupported audio format?
|
|
|
|
*/
|
|
|
|
bool unsupported;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The validated audio format of the FLAC file. This
|
2010-01-05 21:46:12 +01:00
|
|
|
* attribute is defined if "initialized" is true.
|
2010-01-06 09:00:32 +01:00
|
|
|
*/
|
2013-08-03 21:00:50 +02:00
|
|
|
AudioFormat audio_format;
|
2010-01-06 09:00:32 +01:00
|
|
|
|
|
|
|
/**
|
2010-01-05 21:46:12 +01:00
|
|
|
* The total number of frames in this song. The decoder
|
|
|
|
* plugin may initialize this attribute to override the value
|
|
|
|
* provided by libFLAC (e.g. for sub songs from a CUE sheet).
|
2009-11-11 19:25:15 +01:00
|
|
|
*/
|
2010-01-06 09:00:32 +01:00
|
|
|
FLAC__uint64 total_frames;
|
2009-11-11 19:25:15 +01:00
|
|
|
|
2009-11-11 20:18:39 +01:00
|
|
|
/**
|
|
|
|
* The number of the first frame in this song. This is only
|
|
|
|
* non-zero if playing sub songs from a CUE sheet.
|
|
|
|
*/
|
|
|
|
FLAC__uint64 first_frame;
|
|
|
|
|
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
|
|
|
FLAC__uint64 position;
|
2012-10-02 19:47:31 +02:00
|
|
|
|
2013-10-21 21:12:37 +02:00
|
|
|
Decoder &decoder;
|
2009-01-15 19:50:28 +01:00
|
|
|
struct input_stream *input_stream;
|
2006-03-16 07:52:46 +01:00
|
|
|
|
2013-07-31 00:26:55 +02:00
|
|
|
Tag tag;
|
2009-01-15 19:50:28 +01:00
|
|
|
|
2013-10-21 21:12:37 +02:00
|
|
|
flac_data(Decoder &decoder, struct input_stream *input_stream);
|
2012-10-02 19:47:31 +02:00
|
|
|
};
|
2009-11-10 21:42:15 +01:00
|
|
|
|
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);
|
|
|
|
|
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,
|
2009-11-11 19:52:14 +01:00
|
|
|
const FLAC__int32 *const buf[],
|
|
|
|
FLAC__uint64 nbytes);
|
2006-03-16 07:52:46 +01:00
|
|
|
|
2006-07-20 20:53:56 +02:00
|
|
|
#endif /* _FLAC_COMMON_H */
|