1 /**
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #include <stdlib.h>
17 #include <string.h>
18
19 #define REF_COUNT 1
20 #define DECODE_PACKET 1
21
22 extern "C" {
23 #include <Tremolo/codec_internal.h>
24
25 int _vorbis_unpack_books(vorbis_info *vi, oggpack_buffer *opb);
26 int _vorbis_unpack_info(vorbis_info *vi, oggpack_buffer *opb);
27 int _vorbis_unpack_comment(vorbis_comment *vc, oggpack_buffer *opb);
28 }
29 const uint8_t packInfoData[] = {0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0xBB, 0x00,
30 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31 0x00, 0x00, 0x00, 0x00, 0x00, 0xBB, 0x01};
32
33 unsigned char unpackBookData[] = {
34 0x1C, 0x42, 0x43, 0x56, 0x02, 0x00, 0x10, 0x00, 0x00, 0x84, 0x74, 0x9A,
35 0x59, 0xAA, 0x01, 0x22, 0xCC, 0x40, 0x86, 0x81, 0xD0, 0x90, 0x95, 0x00,
36 0x00, 0x02, 0x00, 0x00, 0x60, 0x84, 0x22, 0x0C, 0x31, 0x20, 0x34, 0x64,
37 0x25, 0x00, 0x00, 0x10, 0x00, 0x00, 0x20, 0x86, 0x92, 0x83, 0x68, 0x42,
38 0x6B, 0xCE, 0x37, 0xE7, 0x38, 0x68, 0x96, 0x83, 0xA6, 0x52, 0x6C, 0x4E,
39 0x07, 0x27, 0x52, 0x6D, 0x9E, 0xE4, 0xA6, 0x62, 0x6E, 0xCE, 0x39, 0xE7,
40 0x9C, 0x73, 0xB2, 0x39, 0x67, 0x8C, 0x73, 0xCE, 0x39, 0xA7, 0x28, 0x67,
41 0x16, 0x83, 0x66, 0x42, 0x6B, 0xCE, 0x39, 0x27, 0x31, 0x68, 0x96, 0x82,
42 0x66, 0x42, 0x6B, 0xCE, 0x39, 0xE7, 0x49, 0x6C, 0x1E, 0xB4, 0xA6, 0x4A,
43 0x6B, 0xCE, 0x39, 0x67, 0x9C, 0x73, 0x3A, 0x18, 0x67, 0x84, 0x71, 0xCE,
44 0x39, 0xA7, 0x49, 0x6B, 0x1E, 0xA4, 0x66, 0x63, 0x6D, 0xCE, 0x39, 0x67,
45 0x41, 0x6B, 0x9A, 0xA3, 0xE6, 0x52, 0x6C, 0xCE, 0x39, 0x27, 0x52, 0x6E,
46 0x9E, 0xD4, 0xE6, 0x52, 0x6D, 0xCE, 0x39, 0xE7, 0x9C, 0x73, 0xCE, 0x39,
47 0xE7, 0x9C, 0x73, 0xCE, 0x39, 0xA7, 0x7A, 0x71, 0x3A, 0x07, 0xE7, 0x84,
48 0x73, 0xCE, 0x39, 0x27, 0x6A, 0x6F, 0xAE, 0xE5, 0x26, 0x74, 0x71, 0xCE,
49 0x39, 0xE7, 0x93, 0x71, 0xBA, 0x37, 0x27, 0x84, 0x73, 0xCE, 0x39, 0xE7,
50 0x9C, 0x73, 0xCE, 0x39, 0xE7, 0x9C, 0x73, 0xCE, 0x39, 0x27, 0x08, 0x0D,
51 0x59, 0x09, 0x00, 0x00, 0x01, 0x00, 0x10, 0x84, 0x61, 0x63, 0x18, 0x77,
52 0x0A, 0x82, 0xF4, 0x39, 0x1A, 0x88, 0x51, 0x84, 0x98, 0x86, 0x4C, 0x7A,
53 0xD0, 0x3D, 0x3A, 0x4C, 0x82, 0xC6, 0x20, 0xA7, 0x90, 0x7A, 0x34, 0x3A,
54 0x1A, 0x29, 0xA5, 0x0E, 0x42, 0x49, 0x65, 0x9C, 0x94, 0xD2, 0x09, 0x42,
55 0x43, 0x56, 0x02, 0x00, 0x80, 0x00, 0x00, 0x10, 0x42, 0x48, 0x21, 0x85,
56 0x14, 0x52, 0x48, 0x21, 0x85, 0x14, 0x52, 0x48, 0x21, 0x85, 0x18, 0x62,
57 0x88, 0x21, 0x86, 0x9C, 0x72, 0xCA, 0x29, 0xA8, 0xA0, 0x92, 0x4A, 0x2A,
58 0xAA, 0x28, 0xA3, 0xCC, 0x32, 0xCB, 0x2C, 0xB3, 0xCC, 0x32, 0xCB, 0x2C,
59 0xB3, 0x0E, 0x3B, 0xEB, 0xAC, 0xC3, 0x0E, 0x43, 0x0C, 0x31, 0xC4, 0xD0,
60 0x4A, 0x2B, 0xB1, 0xD4, 0x54, 0x5B, 0x8D, 0x35, 0xD6, 0x9A, 0x7B, 0xCE,
61 0xB9, 0xE6, 0x20, 0xAD, 0x95, 0xD6, 0x5A, 0x6B, 0xAD, 0x94, 0x52, 0x4A,
62 0x29, 0xA5, 0x94, 0x82, 0xD0, 0x90, 0x95, 0x00, 0x00, 0x08, 0x00, 0x00,
63 0x81, 0x90, 0x41, 0x06, 0x19, 0x64, 0x14, 0x52, 0x48, 0x21, 0x85, 0x18,
64 0x62, 0xCA, 0x29, 0xA7, 0x9C, 0x82, 0x0A, 0x2A, 0x20, 0x34, 0x64, 0x25,
65 0x00, 0x00, 0x06, 0x00, 0xC0, 0x21, 0x67, 0xA0, 0x81, 0x06, 0x1A, 0x68,
66 0xA0, 0x81, 0x06, 0x1A, 0x68, 0xA0, 0x71, 0xC6, 0x19, 0x88, 0x20, 0x82,
67 0x08, 0x22, 0xA8, 0xA4, 0x92, 0x4C, 0x3A, 0x0A, 0x29, 0xB5, 0xD8, 0x6A,
68 0xCC, 0x31, 0xD7, 0x5E, 0x83, 0x0E, 0x3A, 0xF7, 0x9E, 0x7B, 0xEF, 0xB9,
69 0xF8, 0x1C, 0x84, 0x52, 0x4A, 0x29, 0xA5, 0x94, 0x52, 0x4A, 0x29, 0xA5,
70 0x94, 0x52, 0x4A, 0x29, 0x25, 0x08, 0x0D, 0x59, 0x09, 0x00, 0x80, 0x00,
71 0x00, 0x00, 0x08, 0x21, 0x84, 0x10, 0x52, 0x48, 0x21, 0x85, 0x14, 0x52,
72 0x8A, 0x31, 0xC6, 0x1C, 0x73, 0x0E, 0x3A, 0x09, 0x25, 0x04, 0x42, 0x43,
73 0x56, 0x02, 0x00, 0x60, 0x00, 0x00, 0x0C, 0x31, 0xC4, 0x18, 0x64, 0x90,
74 0x41, 0x48, 0x21, 0x85, 0x18, 0x62, 0x8A, 0x29, 0xC7, 0x1C, 0x73, 0x0C,
75 0x3A, 0x08, 0x21, 0x94, 0x52, 0x52, 0x68, 0xA1, 0x85, 0x5C, 0x6A, 0x88,
76 0x25, 0x96, 0x56, 0x5A, 0x89, 0xA5, 0xA5, 0x98, 0x6A, 0x8B, 0xB1, 0xD6,
77 0x58, 0x73, 0xED, 0x31, 0xD6, 0xDE, 0x7B, 0xEF, 0xBD, 0xF7, 0xDE, 0x7B,
78 0xEF, 0xBD, 0xF7, 0xDE, 0x7B, 0xCE, 0x81, 0xD0, 0x90, 0x95, 0x00, 0x40,
79 0x04, 0x00, 0x00, 0x83, 0x0C, 0x22, 0x88, 0x20, 0x82, 0x8C, 0x31, 0x06,
80 0x21, 0x04, 0x84, 0x86, 0xAC, 0x04, 0x00, 0x40, 0x00, 0x00, 0x10, 0x62,
81 0x88, 0x31, 0xC6, 0x20, 0x84, 0x10, 0x52, 0x88, 0x21, 0xA7, 0x9C, 0x82,
82 0x4C, 0x32, 0xE9, 0xA4, 0xA3, 0x90, 0x02, 0xA1, 0x21, 0x2B, 0x01, 0x00,
83 0x27, 0x00, 0x00, 0x84, 0x11, 0x47, 0x24, 0x71, 0x04, 0x12, 0x67, 0xA0,
84 0x81, 0x08, 0x2A, 0xA9, 0x20, 0xA3, 0xCC, 0x42, 0x2C, 0xB1, 0xB5, 0xD6,
85 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B,
86 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5,
87 0xD6, 0x5A, 0x6B, 0x2D, 0x10, 0x1A, 0xB2, 0x12, 0x00, 0x88, 0x00, 0x00,
88 0x60, 0x90, 0x41, 0x06, 0x19, 0x44, 0x10, 0x41, 0x04, 0x19, 0x64, 0x80,
89 0xD0, 0x90, 0x95, 0x00, 0x00, 0x08, 0x00, 0x00, 0x23, 0x8C, 0x40, 0x04,
90 0x19, 0xA5, 0x14, 0x63, 0x8E, 0x39, 0xE6, 0x18, 0x74, 0xD0, 0x41, 0x27,
91 0x1D, 0x85, 0x16, 0x5A, 0x20, 0x34, 0x64, 0x25, 0x00, 0xE0, 0x04, 0x00,
92 0x40, 0x20, 0xA1, 0x88, 0x32, 0xCC, 0x30, 0x04, 0x11, 0x55, 0x54, 0x51,
93 0x46, 0x15, 0x55, 0x14, 0x52, 0x47, 0x29, 0xA5, 0x94, 0x52, 0x4A, 0x29,
94 0xA5, 0x94, 0x52, 0x4A, 0x29, 0xA5, 0x94, 0x52, 0x4A, 0x29, 0xA5, 0x94,
95 0x52, 0x4A, 0x29, 0xA5, 0x94, 0x52, 0x4A, 0x29, 0xA5, 0x54, 0x4A, 0x29,
96 0xA5, 0x04, 0x42, 0x43, 0x56, 0x02, 0x00, 0x64, 0x00, 0x00, 0x90, 0xA2,
97 0x94, 0x52, 0x29, 0x2D, 0x45, 0x82, 0x22, 0xA5, 0x18, 0xA4, 0x18, 0x4B,
98 0x46, 0x15, 0x73, 0x50, 0x5A, 0x8A, 0xA8, 0x72, 0x0C, 0x52, 0xCD, 0xA9,
99 0x52, 0xCE, 0x20, 0xE6, 0x24, 0x96, 0x88, 0x31, 0x84, 0x94, 0x93, 0x54,
100 0x32, 0xE6, 0x14, 0x42, 0x0C, 0x42, 0xEA, 0x1C, 0x75, 0x4C, 0x29, 0x06,
101 0x2D, 0x95, 0x18, 0x42, 0xC6, 0x18, 0xA4, 0xD8, 0x72, 0x4B, 0xA1, 0x73,
102 0x0E, 0x08, 0x0D, 0x59, 0x21, 0x00, 0x84, 0x66, 0x00, 0x38, 0x1C, 0x07,
103 0x90, 0x2C, 0x0B, 0x90, 0x2C, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
104 0x00, 0x24, 0x4D, 0x03, 0x34, 0xCF, 0x03, 0x2C, 0xCD, 0x03, 0x00, 0x00,
105 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xD3, 0x00, 0xCB, 0xD3, 0x00, 0xCD,
106 0xF3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
108 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
109 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
111 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x34, 0x0D,
112 0xD0, 0x3C, 0x0F, 0xD0, 0x3C, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
113 0x00, 0x34, 0xCF, 0x03, 0x3C, 0x4F, 0x04, 0x3C, 0x51, 0x04, 0x00, 0x00,
114 0x00, 0x00, 0x00, 0x00, 0x00, 0xCB, 0xF3, 0x00, 0x4D, 0xF4, 0x00, 0x4F,
115 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
117 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
118 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
119 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
120 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x34, 0x0D,
121 0xD0, 0x3C, 0x0F, 0xD0, 0x3C, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
122 0x00, 0x2C, 0xCF, 0x03, 0x3C, 0x51, 0x04, 0x34, 0x4F, 0x04, 0x00, 0x00,
123 0x00, 0x00, 0x00, 0x00, 0x00, 0xCB, 0xF3, 0x00, 0x4F, 0x14, 0x01, 0x4F,
124 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
132 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
139 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
145 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
146 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
151 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
152 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
168 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
175 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0A, 0x38, 0x00, 0x00, 0x0A,
176 0x58, 0x08, 0x85, 0x86, 0xAC, 0x08, 0x00, 0xE2, 0x04, 0x00, 0x1C, 0x92,
177 0x04, 0x49, 0x82, 0x24, 0x41, 0xF3, 0x00, 0x92, 0x65, 0x41, 0xD3, 0xA0,
178 0x69, 0x30, 0x4D, 0x80, 0x64, 0x59, 0xD0, 0x34, 0x68, 0x1A, 0x4C, 0x13,
179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xD3,
180 0xA0, 0x69, 0xD0, 0x34, 0x88, 0x22, 0x40, 0xD2, 0x34, 0x68, 0x1A, 0x34,
181 0x0D, 0xA2, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
182 0x80, 0xA4, 0x69, 0xD0, 0x34, 0x68, 0x1A, 0x44, 0x11, 0x20, 0x69, 0x1A,
183 0x34, 0x0D, 0x9A, 0x06, 0x51, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184 0x00, 0x00, 0x00, 0xC0, 0x33, 0x4D, 0x88, 0x22, 0x44, 0x11, 0xA6, 0x09,
185 0xF0, 0x4C, 0x13, 0xA2, 0x08, 0x51, 0x84, 0x69, 0x02, 0x00, 0x00, 0x00,
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x09, 0x1C,
188 0x00, 0x00, 0x05, 0x4C, 0x28, 0x03, 0x85, 0x86, 0xAC, 0x08, 0x00, 0xE2,
189 0x04, 0x00, 0x1C, 0x8E, 0x62, 0x59, 0x00, 0x00, 0xE0, 0x38, 0x8E, 0x65,
190 0x01, 0x00, 0x80, 0xE3, 0x38, 0x96, 0x05, 0x00, 0x00, 0x96, 0x65, 0x89,
191 0x22, 0x00, 0x00, 0x58, 0x96, 0x26, 0x8A, 0x00, 0x00, 0x00, 0x00, 0x00,
192 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
193 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
194 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
195 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
196 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
197 0x02, 0x00, 0x00, 0x09, 0x1C, 0x00, 0x00, 0x05, 0x4C, 0x28, 0x03, 0x85,
198 0x86, 0xAC, 0x04, 0x00, 0xA2, 0x00, 0x00, 0x1C, 0x8A, 0x62, 0x59, 0xC0,
199 0x71, 0x2C, 0x0B, 0x38, 0x8E, 0x65, 0x01, 0x49, 0xB2, 0x2C, 0x80, 0x65,
200 0x01, 0x34, 0x0F, 0xA0, 0x69, 0x00, 0x51, 0x04, 0x00, 0x02, 0x00, 0x00,
201 0x0D, 0x1C, 0x00, 0x00, 0x05, 0x6C, 0xD0, 0x94, 0x58, 0x1C, 0xA0, 0xD0,
202 0x90, 0x95, 0x00, 0x40, 0x14, 0x00, 0x80, 0x41, 0x71, 0x2C, 0x4B, 0xD3,
203 0x44, 0x91, 0x24, 0x69, 0x9A, 0xE6, 0x89, 0x22, 0x49, 0xD2, 0x34, 0xCF,
204 0x13, 0x45, 0x9A, 0xE6, 0x79, 0x9E, 0x67, 0x9A, 0xF0, 0x3C, 0xCF, 0x33,
205 0x4D, 0x88, 0xA2, 0x28, 0x9A, 0x26, 0x44, 0x51, 0x14, 0x4D, 0x13, 0xA6,
206 0x69, 0x9A, 0xAA, 0x0A, 0x4C, 0x53, 0x55, 0x05, 0x00, 0x00, 0x1A, 0x38,
207 0x00, 0x00, 0x0A, 0xD8, 0xA0, 0x29, 0xB1, 0x38, 0x40, 0xA1, 0x21, 0x2B,
208 0x01, 0x80, 0x90, 0x00, 0x00, 0x87, 0xA2, 0x58, 0x96, 0xA6, 0x79, 0x9E,
209 0xE7, 0x89, 0xA2, 0x69, 0xAA, 0x26, 0x49, 0xD2, 0x34, 0xCF, 0x13, 0x45,
210 0x51, 0x34, 0x4D, 0xD3, 0x54, 0x55, 0x92, 0xA4, 0x69, 0x9E, 0x27, 0x8A,
211 0xA2, 0x68, 0x9A, 0xA6, 0xA9, 0xAA, 0x2C, 0x4B, 0xD3, 0x3C, 0x4F, 0x14,
212 0x45, 0xD1, 0x34, 0x55, 0x55, 0x55, 0xA1, 0x69, 0x9E, 0x27, 0x8A, 0xA2,
213 0x68, 0x9A, 0xAA, 0xAA, 0xBA, 0xF0, 0x3C, 0xCF, 0x13, 0x45, 0x51, 0x34,
214 0x4D, 0x55, 0x75, 0x5D, 0x78, 0x9E, 0xE7, 0x89, 0xA2, 0x28, 0x9A, 0xA6,
215 0xAA, 0xBA, 0x2E, 0x44, 0x51, 0x14, 0x4D, 0xD3, 0x34, 0x55, 0x53, 0x55,
216 0x5D, 0x17, 0x88, 0xA2, 0x69, 0x9A, 0xA6, 0xAA, 0xAA, 0xAA, 0xEB, 0x02,
217 0xD1, 0x13, 0x45, 0xD3, 0x54, 0x55, 0xD7, 0x75, 0x5D, 0xE0, 0x79, 0xA2,
218 0x68, 0x9A, 0xAA, 0xEA, 0xAA, 0xAE, 0x0B, 0x44, 0xD3, 0x34, 0x55, 0x55,
219 0x55, 0x5D, 0x57, 0x96, 0x01, 0xA6, 0x69, 0x9A, 0xAA, 0xEA, 0xBA, 0xB2,
220 0x0C, 0x50, 0x55, 0x55, 0x75, 0x5D, 0xD7, 0x95, 0x65, 0x80, 0xAA, 0xAA,
221 0xAA, 0xEB, 0xBA, 0xAE, 0x2C, 0x03, 0x54, 0xD5, 0x75, 0x5D, 0x57, 0x96,
222 0x65, 0x19, 0x80, 0xEB, 0xBA, 0xAE, 0x2C, 0xCB, 0xB2, 0x00, 0x00, 0x40,
223 0x04, 0x07, 0x00, 0x40, 0x01, 0x23, 0xE8, 0x24, 0xA3, 0xCA, 0x22, 0x6C,
224 0x34, 0xE1, 0xC2, 0x03, 0x50, 0x68, 0xC8, 0x8A, 0x00, 0x20, 0x0A, 0x00,
225 0x00, 0x30, 0x86, 0x29, 0xC5, 0x94, 0x32, 0x8C, 0x49, 0x08, 0x29, 0x84,
226 0x86, 0x31, 0x09, 0x21, 0x85, 0x90, 0x49, 0x49, 0xA9, 0xB4, 0x94, 0x2A,
227 0x08, 0xA9, 0x94, 0x54, 0x4A, 0x05, 0x21, 0x95, 0x92, 0x4A, 0xC9, 0x28,
228 0xA5, 0x94, 0x5A, 0x4A, 0x15, 0x84, 0x54, 0x4A, 0x2A, 0xA5, 0x82, 0x90,
229 0x4A, 0x49, 0xA5, 0x14, 0x00, 0x00, 0x8B, 0xE0, 0x00, 0x00, 0x8B, 0x60,
230 0x21, 0x14, 0x1A, 0xB2, 0x12, 0x00, 0xC8, 0x03, 0x00, 0x20, 0x8C, 0x51,
231 0x8A, 0x31, 0xC6, 0x9C, 0x93, 0x08, 0x29, 0xC5, 0x98, 0x73, 0xCE, 0x49,
232 0x84, 0x94, 0x62, 0xCC, 0x39, 0xE7, 0xA4, 0x52, 0x8C, 0x39, 0xE7, 0x9C,
233 0x73, 0x52, 0x4A, 0xC6, 0x1C, 0x73, 0xCE, 0x39, 0x29, 0xA5, 0x73, 0xCE,
234 0x39, 0xE7, 0x9C, 0x94, 0x92, 0x39, 0xE7, 0x9C, 0x73, 0x4E, 0x4A, 0xE9,
235 0x9C, 0x73, 0xCE, 0x39, 0x27, 0xA5, 0x94, 0xD2, 0x39, 0xE7, 0x9C, 0x93,
236 0x52, 0x4A, 0x09, 0xA1, 0x73, 0xD0, 0x49, 0x29, 0xA5, 0x74, 0xCE, 0x39,
237 0xE7, 0x04, 0x00, 0x80, 0x1A, 0x38, 0x00, 0x00, 0x0A, 0xD8, 0x28, 0xB2,
238 0x39, 0xC1, 0x48, 0x50, 0xA1, 0x21, 0x2B, 0x01, 0x80, 0x54, 0x00, 0x00,
239 0x83, 0xE3, 0x58, 0x96, 0xA6, 0x79, 0x9E, 0x28, 0x9A, 0xA6, 0x25, 0x49,
240 0x9A, 0xE6, 0x79, 0x9E, 0x27, 0x8A, 0xA6, 0xA9, 0x49, 0x92, 0xA6, 0x79,
241 0x9E, 0xE7, 0x89, 0xA2, 0x6A, 0xF2, 0x3C, 0xCF, 0x13, 0x45, 0x51, 0x34,
242 0x4D, 0x55, 0xE5, 0x79, 0x9E, 0x27, 0x8A, 0xA2, 0x68, 0x9A, 0xAA, 0xCA,
243 0x75, 0x45, 0xD1, 0x34, 0x4D, 0x53, 0x55, 0x55, 0x97, 0x2C, 0x8B, 0xA2,
244 0x69, 0x9A, 0xA6, 0xAA, 0xBA, 0x2E, 0x4C, 0xD3, 0x34, 0x55, 0xD5, 0x75,
245 0x5D, 0x17, 0xA6, 0x69, 0x9A, 0xAA, 0xEA, 0xBA, 0xAE, 0x0B, 0xDB, 0x56,
246 0x55, 0x55, 0x75, 0x5D, 0x59, 0x86, 0x6D, 0xAB, 0xAA, 0xAA, 0xBA, 0xAE,
247 0x2C, 0x03, 0xD7, 0x75, 0x5D, 0x59, 0xB6, 0x65, 0x20, 0xCB, 0xAE, 0x2B,
248 0xBB, 0xB6, 0x2C, 0x00, 0x00, 0x5E, 0xC1, 0x01, 0x00, 0xD4, 0xC0, 0x86,
249 0xD5, 0x11, 0x4E, 0x8A, 0xC6, 0x02, 0x0B, 0x0D, 0x59, 0x09, 0x00, 0x64,
250 0x00, 0x00, 0x10, 0xC6, 0x20, 0xA4, 0x10, 0x42, 0x48, 0x19, 0x84, 0x90,
251 0x42, 0x08, 0x21, 0xA5, 0x14, 0x42, 0x02, 0x00, 0x00, 0x09, 0x1C, 0x00,
252 0x00, 0x05, 0x4C, 0x28, 0x03, 0x85, 0x86, 0xAC, 0x04, 0x00, 0x52, 0x01,
253 0x00, 0x00, 0x63, 0xAC, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0x35, 0xD0, 0x59,
254 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x2B, 0x20, 0xB3, 0xD6, 0x5A, 0x6B, 0xAD,
255 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5, 0xD4,
256 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B,
257 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5,
258 0xD6, 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A,
259 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD, 0xB5, 0xD6, 0x5A, 0x6B, 0xAD,
260 0xB5, 0xD6, 0x5A, 0x4B, 0x29, 0xA5, 0x94, 0x52, 0x4A, 0x29, 0xA5, 0x94,
261 0x52, 0x4A, 0x29, 0xA5, 0x94, 0x52, 0x4A, 0x29, 0xA5, 0x94, 0x52, 0x01,
262 0x40, 0xBF, 0x16, 0x0E, 0x00, 0xFF, 0x10, 0x36, 0xAC, 0x8E, 0x70, 0x52,
263 0x34, 0x16, 0x58, 0x68, 0xC8, 0x4A, 0x00, 0x20, 0x1C, 0x00, 0x00, 0x30,
264 0x46, 0x29, 0xC6, 0x1C, 0x83, 0x50, 0x4A, 0x29, 0x15, 0x42, 0x8C, 0x39,
265 0x27, 0x1D, 0x95, 0xD6, 0x62, 0xAC, 0x10, 0x62, 0xCC, 0x39, 0x09, 0x29,
266 0xB5, 0x16, 0x5B, 0xF1, 0x9C, 0x73, 0x10, 0x4A, 0x48, 0xA5, 0xB5, 0x18,
267 0x8B, 0xE7, 0x9C, 0x83, 0x50, 0x4A, 0x4A, 0xB1, 0xD5, 0x58, 0x54, 0x0A,
268 0xA1, 0x94, 0x94, 0x52, 0x8B, 0x2D, 0xD6, 0xA2, 0x52, 0xE8, 0xA8, 0xA4,
269 0x94, 0x52, 0x6B, 0x35, 0x16, 0x63, 0x4C, 0x2A, 0xA9, 0xB5, 0xD6, 0x62,
270 0xAB, 0xB1, 0x18, 0x63, 0x52, 0x0A, 0x2D, 0xB5, 0xD6, 0x62, 0x8C, 0xC5,
271 0x08, 0x5B, 0x53, 0x6A, 0x2D, 0xB6, 0xDA, 0x6A, 0x2C, 0xC6, 0xD8, 0x9A,
272 0x4A, 0x0B, 0x2D, 0xC6, 0x18, 0x63, 0x31, 0xC2, 0x17, 0x19, 0x5B, 0x8B,
273 0xA9, 0xB6, 0x5A, 0x83, 0x31, 0xC2, 0xC8, 0x16, 0x4B, 0x4B, 0xB5, 0xD6,
274 0x1A, 0x8C, 0x31, 0x46, 0xF7, 0xD6, 0x62, 0xA9, 0xAD, 0xE6, 0x62, 0x8C,
275 0x0F, 0xBE, 0xB6, 0x14, 0x4B, 0x8C, 0x35, 0x17, 0x00, 0xE0, 0xEE, 0xE0,
276 0x00, 0x80, 0xA8, 0x60, 0xE3, 0x0C, 0x2B, 0x49, 0x67, 0x85, 0xA3, 0xC1,
277 0x85, 0x86, 0xAC, 0x04, 0x00, 0x42, 0x02, 0x00, 0x08, 0x84, 0x94, 0x62,
278 0x8C, 0x31, 0xC6, 0x9C, 0x73, 0xCE, 0x39, 0xA9, 0x14, 0x63, 0x8E, 0x39,
279 0xE7, 0x9C, 0x83, 0x10, 0x42, 0x28, 0x95, 0x62, 0x8C, 0x31, 0xE7, 0x9C,
280 0x83, 0x10, 0x42, 0x08, 0x25, 0x63, 0x8C, 0x39, 0xE7, 0x1C, 0x84, 0x10,
281 0x42, 0x08, 0xA1, 0x94, 0x92, 0x31, 0xE7, 0x1C, 0x84, 0x10, 0x42, 0x08,
282 0x21, 0xA4, 0x94, 0x3A, 0xE7, 0x1C, 0x84, 0x10, 0x42, 0x08, 0x21, 0x84,
283 0x52, 0x4A, 0xE7, 0x9C, 0x83, 0x10, 0x42, 0x08, 0x21, 0x84, 0x50, 0x4A,
284 0xE9, 0x20, 0x84, 0x10, 0x42, 0x08, 0x21, 0x84, 0x12, 0x4A, 0x29, 0x29,
285 0x85, 0x10, 0x42, 0x08, 0x21, 0x84, 0x10, 0x42, 0x2A, 0x29, 0xA5, 0x10,
286 0x42, 0x08, 0xA1, 0x94, 0x10, 0x4A, 0x48, 0x25, 0xA5, 0x14, 0x42, 0x08,
287 0x21, 0x84, 0x50, 0x4A, 0x09, 0x29, 0xA5, 0x94, 0x42, 0x08, 0xA1, 0x94,
288 0x10, 0x42, 0x28, 0x21, 0xA5, 0x94, 0x52, 0x4A, 0x21, 0x84, 0x10, 0x42,
289 0x29, 0xA5, 0xA4, 0x94, 0x52, 0x4A, 0xA9, 0x84, 0x52, 0x42, 0x09, 0xA1,
290 0x84, 0x54, 0x4A, 0x4A, 0x29, 0x85, 0x12, 0x42, 0x08, 0xA5, 0x94, 0x92,
291 0x52, 0x4A, 0x29, 0x95, 0x52, 0x42, 0x28, 0xA1, 0x84, 0x52, 0x4A, 0x49,
292 0x29, 0xA5, 0x94, 0x52, 0x08, 0x21, 0x84, 0x52, 0x4A, 0x01, 0x00, 0x80,
293 0x08, 0x0E, 0x00, 0x80, 0x02, 0x46, 0xD0, 0x49, 0x46, 0x95, 0x45, 0xD8,
294 0x68, 0xC2, 0x85, 0x07, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x20, 0x08,
295 0x91, 0x19, 0x22, 0x51, 0xB0, 0x00, 0x0C, 0x0E, 0x54, 0x00, 0x42, 0xC2,
296 0x14, 0x00, 0x50, 0x58, 0x60, 0x90, 0x03, 0x00, 0x0D, 0x0E, 0x0F, 0x69,
297 0x17, 0x17, 0xD0, 0x65, 0x80, 0x0B, 0xBA, 0xB8, 0xEB, 0x40, 0x08, 0x41,
298 0x08, 0x42, 0x10, 0x8B, 0x03, 0x28, 0x20, 0x01, 0x07, 0x27, 0xDC, 0xF0,
299 0xC4, 0x1B, 0x9E, 0x70, 0x83, 0x13, 0x74, 0x8A, 0x4A, 0x0D, 0x04, 0x00,
300 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x80, 0x00, 0x00, 0x24, 0x0F, 0x40,
301 0x44, 0x44, 0x34, 0x73, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
302 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x00, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00,
303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08};
304
305 unsigned char bufData[] = {
306 0x3E, 0x79, 0xDE, 0x36, 0x88, 0xA9, 0x82, 0x16, 0xA4, 0x10, 0x4E, 0x70,
307 0x83, 0x90, 0xA3, 0x4C, 0x94, 0xA9, 0xF3, 0x81, 0x46, 0x74, 0x15, 0x42,
308 0x0B, 0x42, 0x08, 0xC7, 0xB8, 0x41, 0x28, 0x23, 0x24, 0xF4, 0xA3, 0x28,
309 0xCB, 0xA2, 0x28, 0xCB, 0xA2, 0x28, 0xCB, 0xA2, 0x28, 0xCB, 0x02, 0x00,
310 0x60, 0x37, 0xB9, 0x8A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
311 0x00, 0x00, 0x40, 0xF0, 0xDE, 0xAA, 0x88, 0xAA, 0x08, 0x84, 0x14, 0x23,
312 0x33, 0x2A, 0x35, 0x85, 0x04, 0x78, 0x7B, 0x95, 0x58, 0x4E, 0xB3, 0x6A,
313 0x69, 0x69, 0x61, 0x66, 0x61, 0x6E, 0x69, 0x62, 0x66, 0x9A, 0x30, 0x41,
314 0x82, 0xF8, 0x84, 0x71, 0x71, 0xB1, 0xF1, 0x31, 0x31, 0xB1, 0xB1, 0x31,
315 0x31, 0xB1, 0x3D, 0x3b, 0x3D, 0xBA, 0xDD, 0x4E, 0xA7, 0xDB, 0xED, 0x74,
316 0xBA, 0xDD, 0xa6, 0xD3, 0x76, 0x9b, 0x4E, 0xDB, 0x6D, 0x3a, 0x6D, 0xDB,
317 0x34, 0x6D, 0xD3, 0x34, 0xED, 0xCB, 0x57, 0x2F, 0x5F, 0xBD, 0x3C, 0xF4,
318 0x43, 0x3F, 0xF4, 0x43, 0x3F, 0xF4, 0xE3, 0xF1, 0xE3, 0xC7, 0x8F, 0x1F,
319 0x3F, 0x7E, 0xFC, 0xF8, 0xF1, 0xE3, 0xC7, 0x8F, 0x1F, 0x3F, 0x7E, 0xFC,
320 0xF8, 0xF1, 0xE3, 0xC7, 0xF1, 0xD1, 0x68, 0x34, 0x1A, 0x8D, 0x46, 0xA3,
321 0xD1, 0x68, 0x34, 0x0A};
322
makeBitReader(const void * data,size_t size,ogg_buffer * buf,ogg_reference * ref,oggpack_buffer * bits)323 static void makeBitReader(const void *data, size_t size, ogg_buffer *buf,
324 ogg_reference *ref, oggpack_buffer *bits) {
325 buf->data = (uint8_t *)data;
326 buf->size = size;
327 buf->refcount = REF_COUNT;
328
329 ref->buffer = buf;
330 ref->length = size;
331 oggpack_readinit(bits, ref);
332 }
333
main()334 int main() {
335 ogg_buffer buf;
336 ogg_reference ref;
337 oggpack_buffer bits;
338
339 memset(&buf, 0, sizeof(ogg_buffer));
340 memset(&ref, 0, sizeof(ogg_reference));
341 memset(&bits, 0, sizeof(oggpack_buffer));
342
343 makeBitReader(packInfoData, sizeof(packInfoData), &buf, &ref, &bits);
344
345 vorbis_info *mVi = new vorbis_info;
346 vorbis_info_init(mVi);
347
348 int ret = _vorbis_unpack_info(mVi, &bits);
349 if (!ret) {
350 memset(&buf, 0, sizeof(ogg_buffer));
351 memset(&ref, 0, sizeof(ogg_reference));
352 memset(&bits, 0, sizeof(oggpack_buffer));
353
354 makeBitReader(unpackBookData, sizeof(unpackBookData), &buf, &ref, &bits);
355
356 ret = _vorbis_unpack_books(mVi, &bits);
357 if (!ret) {
358 ogg_packet pack;
359 memset(&pack, 0, sizeof(ogg_packet));
360 memset(&buf, 0, sizeof(ogg_buffer));
361 memset(&ref, 0, sizeof(ogg_reference));
362
363 vorbis_dsp_state *mState = new vorbis_dsp_state;
364 vorbis_dsp_init(mState, mVi);
365
366 buf.data = bufData;
367 buf.size = sizeof(bufData);
368 buf.refcount = REF_COUNT;
369
370 ref.buffer = &buf;
371 ref.length = buf.size;
372
373 pack.packet = &ref;
374 pack.bytes = ref.length;
375
376 vorbis_dsp_synthesis(mState, &pack, DECODE_PACKET);
377 }
378 }
379 return EXIT_SUCCESS;
380 }
381