FLAC 1.4.2
Free Lossless Audio Codec
stream_encoder.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-2022 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_ENCODER_H
34#define FLAC__STREAM_ENCODER_H
35
36#include <stdio.h> /* for FILE */
37#include "export.h"
38#include "format.h"
39#include "stream_decoder.h"
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45
241typedef enum {
242
282
288extern FLAC_API const char * const FLAC__StreamEncoderStateString[];
289
290
293typedef enum {
294
351
357extern FLAC_API const char * const FLAC__StreamEncoderInitStatusString[];
358
359
362typedef enum {
363
377
383extern FLAC_API const char * const FLAC__StreamEncoderReadStatusString[];
384
385
388typedef enum {
389
397
403extern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[];
404
405
408typedef enum {
409
420
426extern FLAC_API const char * const FLAC__StreamEncoderSeekStatusString[];
427
428
431typedef enum {
432
443
449extern FLAC_API const char * const FLAC__StreamEncoderTellStatusString[];
450
451
452/***********************************************************************
453 *
454 * class FLAC__StreamEncoder
455 *
456 ***********************************************************************/
457
458struct FLAC__StreamEncoderProtected;
459struct FLAC__StreamEncoderPrivate;
464typedef struct {
465 struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */
466 struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */
468
518typedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
519
556typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data);
557
590typedef FLAC__StreamEncoderSeekStatus (*FLAC__StreamEncoderSeekCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
591
635typedef FLAC__StreamEncoderTellStatus (*FLAC__StreamEncoderTellCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
636
654typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data);
655
677typedef void (*FLAC__StreamEncoderProgressCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data);
678
679
680/***********************************************************************
681 *
682 * Class constructor/destructor
683 *
684 ***********************************************************************/
685
694
702
703
704/***********************************************************************
705 *
706 * Public class method prototypes
707 *
708 ***********************************************************************/
709
728
743FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value);
744
762
774
790
802
865
880
894
910
991FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *encoder, const char *specification);
992
1004
1018
1032
1044
1058
1081
1104
1116
1132
1214FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, uint32_t num_blocks);
1215
1233
1243
1255
1268
1286FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got);
1287
1297
1307
1317
1327
1337
1347
1357
1367
1377
1387
1397
1407
1417
1427
1437
1447
1460
1470
1533
1601
1636
1671
1707
1743
1771
1797FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], uint32_t samples);
1798
1829FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], uint32_t samples);
1830
1831/* \} */
1832
1833#ifdef __cplusplus
1834}
1835#endif
1836
1837#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...
#define FLAC_API
Definition: export.h:91
FLAC__StreamDecoderState
Definition: stream_decoder.h:202
FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value)
FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder)
void(* FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data)
Definition: stream_encoder.h:654
FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder)
const char *const FLAC__StreamEncoderInitStatusString[]
FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data)
const char *const FLAC__StreamEncoderStateString[]
FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder)
FLAC__StreamEncoder * FLAC__stream_encoder_new(void)
const char *const FLAC__StreamEncoderReadStatusString[]
uint32_t FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, uint32_t value)
FLAC__StreamEncoderReadStatus(* FLAC__StreamEncoderReadCallback)(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
Definition: stream_encoder.h:518
FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder)
void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got)
FLAC__StreamEncoderWriteStatus(* FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data)
Definition: stream_encoder.h:556
FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, uint32_t value)
FLAC__StreamEncoderReadStatus
Definition: stream_encoder.h:362
FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value)
FLAC__StreamEncoderWriteStatus
Definition: stream_encoder.h:388
FLAC__StreamEncoderInitStatus
Definition: stream_encoder.h:293
FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value)
uint32_t FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder)
void(* FLAC__StreamEncoderProgressCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data)
Definition: stream_encoder.h:677
FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data)
FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value)
uint32_t FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder)
FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE(FLAC__StreamEncoder *encoder, FILE *file, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data)
uint32_t FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *encoder, const char *specification)
FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder)
FLAC__StreamEncoderSeekStatus
Definition: stream_encoder.h:408
FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], uint32_t samples)
uint32_t FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder)
FLAC__StreamEncoderSeekStatus(* FLAC__StreamEncoderSeekCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
Definition: stream_encoder.h:590
void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_get_limit_min_bitrate(const FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, uint32_t value)
FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value)
FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value)
FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder)
FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data)
FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, uint32_t num_blocks)
FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 *const buffer[], uint32_t samples)
FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value)
uint32_t FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder)
FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderReadCallback read_callback, FLAC__StreamEncoderWriteCallback write_callback, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderTellCallback tell_callback, FLAC__StreamEncoderMetadataCallback metadata_callback, void *client_data)
FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file(FLAC__StreamEncoder *encoder, const char *filename, FLAC__StreamEncoderProgressCallback progress_callback, void *client_data)
FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, uint32_t value)
FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder)
const char *const FLAC__StreamEncoderWriteStatusString[]
FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, uint32_t value)
FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, uint32_t value)
FLAC__StreamEncoderTellStatus
Definition: stream_encoder.h:431
FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value)
FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value)
const char *const FLAC__StreamEncoderSeekStatusString[]
FLAC__StreamEncoderTellStatus(* FLAC__StreamEncoderTellCallback)(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
Definition: stream_encoder.h:635
FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, uint32_t value)
FLAC__StreamEncoderState
Definition: stream_encoder.h:241
FLAC__bool FLAC__stream_encoder_set_limit_min_bitrate(FLAC__StreamEncoder *encoder, FLAC__bool value)
uint32_t FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, uint32_t value)
uint32_t FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder)
FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value)
FLAC__bool FLAC__stream_encoder_set_ogg_serial_number(FLAC__StreamEncoder *encoder, long serial_number)
uint32_t FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder)
const char *const FLAC__StreamEncoderTellStatusString[]
const char * FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder)
@ FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE
Definition: stream_encoder.h:364
@ FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM
Definition: stream_encoder.h:367
@ FLAC__STREAM_ENCODER_READ_STATUS_ABORT
Definition: stream_encoder.h:370
@ FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED
Definition: stream_encoder.h:373
@ FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR
Definition: stream_encoder.h:393
@ FLAC__STREAM_ENCODER_WRITE_STATUS_OK
Definition: stream_encoder.h:390
@ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS
Definition: stream_encoder.h:309
@ FLAC__STREAM_ENCODER_INIT_STATUS_OK
Definition: stream_encoder.h:295
@ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER
Definition: stream_encoder.h:323
@ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION
Definition: stream_encoder.h:326
@ FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER
Definition: stream_encoder.h:329
@ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE
Definition: stream_encoder.h:320
@ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE
Definition: stream_encoder.h:317
@ FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER
Definition: stream_encoder.h:301
@ FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR
Definition: stream_encoder.h:298
@ FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE
Definition: stream_encoder.h:332
@ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA
Definition: stream_encoder.h:335
@ FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED
Definition: stream_encoder.h:344
@ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS
Definition: stream_encoder.h:306
@ FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE
Definition: stream_encoder.h:312
@ FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
Definition: stream_encoder.h:416
@ FLAC__STREAM_ENCODER_SEEK_STATUS_OK
Definition: stream_encoder.h:410
@ FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR
Definition: stream_encoder.h:413
@ FLAC__STREAM_ENCODER_TELL_STATUS_OK
Definition: stream_encoder.h:433
@ FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
Definition: stream_encoder.h:439
@ FLAC__STREAM_ENCODER_TELL_STATUS_ERROR
Definition: stream_encoder.h:436
@ FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA
Definition: stream_encoder.h:260
@ FLAC__STREAM_ENCODER_UNINITIALIZED
Definition: stream_encoder.h:246
@ FLAC__STREAM_ENCODER_FRAMING_ERROR
Definition: stream_encoder.h:273
@ FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR
Definition: stream_encoder.h:278
@ FLAC__STREAM_ENCODER_OK
Definition: stream_encoder.h:243
@ FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR
Definition: stream_encoder.h:255
@ FLAC__STREAM_ENCODER_CLIENT_ERROR
Definition: stream_encoder.h:265
@ FLAC__STREAM_ENCODER_OGG_ERROR
Definition: stream_encoder.h:252
@ FLAC__STREAM_ENCODER_IO_ERROR
Definition: stream_encoder.h:268
This module contains the functions which implement the stream decoder.
Definition: stream_encoder.h:464
Definition: format.h:841

Copyright (c) 2000-2009 Josh Coalson Copyright (c) 2011-2022 Xiph.Org Foundation