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