diff options
Diffstat (limited to 'lib/rbcodec/codecs/libopus/ogg')
-rw-r--r-- | lib/rbcodec/codecs/libopus/ogg/crctable.h | 278 | ||||
-rw-r--r-- | lib/rbcodec/codecs/libopus/ogg/framing.c | 1294 | ||||
-rw-r--r-- | lib/rbcodec/codecs/libopus/ogg/ogg.h | 1 |
3 files changed, 1467 insertions, 106 deletions
diff --git a/lib/rbcodec/codecs/libopus/ogg/crctable.h b/lib/rbcodec/codecs/libopus/ogg/crctable.h new file mode 100644 index 0000000000..d1fdbc7e63 --- /dev/null +++ b/lib/rbcodec/codecs/libopus/ogg/crctable.h | |||
@@ -0,0 +1,278 @@ | |||
1 | /******************************************************************** | ||
2 | * * | ||
3 | * THIS FILE IS PART OF THE Ogg CONTAINER SOURCE CODE. * | ||
4 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * | ||
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * | ||
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * | ||
7 | * * | ||
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2018 * | ||
9 | * by the Xiph.Org Foundation http://www.xiph.org/ * | ||
10 | * * | ||
11 | ********************************************************************/ | ||
12 | |||
13 | #include "os_types.h" | ||
14 | |||
15 | static const ogg_uint32_t crc_lookup[8][256]={ | ||
16 | {0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005, | ||
17 | 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd, | ||
18 | 0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9,0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75, | ||
19 | 0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011,0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd, | ||
20 | 0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039,0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5, | ||
21 | 0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81,0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d, | ||
22 | 0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49,0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95, | ||
23 | 0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1,0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d, | ||
24 | 0x34867077,0x30476dc0,0x3d044b19,0x39c556ae,0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072, | ||
25 | 0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16,0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca, | ||
26 | 0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde,0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02, | ||
27 | 0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066,0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba, | ||
28 | 0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e,0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692, | ||
29 | 0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6,0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a, | ||
30 | 0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e,0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2, | ||
31 | 0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686,0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a, | ||
32 | 0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637,0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb, | ||
33 | 0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f,0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53, | ||
34 | 0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47,0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b, | ||
35 | 0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff,0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623, | ||
36 | 0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7,0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b, | ||
37 | 0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f,0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3, | ||
38 | 0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7,0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b, | ||
39 | 0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f,0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3, | ||
40 | 0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640,0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c, | ||
41 | 0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8,0x68860bfd,0x6c47164a,0x61043093,0x65c52d24, | ||
42 | 0x119b4be9,0x155a565e,0x18197087,0x1cd86d30,0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec, | ||
43 | 0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088,0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654, | ||
44 | 0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0,0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c, | ||
45 | 0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18,0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4, | ||
46 | 0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0,0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c, | ||
47 | 0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4}, | ||
48 | |||
49 | {0x00000000,0xd219c1dc,0xa0f29e0f,0x72eb5fd3,0x452421a9,0x973de075,0xe5d6bfa6,0x37cf7e7a, | ||
50 | 0x8a484352,0x5851828e,0x2abadd5d,0xf8a31c81,0xcf6c62fb,0x1d75a327,0x6f9efcf4,0xbd873d28, | ||
51 | 0x10519b13,0xc2485acf,0xb0a3051c,0x62bac4c0,0x5575baba,0x876c7b66,0xf58724b5,0x279ee569, | ||
52 | 0x9a19d841,0x4800199d,0x3aeb464e,0xe8f28792,0xdf3df9e8,0x0d243834,0x7fcf67e7,0xadd6a63b, | ||
53 | 0x20a33626,0xf2baf7fa,0x8051a829,0x524869f5,0x6587178f,0xb79ed653,0xc5758980,0x176c485c, | ||
54 | 0xaaeb7574,0x78f2b4a8,0x0a19eb7b,0xd8002aa7,0xefcf54dd,0x3dd69501,0x4f3dcad2,0x9d240b0e, | ||
55 | 0x30f2ad35,0xe2eb6ce9,0x9000333a,0x4219f2e6,0x75d68c9c,0xa7cf4d40,0xd5241293,0x073dd34f, | ||
56 | 0xbabaee67,0x68a32fbb,0x1a487068,0xc851b1b4,0xff9ecfce,0x2d870e12,0x5f6c51c1,0x8d75901d, | ||
57 | 0x41466c4c,0x935fad90,0xe1b4f243,0x33ad339f,0x04624de5,0xd67b8c39,0xa490d3ea,0x76891236, | ||
58 | 0xcb0e2f1e,0x1917eec2,0x6bfcb111,0xb9e570cd,0x8e2a0eb7,0x5c33cf6b,0x2ed890b8,0xfcc15164, | ||
59 | 0x5117f75f,0x830e3683,0xf1e56950,0x23fca88c,0x1433d6f6,0xc62a172a,0xb4c148f9,0x66d88925, | ||
60 | 0xdb5fb40d,0x094675d1,0x7bad2a02,0xa9b4ebde,0x9e7b95a4,0x4c625478,0x3e890bab,0xec90ca77, | ||
61 | 0x61e55a6a,0xb3fc9bb6,0xc117c465,0x130e05b9,0x24c17bc3,0xf6d8ba1f,0x8433e5cc,0x562a2410, | ||
62 | 0xebad1938,0x39b4d8e4,0x4b5f8737,0x994646eb,0xae893891,0x7c90f94d,0x0e7ba69e,0xdc626742, | ||
63 | 0x71b4c179,0xa3ad00a5,0xd1465f76,0x035f9eaa,0x3490e0d0,0xe689210c,0x94627edf,0x467bbf03, | ||
64 | 0xfbfc822b,0x29e543f7,0x5b0e1c24,0x8917ddf8,0xbed8a382,0x6cc1625e,0x1e2a3d8d,0xcc33fc51, | ||
65 | 0x828cd898,0x50951944,0x227e4697,0xf067874b,0xc7a8f931,0x15b138ed,0x675a673e,0xb543a6e2, | ||
66 | 0x08c49bca,0xdadd5a16,0xa83605c5,0x7a2fc419,0x4de0ba63,0x9ff97bbf,0xed12246c,0x3f0be5b0, | ||
67 | 0x92dd438b,0x40c48257,0x322fdd84,0xe0361c58,0xd7f96222,0x05e0a3fe,0x770bfc2d,0xa5123df1, | ||
68 | 0x189500d9,0xca8cc105,0xb8679ed6,0x6a7e5f0a,0x5db12170,0x8fa8e0ac,0xfd43bf7f,0x2f5a7ea3, | ||
69 | 0xa22feebe,0x70362f62,0x02dd70b1,0xd0c4b16d,0xe70bcf17,0x35120ecb,0x47f95118,0x95e090c4, | ||
70 | 0x2867adec,0xfa7e6c30,0x889533e3,0x5a8cf23f,0x6d438c45,0xbf5a4d99,0xcdb1124a,0x1fa8d396, | ||
71 | 0xb27e75ad,0x6067b471,0x128ceba2,0xc0952a7e,0xf75a5404,0x254395d8,0x57a8ca0b,0x85b10bd7, | ||
72 | 0x383636ff,0xea2ff723,0x98c4a8f0,0x4add692c,0x7d121756,0xaf0bd68a,0xdde08959,0x0ff94885, | ||
73 | 0xc3cab4d4,0x11d37508,0x63382adb,0xb121eb07,0x86ee957d,0x54f754a1,0x261c0b72,0xf405caae, | ||
74 | 0x4982f786,0x9b9b365a,0xe9706989,0x3b69a855,0x0ca6d62f,0xdebf17f3,0xac544820,0x7e4d89fc, | ||
75 | 0xd39b2fc7,0x0182ee1b,0x7369b1c8,0xa1707014,0x96bf0e6e,0x44a6cfb2,0x364d9061,0xe45451bd, | ||
76 | 0x59d36c95,0x8bcaad49,0xf921f29a,0x2b383346,0x1cf74d3c,0xceee8ce0,0xbc05d333,0x6e1c12ef, | ||
77 | 0xe36982f2,0x3170432e,0x439b1cfd,0x9182dd21,0xa64da35b,0x74546287,0x06bf3d54,0xd4a6fc88, | ||
78 | 0x6921c1a0,0xbb38007c,0xc9d35faf,0x1bca9e73,0x2c05e009,0xfe1c21d5,0x8cf77e06,0x5eeebfda, | ||
79 | 0xf33819e1,0x2121d83d,0x53ca87ee,0x81d34632,0xb61c3848,0x6405f994,0x16eea647,0xc4f7679b, | ||
80 | 0x79705ab3,0xab699b6f,0xd982c4bc,0x0b9b0560,0x3c547b1a,0xee4dbac6,0x9ca6e515,0x4ebf24c9}, | ||
81 | |||
82 | {0x00000000,0x01d8ac87,0x03b1590e,0x0269f589,0x0762b21c,0x06ba1e9b,0x04d3eb12,0x050b4795, | ||
83 | 0x0ec56438,0x0f1dc8bf,0x0d743d36,0x0cac91b1,0x09a7d624,0x087f7aa3,0x0a168f2a,0x0bce23ad, | ||
84 | 0x1d8ac870,0x1c5264f7,0x1e3b917e,0x1fe33df9,0x1ae87a6c,0x1b30d6eb,0x19592362,0x18818fe5, | ||
85 | 0x134fac48,0x129700cf,0x10fef546,0x112659c1,0x142d1e54,0x15f5b2d3,0x179c475a,0x1644ebdd, | ||
86 | 0x3b1590e0,0x3acd3c67,0x38a4c9ee,0x397c6569,0x3c7722fc,0x3daf8e7b,0x3fc67bf2,0x3e1ed775, | ||
87 | 0x35d0f4d8,0x3408585f,0x3661add6,0x37b90151,0x32b246c4,0x336aea43,0x31031fca,0x30dbb34d, | ||
88 | 0x269f5890,0x2747f417,0x252e019e,0x24f6ad19,0x21fdea8c,0x2025460b,0x224cb382,0x23941f05, | ||
89 | 0x285a3ca8,0x2982902f,0x2beb65a6,0x2a33c921,0x2f388eb4,0x2ee02233,0x2c89d7ba,0x2d517b3d, | ||
90 | 0x762b21c0,0x77f38d47,0x759a78ce,0x7442d449,0x714993dc,0x70913f5b,0x72f8cad2,0x73206655, | ||
91 | 0x78ee45f8,0x7936e97f,0x7b5f1cf6,0x7a87b071,0x7f8cf7e4,0x7e545b63,0x7c3daeea,0x7de5026d, | ||
92 | 0x6ba1e9b0,0x6a794537,0x6810b0be,0x69c81c39,0x6cc35bac,0x6d1bf72b,0x6f7202a2,0x6eaaae25, | ||
93 | 0x65648d88,0x64bc210f,0x66d5d486,0x670d7801,0x62063f94,0x63de9313,0x61b7669a,0x606fca1d, | ||
94 | 0x4d3eb120,0x4ce61da7,0x4e8fe82e,0x4f5744a9,0x4a5c033c,0x4b84afbb,0x49ed5a32,0x4835f6b5, | ||
95 | 0x43fbd518,0x4223799f,0x404a8c16,0x41922091,0x44996704,0x4541cb83,0x47283e0a,0x46f0928d, | ||
96 | 0x50b47950,0x516cd5d7,0x5305205e,0x52dd8cd9,0x57d6cb4c,0x560e67cb,0x54679242,0x55bf3ec5, | ||
97 | 0x5e711d68,0x5fa9b1ef,0x5dc04466,0x5c18e8e1,0x5913af74,0x58cb03f3,0x5aa2f67a,0x5b7a5afd, | ||
98 | 0xec564380,0xed8eef07,0xefe71a8e,0xee3fb609,0xeb34f19c,0xeaec5d1b,0xe885a892,0xe95d0415, | ||
99 | 0xe29327b8,0xe34b8b3f,0xe1227eb6,0xe0fad231,0xe5f195a4,0xe4293923,0xe640ccaa,0xe798602d, | ||
100 | 0xf1dc8bf0,0xf0042777,0xf26dd2fe,0xf3b57e79,0xf6be39ec,0xf766956b,0xf50f60e2,0xf4d7cc65, | ||
101 | 0xff19efc8,0xfec1434f,0xfca8b6c6,0xfd701a41,0xf87b5dd4,0xf9a3f153,0xfbca04da,0xfa12a85d, | ||
102 | 0xd743d360,0xd69b7fe7,0xd4f28a6e,0xd52a26e9,0xd021617c,0xd1f9cdfb,0xd3903872,0xd24894f5, | ||
103 | 0xd986b758,0xd85e1bdf,0xda37ee56,0xdbef42d1,0xdee40544,0xdf3ca9c3,0xdd555c4a,0xdc8df0cd, | ||
104 | 0xcac91b10,0xcb11b797,0xc978421e,0xc8a0ee99,0xcdaba90c,0xcc73058b,0xce1af002,0xcfc25c85, | ||
105 | 0xc40c7f28,0xc5d4d3af,0xc7bd2626,0xc6658aa1,0xc36ecd34,0xc2b661b3,0xc0df943a,0xc10738bd, | ||
106 | 0x9a7d6240,0x9ba5cec7,0x99cc3b4e,0x981497c9,0x9d1fd05c,0x9cc77cdb,0x9eae8952,0x9f7625d5, | ||
107 | 0x94b80678,0x9560aaff,0x97095f76,0x96d1f3f1,0x93dab464,0x920218e3,0x906bed6a,0x91b341ed, | ||
108 | 0x87f7aa30,0x862f06b7,0x8446f33e,0x859e5fb9,0x8095182c,0x814db4ab,0x83244122,0x82fceda5, | ||
109 | 0x8932ce08,0x88ea628f,0x8a839706,0x8b5b3b81,0x8e507c14,0x8f88d093,0x8de1251a,0x8c39899d, | ||
110 | 0xa168f2a0,0xa0b05e27,0xa2d9abae,0xa3010729,0xa60a40bc,0xa7d2ec3b,0xa5bb19b2,0xa463b535, | ||
111 | 0xafad9698,0xae753a1f,0xac1ccf96,0xadc46311,0xa8cf2484,0xa9178803,0xab7e7d8a,0xaaa6d10d, | ||
112 | 0xbce23ad0,0xbd3a9657,0xbf5363de,0xbe8bcf59,0xbb8088cc,0xba58244b,0xb831d1c2,0xb9e97d45, | ||
113 | 0xb2275ee8,0xb3fff26f,0xb19607e6,0xb04eab61,0xb545ecf4,0xb49d4073,0xb6f4b5fa,0xb72c197d}, | ||
114 | |||
115 | {0x00000000,0xdc6d9ab7,0xbc1a28d9,0x6077b26e,0x7cf54c05,0xa098d6b2,0xc0ef64dc,0x1c82fe6b, | ||
116 | 0xf9ea980a,0x258702bd,0x45f0b0d3,0x999d2a64,0x851fd40f,0x59724eb8,0x3905fcd6,0xe5686661, | ||
117 | 0xf7142da3,0x2b79b714,0x4b0e057a,0x97639fcd,0x8be161a6,0x578cfb11,0x37fb497f,0xeb96d3c8, | ||
118 | 0x0efeb5a9,0xd2932f1e,0xb2e49d70,0x6e8907c7,0x720bf9ac,0xae66631b,0xce11d175,0x127c4bc2, | ||
119 | 0xeae946f1,0x3684dc46,0x56f36e28,0x8a9ef49f,0x961c0af4,0x4a719043,0x2a06222d,0xf66bb89a, | ||
120 | 0x1303defb,0xcf6e444c,0xaf19f622,0x73746c95,0x6ff692fe,0xb39b0849,0xd3ecba27,0x0f812090, | ||
121 | 0x1dfd6b52,0xc190f1e5,0xa1e7438b,0x7d8ad93c,0x61082757,0xbd65bde0,0xdd120f8e,0x017f9539, | ||
122 | 0xe417f358,0x387a69ef,0x580ddb81,0x84604136,0x98e2bf5d,0x448f25ea,0x24f89784,0xf8950d33, | ||
123 | 0xd1139055,0x0d7e0ae2,0x6d09b88c,0xb164223b,0xade6dc50,0x718b46e7,0x11fcf489,0xcd916e3e, | ||
124 | 0x28f9085f,0xf49492e8,0x94e32086,0x488eba31,0x540c445a,0x8861deed,0xe8166c83,0x347bf634, | ||
125 | 0x2607bdf6,0xfa6a2741,0x9a1d952f,0x46700f98,0x5af2f1f3,0x869f6b44,0xe6e8d92a,0x3a85439d, | ||
126 | 0xdfed25fc,0x0380bf4b,0x63f70d25,0xbf9a9792,0xa31869f9,0x7f75f34e,0x1f024120,0xc36fdb97, | ||
127 | 0x3bfad6a4,0xe7974c13,0x87e0fe7d,0x5b8d64ca,0x470f9aa1,0x9b620016,0xfb15b278,0x277828cf, | ||
128 | 0xc2104eae,0x1e7dd419,0x7e0a6677,0xa267fcc0,0xbee502ab,0x6288981c,0x02ff2a72,0xde92b0c5, | ||
129 | 0xcceefb07,0x108361b0,0x70f4d3de,0xac994969,0xb01bb702,0x6c762db5,0x0c019fdb,0xd06c056c, | ||
130 | 0x3504630d,0xe969f9ba,0x891e4bd4,0x5573d163,0x49f12f08,0x959cb5bf,0xf5eb07d1,0x29869d66, | ||
131 | 0xa6e63d1d,0x7a8ba7aa,0x1afc15c4,0xc6918f73,0xda137118,0x067eebaf,0x660959c1,0xba64c376, | ||
132 | 0x5f0ca517,0x83613fa0,0xe3168dce,0x3f7b1779,0x23f9e912,0xff9473a5,0x9fe3c1cb,0x438e5b7c, | ||
133 | 0x51f210be,0x8d9f8a09,0xede83867,0x3185a2d0,0x2d075cbb,0xf16ac60c,0x911d7462,0x4d70eed5, | ||
134 | 0xa81888b4,0x74751203,0x1402a06d,0xc86f3ada,0xd4edc4b1,0x08805e06,0x68f7ec68,0xb49a76df, | ||
135 | 0x4c0f7bec,0x9062e15b,0xf0155335,0x2c78c982,0x30fa37e9,0xec97ad5e,0x8ce01f30,0x508d8587, | ||
136 | 0xb5e5e3e6,0x69887951,0x09ffcb3f,0xd5925188,0xc910afe3,0x157d3554,0x750a873a,0xa9671d8d, | ||
137 | 0xbb1b564f,0x6776ccf8,0x07017e96,0xdb6ce421,0xc7ee1a4a,0x1b8380fd,0x7bf43293,0xa799a824, | ||
138 | 0x42f1ce45,0x9e9c54f2,0xfeebe69c,0x22867c2b,0x3e048240,0xe26918f7,0x821eaa99,0x5e73302e, | ||
139 | 0x77f5ad48,0xab9837ff,0xcbef8591,0x17821f26,0x0b00e14d,0xd76d7bfa,0xb71ac994,0x6b775323, | ||
140 | 0x8e1f3542,0x5272aff5,0x32051d9b,0xee68872c,0xf2ea7947,0x2e87e3f0,0x4ef0519e,0x929dcb29, | ||
141 | 0x80e180eb,0x5c8c1a5c,0x3cfba832,0xe0963285,0xfc14ccee,0x20795659,0x400ee437,0x9c637e80, | ||
142 | 0x790b18e1,0xa5668256,0xc5113038,0x197caa8f,0x05fe54e4,0xd993ce53,0xb9e47c3d,0x6589e68a, | ||
143 | 0x9d1cebb9,0x4171710e,0x2106c360,0xfd6b59d7,0xe1e9a7bc,0x3d843d0b,0x5df38f65,0x819e15d2, | ||
144 | 0x64f673b3,0xb89be904,0xd8ec5b6a,0x0481c1dd,0x18033fb6,0xc46ea501,0xa419176f,0x78748dd8, | ||
145 | 0x6a08c61a,0xb6655cad,0xd612eec3,0x0a7f7474,0x16fd8a1f,0xca9010a8,0xaae7a2c6,0x768a3871, | ||
146 | 0x93e25e10,0x4f8fc4a7,0x2ff876c9,0xf395ec7e,0xef171215,0x337a88a2,0x530d3acc,0x8f60a07b}, | ||
147 | |||
148 | {0x00000000,0x490d678d,0x921acf1a,0xdb17a897,0x20f48383,0x69f9e40e,0xb2ee4c99,0xfbe32b14, | ||
149 | 0x41e90706,0x08e4608b,0xd3f3c81c,0x9afeaf91,0x611d8485,0x2810e308,0xf3074b9f,0xba0a2c12, | ||
150 | 0x83d20e0c,0xcadf6981,0x11c8c116,0x58c5a69b,0xa3268d8f,0xea2bea02,0x313c4295,0x78312518, | ||
151 | 0xc23b090a,0x8b366e87,0x5021c610,0x192ca19d,0xe2cf8a89,0xabc2ed04,0x70d54593,0x39d8221e, | ||
152 | 0x036501af,0x4a686622,0x917fceb5,0xd872a938,0x2391822c,0x6a9ce5a1,0xb18b4d36,0xf8862abb, | ||
153 | 0x428c06a9,0x0b816124,0xd096c9b3,0x999bae3e,0x6278852a,0x2b75e2a7,0xf0624a30,0xb96f2dbd, | ||
154 | 0x80b70fa3,0xc9ba682e,0x12adc0b9,0x5ba0a734,0xa0438c20,0xe94eebad,0x3259433a,0x7b5424b7, | ||
155 | 0xc15e08a5,0x88536f28,0x5344c7bf,0x1a49a032,0xe1aa8b26,0xa8a7ecab,0x73b0443c,0x3abd23b1, | ||
156 | 0x06ca035e,0x4fc764d3,0x94d0cc44,0xddddabc9,0x263e80dd,0x6f33e750,0xb4244fc7,0xfd29284a, | ||
157 | 0x47230458,0x0e2e63d5,0xd539cb42,0x9c34accf,0x67d787db,0x2edae056,0xf5cd48c1,0xbcc02f4c, | ||
158 | 0x85180d52,0xcc156adf,0x1702c248,0x5e0fa5c5,0xa5ec8ed1,0xece1e95c,0x37f641cb,0x7efb2646, | ||
159 | 0xc4f10a54,0x8dfc6dd9,0x56ebc54e,0x1fe6a2c3,0xe40589d7,0xad08ee5a,0x761f46cd,0x3f122140, | ||
160 | 0x05af02f1,0x4ca2657c,0x97b5cdeb,0xdeb8aa66,0x255b8172,0x6c56e6ff,0xb7414e68,0xfe4c29e5, | ||
161 | 0x444605f7,0x0d4b627a,0xd65ccaed,0x9f51ad60,0x64b28674,0x2dbfe1f9,0xf6a8496e,0xbfa52ee3, | ||
162 | 0x867d0cfd,0xcf706b70,0x1467c3e7,0x5d6aa46a,0xa6898f7e,0xef84e8f3,0x34934064,0x7d9e27e9, | ||
163 | 0xc7940bfb,0x8e996c76,0x558ec4e1,0x1c83a36c,0xe7608878,0xae6deff5,0x757a4762,0x3c7720ef, | ||
164 | 0x0d9406bc,0x44996131,0x9f8ec9a6,0xd683ae2b,0x2d60853f,0x646de2b2,0xbf7a4a25,0xf6772da8, | ||
165 | 0x4c7d01ba,0x05706637,0xde67cea0,0x976aa92d,0x6c898239,0x2584e5b4,0xfe934d23,0xb79e2aae, | ||
166 | 0x8e4608b0,0xc74b6f3d,0x1c5cc7aa,0x5551a027,0xaeb28b33,0xe7bfecbe,0x3ca84429,0x75a523a4, | ||
167 | 0xcfaf0fb6,0x86a2683b,0x5db5c0ac,0x14b8a721,0xef5b8c35,0xa656ebb8,0x7d41432f,0x344c24a2, | ||
168 | 0x0ef10713,0x47fc609e,0x9cebc809,0xd5e6af84,0x2e058490,0x6708e31d,0xbc1f4b8a,0xf5122c07, | ||
169 | 0x4f180015,0x06156798,0xdd02cf0f,0x940fa882,0x6fec8396,0x26e1e41b,0xfdf64c8c,0xb4fb2b01, | ||
170 | 0x8d23091f,0xc42e6e92,0x1f39c605,0x5634a188,0xadd78a9c,0xe4daed11,0x3fcd4586,0x76c0220b, | ||
171 | 0xccca0e19,0x85c76994,0x5ed0c103,0x17dda68e,0xec3e8d9a,0xa533ea17,0x7e244280,0x3729250d, | ||
172 | 0x0b5e05e2,0x4253626f,0x9944caf8,0xd049ad75,0x2baa8661,0x62a7e1ec,0xb9b0497b,0xf0bd2ef6, | ||
173 | 0x4ab702e4,0x03ba6569,0xd8adcdfe,0x91a0aa73,0x6a438167,0x234ee6ea,0xf8594e7d,0xb15429f0, | ||
174 | 0x888c0bee,0xc1816c63,0x1a96c4f4,0x539ba379,0xa878886d,0xe175efe0,0x3a624777,0x736f20fa, | ||
175 | 0xc9650ce8,0x80686b65,0x5b7fc3f2,0x1272a47f,0xe9918f6b,0xa09ce8e6,0x7b8b4071,0x328627fc, | ||
176 | 0x083b044d,0x413663c0,0x9a21cb57,0xd32cacda,0x28cf87ce,0x61c2e043,0xbad548d4,0xf3d82f59, | ||
177 | 0x49d2034b,0x00df64c6,0xdbc8cc51,0x92c5abdc,0x692680c8,0x202be745,0xfb3c4fd2,0xb231285f, | ||
178 | 0x8be90a41,0xc2e46dcc,0x19f3c55b,0x50fea2d6,0xab1d89c2,0xe210ee4f,0x390746d8,0x700a2155, | ||
179 | 0xca000d47,0x830d6aca,0x581ac25d,0x1117a5d0,0xeaf48ec4,0xa3f9e949,0x78ee41de,0x31e32653}, | ||
180 | |||
181 | {0x00000000,0x1b280d78,0x36501af0,0x2d781788,0x6ca035e0,0x77883898,0x5af02f10,0x41d82268, | ||
182 | 0xd9406bc0,0xc26866b8,0xef107130,0xf4387c48,0xb5e05e20,0xaec85358,0x83b044d0,0x989849a8, | ||
183 | 0xb641ca37,0xad69c74f,0x8011d0c7,0x9b39ddbf,0xdae1ffd7,0xc1c9f2af,0xecb1e527,0xf799e85f, | ||
184 | 0x6f01a1f7,0x7429ac8f,0x5951bb07,0x4279b67f,0x03a19417,0x1889996f,0x35f18ee7,0x2ed9839f, | ||
185 | 0x684289d9,0x736a84a1,0x5e129329,0x453a9e51,0x04e2bc39,0x1fcab141,0x32b2a6c9,0x299aabb1, | ||
186 | 0xb102e219,0xaa2aef61,0x8752f8e9,0x9c7af591,0xdda2d7f9,0xc68ada81,0xebf2cd09,0xf0dac071, | ||
187 | 0xde0343ee,0xc52b4e96,0xe853591e,0xf37b5466,0xb2a3760e,0xa98b7b76,0x84f36cfe,0x9fdb6186, | ||
188 | 0x0743282e,0x1c6b2556,0x311332de,0x2a3b3fa6,0x6be31dce,0x70cb10b6,0x5db3073e,0x469b0a46, | ||
189 | 0xd08513b2,0xcbad1eca,0xe6d50942,0xfdfd043a,0xbc252652,0xa70d2b2a,0x8a753ca2,0x915d31da, | ||
190 | 0x09c57872,0x12ed750a,0x3f956282,0x24bd6ffa,0x65654d92,0x7e4d40ea,0x53355762,0x481d5a1a, | ||
191 | 0x66c4d985,0x7decd4fd,0x5094c375,0x4bbcce0d,0x0a64ec65,0x114ce11d,0x3c34f695,0x271cfbed, | ||
192 | 0xbf84b245,0xa4acbf3d,0x89d4a8b5,0x92fca5cd,0xd32487a5,0xc80c8add,0xe5749d55,0xfe5c902d, | ||
193 | 0xb8c79a6b,0xa3ef9713,0x8e97809b,0x95bf8de3,0xd467af8b,0xcf4fa2f3,0xe237b57b,0xf91fb803, | ||
194 | 0x6187f1ab,0x7aaffcd3,0x57d7eb5b,0x4cffe623,0x0d27c44b,0x160fc933,0x3b77debb,0x205fd3c3, | ||
195 | 0x0e86505c,0x15ae5d24,0x38d64aac,0x23fe47d4,0x622665bc,0x790e68c4,0x54767f4c,0x4f5e7234, | ||
196 | 0xd7c63b9c,0xccee36e4,0xe196216c,0xfabe2c14,0xbb660e7c,0xa04e0304,0x8d36148c,0x961e19f4, | ||
197 | 0xa5cb3ad3,0xbee337ab,0x939b2023,0x88b32d5b,0xc96b0f33,0xd243024b,0xff3b15c3,0xe41318bb, | ||
198 | 0x7c8b5113,0x67a35c6b,0x4adb4be3,0x51f3469b,0x102b64f3,0x0b03698b,0x267b7e03,0x3d53737b, | ||
199 | 0x138af0e4,0x08a2fd9c,0x25daea14,0x3ef2e76c,0x7f2ac504,0x6402c87c,0x497adff4,0x5252d28c, | ||
200 | 0xcaca9b24,0xd1e2965c,0xfc9a81d4,0xe7b28cac,0xa66aaec4,0xbd42a3bc,0x903ab434,0x8b12b94c, | ||
201 | 0xcd89b30a,0xd6a1be72,0xfbd9a9fa,0xe0f1a482,0xa12986ea,0xba018b92,0x97799c1a,0x8c519162, | ||
202 | 0x14c9d8ca,0x0fe1d5b2,0x2299c23a,0x39b1cf42,0x7869ed2a,0x6341e052,0x4e39f7da,0x5511faa2, | ||
203 | 0x7bc8793d,0x60e07445,0x4d9863cd,0x56b06eb5,0x17684cdd,0x0c4041a5,0x2138562d,0x3a105b55, | ||
204 | 0xa28812fd,0xb9a01f85,0x94d8080d,0x8ff00575,0xce28271d,0xd5002a65,0xf8783ded,0xe3503095, | ||
205 | 0x754e2961,0x6e662419,0x431e3391,0x58363ee9,0x19ee1c81,0x02c611f9,0x2fbe0671,0x34960b09, | ||
206 | 0xac0e42a1,0xb7264fd9,0x9a5e5851,0x81765529,0xc0ae7741,0xdb867a39,0xf6fe6db1,0xedd660c9, | ||
207 | 0xc30fe356,0xd827ee2e,0xf55ff9a6,0xee77f4de,0xafafd6b6,0xb487dbce,0x99ffcc46,0x82d7c13e, | ||
208 | 0x1a4f8896,0x016785ee,0x2c1f9266,0x37379f1e,0x76efbd76,0x6dc7b00e,0x40bfa786,0x5b97aafe, | ||
209 | 0x1d0ca0b8,0x0624adc0,0x2b5cba48,0x3074b730,0x71ac9558,0x6a849820,0x47fc8fa8,0x5cd482d0, | ||
210 | 0xc44ccb78,0xdf64c600,0xf21cd188,0xe934dcf0,0xa8ecfe98,0xb3c4f3e0,0x9ebce468,0x8594e910, | ||
211 | 0xab4d6a8f,0xb06567f7,0x9d1d707f,0x86357d07,0xc7ed5f6f,0xdcc55217,0xf1bd459f,0xea9548e7, | ||
212 | 0x720d014f,0x69250c37,0x445d1bbf,0x5f7516c7,0x1ead34af,0x058539d7,0x28fd2e5f,0x33d52327}, | ||
213 | |||
214 | {0x00000000,0x4f576811,0x9eaed022,0xd1f9b833,0x399cbdf3,0x76cbd5e2,0xa7326dd1,0xe86505c0, | ||
215 | 0x73397be6,0x3c6e13f7,0xed97abc4,0xa2c0c3d5,0x4aa5c615,0x05f2ae04,0xd40b1637,0x9b5c7e26, | ||
216 | 0xe672f7cc,0xa9259fdd,0x78dc27ee,0x378b4fff,0xdfee4a3f,0x90b9222e,0x41409a1d,0x0e17f20c, | ||
217 | 0x954b8c2a,0xda1ce43b,0x0be55c08,0x44b23419,0xacd731d9,0xe38059c8,0x3279e1fb,0x7d2e89ea, | ||
218 | 0xc824f22f,0x87739a3e,0x568a220d,0x19dd4a1c,0xf1b84fdc,0xbeef27cd,0x6f169ffe,0x2041f7ef, | ||
219 | 0xbb1d89c9,0xf44ae1d8,0x25b359eb,0x6ae431fa,0x8281343a,0xcdd65c2b,0x1c2fe418,0x53788c09, | ||
220 | 0x2e5605e3,0x61016df2,0xb0f8d5c1,0xffafbdd0,0x17cab810,0x589dd001,0x89646832,0xc6330023, | ||
221 | 0x5d6f7e05,0x12381614,0xc3c1ae27,0x8c96c636,0x64f3c3f6,0x2ba4abe7,0xfa5d13d4,0xb50a7bc5, | ||
222 | 0x9488f9e9,0xdbdf91f8,0x0a2629cb,0x457141da,0xad14441a,0xe2432c0b,0x33ba9438,0x7cedfc29, | ||
223 | 0xe7b1820f,0xa8e6ea1e,0x791f522d,0x36483a3c,0xde2d3ffc,0x917a57ed,0x4083efde,0x0fd487cf, | ||
224 | 0x72fa0e25,0x3dad6634,0xec54de07,0xa303b616,0x4b66b3d6,0x0431dbc7,0xd5c863f4,0x9a9f0be5, | ||
225 | 0x01c375c3,0x4e941dd2,0x9f6da5e1,0xd03acdf0,0x385fc830,0x7708a021,0xa6f11812,0xe9a67003, | ||
226 | 0x5cac0bc6,0x13fb63d7,0xc202dbe4,0x8d55b3f5,0x6530b635,0x2a67de24,0xfb9e6617,0xb4c90e06, | ||
227 | 0x2f957020,0x60c21831,0xb13ba002,0xfe6cc813,0x1609cdd3,0x595ea5c2,0x88a71df1,0xc7f075e0, | ||
228 | 0xbadefc0a,0xf589941b,0x24702c28,0x6b274439,0x834241f9,0xcc1529e8,0x1dec91db,0x52bbf9ca, | ||
229 | 0xc9e787ec,0x86b0effd,0x574957ce,0x181e3fdf,0xf07b3a1f,0xbf2c520e,0x6ed5ea3d,0x2182822c, | ||
230 | 0x2dd0ee65,0x62878674,0xb37e3e47,0xfc295656,0x144c5396,0x5b1b3b87,0x8ae283b4,0xc5b5eba5, | ||
231 | 0x5ee99583,0x11befd92,0xc04745a1,0x8f102db0,0x67752870,0x28224061,0xf9dbf852,0xb68c9043, | ||
232 | 0xcba219a9,0x84f571b8,0x550cc98b,0x1a5ba19a,0xf23ea45a,0xbd69cc4b,0x6c907478,0x23c71c69, | ||
233 | 0xb89b624f,0xf7cc0a5e,0x2635b26d,0x6962da7c,0x8107dfbc,0xce50b7ad,0x1fa90f9e,0x50fe678f, | ||
234 | 0xe5f41c4a,0xaaa3745b,0x7b5acc68,0x340da479,0xdc68a1b9,0x933fc9a8,0x42c6719b,0x0d91198a, | ||
235 | 0x96cd67ac,0xd99a0fbd,0x0863b78e,0x4734df9f,0xaf51da5f,0xe006b24e,0x31ff0a7d,0x7ea8626c, | ||
236 | 0x0386eb86,0x4cd18397,0x9d283ba4,0xd27f53b5,0x3a1a5675,0x754d3e64,0xa4b48657,0xebe3ee46, | ||
237 | 0x70bf9060,0x3fe8f871,0xee114042,0xa1462853,0x49232d93,0x06744582,0xd78dfdb1,0x98da95a0, | ||
238 | 0xb958178c,0xf60f7f9d,0x27f6c7ae,0x68a1afbf,0x80c4aa7f,0xcf93c26e,0x1e6a7a5d,0x513d124c, | ||
239 | 0xca616c6a,0x8536047b,0x54cfbc48,0x1b98d459,0xf3fdd199,0xbcaab988,0x6d5301bb,0x220469aa, | ||
240 | 0x5f2ae040,0x107d8851,0xc1843062,0x8ed35873,0x66b65db3,0x29e135a2,0xf8188d91,0xb74fe580, | ||
241 | 0x2c139ba6,0x6344f3b7,0xb2bd4b84,0xfdea2395,0x158f2655,0x5ad84e44,0x8b21f677,0xc4769e66, | ||
242 | 0x717ce5a3,0x3e2b8db2,0xefd23581,0xa0855d90,0x48e05850,0x07b73041,0xd64e8872,0x9919e063, | ||
243 | 0x02459e45,0x4d12f654,0x9ceb4e67,0xd3bc2676,0x3bd923b6,0x748e4ba7,0xa577f394,0xea209b85, | ||
244 | 0x970e126f,0xd8597a7e,0x09a0c24d,0x46f7aa5c,0xae92af9c,0xe1c5c78d,0x303c7fbe,0x7f6b17af, | ||
245 | 0xe4376989,0xab600198,0x7a99b9ab,0x35ced1ba,0xddabd47a,0x92fcbc6b,0x43050458,0x0c526c49}, | ||
246 | |||
247 | {0x00000000,0x5ba1dcca,0xb743b994,0xece2655e,0x6a466e9f,0x31e7b255,0xdd05d70b,0x86a40bc1, | ||
248 | 0xd48cdd3e,0x8f2d01f4,0x63cf64aa,0x386eb860,0xbecab3a1,0xe56b6f6b,0x09890a35,0x5228d6ff, | ||
249 | 0xadd8a7cb,0xf6797b01,0x1a9b1e5f,0x413ac295,0xc79ec954,0x9c3f159e,0x70dd70c0,0x2b7cac0a, | ||
250 | 0x79547af5,0x22f5a63f,0xce17c361,0x95b61fab,0x1312146a,0x48b3c8a0,0xa451adfe,0xfff07134, | ||
251 | 0x5f705221,0x04d18eeb,0xe833ebb5,0xb392377f,0x35363cbe,0x6e97e074,0x8275852a,0xd9d459e0, | ||
252 | 0x8bfc8f1f,0xd05d53d5,0x3cbf368b,0x671eea41,0xe1bae180,0xba1b3d4a,0x56f95814,0x0d5884de, | ||
253 | 0xf2a8f5ea,0xa9092920,0x45eb4c7e,0x1e4a90b4,0x98ee9b75,0xc34f47bf,0x2fad22e1,0x740cfe2b, | ||
254 | 0x262428d4,0x7d85f41e,0x91679140,0xcac64d8a,0x4c62464b,0x17c39a81,0xfb21ffdf,0xa0802315, | ||
255 | 0xbee0a442,0xe5417888,0x09a31dd6,0x5202c11c,0xd4a6cadd,0x8f071617,0x63e57349,0x3844af83, | ||
256 | 0x6a6c797c,0x31cda5b6,0xdd2fc0e8,0x868e1c22,0x002a17e3,0x5b8bcb29,0xb769ae77,0xecc872bd, | ||
257 | 0x13380389,0x4899df43,0xa47bba1d,0xffda66d7,0x797e6d16,0x22dfb1dc,0xce3dd482,0x959c0848, | ||
258 | 0xc7b4deb7,0x9c15027d,0x70f76723,0x2b56bbe9,0xadf2b028,0xf6536ce2,0x1ab109bc,0x4110d576, | ||
259 | 0xe190f663,0xba312aa9,0x56d34ff7,0x0d72933d,0x8bd698fc,0xd0774436,0x3c952168,0x6734fda2, | ||
260 | 0x351c2b5d,0x6ebdf797,0x825f92c9,0xd9fe4e03,0x5f5a45c2,0x04fb9908,0xe819fc56,0xb3b8209c, | ||
261 | 0x4c4851a8,0x17e98d62,0xfb0be83c,0xa0aa34f6,0x260e3f37,0x7dafe3fd,0x914d86a3,0xcaec5a69, | ||
262 | 0x98c48c96,0xc365505c,0x2f873502,0x7426e9c8,0xf282e209,0xa9233ec3,0x45c15b9d,0x1e608757, | ||
263 | 0x79005533,0x22a189f9,0xce43eca7,0x95e2306d,0x13463bac,0x48e7e766,0xa4058238,0xffa45ef2, | ||
264 | 0xad8c880d,0xf62d54c7,0x1acf3199,0x416eed53,0xc7cae692,0x9c6b3a58,0x70895f06,0x2b2883cc, | ||
265 | 0xd4d8f2f8,0x8f792e32,0x639b4b6c,0x383a97a6,0xbe9e9c67,0xe53f40ad,0x09dd25f3,0x527cf939, | ||
266 | 0x00542fc6,0x5bf5f30c,0xb7179652,0xecb64a98,0x6a124159,0x31b39d93,0xdd51f8cd,0x86f02407, | ||
267 | 0x26700712,0x7dd1dbd8,0x9133be86,0xca92624c,0x4c36698d,0x1797b547,0xfb75d019,0xa0d40cd3, | ||
268 | 0xf2fcda2c,0xa95d06e6,0x45bf63b8,0x1e1ebf72,0x98bab4b3,0xc31b6879,0x2ff90d27,0x7458d1ed, | ||
269 | 0x8ba8a0d9,0xd0097c13,0x3ceb194d,0x674ac587,0xe1eece46,0xba4f128c,0x56ad77d2,0x0d0cab18, | ||
270 | 0x5f247de7,0x0485a12d,0xe867c473,0xb3c618b9,0x35621378,0x6ec3cfb2,0x8221aaec,0xd9807626, | ||
271 | 0xc7e0f171,0x9c412dbb,0x70a348e5,0x2b02942f,0xada69fee,0xf6074324,0x1ae5267a,0x4144fab0, | ||
272 | 0x136c2c4f,0x48cdf085,0xa42f95db,0xff8e4911,0x792a42d0,0x228b9e1a,0xce69fb44,0x95c8278e, | ||
273 | 0x6a3856ba,0x31998a70,0xdd7bef2e,0x86da33e4,0x007e3825,0x5bdfe4ef,0xb73d81b1,0xec9c5d7b, | ||
274 | 0xbeb48b84,0xe515574e,0x09f73210,0x5256eeda,0xd4f2e51b,0x8f5339d1,0x63b15c8f,0x38108045, | ||
275 | 0x9890a350,0xc3317f9a,0x2fd31ac4,0x7472c60e,0xf2d6cdcf,0xa9771105,0x4595745b,0x1e34a891, | ||
276 | 0x4c1c7e6e,0x17bda2a4,0xfb5fc7fa,0xa0fe1b30,0x265a10f1,0x7dfbcc3b,0x9119a965,0xcab875af, | ||
277 | 0x3548049b,0x6ee9d851,0x820bbd0f,0xd9aa61c5,0x5f0e6a04,0x04afb6ce,0xe84dd390,0xb3ec0f5a, | ||
278 | 0xe1c4d9a5,0xba65056f,0x56876031,0x0d26bcfb,0x8b82b73a,0xd0236bf0,0x3cc10eae,0x6760d264}}; | ||
diff --git a/lib/rbcodec/codecs/libopus/ogg/framing.c b/lib/rbcodec/codecs/libopus/ogg/framing.c index f007de176a..a7032a6a35 100644 --- a/lib/rbcodec/codecs/libopus/ogg/framing.c +++ b/lib/rbcodec/codecs/libopus/ogg/framing.c | |||
@@ -5,14 +5,13 @@ | |||
5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * | 5 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * |
6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * | 6 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * |
7 | * * | 7 | * * |
8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 * | 8 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2018 * |
9 | * by the Xiph.Org Foundation http://www.xiph.org/ * | 9 | * by the Xiph.Org Foundation http://www.xiph.org/ * |
10 | * * | 10 | * * |
11 | ******************************************************************** | 11 | ******************************************************************** |
12 | 12 | ||
13 | function: code raw packets into framed OggSquish stream and | 13 | function: code raw packets into framed OggSquish stream and |
14 | decode Ogg streams back into raw packets | 14 | decode Ogg streams back into raw packets |
15 | last mod: $Id: framing.c 18052 2011-08-04 17:57:02Z giles $ | ||
16 | 15 | ||
17 | note: The CRC code is directly derived from public domain code by | 16 | note: The CRC code is directly derived from public domain code by |
18 | Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html | 17 | Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html |
@@ -20,9 +19,14 @@ | |||
20 | 19 | ||
21 | ********************************************************************/ | 20 | ********************************************************************/ |
22 | 21 | ||
22 | #ifdef HAVE_CONFIG_H | ||
23 | #include "config.h" | ||
24 | #endif | ||
25 | |||
23 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include <limits.h> | ||
24 | #include <string.h> | 28 | #include <string.h> |
25 | #include <ogg/ogg.h> | 29 | #include "ogg.h" |
26 | 30 | ||
27 | /* A complete description of Ogg framing exists in docs/framing.html */ | 31 | /* A complete description of Ogg framing exists in docs/framing.html */ |
28 | 32 | ||
@@ -98,90 +102,31 @@ int ogg_page_packets(const ogg_page *og){ | |||
98 | 102 | ||
99 | #if 0 | 103 | #if 0 |
100 | /* helper to initialize lookup for direct-table CRC (illustrative; we | 104 | /* helper to initialize lookup for direct-table CRC (illustrative; we |
101 | use the static init below) */ | 105 | use the static init in crctable.h) */ |
102 | 106 | ||
103 | static ogg_uint32_t _ogg_crc_entry(unsigned long index){ | 107 | static void _ogg_crc_init(){ |
104 | int i; | 108 | int i, j; |
105 | unsigned long r; | 109 | ogg_uint32_t polynomial, crc; |
106 | 110 | polynomial = 0x04c11db7; /* The same as the ethernet generator | |
107 | r = index << 24; | 111 | polynomial, although we use an |
108 | for (i=0; i<8; i++) | 112 | unreflected alg and an init/final |
109 | if (r & 0x80000000UL) | 113 | of 0, not 0xffffffff */ |
110 | r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator | 114 | for (i = 0; i <= 0xFF; i++){ |
111 | polynomial, although we use an | 115 | crc = i << 24; |
112 | unreflected alg and an init/final | 116 | |
113 | of 0, not 0xffffffff */ | 117 | for (j = 0; j < 8; j++) |
114 | else | 118 | crc = (crc << 1) ^ (crc & (1 << 31) ? polynomial : 0); |
115 | r<<=1; | 119 | |
116 | return (r & 0xffffffffUL); | 120 | crc_lookup[0][i] = crc; |
121 | } | ||
122 | |||
123 | for (i = 0; i <= 0xFF; i++) | ||
124 | for (j = 1; j < 8; j++) | ||
125 | crc_lookup[j][i] = crc_lookup[0][(crc_lookup[j - 1][i] >> 24) & 0xFF] ^ (crc_lookup[j - 1][i] << 8); | ||
117 | } | 126 | } |
118 | #endif | 127 | #endif |
119 | 128 | ||
120 | static const ogg_uint32_t crc_lookup[256]={ | 129 | #include "crctable.h" |
121 | 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9, | ||
122 | 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005, | ||
123 | 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61, | ||
124 | 0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd, | ||
125 | 0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9, | ||
126 | 0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75, | ||
127 | 0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011, | ||
128 | 0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd, | ||
129 | 0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039, | ||
130 | 0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5, | ||
131 | 0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81, | ||
132 | 0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d, | ||
133 | 0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49, | ||
134 | 0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95, | ||
135 | 0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1, | ||
136 | 0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d, | ||
137 | 0x34867077,0x30476dc0,0x3d044b19,0x39c556ae, | ||
138 | 0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072, | ||
139 | 0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16, | ||
140 | 0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca, | ||
141 | 0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde, | ||
142 | 0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02, | ||
143 | 0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066, | ||
144 | 0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba, | ||
145 | 0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e, | ||
146 | 0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692, | ||
147 | 0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6, | ||
148 | 0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a, | ||
149 | 0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e, | ||
150 | 0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2, | ||
151 | 0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686, | ||
152 | 0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a, | ||
153 | 0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637, | ||
154 | 0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb, | ||
155 | 0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f, | ||
156 | 0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53, | ||
157 | 0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47, | ||
158 | 0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b, | ||
159 | 0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff, | ||
160 | 0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623, | ||
161 | 0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7, | ||
162 | 0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b, | ||
163 | 0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f, | ||
164 | 0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3, | ||
165 | 0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7, | ||
166 | 0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b, | ||
167 | 0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f, | ||
168 | 0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3, | ||
169 | 0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640, | ||
170 | 0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c, | ||
171 | 0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8, | ||
172 | 0x68860bfd,0x6c47164a,0x61043093,0x65c52d24, | ||
173 | 0x119b4be9,0x155a565e,0x18197087,0x1cd86d30, | ||
174 | 0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec, | ||
175 | 0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088, | ||
176 | 0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654, | ||
177 | 0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0, | ||
178 | 0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c, | ||
179 | 0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18, | ||
180 | 0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4, | ||
181 | 0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0, | ||
182 | 0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c, | ||
183 | 0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668, | ||
184 | 0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4}; | ||
185 | 130 | ||
186 | /* init the encode/decode logical stream state */ | 131 | /* init the encode/decode logical stream state */ |
187 | 132 | ||
@@ -236,39 +181,51 @@ int ogg_stream_destroy(ogg_stream_state *os){ | |||
236 | /* Helpers for ogg_stream_encode; this keeps the structure and | 181 | /* Helpers for ogg_stream_encode; this keeps the structure and |
237 | what's happening fairly clear */ | 182 | what's happening fairly clear */ |
238 | 183 | ||
239 | static int _os_body_expand(ogg_stream_state *os,int needed){ | 184 | static int _os_body_expand(ogg_stream_state *os,long needed){ |
240 | if(os->body_storage<=os->body_fill+needed){ | 185 | if(os->body_storage-needed<=os->body_fill){ |
186 | long body_storage; | ||
241 | void *ret; | 187 | void *ret; |
242 | ret=_ogg_realloc(os->body_data,(os->body_storage+needed+1024)* | 188 | if(os->body_storage>LONG_MAX-needed){ |
243 | sizeof(*os->body_data)); | 189 | ogg_stream_clear(os); |
190 | return -1; | ||
191 | } | ||
192 | body_storage=os->body_storage+needed; | ||
193 | if(body_storage<LONG_MAX-1024)body_storage+=1024; | ||
194 | ret=_ogg_realloc(os->body_data,body_storage*sizeof(*os->body_data)); | ||
244 | if(!ret){ | 195 | if(!ret){ |
245 | ogg_stream_clear(os); | 196 | ogg_stream_clear(os); |
246 | return -1; | 197 | return -1; |
247 | } | 198 | } |
248 | os->body_storage+=(needed+1024); | 199 | os->body_storage=body_storage; |
249 | os->body_data=ret; | 200 | os->body_data=ret; |
250 | } | 201 | } |
251 | return 0; | 202 | return 0; |
252 | } | 203 | } |
253 | 204 | ||
254 | static int _os_lacing_expand(ogg_stream_state *os,int needed){ | 205 | static int _os_lacing_expand(ogg_stream_state *os,long needed){ |
255 | if(os->lacing_storage<=os->lacing_fill+needed){ | 206 | if(os->lacing_storage-needed<=os->lacing_fill){ |
207 | long lacing_storage; | ||
256 | void *ret; | 208 | void *ret; |
257 | ret=_ogg_realloc(os->lacing_vals,(os->lacing_storage+needed+32)* | 209 | if(os->lacing_storage>LONG_MAX-needed){ |
258 | sizeof(*os->lacing_vals)); | 210 | ogg_stream_clear(os); |
211 | return -1; | ||
212 | } | ||
213 | lacing_storage=os->lacing_storage+needed; | ||
214 | if(lacing_storage<LONG_MAX-32)lacing_storage+=32; | ||
215 | ret=_ogg_realloc(os->lacing_vals,lacing_storage*sizeof(*os->lacing_vals)); | ||
259 | if(!ret){ | 216 | if(!ret){ |
260 | ogg_stream_clear(os); | 217 | ogg_stream_clear(os); |
261 | return -1; | 218 | return -1; |
262 | } | 219 | } |
263 | os->lacing_vals=ret; | 220 | os->lacing_vals=ret; |
264 | ret=_ogg_realloc(os->granule_vals,(os->lacing_storage+needed+32)* | 221 | ret=_ogg_realloc(os->granule_vals,lacing_storage* |
265 | sizeof(*os->granule_vals)); | 222 | sizeof(*os->granule_vals)); |
266 | if(!ret){ | 223 | if(!ret){ |
267 | ogg_stream_clear(os); | 224 | ogg_stream_clear(os); |
268 | return -1; | 225 | return -1; |
269 | } | 226 | } |
270 | os->granule_vals=ret; | 227 | os->granule_vals=ret; |
271 | os->lacing_storage+=(needed+32); | 228 | os->lacing_storage=lacing_storage; |
272 | } | 229 | } |
273 | return 0; | 230 | return 0; |
274 | } | 231 | } |
@@ -277,10 +234,27 @@ static int _os_lacing_expand(ogg_stream_state *os,int needed){ | |||
277 | /* Direct table CRC; note that this will be faster in the future if we | 234 | /* Direct table CRC; note that this will be faster in the future if we |
278 | perform the checksum simultaneously with other copies */ | 235 | perform the checksum simultaneously with other copies */ |
279 | 236 | ||
237 | static ogg_uint32_t _os_update_crc(ogg_uint32_t crc, unsigned char *buffer, int size){ | ||
238 | while (size>=8){ | ||
239 | crc^=buffer[0]<<24|buffer[1]<<16|buffer[2]<<8|buffer[3]; | ||
240 | |||
241 | crc=crc_lookup[7][ crc>>24 ]^crc_lookup[6][(crc>>16)&0xFF]^ | ||
242 | crc_lookup[5][(crc>> 8)&0xFF]^crc_lookup[4][ crc &0xFF]^ | ||
243 | crc_lookup[3][buffer[4] ]^crc_lookup[2][buffer[5] ]^ | ||
244 | crc_lookup[1][buffer[6] ]^crc_lookup[0][buffer[7] ]; | ||
245 | |||
246 | buffer+=8; | ||
247 | size-=8; | ||
248 | } | ||
249 | |||
250 | while (size--) | ||
251 | crc=(crc<<8)^crc_lookup[0][((crc >> 24)&0xff)^*buffer++]; | ||
252 | return crc; | ||
253 | } | ||
254 | |||
280 | void ogg_page_checksum_set(ogg_page *og){ | 255 | void ogg_page_checksum_set(ogg_page *og){ |
281 | if(og){ | 256 | if(og){ |
282 | ogg_uint32_t crc_reg=0; | 257 | ogg_uint32_t crc_reg=0; |
283 | int i; | ||
284 | 258 | ||
285 | /* safety; needed for API behavior, but not framing code */ | 259 | /* safety; needed for API behavior, but not framing code */ |
286 | og->header[22]=0; | 260 | og->header[22]=0; |
@@ -288,10 +262,8 @@ void ogg_page_checksum_set(ogg_page *og){ | |||
288 | og->header[24]=0; | 262 | og->header[24]=0; |
289 | og->header[25]=0; | 263 | og->header[25]=0; |
290 | 264 | ||
291 | for(i=0;i<og->header_len;i++) | 265 | crc_reg=_os_update_crc(crc_reg,og->header,og->header_len); |
292 | crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]]; | 266 | crc_reg=_os_update_crc(crc_reg,og->body,og->body_len); |
293 | for(i=0;i<og->body_len;i++) | ||
294 | crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]]; | ||
295 | 267 | ||
296 | og->header[22]=(unsigned char)(crc_reg&0xff); | 268 | og->header[22]=(unsigned char)(crc_reg&0xff); |
297 | og->header[23]=(unsigned char)((crc_reg>>8)&0xff); | 269 | og->header[23]=(unsigned char)((crc_reg>>8)&0xff); |
@@ -304,12 +276,17 @@ void ogg_page_checksum_set(ogg_page *og){ | |||
304 | int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count, | 276 | int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count, |
305 | long e_o_s, ogg_int64_t granulepos){ | 277 | long e_o_s, ogg_int64_t granulepos){ |
306 | 278 | ||
307 | int bytes = 0, lacing_vals, i; | 279 | long bytes = 0, lacing_vals; |
280 | int i; | ||
308 | 281 | ||
309 | if(ogg_stream_check(os)) return -1; | 282 | if(ogg_stream_check(os)) return -1; |
310 | if(!iov) return 0; | 283 | if(!iov) return 0; |
311 | 284 | ||
312 | for (i = 0; i < count; ++i) bytes += (int)iov[i].iov_len; | 285 | for (i = 0; i < count; ++i){ |
286 | if(iov[i].iov_len>LONG_MAX) return -1; | ||
287 | if(bytes>LONG_MAX-(long)iov[i].iov_len) return -1; | ||
288 | bytes += (long)iov[i].iov_len; | ||
289 | } | ||
313 | lacing_vals=bytes/255+1; | 290 | lacing_vals=bytes/255+1; |
314 | 291 | ||
315 | if(os->body_returned){ | 292 | if(os->body_returned){ |
@@ -396,9 +373,9 @@ static int ogg_stream_flush_i(ogg_stream_state *os,ogg_page *og, int force, int | |||
396 | }else{ | 373 | }else{ |
397 | 374 | ||
398 | /* The extra packets_done, packet_just_done logic here attempts to do two things: | 375 | /* The extra packets_done, packet_just_done logic here attempts to do two things: |
399 | 1) Don't unneccessarily span pages. | 376 | 1) Don't unnecessarily span pages. |
400 | 2) Unless necessary, don't flush pages if there are less than four packets on | 377 | 2) Unless necessary, don't flush pages if there are less than four packets on |
401 | them; this expands page size to reduce unneccessary overhead if incoming packets | 378 | them; this expands page size to reduce unnecessary overhead if incoming packets |
402 | are large. | 379 | are large. |
403 | These are not necessary behaviors, just 'always better than naive flushing' | 380 | These are not necessary behaviors, just 'always better than naive flushing' |
404 | without requiring an application to explicitly request a specific optimized | 381 | without requiring an application to explicitly request a specific optimized |
@@ -683,7 +660,7 @@ long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){ | |||
683 | if(oy->bodybytes+oy->headerbytes>bytes)return(0); | 660 | if(oy->bodybytes+oy->headerbytes>bytes)return(0); |
684 | 661 | ||
685 | /* The whole test page is buffered. Verify the checksum */ | 662 | /* The whole test page is buffered. Verify the checksum */ |
686 | if (0) { | 663 | { |
687 | /* Grab the checksum bytes, set the header field to zero */ | 664 | /* Grab the checksum bytes, set the header field to zero */ |
688 | char chksum[4]; | 665 | char chksum[4]; |
689 | ogg_page log; | 666 | ogg_page log; |
@@ -705,8 +682,10 @@ long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){ | |||
705 | /* replace the computed checksum with the one actually read in */ | 682 | /* replace the computed checksum with the one actually read in */ |
706 | memcpy(page+22,chksum,4); | 683 | memcpy(page+22,chksum,4); |
707 | 684 | ||
685 | #ifndef DISABLE_CRC | ||
708 | /* Bad checksum. Lose sync */ | 686 | /* Bad checksum. Lose sync */ |
709 | goto sync_fail; | 687 | goto sync_fail; |
688 | #endif | ||
710 | } | 689 | } |
711 | } | 690 | } |
712 | 691 | ||
@@ -780,6 +759,7 @@ int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){ | |||
780 | } | 759 | } |
781 | 760 | ||
782 | /* loop. keep looking */ | 761 | /* loop. keep looking */ |
762 | |||
783 | } | 763 | } |
784 | } | 764 | } |
785 | 765 | ||
@@ -856,6 +836,7 @@ int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){ | |||
856 | some segments */ | 836 | some segments */ |
857 | if(continued){ | 837 | if(continued){ |
858 | if(os->lacing_fill<1 || | 838 | if(os->lacing_fill<1 || |
839 | (os->lacing_vals[os->lacing_fill-1]&0xff)<255 || | ||
859 | os->lacing_vals[os->lacing_fill-1]==0x400){ | 840 | os->lacing_vals[os->lacing_fill-1]==0x400){ |
860 | bos=0; | 841 | bos=0; |
861 | for(;segptr<segments;segptr++){ | 842 | for(;segptr<segments;segptr++){ |
@@ -1023,3 +1004,1106 @@ void ogg_packet_clear(ogg_packet *op) { | |||
1023 | memset(op, 0, sizeof(*op)); | 1004 | memset(op, 0, sizeof(*op)); |
1024 | } | 1005 | } |
1025 | 1006 | ||
1007 | #ifdef _V_SELFTEST | ||
1008 | #include <stdio.h> | ||
1009 | |||
1010 | ogg_stream_state os_en, os_de; | ||
1011 | ogg_sync_state oy; | ||
1012 | |||
1013 | void checkpacket(ogg_packet *op,long len, int no, long pos){ | ||
1014 | long j; | ||
1015 | static int sequence=0; | ||
1016 | static int lastno=0; | ||
1017 | |||
1018 | if(op->bytes!=len){ | ||
1019 | fprintf(stderr,"incorrect packet length (%ld != %ld)!\n",op->bytes,len); | ||
1020 | exit(1); | ||
1021 | } | ||
1022 | if(op->granulepos!=pos){ | ||
1023 | fprintf(stderr,"incorrect packet granpos (%ld != %ld)!\n",(long)op->granulepos,pos); | ||
1024 | exit(1); | ||
1025 | } | ||
1026 | |||
1027 | /* packet number just follows sequence/gap; adjust the input number | ||
1028 | for that */ | ||
1029 | if(no==0){ | ||
1030 | sequence=0; | ||
1031 | }else{ | ||
1032 | sequence++; | ||
1033 | if(no>lastno+1) | ||
1034 | sequence++; | ||
1035 | } | ||
1036 | lastno=no; | ||
1037 | if(op->packetno!=sequence){ | ||
1038 | fprintf(stderr,"incorrect packet sequence %ld != %d\n", | ||
1039 | (long)(op->packetno),sequence); | ||
1040 | exit(1); | ||
1041 | } | ||
1042 | |||
1043 | /* Test data */ | ||
1044 | for(j=0;j<op->bytes;j++) | ||
1045 | if(op->packet[j]!=((j+no)&0xff)){ | ||
1046 | fprintf(stderr,"body data mismatch (1) at pos %ld: %x!=%lx!\n\n", | ||
1047 | j,op->packet[j],(j+no)&0xff); | ||
1048 | exit(1); | ||
1049 | } | ||
1050 | } | ||
1051 | |||
1052 | void check_page(unsigned char *data,const int *header,ogg_page *og){ | ||
1053 | long j; | ||
1054 | /* Test data */ | ||
1055 | for(j=0;j<og->body_len;j++) | ||
1056 | if(og->body[j]!=data[j]){ | ||
1057 | fprintf(stderr,"body data mismatch (2) at pos %ld: %x!=%x!\n\n", | ||
1058 | j,data[j],og->body[j]); | ||
1059 | exit(1); | ||
1060 | } | ||
1061 | |||
1062 | /* Test header */ | ||
1063 | for(j=0;j<og->header_len;j++){ | ||
1064 | if(og->header[j]!=header[j]){ | ||
1065 | fprintf(stderr,"header content mismatch at pos %ld:\n",j); | ||
1066 | for(j=0;j<header[26]+27;j++) | ||
1067 | fprintf(stderr," (%ld)%02x:%02x",j,header[j],og->header[j]); | ||
1068 | fprintf(stderr,"\n"); | ||
1069 | exit(1); | ||
1070 | } | ||
1071 | } | ||
1072 | if(og->header_len!=header[26]+27){ | ||
1073 | fprintf(stderr,"header length incorrect! (%ld!=%d)\n", | ||
1074 | og->header_len,header[26]+27); | ||
1075 | exit(1); | ||
1076 | } | ||
1077 | } | ||
1078 | |||
1079 | void print_header(ogg_page *og){ | ||
1080 | int j; | ||
1081 | fprintf(stderr,"\nHEADER:\n"); | ||
1082 | fprintf(stderr," capture: %c %c %c %c version: %d flags: %x\n", | ||
1083 | og->header[0],og->header[1],og->header[2],og->header[3], | ||
1084 | (int)og->header[4],(int)og->header[5]); | ||
1085 | |||
1086 | fprintf(stderr," granulepos: %d serialno: %d pageno: %ld\n", | ||
1087 | (og->header[9]<<24)|(og->header[8]<<16)| | ||
1088 | (og->header[7]<<8)|og->header[6], | ||
1089 | (og->header[17]<<24)|(og->header[16]<<16)| | ||
1090 | (og->header[15]<<8)|og->header[14], | ||
1091 | ((long)(og->header[21])<<24)|(og->header[20]<<16)| | ||
1092 | (og->header[19]<<8)|og->header[18]); | ||
1093 | |||
1094 | fprintf(stderr," checksum: %02x:%02x:%02x:%02x\n segments: %d (", | ||
1095 | (int)og->header[22],(int)og->header[23], | ||
1096 | (int)og->header[24],(int)og->header[25], | ||
1097 | (int)og->header[26]); | ||
1098 | |||
1099 | for(j=27;j<og->header_len;j++) | ||
1100 | fprintf(stderr,"%d ",(int)og->header[j]); | ||
1101 | fprintf(stderr,")\n\n"); | ||
1102 | } | ||
1103 | |||
1104 | void copy_page(ogg_page *og){ | ||
1105 | unsigned char *temp=_ogg_malloc(og->header_len); | ||
1106 | memcpy(temp,og->header,og->header_len); | ||
1107 | og->header=temp; | ||
1108 | |||
1109 | temp=_ogg_malloc(og->body_len); | ||
1110 | memcpy(temp,og->body,og->body_len); | ||
1111 | og->body=temp; | ||
1112 | } | ||
1113 | |||
1114 | void free_page(ogg_page *og){ | ||
1115 | _ogg_free (og->header); | ||
1116 | _ogg_free (og->body); | ||
1117 | } | ||
1118 | |||
1119 | void error(void){ | ||
1120 | fprintf(stderr,"error!\n"); | ||
1121 | exit(1); | ||
1122 | } | ||
1123 | |||
1124 | /* 17 only */ | ||
1125 | const int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06, | ||
1126 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1127 | 0x01,0x02,0x03,0x04,0,0,0,0, | ||
1128 | 0x15,0xed,0xec,0x91, | ||
1129 | 1, | ||
1130 | 17}; | ||
1131 | |||
1132 | /* 17, 254, 255, 256, 500, 510, 600 byte, pad */ | ||
1133 | const int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02, | ||
1134 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1135 | 0x01,0x02,0x03,0x04,0,0,0,0, | ||
1136 | 0x59,0x10,0x6c,0x2c, | ||
1137 | 1, | ||
1138 | 17}; | ||
1139 | const int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04, | ||
1140 | 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1141 | 0x01,0x02,0x03,0x04,1,0,0,0, | ||
1142 | 0x89,0x33,0x85,0xce, | ||
1143 | 13, | ||
1144 | 254,255,0,255,1,255,245,255,255,0, | ||
1145 | 255,255,90}; | ||
1146 | |||
1147 | /* nil packets; beginning,middle,end */ | ||
1148 | const int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02, | ||
1149 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1150 | 0x01,0x02,0x03,0x04,0,0,0,0, | ||
1151 | 0xff,0x7b,0x23,0x17, | ||
1152 | 1, | ||
1153 | 0}; | ||
1154 | const int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04, | ||
1155 | 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1156 | 0x01,0x02,0x03,0x04,1,0,0,0, | ||
1157 | 0x5c,0x3f,0x66,0xcb, | ||
1158 | 17, | ||
1159 | 17,254,255,0,0,255,1,0,255,245,255,255,0, | ||
1160 | 255,255,90,0}; | ||
1161 | |||
1162 | /* large initial packet */ | ||
1163 | const int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02, | ||
1164 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1165 | 0x01,0x02,0x03,0x04,0,0,0,0, | ||
1166 | 0x01,0x27,0x31,0xaa, | ||
1167 | 18, | ||
1168 | 255,255,255,255,255,255,255,255, | ||
1169 | 255,255,255,255,255,255,255,255,255,10}; | ||
1170 | |||
1171 | const int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04, | ||
1172 | 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1173 | 0x01,0x02,0x03,0x04,1,0,0,0, | ||
1174 | 0x7f,0x4e,0x8a,0xd2, | ||
1175 | 4, | ||
1176 | 255,4,255,0}; | ||
1177 | |||
1178 | |||
1179 | /* continuing packet test */ | ||
1180 | const int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02, | ||
1181 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1182 | 0x01,0x02,0x03,0x04,0,0,0,0, | ||
1183 | 0xff,0x7b,0x23,0x17, | ||
1184 | 1, | ||
1185 | 0}; | ||
1186 | |||
1187 | const int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00, | ||
1188 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
1189 | 0x01,0x02,0x03,0x04,1,0,0,0, | ||
1190 | 0xf8,0x3c,0x19,0x79, | ||
1191 | 255, | ||
1192 | 255,255,255,255,255,255,255,255, | ||
1193 | 255,255,255,255,255,255,255,255, | ||
1194 | 255,255,255,255,255,255,255,255, | ||
1195 | 255,255,255,255,255,255,255,255, | ||
1196 | 255,255,255,255,255,255,255,255, | ||
1197 | 255,255,255,255,255,255,255,255, | ||
1198 | 255,255,255,255,255,255,255,255, | ||
1199 | 255,255,255,255,255,255,255,255, | ||
1200 | 255,255,255,255,255,255,255,255, | ||
1201 | 255,255,255,255,255,255,255,255, | ||
1202 | 255,255,255,255,255,255,255,255, | ||
1203 | 255,255,255,255,255,255,255,255, | ||
1204 | 255,255,255,255,255,255,255,255, | ||
1205 | 255,255,255,255,255,255,255,255, | ||
1206 | 255,255,255,255,255,255,255,255, | ||
1207 | 255,255,255,255,255,255,255,255, | ||
1208 | 255,255,255,255,255,255,255,255, | ||
1209 | 255,255,255,255,255,255,255,255, | ||
1210 | 255,255,255,255,255,255,255,255, | ||
1211 | 255,255,255,255,255,255,255,255, | ||
1212 | 255,255,255,255,255,255,255,255, | ||
1213 | 255,255,255,255,255,255,255,255, | ||
1214 | 255,255,255,255,255,255,255,255, | ||
1215 | 255,255,255,255,255,255,255,255, | ||
1216 | 255,255,255,255,255,255,255,255, | ||
1217 | 255,255,255,255,255,255,255,255, | ||
1218 | 255,255,255,255,255,255,255,255, | ||
1219 | 255,255,255,255,255,255,255,255, | ||
1220 | 255,255,255,255,255,255,255,255, | ||
1221 | 255,255,255,255,255,255,255,255, | ||
1222 | 255,255,255,255,255,255,255,255, | ||
1223 | 255,255,255,255,255,255,255}; | ||
1224 | |||
1225 | const int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05, | ||
1226 | 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1227 | 0x01,0x02,0x03,0x04,2,0,0,0, | ||
1228 | 0x38,0xe6,0xb6,0x28, | ||
1229 | 6, | ||
1230 | 255,220,255,4,255,0}; | ||
1231 | |||
1232 | |||
1233 | /* spill expansion test */ | ||
1234 | const int head1_4b[] = {0x4f,0x67,0x67,0x53,0,0x02, | ||
1235 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1236 | 0x01,0x02,0x03,0x04,0,0,0,0, | ||
1237 | 0xff,0x7b,0x23,0x17, | ||
1238 | 1, | ||
1239 | 0}; | ||
1240 | |||
1241 | const int head2_4b[] = {0x4f,0x67,0x67,0x53,0,0x00, | ||
1242 | 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1243 | 0x01,0x02,0x03,0x04,1,0,0,0, | ||
1244 | 0xce,0x8f,0x17,0x1a, | ||
1245 | 23, | ||
1246 | 255,255,255,255,255,255,255,255, | ||
1247 | 255,255,255,255,255,255,255,255,255,10,255,4,255,0,0}; | ||
1248 | |||
1249 | |||
1250 | const int head3_4b[] = {0x4f,0x67,0x67,0x53,0,0x04, | ||
1251 | 0x07,0x14,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1252 | 0x01,0x02,0x03,0x04,2,0,0,0, | ||
1253 | 0x9b,0xb2,0x50,0xa1, | ||
1254 | 1, | ||
1255 | 0}; | ||
1256 | |||
1257 | /* page with the 255 segment limit */ | ||
1258 | const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02, | ||
1259 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1260 | 0x01,0x02,0x03,0x04,0,0,0,0, | ||
1261 | 0xff,0x7b,0x23,0x17, | ||
1262 | 1, | ||
1263 | 0}; | ||
1264 | |||
1265 | const int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00, | ||
1266 | 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00, | ||
1267 | 0x01,0x02,0x03,0x04,1,0,0,0, | ||
1268 | 0xed,0x2a,0x2e,0xa7, | ||
1269 | 255, | ||
1270 | 10,10,10,10,10,10,10,10, | ||
1271 | 10,10,10,10,10,10,10,10, | ||
1272 | 10,10,10,10,10,10,10,10, | ||
1273 | 10,10,10,10,10,10,10,10, | ||
1274 | 10,10,10,10,10,10,10,10, | ||
1275 | 10,10,10,10,10,10,10,10, | ||
1276 | 10,10,10,10,10,10,10,10, | ||
1277 | 10,10,10,10,10,10,10,10, | ||
1278 | 10,10,10,10,10,10,10,10, | ||
1279 | 10,10,10,10,10,10,10,10, | ||
1280 | 10,10,10,10,10,10,10,10, | ||
1281 | 10,10,10,10,10,10,10,10, | ||
1282 | 10,10,10,10,10,10,10,10, | ||
1283 | 10,10,10,10,10,10,10,10, | ||
1284 | 10,10,10,10,10,10,10,10, | ||
1285 | 10,10,10,10,10,10,10,10, | ||
1286 | 10,10,10,10,10,10,10,10, | ||
1287 | 10,10,10,10,10,10,10,10, | ||
1288 | 10,10,10,10,10,10,10,10, | ||
1289 | 10,10,10,10,10,10,10,10, | ||
1290 | 10,10,10,10,10,10,10,10, | ||
1291 | 10,10,10,10,10,10,10,10, | ||
1292 | 10,10,10,10,10,10,10,10, | ||
1293 | 10,10,10,10,10,10,10,10, | ||
1294 | 10,10,10,10,10,10,10,10, | ||
1295 | 10,10,10,10,10,10,10,10, | ||
1296 | 10,10,10,10,10,10,10,10, | ||
1297 | 10,10,10,10,10,10,10,10, | ||
1298 | 10,10,10,10,10,10,10,10, | ||
1299 | 10,10,10,10,10,10,10,10, | ||
1300 | 10,10,10,10,10,10,10,10, | ||
1301 | 10,10,10,10,10,10,10}; | ||
1302 | |||
1303 | const int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04, | ||
1304 | 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00, | ||
1305 | 0x01,0x02,0x03,0x04,2,0,0,0, | ||
1306 | 0x6c,0x3b,0x82,0x3d, | ||
1307 | 1, | ||
1308 | 50}; | ||
1309 | |||
1310 | |||
1311 | /* packet that overspans over an entire page */ | ||
1312 | const int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02, | ||
1313 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1314 | 0x01,0x02,0x03,0x04,0,0,0,0, | ||
1315 | 0xff,0x7b,0x23,0x17, | ||
1316 | 1, | ||
1317 | 0}; | ||
1318 | |||
1319 | const int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00, | ||
1320 | 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1321 | 0x01,0x02,0x03,0x04,1,0,0,0, | ||
1322 | 0x68,0x22,0x7c,0x3d, | ||
1323 | 255, | ||
1324 | 100, | ||
1325 | 255,255,255,255,255,255,255,255, | ||
1326 | 255,255,255,255,255,255,255,255, | ||
1327 | 255,255,255,255,255,255,255,255, | ||
1328 | 255,255,255,255,255,255,255,255, | ||
1329 | 255,255,255,255,255,255,255,255, | ||
1330 | 255,255,255,255,255,255,255,255, | ||
1331 | 255,255,255,255,255,255,255,255, | ||
1332 | 255,255,255,255,255,255,255,255, | ||
1333 | 255,255,255,255,255,255,255,255, | ||
1334 | 255,255,255,255,255,255,255,255, | ||
1335 | 255,255,255,255,255,255,255,255, | ||
1336 | 255,255,255,255,255,255,255,255, | ||
1337 | 255,255,255,255,255,255,255,255, | ||
1338 | 255,255,255,255,255,255,255,255, | ||
1339 | 255,255,255,255,255,255,255,255, | ||
1340 | 255,255,255,255,255,255,255,255, | ||
1341 | 255,255,255,255,255,255,255,255, | ||
1342 | 255,255,255,255,255,255,255,255, | ||
1343 | 255,255,255,255,255,255,255,255, | ||
1344 | 255,255,255,255,255,255,255,255, | ||
1345 | 255,255,255,255,255,255,255,255, | ||
1346 | 255,255,255,255,255,255,255,255, | ||
1347 | 255,255,255,255,255,255,255,255, | ||
1348 | 255,255,255,255,255,255,255,255, | ||
1349 | 255,255,255,255,255,255,255,255, | ||
1350 | 255,255,255,255,255,255,255,255, | ||
1351 | 255,255,255,255,255,255,255,255, | ||
1352 | 255,255,255,255,255,255,255,255, | ||
1353 | 255,255,255,255,255,255,255,255, | ||
1354 | 255,255,255,255,255,255,255,255, | ||
1355 | 255,255,255,255,255,255,255,255, | ||
1356 | 255,255,255,255,255,255}; | ||
1357 | |||
1358 | const int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01, | ||
1359 | 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, | ||
1360 | 0x01,0x02,0x03,0x04,2,0,0,0, | ||
1361 | 0xf4,0x87,0xba,0xf3, | ||
1362 | 255, | ||
1363 | 255,255,255,255,255,255,255,255, | ||
1364 | 255,255,255,255,255,255,255,255, | ||
1365 | 255,255,255,255,255,255,255,255, | ||
1366 | 255,255,255,255,255,255,255,255, | ||
1367 | 255,255,255,255,255,255,255,255, | ||
1368 | 255,255,255,255,255,255,255,255, | ||
1369 | 255,255,255,255,255,255,255,255, | ||
1370 | 255,255,255,255,255,255,255,255, | ||
1371 | 255,255,255,255,255,255,255,255, | ||
1372 | 255,255,255,255,255,255,255,255, | ||
1373 | 255,255,255,255,255,255,255,255, | ||
1374 | 255,255,255,255,255,255,255,255, | ||
1375 | 255,255,255,255,255,255,255,255, | ||
1376 | 255,255,255,255,255,255,255,255, | ||
1377 | 255,255,255,255,255,255,255,255, | ||
1378 | 255,255,255,255,255,255,255,255, | ||
1379 | 255,255,255,255,255,255,255,255, | ||
1380 | 255,255,255,255,255,255,255,255, | ||
1381 | 255,255,255,255,255,255,255,255, | ||
1382 | 255,255,255,255,255,255,255,255, | ||
1383 | 255,255,255,255,255,255,255,255, | ||
1384 | 255,255,255,255,255,255,255,255, | ||
1385 | 255,255,255,255,255,255,255,255, | ||
1386 | 255,255,255,255,255,255,255,255, | ||
1387 | 255,255,255,255,255,255,255,255, | ||
1388 | 255,255,255,255,255,255,255,255, | ||
1389 | 255,255,255,255,255,255,255,255, | ||
1390 | 255,255,255,255,255,255,255,255, | ||
1391 | 255,255,255,255,255,255,255,255, | ||
1392 | 255,255,255,255,255,255,255,255, | ||
1393 | 255,255,255,255,255,255,255,255, | ||
1394 | 255,255,255,255,255,255,255}; | ||
1395 | |||
1396 | const int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05, | ||
1397 | 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1398 | 0x01,0x02,0x03,0x04,3,0,0,0, | ||
1399 | 0xf7,0x2f,0x6c,0x60, | ||
1400 | 5, | ||
1401 | 254,255,4,255,0}; | ||
1402 | |||
1403 | /* packet that overspans over an entire page */ | ||
1404 | const int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02, | ||
1405 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1406 | 0x01,0x02,0x03,0x04,0,0,0,0, | ||
1407 | 0xff,0x7b,0x23,0x17, | ||
1408 | 1, | ||
1409 | 0}; | ||
1410 | |||
1411 | const int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00, | ||
1412 | 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1413 | 0x01,0x02,0x03,0x04,1,0,0,0, | ||
1414 | 0x68,0x22,0x7c,0x3d, | ||
1415 | 255, | ||
1416 | 100, | ||
1417 | 255,255,255,255,255,255,255,255, | ||
1418 | 255,255,255,255,255,255,255,255, | ||
1419 | 255,255,255,255,255,255,255,255, | ||
1420 | 255,255,255,255,255,255,255,255, | ||
1421 | 255,255,255,255,255,255,255,255, | ||
1422 | 255,255,255,255,255,255,255,255, | ||
1423 | 255,255,255,255,255,255,255,255, | ||
1424 | 255,255,255,255,255,255,255,255, | ||
1425 | 255,255,255,255,255,255,255,255, | ||
1426 | 255,255,255,255,255,255,255,255, | ||
1427 | 255,255,255,255,255,255,255,255, | ||
1428 | 255,255,255,255,255,255,255,255, | ||
1429 | 255,255,255,255,255,255,255,255, | ||
1430 | 255,255,255,255,255,255,255,255, | ||
1431 | 255,255,255,255,255,255,255,255, | ||
1432 | 255,255,255,255,255,255,255,255, | ||
1433 | 255,255,255,255,255,255,255,255, | ||
1434 | 255,255,255,255,255,255,255,255, | ||
1435 | 255,255,255,255,255,255,255,255, | ||
1436 | 255,255,255,255,255,255,255,255, | ||
1437 | 255,255,255,255,255,255,255,255, | ||
1438 | 255,255,255,255,255,255,255,255, | ||
1439 | 255,255,255,255,255,255,255,255, | ||
1440 | 255,255,255,255,255,255,255,255, | ||
1441 | 255,255,255,255,255,255,255,255, | ||
1442 | 255,255,255,255,255,255,255,255, | ||
1443 | 255,255,255,255,255,255,255,255, | ||
1444 | 255,255,255,255,255,255,255,255, | ||
1445 | 255,255,255,255,255,255,255,255, | ||
1446 | 255,255,255,255,255,255,255,255, | ||
1447 | 255,255,255,255,255,255,255,255, | ||
1448 | 255,255,255,255,255,255}; | ||
1449 | |||
1450 | const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05, | ||
1451 | 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, | ||
1452 | 0x01,0x02,0x03,0x04,2,0,0,0, | ||
1453 | 0xd4,0xe0,0x60,0xe5, | ||
1454 | 1, | ||
1455 | 0}; | ||
1456 | |||
1457 | int compare_packet(const ogg_packet *op1, const ogg_packet *op2){ | ||
1458 | if(op1->packet!=op2->packet){ | ||
1459 | fprintf(stderr,"op1->packet != op2->packet\n"); | ||
1460 | return(1); | ||
1461 | } | ||
1462 | if(op1->bytes!=op2->bytes){ | ||
1463 | fprintf(stderr,"op1->bytes != op2->bytes\n"); | ||
1464 | return(1); | ||
1465 | } | ||
1466 | if(op1->b_o_s!=op2->b_o_s){ | ||
1467 | fprintf(stderr,"op1->b_o_s != op2->b_o_s\n"); | ||
1468 | return(1); | ||
1469 | } | ||
1470 | if(op1->e_o_s!=op2->e_o_s){ | ||
1471 | fprintf(stderr,"op1->e_o_s != op2->e_o_s\n"); | ||
1472 | return(1); | ||
1473 | } | ||
1474 | if(op1->granulepos!=op2->granulepos){ | ||
1475 | fprintf(stderr,"op1->granulepos != op2->granulepos\n"); | ||
1476 | return(1); | ||
1477 | } | ||
1478 | if(op1->packetno!=op2->packetno){ | ||
1479 | fprintf(stderr,"op1->packetno != op2->packetno\n"); | ||
1480 | return(1); | ||
1481 | } | ||
1482 | return(0); | ||
1483 | } | ||
1484 | |||
1485 | void test_pack(const int *pl, const int **headers, int byteskip, | ||
1486 | int pageskip, int packetskip){ | ||
1487 | unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */ | ||
1488 | long inptr=0; | ||
1489 | long outptr=0; | ||
1490 | long deptr=0; | ||
1491 | long depacket=0; | ||
1492 | long granule_pos=7,pageno=0; | ||
1493 | int i,j,packets,pageout=pageskip; | ||
1494 | int eosflag=0; | ||
1495 | int bosflag=0; | ||
1496 | |||
1497 | int byteskipcount=0; | ||
1498 | |||
1499 | ogg_stream_reset(&os_en); | ||
1500 | ogg_stream_reset(&os_de); | ||
1501 | ogg_sync_reset(&oy); | ||
1502 | |||
1503 | for(packets=0;packets<packetskip;packets++) | ||
1504 | depacket+=pl[packets]; | ||
1505 | |||
1506 | for(packets=0;;packets++)if(pl[packets]==-1)break; | ||
1507 | |||
1508 | for(i=0;i<packets;i++){ | ||
1509 | /* construct a test packet */ | ||
1510 | ogg_packet op; | ||
1511 | int len=pl[i]; | ||
1512 | |||
1513 | op.packet=data+inptr; | ||
1514 | op.bytes=len; | ||
1515 | op.e_o_s=(pl[i+1]<0?1:0); | ||
1516 | op.granulepos=granule_pos; | ||
1517 | |||
1518 | granule_pos+=1024; | ||
1519 | |||
1520 | for(j=0;j<len;j++)data[inptr++]=i+j; | ||
1521 | |||
1522 | /* submit the test packet */ | ||
1523 | ogg_stream_packetin(&os_en,&op); | ||
1524 | |||
1525 | /* retrieve any finished pages */ | ||
1526 | { | ||
1527 | ogg_page og; | ||
1528 | |||
1529 | while(ogg_stream_pageout(&os_en,&og)){ | ||
1530 | /* We have a page. Check it carefully */ | ||
1531 | |||
1532 | fprintf(stderr,"%ld, ",pageno); | ||
1533 | |||
1534 | if(headers[pageno]==NULL){ | ||
1535 | fprintf(stderr,"coded too many pages!\n"); | ||
1536 | exit(1); | ||
1537 | } | ||
1538 | |||
1539 | check_page(data+outptr,headers[pageno],&og); | ||
1540 | |||
1541 | outptr+=og.body_len; | ||
1542 | pageno++; | ||
1543 | if(pageskip){ | ||
1544 | bosflag=1; | ||
1545 | pageskip--; | ||
1546 | deptr+=og.body_len; | ||
1547 | } | ||
1548 | |||
1549 | /* have a complete page; submit it to sync/decode */ | ||
1550 | |||
1551 | { | ||
1552 | ogg_page og_de; | ||
1553 | ogg_packet op_de,op_de2; | ||
1554 | char *buf=ogg_sync_buffer(&oy,og.header_len+og.body_len); | ||
1555 | char *next=buf; | ||
1556 | byteskipcount+=og.header_len; | ||
1557 | if(byteskipcount>byteskip){ | ||
1558 | memcpy(next,og.header,byteskipcount-byteskip); | ||
1559 | next+=byteskipcount-byteskip; | ||
1560 | byteskipcount=byteskip; | ||
1561 | } | ||
1562 | |||
1563 | byteskipcount+=og.body_len; | ||
1564 | if(byteskipcount>byteskip){ | ||
1565 | memcpy(next,og.body,byteskipcount-byteskip); | ||
1566 | next+=byteskipcount-byteskip; | ||
1567 | byteskipcount=byteskip; | ||
1568 | } | ||
1569 | |||
1570 | ogg_sync_wrote(&oy,next-buf); | ||
1571 | |||
1572 | while(1){ | ||
1573 | int ret=ogg_sync_pageout(&oy,&og_de); | ||
1574 | if(ret==0)break; | ||
1575 | if(ret<0)continue; | ||
1576 | /* got a page. Happy happy. Verify that it's good. */ | ||
1577 | |||
1578 | fprintf(stderr,"(%d), ",pageout); | ||
1579 | |||
1580 | check_page(data+deptr,headers[pageout],&og_de); | ||
1581 | deptr+=og_de.body_len; | ||
1582 | pageout++; | ||
1583 | |||
1584 | /* submit it to deconstitution */ | ||
1585 | ogg_stream_pagein(&os_de,&og_de); | ||
1586 | |||
1587 | /* packets out? */ | ||
1588 | while(ogg_stream_packetpeek(&os_de,&op_de2)>0){ | ||
1589 | ogg_stream_packetpeek(&os_de,NULL); | ||
1590 | ogg_stream_packetout(&os_de,&op_de); /* just catching them all */ | ||
1591 | |||
1592 | /* verify peek and out match */ | ||
1593 | if(compare_packet(&op_de,&op_de2)){ | ||
1594 | fprintf(stderr,"packetout != packetpeek! pos=%ld\n", | ||
1595 | depacket); | ||
1596 | exit(1); | ||
1597 | } | ||
1598 | |||
1599 | /* verify the packet! */ | ||
1600 | /* check data */ | ||
1601 | if(memcmp(data+depacket,op_de.packet,op_de.bytes)){ | ||
1602 | fprintf(stderr,"packet data mismatch in decode! pos=%ld\n", | ||
1603 | depacket); | ||
1604 | exit(1); | ||
1605 | } | ||
1606 | /* check bos flag */ | ||
1607 | if(bosflag==0 && op_de.b_o_s==0){ | ||
1608 | fprintf(stderr,"b_o_s flag not set on packet!\n"); | ||
1609 | exit(1); | ||
1610 | } | ||
1611 | if(bosflag && op_de.b_o_s){ | ||
1612 | fprintf(stderr,"b_o_s flag incorrectly set on packet!\n"); | ||
1613 | exit(1); | ||
1614 | } | ||
1615 | bosflag=1; | ||
1616 | depacket+=op_de.bytes; | ||
1617 | |||
1618 | /* check eos flag */ | ||
1619 | if(eosflag){ | ||
1620 | fprintf(stderr,"Multiple decoded packets with eos flag!\n"); | ||
1621 | exit(1); | ||
1622 | } | ||
1623 | |||
1624 | if(op_de.e_o_s)eosflag=1; | ||
1625 | |||
1626 | /* check granulepos flag */ | ||
1627 | if(op_de.granulepos!=-1){ | ||
1628 | fprintf(stderr," granule:%ld ",(long)op_de.granulepos); | ||
1629 | } | ||
1630 | } | ||
1631 | } | ||
1632 | } | ||
1633 | } | ||
1634 | } | ||
1635 | } | ||
1636 | _ogg_free(data); | ||
1637 | if(headers[pageno]!=NULL){ | ||
1638 | fprintf(stderr,"did not write last page!\n"); | ||
1639 | exit(1); | ||
1640 | } | ||
1641 | if(headers[pageout]!=NULL){ | ||
1642 | fprintf(stderr,"did not decode last page!\n"); | ||
1643 | exit(1); | ||
1644 | } | ||
1645 | if(inptr!=outptr){ | ||
1646 | fprintf(stderr,"encoded page data incomplete!\n"); | ||
1647 | exit(1); | ||
1648 | } | ||
1649 | if(inptr!=deptr){ | ||
1650 | fprintf(stderr,"decoded page data incomplete!\n"); | ||
1651 | exit(1); | ||
1652 | } | ||
1653 | if(inptr!=depacket){ | ||
1654 | fprintf(stderr,"decoded packet data incomplete!\n"); | ||
1655 | exit(1); | ||
1656 | } | ||
1657 | if(!eosflag){ | ||
1658 | fprintf(stderr,"Never got a packet with EOS set!\n"); | ||
1659 | exit(1); | ||
1660 | } | ||
1661 | fprintf(stderr,"ok.\n"); | ||
1662 | } | ||
1663 | |||
1664 | int main(void){ | ||
1665 | |||
1666 | ogg_stream_init(&os_en,0x04030201); | ||
1667 | ogg_stream_init(&os_de,0x04030201); | ||
1668 | ogg_sync_init(&oy); | ||
1669 | |||
1670 | /* Exercise each code path in the framing code. Also verify that | ||
1671 | the checksums are working. */ | ||
1672 | |||
1673 | { | ||
1674 | /* 17 only */ | ||
1675 | const int packets[]={17, -1}; | ||
1676 | const int *headret[]={head1_0,NULL}; | ||
1677 | |||
1678 | fprintf(stderr,"testing single page encoding... "); | ||
1679 | test_pack(packets,headret,0,0,0); | ||
1680 | } | ||
1681 | |||
1682 | { | ||
1683 | /* 17, 254, 255, 256, 500, 510, 600 byte, pad */ | ||
1684 | const int packets[]={17, 254, 255, 256, 500, 510, 600, -1}; | ||
1685 | const int *headret[]={head1_1,head2_1,NULL}; | ||
1686 | |||
1687 | fprintf(stderr,"testing basic page encoding... "); | ||
1688 | test_pack(packets,headret,0,0,0); | ||
1689 | } | ||
1690 | |||
1691 | { | ||
1692 | /* nil packets; beginning,middle,end */ | ||
1693 | const int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1}; | ||
1694 | const int *headret[]={head1_2,head2_2,NULL}; | ||
1695 | |||
1696 | fprintf(stderr,"testing basic nil packets... "); | ||
1697 | test_pack(packets,headret,0,0,0); | ||
1698 | } | ||
1699 | |||
1700 | { | ||
1701 | /* large initial packet */ | ||
1702 | const int packets[]={4345,259,255,-1}; | ||
1703 | const int *headret[]={head1_3,head2_3,NULL}; | ||
1704 | |||
1705 | fprintf(stderr,"testing initial-packet lacing > 4k... "); | ||
1706 | test_pack(packets,headret,0,0,0); | ||
1707 | } | ||
1708 | |||
1709 | { | ||
1710 | /* continuing packet test; with page spill expansion, we have to | ||
1711 | overflow the lacing table. */ | ||
1712 | const int packets[]={0,65500,259,255,-1}; | ||
1713 | const int *headret[]={head1_4,head2_4,head3_4,NULL}; | ||
1714 | |||
1715 | fprintf(stderr,"testing single packet page span... "); | ||
1716 | test_pack(packets,headret,0,0,0); | ||
1717 | } | ||
1718 | |||
1719 | { | ||
1720 | /* spill expand packet test */ | ||
1721 | const int packets[]={0,4345,259,255,0,0,-1}; | ||
1722 | const int *headret[]={head1_4b,head2_4b,head3_4b,NULL}; | ||
1723 | |||
1724 | fprintf(stderr,"testing page spill expansion... "); | ||
1725 | test_pack(packets,headret,0,0,0); | ||
1726 | } | ||
1727 | |||
1728 | /* page with the 255 segment limit */ | ||
1729 | { | ||
1730 | |||
1731 | const int packets[]={0,10,10,10,10,10,10,10,10, | ||
1732 | 10,10,10,10,10,10,10,10, | ||
1733 | 10,10,10,10,10,10,10,10, | ||
1734 | 10,10,10,10,10,10,10,10, | ||
1735 | 10,10,10,10,10,10,10,10, | ||
1736 | 10,10,10,10,10,10,10,10, | ||
1737 | 10,10,10,10,10,10,10,10, | ||
1738 | 10,10,10,10,10,10,10,10, | ||
1739 | 10,10,10,10,10,10,10,10, | ||
1740 | 10,10,10,10,10,10,10,10, | ||
1741 | 10,10,10,10,10,10,10,10, | ||
1742 | 10,10,10,10,10,10,10,10, | ||
1743 | 10,10,10,10,10,10,10,10, | ||
1744 | 10,10,10,10,10,10,10,10, | ||
1745 | 10,10,10,10,10,10,10,10, | ||
1746 | 10,10,10,10,10,10,10,10, | ||
1747 | 10,10,10,10,10,10,10,10, | ||
1748 | 10,10,10,10,10,10,10,10, | ||
1749 | 10,10,10,10,10,10,10,10, | ||
1750 | 10,10,10,10,10,10,10,10, | ||
1751 | 10,10,10,10,10,10,10,10, | ||
1752 | 10,10,10,10,10,10,10,10, | ||
1753 | 10,10,10,10,10,10,10,10, | ||
1754 | 10,10,10,10,10,10,10,10, | ||
1755 | 10,10,10,10,10,10,10,10, | ||
1756 | 10,10,10,10,10,10,10,10, | ||
1757 | 10,10,10,10,10,10,10,10, | ||
1758 | 10,10,10,10,10,10,10,10, | ||
1759 | 10,10,10,10,10,10,10,10, | ||
1760 | 10,10,10,10,10,10,10,10, | ||
1761 | 10,10,10,10,10,10,10,10, | ||
1762 | 10,10,10,10,10,10,10,50,-1}; | ||
1763 | const int *headret[]={head1_5,head2_5,head3_5,NULL}; | ||
1764 | |||
1765 | fprintf(stderr,"testing max packet segments... "); | ||
1766 | test_pack(packets,headret,0,0,0); | ||
1767 | } | ||
1768 | |||
1769 | { | ||
1770 | /* packet that overspans over an entire page */ | ||
1771 | const int packets[]={0,100,130049,259,255,-1}; | ||
1772 | const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL}; | ||
1773 | |||
1774 | fprintf(stderr,"testing very large packets... "); | ||
1775 | test_pack(packets,headret,0,0,0); | ||
1776 | } | ||
1777 | |||
1778 | #ifndef DISABLE_CRC | ||
1779 | { | ||
1780 | /* test for the libogg 1.1.1 resync in large continuation bug | ||
1781 | found by Josh Coalson) */ | ||
1782 | const int packets[]={0,100,130049,259,255,-1}; | ||
1783 | const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL}; | ||
1784 | |||
1785 | fprintf(stderr,"testing continuation resync in very large packets... "); | ||
1786 | test_pack(packets,headret,100,2,3); | ||
1787 | } | ||
1788 | #else | ||
1789 | fprintf(stderr,"Skipping continuation resync test due to --disable-crc\n"); | ||
1790 | #endif | ||
1791 | |||
1792 | { | ||
1793 | /* term only page. why not? */ | ||
1794 | const int packets[]={0,100,64770,-1}; | ||
1795 | const int *headret[]={head1_7,head2_7,head3_7,NULL}; | ||
1796 | |||
1797 | fprintf(stderr,"testing zero data page (1 nil packet)... "); | ||
1798 | test_pack(packets,headret,0,0,0); | ||
1799 | } | ||
1800 | |||
1801 | |||
1802 | |||
1803 | { | ||
1804 | /* build a bunch of pages for testing */ | ||
1805 | unsigned char *data=_ogg_malloc(1024*1024); | ||
1806 | int pl[]={0, 1,1,98,4079, 1,1,2954,2057, 76,34,912,0,234,1000,1000, 1000,300,-1}; | ||
1807 | int inptr=0,i,j; | ||
1808 | ogg_page og[5]; | ||
1809 | |||
1810 | ogg_stream_reset(&os_en); | ||
1811 | |||
1812 | for(i=0;pl[i]!=-1;i++){ | ||
1813 | ogg_packet op; | ||
1814 | int len=pl[i]; | ||
1815 | |||
1816 | op.packet=data+inptr; | ||
1817 | op.bytes=len; | ||
1818 | op.e_o_s=(pl[i+1]<0?1:0); | ||
1819 | op.granulepos=(i+1)*1000; | ||
1820 | |||
1821 | for(j=0;j<len;j++)data[inptr++]=i+j; | ||
1822 | ogg_stream_packetin(&os_en,&op); | ||
1823 | } | ||
1824 | |||
1825 | _ogg_free(data); | ||
1826 | |||
1827 | /* retrieve finished pages */ | ||
1828 | for(i=0;i<5;i++){ | ||
1829 | if(ogg_stream_pageout(&os_en,&og[i])==0){ | ||
1830 | fprintf(stderr,"Too few pages output building sync tests!\n"); | ||
1831 | exit(1); | ||
1832 | } | ||
1833 | copy_page(&og[i]); | ||
1834 | } | ||
1835 | |||
1836 | /* Test lost pages on pagein/packetout: no rollback */ | ||
1837 | { | ||
1838 | ogg_page temp; | ||
1839 | ogg_packet test; | ||
1840 | |||
1841 | fprintf(stderr,"Testing loss of pages... "); | ||
1842 | |||
1843 | ogg_sync_reset(&oy); | ||
1844 | ogg_stream_reset(&os_de); | ||
1845 | for(i=0;i<5;i++){ | ||
1846 | memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header, | ||
1847 | og[i].header_len); | ||
1848 | ogg_sync_wrote(&oy,og[i].header_len); | ||
1849 | memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len); | ||
1850 | ogg_sync_wrote(&oy,og[i].body_len); | ||
1851 | } | ||
1852 | |||
1853 | ogg_sync_pageout(&oy,&temp); | ||
1854 | ogg_stream_pagein(&os_de,&temp); | ||
1855 | ogg_sync_pageout(&oy,&temp); | ||
1856 | ogg_stream_pagein(&os_de,&temp); | ||
1857 | ogg_sync_pageout(&oy,&temp); | ||
1858 | /* skip */ | ||
1859 | ogg_sync_pageout(&oy,&temp); | ||
1860 | ogg_stream_pagein(&os_de,&temp); | ||
1861 | |||
1862 | /* do we get the expected results/packets? */ | ||
1863 | |||
1864 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1865 | checkpacket(&test,0,0,0); | ||
1866 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1867 | checkpacket(&test,1,1,-1); | ||
1868 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1869 | checkpacket(&test,1,2,-1); | ||
1870 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1871 | checkpacket(&test,98,3,-1); | ||
1872 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1873 | checkpacket(&test,4079,4,5000); | ||
1874 | if(ogg_stream_packetout(&os_de,&test)!=-1){ | ||
1875 | fprintf(stderr,"Error: loss of page did not return error\n"); | ||
1876 | exit(1); | ||
1877 | } | ||
1878 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1879 | checkpacket(&test,76,9,-1); | ||
1880 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1881 | checkpacket(&test,34,10,-1); | ||
1882 | fprintf(stderr,"ok.\n"); | ||
1883 | } | ||
1884 | |||
1885 | /* Test lost pages on pagein/packetout: rollback with continuation */ | ||
1886 | { | ||
1887 | ogg_page temp; | ||
1888 | ogg_packet test; | ||
1889 | |||
1890 | fprintf(stderr,"Testing loss of pages (rollback required)... "); | ||
1891 | |||
1892 | ogg_sync_reset(&oy); | ||
1893 | ogg_stream_reset(&os_de); | ||
1894 | for(i=0;i<5;i++){ | ||
1895 | memcpy(ogg_sync_buffer(&oy,og[i].header_len),og[i].header, | ||
1896 | og[i].header_len); | ||
1897 | ogg_sync_wrote(&oy,og[i].header_len); | ||
1898 | memcpy(ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len); | ||
1899 | ogg_sync_wrote(&oy,og[i].body_len); | ||
1900 | } | ||
1901 | |||
1902 | ogg_sync_pageout(&oy,&temp); | ||
1903 | ogg_stream_pagein(&os_de,&temp); | ||
1904 | ogg_sync_pageout(&oy,&temp); | ||
1905 | ogg_stream_pagein(&os_de,&temp); | ||
1906 | ogg_sync_pageout(&oy,&temp); | ||
1907 | ogg_stream_pagein(&os_de,&temp); | ||
1908 | ogg_sync_pageout(&oy,&temp); | ||
1909 | /* skip */ | ||
1910 | ogg_sync_pageout(&oy,&temp); | ||
1911 | ogg_stream_pagein(&os_de,&temp); | ||
1912 | |||
1913 | /* do we get the expected results/packets? */ | ||
1914 | |||
1915 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1916 | checkpacket(&test,0,0,0); | ||
1917 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1918 | checkpacket(&test,1,1,-1); | ||
1919 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1920 | checkpacket(&test,1,2,-1); | ||
1921 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1922 | checkpacket(&test,98,3,-1); | ||
1923 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1924 | checkpacket(&test,4079,4,5000); | ||
1925 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1926 | checkpacket(&test,1,5,-1); | ||
1927 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1928 | checkpacket(&test,1,6,-1); | ||
1929 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1930 | checkpacket(&test,2954,7,-1); | ||
1931 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1932 | checkpacket(&test,2057,8,9000); | ||
1933 | if(ogg_stream_packetout(&os_de,&test)!=-1){ | ||
1934 | fprintf(stderr,"Error: loss of page did not return error\n"); | ||
1935 | exit(1); | ||
1936 | } | ||
1937 | if(ogg_stream_packetout(&os_de,&test)!=1)error(); | ||
1938 | checkpacket(&test,300,17,18000); | ||
1939 | fprintf(stderr,"ok.\n"); | ||
1940 | } | ||
1941 | |||
1942 | /* the rest only test sync */ | ||
1943 | { | ||
1944 | ogg_page og_de; | ||
1945 | /* Test fractional page inputs: incomplete capture */ | ||
1946 | fprintf(stderr,"Testing sync on partial inputs... "); | ||
1947 | ogg_sync_reset(&oy); | ||
1948 | memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, | ||
1949 | 3); | ||
1950 | ogg_sync_wrote(&oy,3); | ||
1951 | if(ogg_sync_pageout(&oy,&og_de)>0)error(); | ||
1952 | |||
1953 | /* Test fractional page inputs: incomplete fixed header */ | ||
1954 | memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+3, | ||
1955 | 20); | ||
1956 | ogg_sync_wrote(&oy,20); | ||
1957 | if(ogg_sync_pageout(&oy,&og_de)>0)error(); | ||
1958 | |||
1959 | /* Test fractional page inputs: incomplete header */ | ||
1960 | memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+23, | ||
1961 | 5); | ||
1962 | ogg_sync_wrote(&oy,5); | ||
1963 | if(ogg_sync_pageout(&oy,&og_de)>0)error(); | ||
1964 | |||
1965 | /* Test fractional page inputs: incomplete body */ | ||
1966 | |||
1967 | memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+28, | ||
1968 | og[1].header_len-28); | ||
1969 | ogg_sync_wrote(&oy,og[1].header_len-28); | ||
1970 | if(ogg_sync_pageout(&oy,&og_de)>0)error(); | ||
1971 | |||
1972 | memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,1000); | ||
1973 | ogg_sync_wrote(&oy,1000); | ||
1974 | if(ogg_sync_pageout(&oy,&og_de)>0)error(); | ||
1975 | |||
1976 | memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body+1000, | ||
1977 | og[1].body_len-1000); | ||
1978 | ogg_sync_wrote(&oy,og[1].body_len-1000); | ||
1979 | if(ogg_sync_pageout(&oy,&og_de)<=0)error(); | ||
1980 | |||
1981 | fprintf(stderr,"ok.\n"); | ||
1982 | } | ||
1983 | |||
1984 | /* Test fractional page inputs: page + incomplete capture */ | ||
1985 | { | ||
1986 | ogg_page og_de; | ||
1987 | fprintf(stderr,"Testing sync on 1+partial inputs... "); | ||
1988 | ogg_sync_reset(&oy); | ||
1989 | |||
1990 | memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, | ||
1991 | og[1].header_len); | ||
1992 | ogg_sync_wrote(&oy,og[1].header_len); | ||
1993 | |||
1994 | memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, | ||
1995 | og[1].body_len); | ||
1996 | ogg_sync_wrote(&oy,og[1].body_len); | ||
1997 | |||
1998 | memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, | ||
1999 | 20); | ||
2000 | ogg_sync_wrote(&oy,20); | ||
2001 | if(ogg_sync_pageout(&oy,&og_de)<=0)error(); | ||
2002 | if(ogg_sync_pageout(&oy,&og_de)>0)error(); | ||
2003 | |||
2004 | memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+20, | ||
2005 | og[1].header_len-20); | ||
2006 | ogg_sync_wrote(&oy,og[1].header_len-20); | ||
2007 | memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, | ||
2008 | og[1].body_len); | ||
2009 | ogg_sync_wrote(&oy,og[1].body_len); | ||
2010 | if(ogg_sync_pageout(&oy,&og_de)<=0)error(); | ||
2011 | |||
2012 | fprintf(stderr,"ok.\n"); | ||
2013 | } | ||
2014 | |||
2015 | /* Test recapture: garbage + page */ | ||
2016 | { | ||
2017 | ogg_page og_de; | ||
2018 | fprintf(stderr,"Testing search for capture... "); | ||
2019 | ogg_sync_reset(&oy); | ||
2020 | |||
2021 | /* 'garbage' */ | ||
2022 | memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, | ||
2023 | og[1].body_len); | ||
2024 | ogg_sync_wrote(&oy,og[1].body_len); | ||
2025 | |||
2026 | memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, | ||
2027 | og[1].header_len); | ||
2028 | ogg_sync_wrote(&oy,og[1].header_len); | ||
2029 | |||
2030 | memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, | ||
2031 | og[1].body_len); | ||
2032 | ogg_sync_wrote(&oy,og[1].body_len); | ||
2033 | |||
2034 | memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, | ||
2035 | 20); | ||
2036 | ogg_sync_wrote(&oy,20); | ||
2037 | if(ogg_sync_pageout(&oy,&og_de)>0)error(); | ||
2038 | if(ogg_sync_pageout(&oy,&og_de)<=0)error(); | ||
2039 | if(ogg_sync_pageout(&oy,&og_de)>0)error(); | ||
2040 | |||
2041 | memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header+20, | ||
2042 | og[2].header_len-20); | ||
2043 | ogg_sync_wrote(&oy,og[2].header_len-20); | ||
2044 | memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body, | ||
2045 | og[2].body_len); | ||
2046 | ogg_sync_wrote(&oy,og[2].body_len); | ||
2047 | if(ogg_sync_pageout(&oy,&og_de)<=0)error(); | ||
2048 | |||
2049 | fprintf(stderr,"ok.\n"); | ||
2050 | } | ||
2051 | |||
2052 | #ifndef DISABLE_CRC | ||
2053 | /* Test recapture: page + garbage + page */ | ||
2054 | { | ||
2055 | ogg_page og_de; | ||
2056 | fprintf(stderr,"Testing recapture... "); | ||
2057 | ogg_sync_reset(&oy); | ||
2058 | |||
2059 | memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, | ||
2060 | og[1].header_len); | ||
2061 | ogg_sync_wrote(&oy,og[1].header_len); | ||
2062 | |||
2063 | memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, | ||
2064 | og[1].body_len); | ||
2065 | ogg_sync_wrote(&oy,og[1].body_len); | ||
2066 | |||
2067 | memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, | ||
2068 | og[2].header_len); | ||
2069 | ogg_sync_wrote(&oy,og[2].header_len); | ||
2070 | |||
2071 | memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, | ||
2072 | og[2].header_len); | ||
2073 | ogg_sync_wrote(&oy,og[2].header_len); | ||
2074 | |||
2075 | if(ogg_sync_pageout(&oy,&og_de)<=0)error(); | ||
2076 | |||
2077 | memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body, | ||
2078 | og[2].body_len-5); | ||
2079 | ogg_sync_wrote(&oy,og[2].body_len-5); | ||
2080 | |||
2081 | memcpy(ogg_sync_buffer(&oy,og[3].header_len),og[3].header, | ||
2082 | og[3].header_len); | ||
2083 | ogg_sync_wrote(&oy,og[3].header_len); | ||
2084 | |||
2085 | memcpy(ogg_sync_buffer(&oy,og[3].body_len),og[3].body, | ||
2086 | og[3].body_len); | ||
2087 | ogg_sync_wrote(&oy,og[3].body_len); | ||
2088 | |||
2089 | if(ogg_sync_pageout(&oy,&og_de)>0)error(); | ||
2090 | if(ogg_sync_pageout(&oy,&og_de)<=0)error(); | ||
2091 | |||
2092 | fprintf(stderr,"ok.\n"); | ||
2093 | } | ||
2094 | #else | ||
2095 | fprintf(stderr,"Skipping recapture test due to --disable-crc\n"); | ||
2096 | #endif | ||
2097 | |||
2098 | /* Free page data that was previously copied */ | ||
2099 | { | ||
2100 | for(i=0;i<5;i++){ | ||
2101 | free_page(&og[i]); | ||
2102 | } | ||
2103 | } | ||
2104 | } | ||
2105 | |||
2106 | return(0); | ||
2107 | } | ||
2108 | |||
2109 | #endif | ||
diff --git a/lib/rbcodec/codecs/libopus/ogg/ogg.h b/lib/rbcodec/codecs/libopus/ogg/ogg.h index 00975ca354..330ea3c63a 100644 --- a/lib/rbcodec/codecs/libopus/ogg/ogg.h +++ b/lib/rbcodec/codecs/libopus/ogg/ogg.h | |||
@@ -11,7 +11,6 @@ | |||
11 | ******************************************************************** | 11 | ******************************************************************** |
12 | 12 | ||
13 | function: toplevel libogg include | 13 | function: toplevel libogg include |
14 | last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $ | ||
15 | 14 | ||
16 | ********************************************************************/ | 15 | ********************************************************************/ |
17 | #ifndef _OGG_H | 16 | #ifndef _OGG_H |