1 /* libFLAC - Free Lossless Audio Codec library
2 * Copyright (C) 2000,2001 Josh Coalson
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef FLAC__FILE_DECODER_H
21 #define FLAC__FILE_DECODER_H
23 #include "stream_decoder.h"
26 FLAC__FILE_DECODER_OK = 0,
27 FLAC__FILE_DECODER_SEEKING,
28 FLAC__FILE_DECODER_END_OF_FILE,
29 FLAC__FILE_DECODER_ERROR_OPENING_FILE,
30 FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR,
31 FLAC__FILE_DECODER_SEEK_ERROR,
32 FLAC__FILE_DECODER_STREAM_ERROR,
33 FLAC__FILE_DECODER_MD5_ERROR,
34 FLAC__FILE_DECODER_UNINITIALIZED
35 } FLAC__FileDecoderState;
36 extern const char *FLAC__FileDecoderStateString[];
38 struct FLAC__FileDecoderPrivate;
40 /* this field may not change once FLAC__file_decoder_init() is called */
41 bool check_md5; /* if true, generate MD5 signature of decoded data and compare against signature in the Encoding metadata block */
43 FLAC__FileDecoderState state; /* must be FLAC__FILE_DECODER_UNINITIALIZED when passed to FLAC__file_decoder_init() */
44 struct FLAC__FileDecoderPrivate *guts; /* must be 0 when passed to FLAC__file_decoder_init() */
47 FLAC__FileDecoder *FLAC__file_decoder_get_new_instance();
48 void FLAC__file_decoder_free_instance(FLAC__FileDecoder *decoder);
49 FLAC__FileDecoderState FLAC__file_decoder_init(
50 FLAC__FileDecoder *decoder,
52 FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const int32 *buffer[], void *client_data),
53 void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data),
54 void (*error_callback)(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data),
57 /* 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 */
58 bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder);
59 bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder);
60 bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder);
61 bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder);
62 bool FLAC__file_decoder_process_remaining_frames(FLAC__FileDecoder *decoder);
63 bool FLAC__file_decoder_seek_absolute(FLAC__FileDecoder *decoder, uint64 sample);