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