77 #define HUFFMAN_TABLE_SIZE (64 * 1024)
118 if ((w == 0) || (w > 1024))
123 if ((h == 0) || (h > 1024))
128 if (sample_rate && (sample_rate < 8000 || sample_rate > 48000))
133 if (number > 2 || sample_rate && !number)
138 if (number > 2 || sample_rate && !number)
158 unsigned int sample_rate, bytes_per_sample, channels;
175 if (sample_rate > 0) {
176 if (sample_rate < 14 || sample_rate > INT_MAX) {
180 if (bytes_per_sample < 1 || bytes_per_sample > 2) {
185 if (channels < 1 || channels > 2) {
226 st->
codec->
bit_rate = sample_rate * bytes_per_sample * 8 * channels;
228 if (bytes_per_sample == 1)
233 if (sample_rate % 14 != 0) {
235 bytes_per_sample * channels;
237 bytes_per_sample * channels;
240 (sample_rate / 14) * bytes_per_sample * channels;
256 unsigned int chunk_size;
261 unsigned char r,
g,
b;
262 unsigned char palette_buffer[768];
272 }
else if (command == 1) {
274 ret =
avio_read(pb, palette_buffer, 768);
277 }
else if (ret != 768) {
283 for (i = 0; i < 768; i++)
284 if (palette_buffer[i] > 63) {
289 for (i = 0; i < 256; i++) {
290 r = palette_buffer[i * 3 ] << palette_scale;
291 g = palette_buffer[i * 3 + 1] << palette_scale;
292 b = palette_buffer[i * 3 + 2] << palette_scale;
293 palette[i] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
294 if (palette_scale == 2)
295 palette[i] |= palette[i] >> 6 & 0x30303;
304 if (chunk_size < 4 || chunk_size > INT_MAX - 4) {
316 else if (ret != chunk_size) {
357 int64_t timestamp,
int flags)