2001-02-08 00:38:41 +00:00
|
|
|
/* libFLAC - Free Lossless Audio Codec library
|
2001-01-16 20:17:53 +00:00
|
|
|
* Copyright (C) 2000,2001 Josh Coalson
|
2000-12-10 04:09:52 +00:00
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library 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
|
|
|
|
|
* Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef FLAC__FILE_DECODER_H
|
|
|
|
|
#define FLAC__FILE_DECODER_H
|
|
|
|
|
|
|
|
|
|
#include "stream_decoder.h"
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
2000-12-22 22:35:33 +00:00
|
|
|
FLAC__FILE_DECODER_OK = 0,
|
2000-12-10 04:09:52 +00:00
|
|
|
FLAC__FILE_DECODER_SEEKING,
|
|
|
|
|
FLAC__FILE_DECODER_END_OF_FILE,
|
|
|
|
|
FLAC__FILE_DECODER_ERROR_OPENING_FILE,
|
|
|
|
|
FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR,
|
|
|
|
|
FLAC__FILE_DECODER_SEEK_ERROR,
|
|
|
|
|
FLAC__FILE_DECODER_STREAM_ERROR,
|
2001-01-12 23:55:11 +00:00
|
|
|
FLAC__FILE_DECODER_MD5_ERROR,
|
2001-06-13 17:59:57 +00:00
|
|
|
FLAC__FILE_DECODER_STREAM_DECODER_ERROR,
|
|
|
|
|
FLAC__FILE_DECODER_ALREADY_INITIALIZED,
|
2000-12-10 04:09:52 +00:00
|
|
|
FLAC__FILE_DECODER_UNINITIALIZED
|
|
|
|
|
} FLAC__FileDecoderState;
|
2000-12-22 22:35:33 +00:00
|
|
|
extern const char *FLAC__FileDecoderStateString[];
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2001-06-13 17:59:57 +00:00
|
|
|
/***********************************************************************
|
|
|
|
|
*
|
|
|
|
|
* class FLAC__FileDecoder : public FLAC__StreamDecoder
|
|
|
|
|
*
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
struct FLAC__FileDecoderProtected;
|
2000-12-10 04:09:52 +00:00
|
|
|
struct FLAC__FileDecoderPrivate;
|
|
|
|
|
typedef struct {
|
2001-06-13 17:59:57 +00:00
|
|
|
struct FLAC__FileDecoderProtected *protected;
|
|
|
|
|
struct FLAC__FileDecoderPrivate *private;
|
2000-12-10 04:09:52 +00:00
|
|
|
} FLAC__FileDecoder;
|
|
|
|
|
|
2001-06-13 17:59:57 +00:00
|
|
|
/***********************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Class constructor/destructor
|
|
|
|
|
*
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
FLAC__FileDecoder *FLAC__file_decoder_new();
|
|
|
|
|
void FLAC__file_decoder_delete(FLAC__FileDecoder *);
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Public class method prototypes
|
|
|
|
|
*
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Initialize the instance; should be called after construction and
|
|
|
|
|
* before any other calls. Will set and return the decoder state,
|
|
|
|
|
* which will be FLAC__FILE_DECODER_OK if initialization succeeded.
|
|
|
|
|
*/
|
2000-12-10 04:09:52 +00:00
|
|
|
FLAC__FileDecoderState FLAC__file_decoder_init(
|
|
|
|
|
FLAC__FileDecoder *decoder,
|
2001-06-13 17:59:57 +00:00
|
|
|
bool check_md5,
|
2000-12-10 04:09:52 +00:00
|
|
|
const char *filename,
|
2001-01-23 23:07:36 +00:00
|
|
|
FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const int32 *buffer[], void *client_data),
|
2000-12-10 04:09:52 +00:00
|
|
|
void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data),
|
|
|
|
|
void (*error_callback)(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data),
|
|
|
|
|
void *client_data
|
|
|
|
|
);
|
2001-06-13 17:59:57 +00:00
|
|
|
/*
|
|
|
|
|
* only returns false if check_md5 is set AND the stored MD5 sum
|
|
|
|
|
* is non-zero AND the stored MD5 sum and computed MD5 sum do not
|
|
|
|
|
* match
|
|
|
|
|
*/
|
2001-01-12 23:55:11 +00:00
|
|
|
bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder);
|
2001-06-13 17:59:57 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* methods to return the file decoder state and check_md5 flag
|
|
|
|
|
*/
|
|
|
|
|
FLAC__FileDecoderState FLAC__file_decoder_state(const FLAC__FileDecoder *decoder);
|
|
|
|
|
bool FLAC__file_decoder_check_md5(const FLAC__FileDecoder *decoder);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* methods for decoding the data
|
|
|
|
|
*/
|
2000-12-10 04:09:52 +00:00
|
|
|
bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder);
|
|
|
|
|
bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder);
|
|
|
|
|
bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder);
|
|
|
|
|
bool FLAC__file_decoder_process_remaining_frames(FLAC__FileDecoder *decoder);
|
2001-06-13 17:59:57 +00:00
|
|
|
|
2000-12-10 04:09:52 +00:00
|
|
|
bool FLAC__file_decoder_seek_absolute(FLAC__FileDecoder *decoder, uint64 sample);
|
|
|
|
|
|
|
|
|
|
#endif
|