1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include <wavpack/wavpack.h>
20 #include <string.h>
21
25
29
30 #define WV_DEFAULT_BLOCK_SIZE 32768
31
36
39
42
45 {
48
52
53 if (frame) {
55 if (ret < 0)
57
59 if (!ret) {
61 WavpackGetErrorMessage(s->
wv));
63 }
64 }
65
68 ret = WavpackFlushSamples(s->
wv);
69 if (!ret) {
71 WavpackGetErrorMessage(s->
wv));
73 }
74 }
75
78 *got_output = 1;
79 }
80
81 return 0;
82 }
83
85 {
89
93 return 0;
94 }
96 } else {
98 if (ret < 0) {
100 return 0;
101 }
102 }
103
104 memcpy(s->
pkt->
data + offset, data, count);
105
107
108 return 1;
109 }
110
112 {
114 WavpackConfig
config = { 0 };
116
121 }
122
125
126 config.bytes_per_sample = 4;
127 config.bits_per_sample = 32;
130 config.num_channels = avctx->
channels;
132
135 config.flags |= CONFIG_VERY_HIGH_FLAG;
136
138 config.xmode = 6;
140 config.xmode = 5;
142 config.xmode = 4;
144 config.xmode = 3;
146 config.xmode = 2;
148 config.flags |= CONFIG_HIGH_FLAG;
150 config.flags |= CONFIG_FAST_FLAG;
151 }
152
153 ret = WavpackSetConfiguration(s->
wv, &config, -1);
154 if (!ret)
155 goto fail;
156
157 ret = WavpackPackInit(s->
wv);
158 if (!ret)
159 goto fail;
160
162
163 return 0;
164
165 fail:
167 WavpackGetErrorMessage(s->
wv));
168 WavpackCloseFile(s->
wv);
170 }
171
173 {
175
176 WavpackCloseFile(s->
wv);
177
179
180 return 0;
181 }
182
184 .
name =
"libwavpack",
194 };