1 /*
2 * Discworld II BMV audio decoder
3 * Copyright (c) 2011 Konstantin Shishkov
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
24
28
30 16512, 8256, 4128, 2064, 1032, 516, 258, 192, 129, 88, 64, 56, 48, 40, 36, 32
31 };
32
34 {
38
39 return 0;
40 }
41
44 {
45 const uint8_t *buf = avpkt->
data;
46 int buf_size = avpkt->
size;
47 int blocks = 0, total_blocks,
i;
49 int16_t *output_samples;
51
52 total_blocks = *buf++;
53 if (buf_size < total_blocks * 65 + 1) {
55 total_blocks * 65 + 1, buf_size);
57 }
58
59 /* get output buffer */
60 frame->nb_samples = total_blocks * 32;
63 output_samples = (int16_t *)
frame->data[0];
64
65 for (blocks = 0; blocks < total_blocks; blocks++) {
66 uint8_t
code = *buf++;
70 for (
i = 0;
i < 32;
i++) {
73 }
74 }
75
76 *got_frame_ptr = 1;
77
78 return buf_size;
79 }
80
82 .
p.
name =
"bmv_audio",
89 };