FLAC 1.3.4
Free Lossless Audio Codec
stream_decoder.h
Go to the documentation of this file.
1/* libFLAC - Free Lossless Audio Codec library
2 * Copyright (C) 2000-2009 Josh Coalson
3 * Copyright (C) 2011-2016 Xiph.Org Foundation
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * - Neither the name of the Xiph.org Foundation nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef FLAC__STREAM_DECODER_H
34#define FLAC__STREAM_DECODER_H
35
36#include <stdio.h> /* for FILE */
37#include "export.h"
38#include "format.h"
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44
202typedef enum {
203
245
251extern FLAC_API const char * const FLAC__StreamDecoderStateString[];
252
253
256typedef enum {
257
283
289extern FLAC_API const char * const FLAC__StreamDecoderInitStatusString[];
290
291
294typedef enum {
295
314
320extern FLAC_API const char * const FLAC__StreamDecoderReadStatusString[];
321
322
325typedef enum {
326
337
343extern FLAC_API const char * const FLAC__StreamDecoderSeekStatusString[];
344
345
348typedef enum {
349
360
366extern FLAC_API const char * const FLAC__StreamDecoderTellStatusString[];
367
368
371typedef enum {
372
383
389extern FLAC_API const char * const FLAC__StreamDecoderLengthStatusString[];
390
391
394typedef enum {
395
403
409extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
410
411
427typedef enum {
428
442
448extern FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[];
449
450
451/***********************************************************************
452 *
453 * class FLAC__StreamDecoder
454 *
455 ***********************************************************************/
456
457struct FLAC__StreamDecoderProtected;
458struct FLAC__StreamDecoderPrivate;
463typedef struct {
464 struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
465 struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
467
517typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
518
552typedef FLAC__StreamDecoderSeekStatus (*FLAC__StreamDecoderSeekCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
553
590typedef FLAC__StreamDecoderTellStatus (*FLAC__StreamDecoderTellCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
591
628typedef FLAC__StreamDecoderLengthStatus (*FLAC__StreamDecoderLengthCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
629
655typedef FLAC__bool (*FLAC__StreamDecoderEofCallback)(const FLAC__StreamDecoder *decoder, void *client_data);
656
683typedef FLAC__StreamDecoderWriteStatus (*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
684
710typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
711
727typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
728
729
730/***********************************************************************
731 *
732 * Class constructor/destructor
733 *
734 ***********************************************************************/
735
744
752
753
754/***********************************************************************
755 *
756 * Public class method prototypes
757 *
758 ***********************************************************************/
759
776FLAC_API FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long serial_number);
777
798FLAC_API FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool value);
799
813
827FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
828
840
854
868FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
869
881
891
901
915
927
939
951
963
975
987
1007FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position);
1008
1074 FLAC__StreamDecoder *decoder,
1075 FLAC__StreamDecoderReadCallback read_callback,
1076 FLAC__StreamDecoderSeekCallback seek_callback,
1077 FLAC__StreamDecoderTellCallback tell_callback,
1078 FLAC__StreamDecoderLengthCallback length_callback,
1079 FLAC__StreamDecoderEofCallback eof_callback,
1080 FLAC__StreamDecoderWriteCallback write_callback,
1081 FLAC__StreamDecoderMetadataCallback metadata_callback,
1082 FLAC__StreamDecoderErrorCallback error_callback,
1083 void *client_data
1084);
1085
1155 FLAC__StreamDecoder *decoder,
1156 FLAC__StreamDecoderReadCallback read_callback,
1157 FLAC__StreamDecoderSeekCallback seek_callback,
1158 FLAC__StreamDecoderTellCallback tell_callback,
1159 FLAC__StreamDecoderLengthCallback length_callback,
1160 FLAC__StreamDecoderEofCallback eof_callback,
1161 FLAC__StreamDecoderWriteCallback write_callback,
1162 FLAC__StreamDecoderMetadataCallback metadata_callback,
1163 FLAC__StreamDecoderErrorCallback error_callback,
1164 void *client_data
1165);
1166
1205 FLAC__StreamDecoder *decoder,
1206 FILE *file,
1207 FLAC__StreamDecoderWriteCallback write_callback,
1208 FLAC__StreamDecoderMetadataCallback metadata_callback,
1209 FLAC__StreamDecoderErrorCallback error_callback,
1210 void *client_data
1211);
1212
1255 FLAC__StreamDecoder *decoder,
1256 FILE *file,
1257 FLAC__StreamDecoderWriteCallback write_callback,
1258 FLAC__StreamDecoderMetadataCallback metadata_callback,
1259 FLAC__StreamDecoderErrorCallback error_callback,
1260 void *client_data
1261);
1262
1297 FLAC__StreamDecoder *decoder,
1298 const char *filename,
1299 FLAC__StreamDecoderWriteCallback write_callback,
1300 FLAC__StreamDecoderMetadataCallback metadata_callback,
1301 FLAC__StreamDecoderErrorCallback error_callback,
1302 void *client_data
1303);
1304
1343 FLAC__StreamDecoder *decoder,
1344 const char *filename,
1345 FLAC__StreamDecoderWriteCallback write_callback,
1346 FLAC__StreamDecoderMetadataCallback metadata_callback,
1347 FLAC__StreamDecoderErrorCallback error_callback,
1348 void *client_data
1349);
1350
1371
1386
1418
1451
1472
1493
1534
1551FLAC_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
This module contains #defines and symbols for exporting function calls, and providing version informa...
This module contains structure definitions for the representation of FLAC format components in memory...
FLAC__ChannelAssignment
Definition: format.h:381
FLAC__MetadataType
Definition: format.h:489
FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder)
const char *const FLAC__StreamDecoderInitStatusString[]
FLAC__StreamDecoderErrorStatus
Definition: stream_decoder.h:427
FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadCallback read_callback, FLAC__StreamDecoderSeekCallback seek_callback, FLAC__StreamDecoderTellCallback tell_callback, FLAC__StreamDecoderLengthCallback length_callback, FLAC__StreamDecoderEofCallback eof_callback, FLAC__StreamDecoderWriteCallback write_callback, FLAC__StreamDecoderMetadataCallback metadata_callback, FLAC__StreamDecoderErrorCallback error_callback, void *client_data)
FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadCallback read_callback, FLAC__StreamDecoderSeekCallback seek_callback, FLAC__StreamDecoderTellCallback tell_callback, FLAC__StreamDecoderLengthCallback length_callback, FLAC__StreamDecoderEofCallback eof_callback, FLAC__StreamDecoderWriteCallback write_callback, FLAC__StreamDecoderMetadataCallback metadata_callback, FLAC__StreamDecoderErrorCallback error_callback, void *client_data)
FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder)
FLAC__StreamDecoderReadStatus(* FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
Definition: stream_decoder.h:517
const char * FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder)
FLAC__StreamDecoderState
Definition: stream_decoder.h:202
const char *const FLAC__StreamDecoderTellStatusString[]
FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_file(FLAC__StreamDecoder *decoder, const char *filename, FLAC__StreamDecoderWriteCallback write_callback, FLAC__StreamDecoderMetadataCallback metadata_callback, FLAC__StreamDecoderErrorCallback error_callback, void *client_data)
FLAC__StreamDecoderSeekStatus(* FLAC__StreamDecoderSeekCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
Definition: stream_decoder.h:552
FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_FILE(FLAC__StreamDecoder *decoder, FILE *file, FLAC__StreamDecoderWriteCallback write_callback, FLAC__StreamDecoderMetadataCallback metadata_callback, FLAC__StreamDecoderErrorCallback error_callback, void *client_data)
FLAC__bool(* FLAC__StreamDecoderEofCallback)(const FLAC__StreamDecoder *decoder, void *client_data)
Definition: stream_decoder.h:655
FLAC__StreamDecoderLengthStatus(* FLAC__StreamDecoderLengthCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
Definition: stream_decoder.h:628
FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file(FLAC__StreamDecoder *decoder, const char *filename, FLAC__StreamDecoderWriteCallback write_callback, FLAC__StreamDecoderMetadataCallback metadata_callback, FLAC__StreamDecoderErrorCallback error_callback, void *client_data)
FLAC__StreamDecoderWriteStatus(* FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *const buffer[], void *client_data)
Definition: stream_decoder.h:683
uint32_t FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *decoder, FLAC__uint64 sample)
void(* FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
Definition: stream_decoder.h:710
FLAC__StreamDecoderWriteStatus
Definition: stream_decoder.h:394
const char *const FLAC__StreamDecoderLengthStatusString[]
FLAC__bool FLAC__stream_decoder_set_ogg_serial_number(FLAC__StreamDecoder *decoder, long serial_number)
uint32_t FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder)
FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_FILE(FLAC__StreamDecoder *decoder, FILE *file, FLAC__StreamDecoderWriteCallback write_callback, FLAC__StreamDecoderMetadataCallback metadata_callback, FLAC__StreamDecoderErrorCallback error_callback, void *client_data)
FLAC__StreamDecoderTellStatus
Definition: stream_decoder.h:348
FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_set_md5_checking(FLAC__StreamDecoder *decoder, FLAC__bool value)
FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder)
uint32_t FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder)
const char *const FLAC__StreamDecoderWriteStatusString[]
FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4])
FLAC__StreamDecoderInitStatus
Definition: stream_decoder.h:256
const char *const FLAC__StreamDecoderReadStatusString[]
const char *const FLAC__StreamDecoderStateString[]
const char *const FLAC__StreamDecoderErrorStatusString[]
const char *const FLAC__StreamDecoderSeekStatusString[]
void(* FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
Definition: stream_decoder.h:727
FLAC__StreamDecoderSeekStatus
Definition: stream_decoder.h:325
FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type)
FLAC__StreamDecoderLengthStatus
Definition: stream_decoder.h:371
FLAC__StreamDecoder * FLAC__stream_decoder_new(void)
FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type)
FLAC__StreamDecoderReadStatus
Definition: stream_decoder.h:294
void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_get_md5_checking(const FLAC__StreamDecoder *decoder)
FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4])
FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder)
FLAC__StreamDecoderTellStatus(* FLAC__StreamDecoderTellCallback)(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
Definition: stream_decoder.h:590
uint32_t FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder)
FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamDecoder *decoder, FLAC__uint64 *position)
@ FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
Definition: stream_decoder.h:435
@ FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
Definition: stream_decoder.h:429
@ FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
Definition: stream_decoder.h:438
@ FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
Definition: stream_decoder.h:432
@ FLAC__STREAM_DECODER_READ_FRAME
Definition: stream_decoder.h:215
@ FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR
Definition: stream_decoder.h:233
@ FLAC__STREAM_DECODER_END_OF_STREAM
Definition: stream_decoder.h:218
@ FLAC__STREAM_DECODER_OGG_ERROR
Definition: stream_decoder.h:221
@ FLAC__STREAM_DECODER_READ_METADATA
Definition: stream_decoder.h:207
@ FLAC__STREAM_DECODER_UNINITIALIZED
Definition: stream_decoder.h:238
@ FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC
Definition: stream_decoder.h:210
@ FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
Definition: stream_decoder.h:204
@ FLAC__STREAM_DECODER_ABORTED
Definition: stream_decoder.h:230
@ FLAC__STREAM_DECODER_SEEK_ERROR
Definition: stream_decoder.h:224
@ FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
Definition: stream_decoder.h:399
@ FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE
Definition: stream_decoder.h:396
@ FLAC__STREAM_DECODER_TELL_STATUS_OK
Definition: stream_decoder.h:350
@ FLAC__STREAM_DECODER_TELL_STATUS_ERROR
Definition: stream_decoder.h:353
@ FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED
Definition: stream_decoder.h:356
@ FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR
Definition: stream_decoder.h:269
@ FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS
Definition: stream_decoder.h:266
@ FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE
Definition: stream_decoder.h:272
@ FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER
Definition: stream_decoder.h:261
@ FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED
Definition: stream_decoder.h:276
@ FLAC__STREAM_DECODER_INIT_STATUS_OK
Definition: stream_decoder.h:258
@ FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED
Definition: stream_decoder.h:333
@ FLAC__STREAM_DECODER_SEEK_STATUS_ERROR
Definition: stream_decoder.h:330
@ FLAC__STREAM_DECODER_SEEK_STATUS_OK
Definition: stream_decoder.h:327
@ FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR
Definition: stream_decoder.h:376
@ FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED
Definition: stream_decoder.h:379
@ FLAC__STREAM_DECODER_LENGTH_STATUS_OK
Definition: stream_decoder.h:373
@ FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM
Definition: stream_decoder.h:299
@ FLAC__STREAM_DECODER_READ_STATUS_ABORT
Definition: stream_decoder.h:310
@ FLAC__STREAM_DECODER_READ_STATUS_CONTINUE
Definition: stream_decoder.h:296
Definition: format.h:473
Definition: stream_decoder.h:463
Definition: format.h:834