Mercurial > libavcodec.hg
annotate xiph.c @ 12043:f9a0bd0888a4 libavcodec
mpegaudio: call ff_mpegaudiodec_init_mmx() only from float decoder
The mmx code is floating-point only, and this function does not know
from which decoder it is called. Without this change, the integer
decoder only "works" because the size of the context struct is smaller
in this case, and the mmx init function writes the function pointer
outside the allocated context.
author | mru |
---|---|
date | Thu, 01 Jul 2010 23:21:17 +0000 |
parents | 2acf0ae7b041 |
children |
rev | line source |
---|---|
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
1 /* |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
2 * Copyright (C) 2007 FFmpeg Project |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
3 * |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
4 * This file is part of FFmpeg. |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
5 * |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
6 * FFmpeg is free software; you can redistribute it and/or |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
10 * |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
11 * FFmpeg is distributed in the hope that it will be useful, |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
14 * Lesser General Public License for more details. |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
15 * |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
17 * License along with FFmpeg; if not, write to the Free Software |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
19 */ |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
20 |
8573
2acf0ae7b041
Fix build: Add intreadwrite.h and bswap.h #includes where necessary.
diego
parents:
6657
diff
changeset
|
21 #include "libavutil/intreadwrite.h" |
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
22 #include "xiph.h" |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
23 |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
24 int ff_split_xiph_headers(uint8_t *extradata, int extradata_size, |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
25 int first_header_size, uint8_t *header_start[3], |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
26 int header_len[3]) |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
27 { |
6657 | 28 int i; |
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
29 |
6656
b1049dd41dd4
Add checks to ff_split_xiph_headers to ensure that returned header_len and
reimar
parents:
4722
diff
changeset
|
30 if (extradata_size >= 6 && AV_RB16(extradata) == first_header_size) { |
b1049dd41dd4
Add checks to ff_split_xiph_headers to ensure that returned header_len and
reimar
parents:
4722
diff
changeset
|
31 int overall_len = 6; |
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
32 for (i=0; i<3; i++) { |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
33 header_len[i] = AV_RB16(extradata); |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
34 extradata += 2; |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
35 header_start[i] = extradata; |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
36 extradata += header_len[i]; |
6656
b1049dd41dd4
Add checks to ff_split_xiph_headers to ensure that returned header_len and
reimar
parents:
4722
diff
changeset
|
37 if (overall_len > extradata_size - header_len[i]) |
b1049dd41dd4
Add checks to ff_split_xiph_headers to ensure that returned header_len and
reimar
parents:
4722
diff
changeset
|
38 return -1; |
b1049dd41dd4
Add checks to ff_split_xiph_headers to ensure that returned header_len and
reimar
parents:
4722
diff
changeset
|
39 overall_len += header_len[i]; |
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
40 } |
6656
b1049dd41dd4
Add checks to ff_split_xiph_headers to ensure that returned header_len and
reimar
parents:
4722
diff
changeset
|
41 } else if (extradata_size >= 3 && extradata_size < INT_MAX - 0x1ff && extradata[0] == 2) { |
b1049dd41dd4
Add checks to ff_split_xiph_headers to ensure that returned header_len and
reimar
parents:
4722
diff
changeset
|
42 int overall_len = 3; |
6657 | 43 extradata++; |
44 for (i=0; i<2; i++, extradata++) { | |
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
45 header_len[i] = 0; |
6657 | 46 for (; overall_len < extradata_size && *extradata==0xff; extradata++) { |
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
47 header_len[i] += 0xff; |
6656
b1049dd41dd4
Add checks to ff_split_xiph_headers to ensure that returned header_len and
reimar
parents:
4722
diff
changeset
|
48 overall_len += 0xff + 1; |
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
49 } |
6657 | 50 header_len[i] += *extradata; |
51 overall_len += *extradata; | |
6656
b1049dd41dd4
Add checks to ff_split_xiph_headers to ensure that returned header_len and
reimar
parents:
4722
diff
changeset
|
52 if (overall_len > extradata_size) |
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
53 return -1; |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
54 } |
6657 | 55 header_len[2] = extradata_size - overall_len; |
4722
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
56 header_start[0] = extradata; |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
57 header_start[1] = header_start[0] + header_len[0]; |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
58 header_start[2] = header_start[1] + header_len[1]; |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
59 } else { |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
60 return -1; |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
61 } |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
62 return 0; |
7595ead28402
extract vorbis header spliting code into a reusable function
aurel
parents:
diff
changeset
|
63 } |