FLAC
1.2.1
Main Page
Modules
Classes
Files
File List
File Members
include
FLAC
stream_decoder.h
Go to the documentation of this file.
1
/* libFLAC - Free Lossless Audio Codec library
2
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
6
* are met:
7
*
8
* - Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
*
11
* - Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
*
15
* - Neither the name of the Xiph.org Foundation nor the names of its
16
* contributors may be used to endorse or promote products derived from
17
* this software without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
23
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
*/
31
32
#ifndef FLAC__STREAM_DECODER_H
33
#define FLAC__STREAM_DECODER_H
34
35
#include <stdio.h>
/* for FILE */
36
#include "
export.h
"
37
#include "
format.h
"
38
39
#ifdef __cplusplus
40
extern
"C"
{
41
#endif
42
43
201
typedef
enum
{
202
203
FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
= 0,
206
FLAC__STREAM_DECODER_READ_METADATA
,
209
FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC
,
214
FLAC__STREAM_DECODER_READ_FRAME
,
217
FLAC__STREAM_DECODER_END_OF_STREAM
,
220
FLAC__STREAM_DECODER_OGG_ERROR
,
223
FLAC__STREAM_DECODER_SEEK_ERROR
,
229
FLAC__STREAM_DECODER_ABORTED
,
232
FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR
,
237
FLAC__STREAM_DECODER_UNINITIALIZED
243
}
FLAC__StreamDecoderState
;
244
250
extern
FLAC_API
const
char
*
const
FLAC__StreamDecoderStateString
[];
251
252
255
typedef
enum
{
256
257
FLAC__STREAM_DECODER_INIT_STATUS_OK
= 0,
260
FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER
,
265
FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS
,
268
FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR
,
271
FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE
,
275
FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED
281
}
FLAC__StreamDecoderInitStatus
;
282
288
extern
FLAC_API
const
char
*
const
FLAC__StreamDecoderInitStatusString
[];
289
290
293
typedef
enum
{
294
295
FLAC__STREAM_DECODER_READ_STATUS_CONTINUE
,
298
FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM
,
309
FLAC__STREAM_DECODER_READ_STATUS_ABORT
312
}
FLAC__StreamDecoderReadStatus
;
313
319
extern
FLAC_API
const
char
*
const
FLAC__StreamDecoderReadStatusString
[];
320
321
324
typedef
enum
{
325
326
FLAC__STREAM_DECODER_SEEK_STATUS_OK
,
329
FLAC__STREAM_DECODER_SEEK_STATUS_ERROR
,
332
FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
335
}
FLAC__StreamDecoderSeekStatus
;
336
342
extern
FLAC_API
const
char
*
const
FLAC__StreamDecoderSeekStatusString
[];
343
344
347
typedef
enum
{
348
349
FLAC__STREAM_DECODER_TELL_STATUS_OK
,
352
FLAC__STREAM_DECODER_TELL_STATUS_ERROR
,
355
FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
358
}
FLAC__StreamDecoderTellStatus
;
359
365
extern
FLAC_API
const
char
*
const
FLAC__StreamDecoderTellStatusString
[];
366
367
370
typedef
enum
{
371
372
FLAC__STREAM_DECODER_LENGTH_STATUS_OK
,
375
FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR
,
378
FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
381
}
FLAC__StreamDecoderLengthStatus
;
382
388
extern
FLAC_API
const
char
*
const
FLAC__StreamDecoderLengthStatusString
[];
389
390
393
typedef
enum
{
394
395
FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE
,
398
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
401
}
FLAC__StreamDecoderWriteStatus
;
402
408
extern
FLAC_API
const
char
*
const
FLAC__StreamDecoderWriteStatusString
[];
409
410
426
typedef
enum
{
427
428
FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
,
431
FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
,
434
FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
,
437
FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
440
}
FLAC__StreamDecoderErrorStatus
;
441
447
extern
FLAC_API
const
char
*
const
FLAC__StreamDecoderErrorStatusString
[];
448
449
450
/***********************************************************************
451
*
452
* class FLAC__StreamDecoder
453
*
454
***********************************************************************/
455
456
struct
FLAC__StreamDecoderProtected;
457
struct
FLAC__StreamDecoderPrivate;
462
typedef
struct
{
463
struct
FLAC__StreamDecoderProtected *protected_;
/* avoid the C++ keyword 'protected' */
464
struct
FLAC__StreamDecoderPrivate *private_;
/* avoid the C++ keyword 'private' */
465
}
FLAC__StreamDecoder
;
466
516
typedef
FLAC__StreamDecoderReadStatus
(*
FLAC__StreamDecoderReadCallback
)(
const
FLAC__StreamDecoder
*decoder, FLAC__byte buffer[],
size_t
*bytes,
void
*client_data);
517
551
typedef
FLAC__StreamDecoderSeekStatus
(*
FLAC__StreamDecoderSeekCallback
)(
const
FLAC__StreamDecoder
*decoder, FLAC__uint64 absolute_byte_offset,
void
*client_data);
552
589
typedef
FLAC__StreamDecoderTellStatus
(*
FLAC__StreamDecoderTellCallback
)(
const
FLAC__StreamDecoder
*decoder, FLAC__uint64 *absolute_byte_offset,
void
*client_data);
590
627
typedef
FLAC__StreamDecoderLengthStatus
(*
FLAC__StreamDecoderLengthCallback
)(
const
FLAC__StreamDecoder
*decoder, FLAC__uint64 *stream_length,
void
*client_data);
628
654
typedef
FLAC__bool (*
FLAC__StreamDecoderEofCallback
)(
const
FLAC__StreamDecoder
*decoder,
void
*client_data);
655
682
typedef
FLAC__StreamDecoderWriteStatus
(*
FLAC__StreamDecoderWriteCallback
)(
const
FLAC__StreamDecoder
*decoder,
const
FLAC__Frame
*frame,
const
FLAC__int32 *
const
buffer[],
void
*client_data);
683
709
typedef
void (*
FLAC__StreamDecoderMetadataCallback
)(
const
FLAC__StreamDecoder
*decoder,
const
FLAC__StreamMetadata
*metadata,
void
*client_data);
710
726
typedef
void (*
FLAC__StreamDecoderErrorCallback
)(
const
FLAC__StreamDecoder
*decoder,
FLAC__StreamDecoderErrorStatus
status,
void
*client_data);
727
728
729
/***********************************************************************
730
*
731
* Class constructor/destructor
732
*
733
***********************************************************************/
734
742
FLAC_API
FLAC__StreamDecoder
*
FLAC__stream_decoder_new
(
void
);
743
750
FLAC_API
void
FLAC__stream_decoder_delete
(
FLAC__StreamDecoder
*decoder);
751
752
753
/***********************************************************************
754
*
755
* Public class method prototypes
756
*
757
***********************************************************************/
758
775
FLAC_API FLAC__bool
FLAC__stream_decoder_set_ogg_serial_number
(
FLAC__StreamDecoder
*decoder,
long
serial_number);
776
797
FLAC_API FLAC__bool
FLAC__stream_decoder_set_md5_checking
(
FLAC__StreamDecoder
*decoder, FLAC__bool value);
798
811
FLAC_API FLAC__bool
FLAC__stream_decoder_set_metadata_respond
(
FLAC__StreamDecoder
*decoder,
FLAC__MetadataType
type);
812
826
FLAC_API FLAC__bool
FLAC__stream_decoder_set_metadata_respond_application
(
FLAC__StreamDecoder
*decoder,
const
FLAC__byte
id
[4]);
827
838
FLAC_API FLAC__bool
FLAC__stream_decoder_set_metadata_respond_all
(
FLAC__StreamDecoder
*decoder);
839
852
FLAC_API FLAC__bool
FLAC__stream_decoder_set_metadata_ignore
(
FLAC__StreamDecoder
*decoder,
FLAC__MetadataType
type);
853
867
FLAC_API FLAC__bool
FLAC__stream_decoder_set_metadata_ignore_application
(
FLAC__StreamDecoder
*decoder,
const
FLAC__byte
id
[4]);
868
879
FLAC_API FLAC__bool
FLAC__stream_decoder_set_metadata_ignore_all
(
FLAC__StreamDecoder
*decoder);
880
889
FLAC_API
FLAC__StreamDecoderState
FLAC__stream_decoder_get_state
(
const
FLAC__StreamDecoder
*decoder);
890
899
FLAC_API
const
char
*
FLAC__stream_decoder_get_resolved_state_string
(
const
FLAC__StreamDecoder
*decoder);
900
913
FLAC_API FLAC__bool
FLAC__stream_decoder_get_md5_checking
(
const
FLAC__StreamDecoder
*decoder);
914
925
FLAC_API FLAC__uint64
FLAC__stream_decoder_get_total_samples
(
const
FLAC__StreamDecoder
*decoder);
926
937
FLAC_API
unsigned
FLAC__stream_decoder_get_channels
(
const
FLAC__StreamDecoder
*decoder);
938
949
FLAC_API
FLAC__ChannelAssignment
FLAC__stream_decoder_get_channel_assignment
(
const
FLAC__StreamDecoder
*decoder);
950
961
FLAC_API
unsigned
FLAC__stream_decoder_get_bits_per_sample
(
const
FLAC__StreamDecoder
*decoder);
962
973
FLAC_API
unsigned
FLAC__stream_decoder_get_sample_rate
(
const
FLAC__StreamDecoder
*decoder);
974
985
FLAC_API
unsigned
FLAC__stream_decoder_get_blocksize
(
const
FLAC__StreamDecoder
*decoder);
986
1006
FLAC_API FLAC__bool
FLAC__stream_decoder_get_decode_position
(
const
FLAC__StreamDecoder
*decoder, FLAC__uint64 *position);
1007
1072
FLAC_API
FLAC__StreamDecoderInitStatus
FLAC__stream_decoder_init_stream
(
1073
FLAC__StreamDecoder
*decoder,
1074
FLAC__StreamDecoderReadCallback
read_callback,
1075
FLAC__StreamDecoderSeekCallback
seek_callback,
1076
FLAC__StreamDecoderTellCallback
tell_callback,
1077
FLAC__StreamDecoderLengthCallback
length_callback,
1078
FLAC__StreamDecoderEofCallback
eof_callback,
1079
FLAC__StreamDecoderWriteCallback
write_callback,
1080
FLAC__StreamDecoderMetadataCallback
metadata_callback,
1081
FLAC__StreamDecoderErrorCallback
error_callback,
1082
void
*client_data
1083
);
1084
1153
FLAC_API
FLAC__StreamDecoderInitStatus
FLAC__stream_decoder_init_ogg_stream
(
1154
FLAC__StreamDecoder
*decoder,
1155
FLAC__StreamDecoderReadCallback
read_callback,
1156
FLAC__StreamDecoderSeekCallback
seek_callback,
1157
FLAC__StreamDecoderTellCallback
tell_callback,
1158
FLAC__StreamDecoderLengthCallback
length_callback,
1159
FLAC__StreamDecoderEofCallback
eof_callback,
1160
FLAC__StreamDecoderWriteCallback
write_callback,
1161
FLAC__StreamDecoderMetadataCallback
metadata_callback,
1162
FLAC__StreamDecoderErrorCallback
error_callback,
1163
void
*client_data
1164
);
1165
1203
FLAC_API
FLAC__StreamDecoderInitStatus
FLAC__stream_decoder_init_FILE
(
1204
FLAC__StreamDecoder
*decoder,
1205
FILE *file,
1206
FLAC__StreamDecoderWriteCallback
write_callback,
1207
FLAC__StreamDecoderMetadataCallback
metadata_callback,
1208
FLAC__StreamDecoderErrorCallback
error_callback,
1209
void
*client_data
1210
);
1211
1253
FLAC_API
FLAC__StreamDecoderInitStatus
FLAC__stream_decoder_init_ogg_FILE
(
1254
FLAC__StreamDecoder
*decoder,
1255
FILE *file,
1256
FLAC__StreamDecoderWriteCallback
write_callback,
1257
FLAC__StreamDecoderMetadataCallback
metadata_callback,
1258
FLAC__StreamDecoderErrorCallback
error_callback,
1259
void
*client_data
1260
);
1261
1295
FLAC_API
FLAC__StreamDecoderInitStatus
FLAC__stream_decoder_init_file
(
1296
FLAC__StreamDecoder
*decoder,
1297
const
char
*filename,
1298
FLAC__StreamDecoderWriteCallback
write_callback,
1299
FLAC__StreamDecoderMetadataCallback
metadata_callback,
1300
FLAC__StreamDecoderErrorCallback
error_callback,
1301
void
*client_data
1302
);
1303
1341
FLAC_API
FLAC__StreamDecoderInitStatus
FLAC__stream_decoder_init_ogg_file
(
1342
FLAC__StreamDecoder
*decoder,
1343
const
char
*filename,
1344
FLAC__StreamDecoderWriteCallback
write_callback,
1345
FLAC__StreamDecoderMetadataCallback
metadata_callback,
1346
FLAC__StreamDecoderErrorCallback
error_callback,
1347
void
*client_data
1348
);
1349
1369
FLAC_API FLAC__bool
FLAC__stream_decoder_finish
(
FLAC__StreamDecoder
*decoder);
1370
1384
FLAC_API FLAC__bool
FLAC__stream_decoder_flush
(
FLAC__StreamDecoder
*decoder);
1385
1417
FLAC_API FLAC__bool
FLAC__stream_decoder_reset
(
FLAC__StreamDecoder
*decoder);
1418
1450
FLAC_API FLAC__bool
FLAC__stream_decoder_process_single
(
FLAC__StreamDecoder
*decoder);
1451
1471
FLAC_API FLAC__bool
FLAC__stream_decoder_process_until_end_of_metadata
(
FLAC__StreamDecoder
*decoder);
1472
1492
FLAC_API FLAC__bool
FLAC__stream_decoder_process_until_end_of_stream
(
FLAC__StreamDecoder
*decoder);
1493
1533
FLAC_API FLAC__bool
FLAC__stream_decoder_skip_single_frame
(
FLAC__StreamDecoder
*decoder);
1534
1551
FLAC_API FLAC__bool
FLAC__stream_decoder_seek_absolute
(
FLAC__StreamDecoder
*decoder, FLAC__uint64 sample);
1552
1553
/* \} */
1554
1555
#ifdef __cplusplus
1556
}
1557
#endif
1558
1559
#endif
Copyright (c) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson