1 /*
2 * Copyright (C) 2017 foo86
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
24
26 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 8, 1, 2, 3, 3, 4, 5, 6, 1, 2, 3, 4, 1, 1
27 };
28
30 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 8, 8
31 };
32
34 0, 42965, 43008, 44800, 53706, 53760
35 };
36
38 {
39 if (nb_words >
s->input_size) {
41 }
42
43 s->input += nb_words *
s->word_bytes;
44 s->input_size -= nb_words;
45 return 0;
46 }
47
49 {
51 const uint8_t *
key =
s->input;
56 }
57 return 0;
58 }
59
61 {
62 const uint8_t *
src =
s->input;
63 uint8_t *
dst =
s->buffer;
66
68
69 if (nb_words >
s->input_size) {
73 }
74
75 switch (
s->word_bits) {
76 case 16:
77 for (
i = 0;
i < nb_words;
i++,
src += 2,
dst += 2)
79 break;
80 case 20:
82 for (
i = 0;
i < nb_words;
i++,
src += 3)
85 break;
86 case 24:
87 for (
i = 0;
i < nb_words;
i++,
src += 3,
dst += 3)
89 break;
90 default:
92 }
93
95 }
96
98 {
100 int hdr,
ret,
key, mtd_size;
101
102 if (buf_size < 3)
104
106 if ((hdr & 0xfffffe) == 0x7888e) {
108 } else if ((hdr & 0xffffe0) == 0x788e0) {
110 } else if ((hdr & 0xfffe00) == 0x78e00) {
112 } else {
116 }
117
118 s->word_bytes =
s->word_bits + 7 >> 3;
119 s->input = buf +
s->word_bytes;
120 s->input_size = buf_size /
s->word_bytes - 1;
121 s->key_present = hdr >> 24 -
s->word_bits & 1;
122
127
130 if (!mtd_size) {
134 }
135
138
145 }
146
149
157 }
158
160 for (
int i = 0;
i <
header->nb_channels;
i++)
164
166 for (
int i = 0;
i <
header->nb_channels;
i++) {
171 }
172
177 }
178
180 }