• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/minidlna/flac-1.2.1/src/libFLAC/include/private/
1/* libFLAC - Free Lossless Audio Codec library
2 * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007  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__PRIVATE__BITWRITER_H
33#define FLAC__PRIVATE__BITWRITER_H
34
35#include <stdio.h> /* for FILE */
36#include "FLAC/ordinals.h"
37
38/*
39 * opaque structure definition
40 */
41struct FLAC__BitWriter;
42typedef struct FLAC__BitWriter FLAC__BitWriter;
43
44/*
45 * construction, deletion, initialization, etc functions
46 */
47FLAC__BitWriter *FLAC__bitwriter_new(void);
48void FLAC__bitwriter_delete(FLAC__BitWriter *bw);
49FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw);
50void FLAC__bitwriter_free(FLAC__BitWriter *bw); /* does not 'free(buffer)' */
51void FLAC__bitwriter_clear(FLAC__BitWriter *bw);
52void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out);
53
54/*
55 * CRC functions
56 *
57 * non-const *bw because they have to cal FLAC__bitwriter_get_buffer()
58 */
59FLAC__bool FLAC__bitwriter_get_write_crc16(FLAC__BitWriter *bw, FLAC__uint16 *crc);
60FLAC__bool FLAC__bitwriter_get_write_crc8(FLAC__BitWriter *bw, FLAC__byte *crc);
61
62/*
63 * info functions
64 */
65FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw);
66unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw); /* can be called anytime, returns total # of bits unconsumed */
67
68/*
69 * direct buffer access
70 *
71 * there may be no calls on the bitwriter between get and release.
72 * the bitwriter continues to own the returned buffer.
73 * before get, bitwriter MUST be byte aligned: check with FLAC__bitwriter_is_byte_aligned()
74 */
75FLAC__bool FLAC__bitwriter_get_buffer(FLAC__BitWriter *bw, const FLAC__byte **buffer, size_t *bytes);
76void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw);
77
78/*
79 * write functions
80 */
81FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits);
82FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits);
83FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits);
84FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits);
85FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val); /*only for bits=32*/
86FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals);
87FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val);
88unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter);
89#if 0 /* UNUSED */
90unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter);
91unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned val, unsigned parameter);
92#endif
93FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter);
94FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter);
95#if 0 /* UNUSED */
96FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter);
97FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned val, unsigned parameter);
98#endif
99FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 val);
100FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 val);
101FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw);
102
103#endif
104