xref: /aosp_15_r20/external/tremolo/Tremolo/ivorbiscodec.h (revision bda690e46497e1f65c5077173b9c548e6e0cd5a1)
1*bda690e4SXin Li /************************************************************************
2*bda690e4SXin Li  * Copyright (C) 2002-2009, Xiph.org Foundation
3*bda690e4SXin Li  * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd
4*bda690e4SXin Li  * All rights reserved.
5*bda690e4SXin Li  *
6*bda690e4SXin Li  * Redistribution and use in source and binary forms, with or without
7*bda690e4SXin Li  * modification, are permitted provided that the following conditions
8*bda690e4SXin Li  * are met:
9*bda690e4SXin Li  *
10*bda690e4SXin Li  *     * Redistributions of source code must retain the above copyright
11*bda690e4SXin Li  * notice, this list of conditions and the following disclaimer.
12*bda690e4SXin Li  *     * Redistributions in binary form must reproduce the above
13*bda690e4SXin Li  * copyright notice, this list of conditions and the following disclaimer
14*bda690e4SXin Li  * in the documentation and/or other materials provided with the
15*bda690e4SXin Li  * distribution.
16*bda690e4SXin Li  *     * Neither the names of the Xiph.org Foundation nor Pinknoise
17*bda690e4SXin Li  * Productions Ltd nor the names of its contributors may be used to
18*bda690e4SXin Li  * endorse or promote products derived from this software without
19*bda690e4SXin Li  * specific prior written permission.
20*bda690e4SXin Li  *
21*bda690e4SXin Li  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*bda690e4SXin Li  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*bda690e4SXin Li  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24*bda690e4SXin Li  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25*bda690e4SXin Li  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26*bda690e4SXin Li  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27*bda690e4SXin Li  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28*bda690e4SXin Li  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29*bda690e4SXin Li  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30*bda690e4SXin Li  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31*bda690e4SXin Li  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32*bda690e4SXin Li  ************************************************************************
33*bda690e4SXin Li 
34*bda690e4SXin Li  function: libvorbis codec headers
35*bda690e4SXin Li 
36*bda690e4SXin Li  ************************************************************************/
37*bda690e4SXin Li 
38*bda690e4SXin Li #ifndef _vorbis_codec_h_
39*bda690e4SXin Li #define _vorbis_codec_h_
40*bda690e4SXin Li 
41*bda690e4SXin Li #ifdef __cplusplus
42*bda690e4SXin Li extern "C"
43*bda690e4SXin Li {
44*bda690e4SXin Li #endif /* __cplusplus */
45*bda690e4SXin Li 
46*bda690e4SXin Li #include "ogg.h"
47*bda690e4SXin Li 
48*bda690e4SXin Li struct vorbis_dsp_state;
49*bda690e4SXin Li typedef struct vorbis_dsp_state vorbis_dsp_state;
50*bda690e4SXin Li 
51*bda690e4SXin Li typedef struct vorbis_info{
52*bda690e4SXin Li   int version;
53*bda690e4SXin Li   int channels;
54*bda690e4SXin Li   long rate;
55*bda690e4SXin Li 
56*bda690e4SXin Li   /* The below bitrate declarations are *hints*.
57*bda690e4SXin Li      Combinations of the three values carry the following implications:
58*bda690e4SXin Li 
59*bda690e4SXin Li      all three set to the same value:
60*bda690e4SXin Li        implies a fixed rate bitstream
61*bda690e4SXin Li      only nominal set:
62*bda690e4SXin Li        implies a VBR stream that averages the nominal bitrate.  No hard
63*bda690e4SXin Li        upper/lower limit
64*bda690e4SXin Li      upper and or lower set:
65*bda690e4SXin Li        implies a VBR bitstream that obeys the bitrate limits. nominal
66*bda690e4SXin Li        may also be set to give a nominal rate.
67*bda690e4SXin Li      none set:
68*bda690e4SXin Li        the coder does not care to speculate.
69*bda690e4SXin Li   */
70*bda690e4SXin Li 
71*bda690e4SXin Li   long bitrate_upper;
72*bda690e4SXin Li   long bitrate_nominal;
73*bda690e4SXin Li   long bitrate_lower;
74*bda690e4SXin Li   long bitrate_window;
75*bda690e4SXin Li 
76*bda690e4SXin Li   void *codec_setup;
77*bda690e4SXin Li } vorbis_info;
78*bda690e4SXin Li 
79*bda690e4SXin Li typedef struct vorbis_comment{
80*bda690e4SXin Li   char **user_comments;
81*bda690e4SXin Li   int   *comment_lengths;
82*bda690e4SXin Li   int    comments;
83*bda690e4SXin Li   char  *vendor;
84*bda690e4SXin Li 
85*bda690e4SXin Li } vorbis_comment;
86*bda690e4SXin Li 
87*bda690e4SXin Li 
88*bda690e4SXin Li /* Vorbis PRIMITIVES: general ***************************************/
89*bda690e4SXin Li 
90*bda690e4SXin Li extern void     vorbis_info_init(vorbis_info *vi);
91*bda690e4SXin Li extern void     vorbis_info_clear(vorbis_info *vi);
92*bda690e4SXin Li extern int      vorbis_info_blocksize(vorbis_info *vi,int zo);
93*bda690e4SXin Li extern void     vorbis_comment_init(vorbis_comment *vc);
94*bda690e4SXin Li extern void     vorbis_comment_add(vorbis_comment *vc, char *comment);
95*bda690e4SXin Li extern void     vorbis_comment_add_tag(vorbis_comment *vc,
96*bda690e4SXin Li 				       char *tag, char *contents);
97*bda690e4SXin Li extern char    *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
98*bda690e4SXin Li extern int      vorbis_comment_query_count(vorbis_comment *vc, char *tag);
99*bda690e4SXin Li extern void     vorbis_comment_clear(vorbis_comment *vc);
100*bda690e4SXin Li 
101*bda690e4SXin Li /* Vorbis ERRORS and return codes ***********************************/
102*bda690e4SXin Li 
103*bda690e4SXin Li #define OV_FALSE      -1
104*bda690e4SXin Li #define OV_EOF        -2
105*bda690e4SXin Li #define OV_HOLE       -3
106*bda690e4SXin Li 
107*bda690e4SXin Li #define OV_EREAD      -128
108*bda690e4SXin Li #define OV_EFAULT     -129
109*bda690e4SXin Li #define OV_EIMPL      -130
110*bda690e4SXin Li #define OV_EINVAL     -131
111*bda690e4SXin Li #define OV_ENOTVORBIS -132
112*bda690e4SXin Li #define OV_EBADHEADER -133
113*bda690e4SXin Li #define OV_EVERSION   -134
114*bda690e4SXin Li #define OV_ENOTAUDIO  -135
115*bda690e4SXin Li #define OV_EBADPACKET -136
116*bda690e4SXin Li #define OV_EBADLINK   -137
117*bda690e4SXin Li #define OV_ENOSEEK    -138
118*bda690e4SXin Li 
119*bda690e4SXin Li #ifdef __cplusplus
120*bda690e4SXin Li }
121*bda690e4SXin Li #endif /* __cplusplus */
122*bda690e4SXin Li 
123*bda690e4SXin Li #endif
124*bda690e4SXin Li 
125