2001-02-08 00:38:41 +00:00
|
|
|
/* libFLAC - Free Lossless Audio Codec library
|
2002-01-26 17:36:39 +00:00
|
|
|
* Copyright (C) 2000,2001,2002 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"
|
|
|
|
|
2002-05-06 17:39:29 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2000-12-10 04:09:52 +00:00
|
|
|
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_END_OF_FILE,
|
|
|
|
FLAC__FILE_DECODER_ERROR_OPENING_FILE,
|
|
|
|
FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR,
|
|
|
|
FLAC__FILE_DECODER_SEEK_ERROR,
|
2002-06-01 05:45:50 +00:00
|
|
|
FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR,
|
2001-06-13 17:59:57 +00:00
|
|
|
FLAC__FILE_DECODER_ALREADY_INITIALIZED,
|
2001-06-16 07:32:25 +00:00
|
|
|
FLAC__FILE_DECODER_INVALID_CALLBACK,
|
2002-06-01 05:45:50 +00:00
|
|
|
FLAC__FILE_DECODER_UNINITIALIZED
|
2000-12-10 04:09:52 +00:00
|
|
|
} 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-08-16 20:07:29 +00:00
|
|
|
struct FLAC__FileDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
|
|
|
|
struct FLAC__FileDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
|
2000-12-10 04:09:52 +00:00
|
|
|
} FLAC__FileDecoder;
|
|
|
|
|
2001-06-13 17:59:57 +00:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* Class constructor/destructor
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
2001-06-16 07:32:25 +00:00
|
|
|
/*
|
|
|
|
* Any parameters that are not set before FLAC__file_decoder_init()
|
|
|
|
* will take on the defaults from the constructor, shown below.
|
|
|
|
* For more on what the parameters mean, see the documentation.
|
|
|
|
*
|
2001-06-23 03:03:24 +00:00
|
|
|
* FLAC__bool md5_checking (DEFAULT: false) MD5 checking will be turned off if a seek is requested
|
|
|
|
* (*write_callback)() (DEFAULT: NULL ) The callbacks are the only values that MUST be set before FLAC__file_decoder_init()
|
|
|
|
* (*metadata_callback)() (DEFAULT: NULL )
|
|
|
|
* (*error_callback)() (DEFAULT: NULL )
|
|
|
|
* void* client_data (DEFAULT: NULL ) passed back through the callbacks
|
2001-06-16 07:32:25 +00:00
|
|
|
*/
|
2001-06-13 17:59:57 +00:00
|
|
|
FLAC__FileDecoder *FLAC__file_decoder_new();
|
|
|
|
void FLAC__file_decoder_delete(FLAC__FileDecoder *);
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* Public class method prototypes
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
/*
|
2001-06-16 07:32:25 +00:00
|
|
|
* Various "set" methods. These may only be called when the decoder
|
|
|
|
* is in the state FLAC__FILE_DECODER_UNINITIALIZED, i.e. after
|
|
|
|
* FLAC__file_decoder_new() or FLAC__file_decoder_finish(), but
|
|
|
|
* before FLAC__file_decoder_init(). If this is the case they will
|
|
|
|
* return true, otherwise false.
|
|
|
|
*
|
|
|
|
* NOTE that these functions do not validate the values as many are
|
|
|
|
* interdependent. The FLAC__file_decoder_init() function will do
|
|
|
|
* this, so make sure to pay attention to the state returned by
|
|
|
|
* FLAC__file_decoder_init().
|
|
|
|
*
|
|
|
|
* Any parameters that are not set before FLAC__file_decoder_init()
|
|
|
|
* will take on the defaults from the constructor. NOTE that
|
|
|
|
* FLAC__file_decoder_flush() or FLAC__file_decoder_reset() do
|
|
|
|
* NOT reset the values to the constructor defaults.
|
2002-05-29 05:51:24 +00:00
|
|
|
@@@@ update so that only _set_ methods that need to return FLAC__bool, else void; update documentation.html also
|
|
|
|
@@@@ update defaults above and in documentation.html about the metadata_respond/ignore defaults
|
2001-06-13 17:59:57 +00:00
|
|
|
*/
|
2002-05-29 05:51:24 +00:00
|
|
|
FLAC__bool FLAC__file_decoder_set_md5_checking(FLAC__FileDecoder *decoder, FLAC__bool value);
|
|
|
|
FLAC__bool FLAC__file_decoder_set_filename(FLAC__FileDecoder *decoder, const char *value); /* 'value' may not be 0; use "-" for stdin */
|
|
|
|
FLAC__bool FLAC__file_decoder_set_write_callback(FLAC__FileDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data));
|
|
|
|
FLAC__bool FLAC__file_decoder_set_metadata_callback(FLAC__FileDecoder *decoder, void (*value)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data));
|
|
|
|
FLAC__bool FLAC__file_decoder_set_error_callback(FLAC__FileDecoder *decoder, void (*value)(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data));
|
|
|
|
FLAC__bool FLAC__file_decoder_set_client_data(FLAC__FileDecoder *decoder, void *value);
|
2002-05-07 05:30:27 +00:00
|
|
|
/*
|
|
|
|
* See the comments for the equivalent functions in stream_decoder.h
|
|
|
|
*/
|
2002-05-29 05:51:24 +00:00
|
|
|
FLAC__bool FLAC__file_decoder_set_metadata_respond(FLAC__FileDecoder *decoder, FLAC__MetaDataType type);
|
|
|
|
FLAC__bool FLAC__file_decoder_set_metadata_respond_application(FLAC__FileDecoder *decoder, const FLAC__byte id[4]);
|
|
|
|
FLAC__bool FLAC__file_decoder_set_metadata_respond_all(FLAC__FileDecoder *decoder);
|
|
|
|
FLAC__bool FLAC__file_decoder_set_metadata_ignore(FLAC__FileDecoder *decoder, FLAC__MetaDataType type);
|
|
|
|
FLAC__bool FLAC__file_decoder_set_metadata_ignore_application(FLAC__FileDecoder *decoder, const FLAC__byte id[4]);
|
|
|
|
FLAC__bool FLAC__file_decoder_set_metadata_ignore_all(FLAC__FileDecoder *decoder);
|
2001-06-16 07:32:25 +00:00
|
|
|
|
2001-06-13 17:59:57 +00:00
|
|
|
/*
|
2001-06-16 07:32:25 +00:00
|
|
|
* Various "get" methods
|
2001-06-13 17:59:57 +00:00
|
|
|
*/
|
2001-06-16 07:32:25 +00:00
|
|
|
FLAC__FileDecoderState FLAC__file_decoder_get_state(const FLAC__FileDecoder *decoder);
|
2001-06-23 03:03:24 +00:00
|
|
|
FLAC__bool FLAC__file_decoder_get_md5_checking(const FLAC__FileDecoder *decoder);
|
2001-06-16 07:32:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the instance; should be called after construction and
|
|
|
|
* 'set' calls but before any of the 'process' or 'seek' calls. Will
|
|
|
|
* set and return the decoder state, which will be FLAC__FILE_DECODER_OK
|
2001-11-08 23:59:22 +00:00
|
|
|
* if initialization succeeded.
|
2001-06-16 07:32:25 +00:00
|
|
|
*/
|
|
|
|
FLAC__FileDecoderState FLAC__file_decoder_init(FLAC__FileDecoder *decoder);
|
2001-06-13 17:59:57 +00:00
|
|
|
|
|
|
|
/*
|
2001-06-16 07:32:25 +00:00
|
|
|
* Flush the decoding buffer, release resources, and return the decoder
|
|
|
|
* state to FLAC__FILE_DECODER_UNINITIALIZED. Only returns false if
|
|
|
|
* md5_checking is set AND the stored MD5 sum is non-zero AND the stored
|
|
|
|
* MD5 sum and computed MD5 sum do not match.
|
2001-06-13 17:59:57 +00:00
|
|
|
*/
|
2001-06-23 03:03:24 +00:00
|
|
|
FLAC__bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder);
|
2001-06-13 17:59:57 +00:00
|
|
|
|
|
|
|
/*
|
2001-06-16 07:32:25 +00:00
|
|
|
* Methods for decoding the data
|
2001-06-13 17:59:57 +00:00
|
|
|
*/
|
2001-06-23 03:03:24 +00:00
|
|
|
FLAC__bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder);
|
|
|
|
FLAC__bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder);
|
|
|
|
FLAC__bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder);
|
|
|
|
FLAC__bool FLAC__file_decoder_process_remaining_frames(FLAC__FileDecoder *decoder);
|
2001-06-13 17:59:57 +00:00
|
|
|
|
2001-06-23 03:03:24 +00:00
|
|
|
FLAC__bool FLAC__file_decoder_seek_absolute(FLAC__FileDecoder *decoder, FLAC__uint64 sample);
|
2000-12-10 04:09:52 +00:00
|
|
|
|
2002-05-06 17:39:29 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-12-10 04:09:52 +00:00
|
|
|
#endif
|