25 #include "../ogg/ogg.h"
30 return((
int)(og->
header[4]));
34 return((
int)(og->
header[5]&0x01));
38 return((
int)(og->
header[5]&0x02));
42 return((
int)(og->
header[5]&0x04));
46 unsigned char *page=og->
header;
48 granulepos= (granulepos<<8)|(page[12]&0xff);
49 granulepos= (granulepos<<8)|(page[11]&0xff);
50 granulepos= (granulepos<<8)|(page[10]&0xff);
51 granulepos= (granulepos<<8)|(page[9]&0xff);
52 granulepos= (granulepos<<8)|(page[8]&0xff);
53 granulepos= (granulepos<<8)|(page[7]&0xff);
54 granulepos= (granulepos<<8)|(page[6]&0xff);
109 if (r & 0x80000000UL)
110 r = (r << 1) ^ 0x04c11db7;
116 return (r & 0xffffffffUL);
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};
190 memset(os,0,
sizeof(*os));
213 memset(os,0,
sizeof(*os));
260 crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->
header[
i]];
262 crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->
body[
i]];
264 og->
header[22]=crc_reg&0xff;
265 og->
header[23]=(crc_reg>>8)&0xff;
266 og->
header[24]=(crc_reg>>16)&0xff;
267 og->
header[25]=(crc_reg>>24)&0xff;
273 int lacing_vals=op->
bytes/255+1,
i;
288 _os_body_expand(os,op->
bytes);
289 _os_lacing_expand(os,lacing_vals);
300 for(i=0;i<lacing_vals-1;i++){
342 if(maxvals==0)
return(0);
351 for(vals=0;vals<maxvals;vals++){
358 for(vals=0;vals<maxvals;vals++){
366 memcpy(os->
header,
"OggS",4);
382 os->
header[
i]=(granule_pos&0xff);
484 memset(oy,0,
sizeof(*oy));
518 long newsize=size+oy->
fill+4096;
554 if(bytes<27)
return(0);
557 if(memcmp(page,
"OggS",4))
goto sync_fail;
559 headerbytes=page[26]+27;
560 if(bytes<headerbytes)
return(0);
564 for(i=0;i<page[26];i++)
577 memcpy(chksum,page+22,4);
588 if(memcmp(chksum,page+22,4)){
592 memcpy(page+22,chksum,4);
624 next=memchr(page+1,
'O',bytes-1);
629 return(-(next-page));
675 unsigned char *header=og->
header;
676 unsigned char *body=og->
body;
687 int segments=header[26];
717 if(serialno!=os->
serialno)
return(-1);
718 if(version>0)
return(-1);
720 _os_lacing_expand(os,segments+1);
741 for(;segptr<segments;segptr++){
742 int val=header[27+segptr];
754 _os_body_expand(os,bodysize);
761 while(segptr<segments){
762 int val=header[27+segptr];
850 if(!op && !adv)
return(1);
864 if(val&0x200)eos=0x200;
887 return _packetout(os,op,1);
891 return _packetout(os,op,0);
896 memset(op, 0,
sizeof(*op));
907 static int sequence=0;
911 fprintf(stderr,
"incorrect packet length!\n");
915 fprintf(stderr,
"incorrect packet position!\n");
930 fprintf(stderr,
"incorrect packet sequence %ld != %d\n",
936 for(j=0;j<op->
bytes;j++)
937 if(op->
packet[j]!=((j+no)&0xff)){
938 fprintf(stderr,
"body data mismatch (1) at pos %ld: %x!=%lx!\n\n",
939 j,op->
packet[j],(j+no)&0xff);
944 void check_page(
unsigned char *
data,
const int *header,
ogg_page *og){
948 if(og->
body[j]!=data[j]){
949 fprintf(stderr,
"body data mismatch (2) at pos %ld: %x!=%x!\n\n",
950 j,data[j],og->
body[j]);
956 if(og->
header[j]!=header[j]){
957 fprintf(stderr,
"header content mismatch at pos %ld:\n",j);
958 for(j=0;j<header[26]+27;j++)
959 fprintf(stderr,
" (%ld)%02x:%02x",j,header[j],og->
header[j]);
960 fprintf(stderr,
"\n");
965 fprintf(stderr,
"header length incorrect! (%ld!=%d)\n",
973 fprintf(stderr,
"\nHEADER:\n");
974 fprintf(stderr,
" capture: %c %c %c %c version: %d flags: %x\n",
978 fprintf(stderr,
" granulepos: %d serialno: %d pageno: %ld\n",
986 fprintf(stderr,
" checksum: %02x:%02x:%02x:%02x\n segments: %d (",
992 fprintf(stderr,
"%d ",(
int)og->
header[j]);
993 fprintf(stderr,
")\n\n");
1007 fprintf(stderr,
"error!\n");
1012 const int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06,
1013 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1014 0x01,0x02,0x03,0x04,0,0,0,0,
1015 0x15,0xed,0xec,0x91,
1020 const int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02,
1021 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1022 0x01,0x02,0x03,0x04,0,0,0,0,
1023 0x59,0x10,0x6c,0x2c,
1026 const int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04,
1027 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
1028 0x01,0x02,0x03,0x04,1,0,0,0,
1029 0x89,0x33,0x85,0xce,
1031 254,255,0,255,1,255,245,255,255,0,
1035 const int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02,
1036 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1037 0x01,0x02,0x03,0x04,0,0,0,0,
1038 0xff,0x7b,0x23,0x17,
1041 const int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04,
1042 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
1043 0x01,0x02,0x03,0x04,1,0,0,0,
1044 0x5c,0x3f,0x66,0xcb,
1046 17,254,255,0,0,255,1,0,255,245,255,255,0,
1050 const int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02,
1051 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1052 0x01,0x02,0x03,0x04,0,0,0,0,
1053 0x01,0x27,0x31,0xaa,
1055 255,255,255,255,255,255,255,255,
1056 255,255,255,255,255,255,255,255,255,10};
1058 const int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04,
1059 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
1060 0x01,0x02,0x03,0x04,1,0,0,0,
1061 0x7f,0x4e,0x8a,0xd2,
1067 const int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02,
1068 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1069 0x01,0x02,0x03,0x04,0,0,0,0,
1070 0xff,0x7b,0x23,0x17,
1074 const int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00,
1075 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1076 0x01,0x02,0x03,0x04,1,0,0,0,
1077 0x34,0x24,0xd5,0x29,
1079 255,255,255,255,255,255,255,255,
1080 255,255,255,255,255,255,255,255,255};
1082 const int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05,
1083 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,
1084 0x01,0x02,0x03,0x04,2,0,0,0,
1085 0xc8,0xc3,0xcb,0xed,
1091 const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02,
1092 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1093 0x01,0x02,0x03,0x04,0,0,0,0,
1094 0xff,0x7b,0x23,0x17,
1098 const int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00,
1099 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00,
1100 0x01,0x02,0x03,0x04,1,0,0,0,
1101 0xed,0x2a,0x2e,0xa7,
1103 10,10,10,10,10,10,10,10,
1104 10,10,10,10,10,10,10,10,
1105 10,10,10,10,10,10,10,10,
1106 10,10,10,10,10,10,10,10,
1107 10,10,10,10,10,10,10,10,
1108 10,10,10,10,10,10,10,10,
1109 10,10,10,10,10,10,10,10,
1110 10,10,10,10,10,10,10,10,
1111 10,10,10,10,10,10,10,10,
1112 10,10,10,10,10,10,10,10,
1113 10,10,10,10,10,10,10,10,
1114 10,10,10,10,10,10,10,10,
1115 10,10,10,10,10,10,10,10,
1116 10,10,10,10,10,10,10,10,
1117 10,10,10,10,10,10,10,10,
1118 10,10,10,10,10,10,10,10,
1119 10,10,10,10,10,10,10,10,
1120 10,10,10,10,10,10,10,10,
1121 10,10,10,10,10,10,10,10,
1122 10,10,10,10,10,10,10,10,
1123 10,10,10,10,10,10,10,10,
1124 10,10,10,10,10,10,10,10,
1125 10,10,10,10,10,10,10,10,
1126 10,10,10,10,10,10,10,10,
1127 10,10,10,10,10,10,10,10,
1128 10,10,10,10,10,10,10,10,
1129 10,10,10,10,10,10,10,10,
1130 10,10,10,10,10,10,10,10,
1131 10,10,10,10,10,10,10,10,
1132 10,10,10,10,10,10,10,10,
1133 10,10,10,10,10,10,10,10,
1134 10,10,10,10,10,10,10};
1136 const int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04,
1137 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
1138 0x01,0x02,0x03,0x04,2,0,0,0,
1139 0x6c,0x3b,0x82,0x3d,
1145 const int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02,
1146 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1147 0x01,0x02,0x03,0x04,0,0,0,0,
1148 0xff,0x7b,0x23,0x17,
1152 const int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00,
1153 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
1154 0x01,0x02,0x03,0x04,1,0,0,0,
1155 0x3c,0xd9,0x4d,0x3f,
1157 100,255,255,255,255,255,255,255,255,
1158 255,255,255,255,255,255,255,255};
1160 const int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01,
1161 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
1162 0x01,0x02,0x03,0x04,2,0,0,0,
1163 0xbd,0xd5,0xb5,0x8b,
1165 255,255,255,255,255,255,255,255,
1166 255,255,255,255,255,255,255,255,255};
1168 const int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05,
1169 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
1170 0x01,0x02,0x03,0x04,3,0,0,0,
1171 0xef,0xdd,0x88,0xde,
1173 255,255,75,255,4,255,0};
1176 const int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02,
1177 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
1178 0x01,0x02,0x03,0x04,0,0,0,0,
1179 0xff,0x7b,0x23,0x17,
1183 const int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00,
1184 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
1185 0x01,0x02,0x03,0x04,1,0,0,0,
1186 0x3c,0xd9,0x4d,0x3f,
1188 100,255,255,255,255,255,255,255,255,
1189 255,255,255,255,255,255,255,255};
1191 const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05,
1192 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
1193 0x01,0x02,0x03,0x04,2,0,0,0,
1194 0xd4,0xe0,0x60,0xe5,
1197 void test_pack(
const int *pl,
const int **headers){
1203 long granule_pos=7,pageno=0;
1204 int i,
j,packets,pageout=0;
1212 for(packets=0;;packets++)
if(pl[packets]==-1)
break;
1214 for(i=0;i<packets;i++){
1221 op.
e_o_s=(pl[i+1]<0?1:0);
1226 for(j=0;j<
len;j++)data[inptr++]=i+j;
1238 fprintf(stderr,
"%ld, ",pageno);
1240 if(headers[pageno]==
NULL){
1241 fprintf(stderr,
"coded too many pages!\n");
1245 check_page(data+outptr,headers[pageno],&og);
1263 check_page(data+deptr,headers[pageout],&og_de);
1276 if(memcmp(&op_de,&op_de2,
sizeof(op_de))){
1277 fprintf(stderr,
"packetout != packetpeek! pos=%ld\n",
1284 if(memcmp(data+depacket,op_de.
packet,op_de.
bytes)){
1285 fprintf(stderr,
"packet data mismatch in decode! pos=%ld\n",
1290 if(bosflag==0 && op_de.
b_o_s==0){
1291 fprintf(stderr,
"b_o_s flag not set on packet!\n");
1294 if(bosflag && op_de.
b_o_s){
1295 fprintf(stderr,
"b_o_s flag incorrectly set on packet!\n");
1299 depacket+=op_de.
bytes;
1303 fprintf(stderr,
"Multiple decoded packets with eos flag!\n");
1307 if(op_de.
e_o_s)eosflag=1;
1311 fprintf(stderr,
" granule:%ld ",(
long)op_de.
granulepos);
1320 if(headers[pageno]!=
NULL){
1321 fprintf(stderr,
"did not write last page!\n");
1324 if(headers[pageout]!=
NULL){
1325 fprintf(stderr,
"did not decode last page!\n");
1329 fprintf(stderr,
"encoded page data incomplete!\n");
1333 fprintf(stderr,
"decoded page data incomplete!\n");
1336 if(inptr!=depacket){
1337 fprintf(stderr,
"decoded packet data incomplete!\n");
1341 fprintf(stderr,
"Never got a packet with EOS set!\n");
1344 fprintf(stderr,
"ok.\n");
1358 const int packets[]={17, -1};
1359 const int *headret[]={head1_0,
NULL};
1361 fprintf(stderr,
"testing single page encoding... ");
1362 test_pack(packets,headret);
1367 const int packets[]={17, 254, 255, 256, 500, 510, 600, -1};
1368 const int *headret[]={head1_1,head2_1,
NULL};
1370 fprintf(stderr,
"testing basic page encoding... ");
1371 test_pack(packets,headret);
1376 const int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1};
1377 const int *headret[]={head1_2,head2_2,
NULL};
1379 fprintf(stderr,
"testing basic nil packets... ");
1380 test_pack(packets,headret);
1385 const int packets[]={4345,259,255,-1};
1386 const int *headret[]={head1_3,head2_3,
NULL};
1388 fprintf(stderr,
"testing initial-packet lacing > 4k... ");
1389 test_pack(packets,headret);
1394 const int packets[]={0,4345,259,255,-1};
1395 const int *headret[]={head1_4,head2_4,head3_4,
NULL};
1397 fprintf(stderr,
"testing single packet page span... ");
1398 test_pack(packets,headret);
1404 const int packets[]={0,10,10,10,10,10,10,10,10,
1405 10,10,10,10,10,10,10,10,
1406 10,10,10,10,10,10,10,10,
1407 10,10,10,10,10,10,10,10,
1408 10,10,10,10,10,10,10,10,
1409 10,10,10,10,10,10,10,10,
1410 10,10,10,10,10,10,10,10,
1411 10,10,10,10,10,10,10,10,
1412 10,10,10,10,10,10,10,10,
1413 10,10,10,10,10,10,10,10,
1414 10,10,10,10,10,10,10,10,
1415 10,10,10,10,10,10,10,10,
1416 10,10,10,10,10,10,10,10,
1417 10,10,10,10,10,10,10,10,
1418 10,10,10,10,10,10,10,10,
1419 10,10,10,10,10,10,10,10,
1420 10,10,10,10,10,10,10,10,
1421 10,10,10,10,10,10,10,10,
1422 10,10,10,10,10,10,10,10,
1423 10,10,10,10,10,10,10,10,
1424 10,10,10,10,10,10,10,10,
1425 10,10,10,10,10,10,10,10,
1426 10,10,10,10,10,10,10,10,
1427 10,10,10,10,10,10,10,10,
1428 10,10,10,10,10,10,10,10,
1429 10,10,10,10,10,10,10,10,
1430 10,10,10,10,10,10,10,10,
1431 10,10,10,10,10,10,10,10,
1432 10,10,10,10,10,10,10,10,
1433 10,10,10,10,10,10,10,10,
1434 10,10,10,10,10,10,10,10,
1435 10,10,10,10,10,10,10,50,-1};
1436 const int *headret[]={head1_5,head2_5,head3_5,
NULL};
1438 fprintf(stderr,
"testing max packet segments... ");
1439 test_pack(packets,headret);
1444 const int packets[]={0,100,9000,259,255,-1};
1445 const int *headret[]={head1_6,head2_6,head3_6,head4_6,
NULL};
1447 fprintf(stderr,
"testing very large packets... ");
1448 test_pack(packets,headret);
1453 const int packets[]={0,100,4080,-1};
1454 const int *headret[]={head1_7,head2_7,head3_7,
NULL};
1456 fprintf(stderr,
"testing zero data page (1 nil packet)... ");
1457 test_pack(packets,headret);
1465 int pl[]={0,100,4079,2956,2057,76,34,912,0,234,1000,1000,1000,300,-1};
1471 for(i=0;pl[
i]!=-1;i++){
1477 op.
e_o_s=(pl[i+1]<0?1:0);
1480 for(j=0;j<
len;j++)data[inptr++]=i+j;
1489 fprintf(stderr,
"Too few pages output building sync tests!\n");
1500 fprintf(stderr,
"Testing loss of pages... ");
1508 memcpy(
ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
1524 checkpacket(&test,0,0,0);
1526 checkpacket(&test,100,1,-1);
1528 checkpacket(&test,4079,2,3000);
1530 fprintf(stderr,
"Error: loss of page did not return error\n");
1534 checkpacket(&test,76,5,-1);
1536 checkpacket(&test,34,6,-1);
1537 fprintf(stderr,
"ok.\n");
1545 fprintf(stderr,
"Testing loss of pages (rollback required)... ");
1553 memcpy(
ogg_sync_buffer(&oy,og[i].body_len),og[i].body,og[i].body_len);
1571 checkpacket(&test,0,0,0);
1573 checkpacket(&test,100,1,-1);
1575 checkpacket(&test,4079,2,3000);
1577 checkpacket(&test,2956,3,4000);
1579 fprintf(stderr,
"Error: loss of page did not return error\n");
1583 checkpacket(&test,300,13,14000);
1584 fprintf(stderr,
"ok.\n");
1591 fprintf(stderr,
"Testing sync on partial inputs... ");
1613 og[1].header_len-28);
1622 og[1].body_len-1000);
1626 fprintf(stderr,
"ok.\n");
1632 fprintf(stderr,
"Testing sync on 1+partial inputs... ");
1650 og[1].header_len-20);
1657 fprintf(stderr,
"ok.\n");
1663 fprintf(stderr,
"Testing search for capture... ");
1687 og[2].header_len-20);
1694 fprintf(stderr,
"ok.\n");
1700 fprintf(stderr,
"Testing recapture... ");
1736 fprintf(stderr,
"ok.\n");
int ogg_stream_eos(ogg_stream_state *os)
int ogg_page_serialno(ogg_page *og)
long ogg_page_pageno(ogg_page *og)
int ogg_page_packets(ogg_page *og)
int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og)
unsigned char * body_data
int ogg_sync_wrote(ogg_sync_state *oy, long bytes)
ogg_int64_t * granule_vals
int ogg_sync_destroy(ogg_sync_state *oy)
int ogg_page_version(ogg_page *og)
int ogg_sync_reset(ogg_sync_state *oy)
unsigned char header[282]
int ogg_sync_clear(ogg_sync_state *oy)
int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og)
GLuint GLuint GLsizei count
int ogg_page_continued(ogg_page *og)
int ogg_stream_clear(ogg_stream_state *os)
int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og)
int ogg_stream_init(ogg_stream_state *os, int serialno)
GLsizei GLsizei GLenum GLenum const GLvoid * data
void ogg_page_checksum_set(ogg_page *og)
int ogg_stream_destroy(ogg_stream_state *os)
int ogg_stream_flush(ogg_stream_state *os, ogg_page *og)
int ogg_stream_reset(ogg_stream_state *os)
int ogg_sync_init(ogg_sync_state *oy)
int ogg_page_bos(ogg_page *og)
GLdouble GLdouble GLdouble r
char * ogg_sync_buffer(ogg_sync_state *oy, long size)
int ogg_stream_packetout(ogg_stream_state *os, ogg_packet *op)
int ogg_page_eos(ogg_page *og)
int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op)
int ogg_stream_packetpeek(ogg_stream_state *os, ogg_packet *op)
void ogg_packet_clear(ogg_packet *op)
ogg_int64_t ogg_page_granulepos(ogg_page *og)
int ogg_stream_reset_serialno(ogg_stream_state *os, int serialno)
long ogg_sync_pageseek(ogg_sync_state *oy, ogg_page *og)