Revision 5d97d9d5 libavformat/nutdec.c
libavformat/nutdec.c  

114  114  
115  115 
size= get_v(bc); 
116  116  
117 
init_checksum(bc, calculate_checksum ? av_crc04C11DB7_update : NULL, 1);


117 
init_checksum(bc, calculate_checksum ? av_crc04C11DB7_update : NULL, 0);


118  118  
119  119 
// nut>packet_start[2] = start; 
120  120 
// nut>written_packet_size= size; 
...  ...  
122  122 
return size; 
123  123 
} 
124  124  
125 
static int check_checksum(ByteIOContext *bc){ 

126 
unsigned long checksum= get_checksum(bc); 

127 
// return checksum != get_be32(bc); 

128  
129 
av_log(NULL, AV_LOG_ERROR, "%08X %08X\n", checksum, (int)get_be32(bc)); 

130  
131 
return 0; 

132 
} 

133  
134  125 
static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){ 
135  126 
uint64_t state=0; 
136  127  
...  ...  
218  209 
int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res; 
219  210  
220  211 
end= get_packetheader(nut, bc, 1); 
221 
end += url_ftell(bc)  4;


212 
end += url_ftell(bc); 

222  213  
223  214 
GET_V(tmp , tmp >=2 && tmp <= 3) 
224  215 
GET_V(stream_count , tmp > 0 && tmp <=MAX_STREAMS) 
...  ...  
284  275 
} 
285  276 
assert(nut>frame_code['N'].flags == FLAG_INVALID); 
286  277  
287 
if(skip_reserved(bc, end)  check_checksum(bc)){


278 
if(skip_reserved(bc, end)  get_checksum(bc)){


288  279 
av_log(s, AV_LOG_ERROR, "Main header checksum mismatch\n"); 
289  280 
return 1; 
290  281 
} 
...  ...  
306  297 
AVStream *st; 
307  298  
308  299 
end= get_packetheader(nut, bc, 1); 
309 
end += url_ftell(bc)  4;


300 
end += url_ftell(bc); 

310  301  
311  302 
GET_V(stream_id, tmp < s>nb_streams && !nut>stream[tmp].time_base.num); 
312  303 
stc= &nut>stream[stream_id]; 
...  ...  
374  365 
} 
375  366 
GET_V(st>codec>channels, tmp > 0) 
376  367 
} 
377 
if(skip_reserved(bc, end)  check_checksum(bc)){


368 
if(skip_reserved(bc, end)  get_checksum(bc)){


378  369 
av_log(s, AV_LOG_ERROR, "Stream header %d checksum mismatch\n", stream_id); 
379  370 
return 1; 
380  371 
} 
...  ...  
393  384 
char name[256], str_value[1024], type_str[256], *type= type_str; 
394  385  
395  386 
end= get_packetheader(nut, bc, 1); 
396 
end += url_ftell(bc)  4;


387 
end += url_ftell(bc); 

397  388  
398  389 
GET_V(stream_id_plus1, tmp <= s>nb_streams) 
399  390 
chapter_id = get_s(bc); 
...  ...  
434  425 
} 
435  426 
} 
436  427  
437 
if(skip_reserved(bc, end)  check_checksum(bc)){


428 
if(skip_reserved(bc, end)  get_checksum(bc)){


438  429 
av_log(s, AV_LOG_ERROR, "Info header checksum mismatch\n"); 
439  430 
return 1; 
440  431 
} 
...  ...  
452  443 
nut>last_syncpoint_pos= url_ftell(bc)8; 
453  444  
454  445 
end= get_packetheader(nut, bc, 1); 
455 
end += url_ftell(bc)  4;


446 
end += url_ftell(bc); 

456  447  
457  448 
tmp= get_v(bc); 
458  449 
get_v(bc); //back_ptr_div16 
...  ...  
468  459 
} 
469  460 
//FIXME put this in a reset func maybe 
470  461  
471 
if(skip_reserved(bc, end)  check_checksum(bc)){


462 
if(skip_reserved(bc, end)  get_checksum(bc)){


472  463 
av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n"); 
473  464 
return 1; 
474  465 
} 
...  ...  
492  483 
} 
493  484  
494  485 
end= get_packetheader(nut, bc, 1); 
495 
end += url_ftell(bc)  4;


486 
end += url_ftell(bc); 

496  487  
497  488 
get_v(bc); //max_pts 
498  489 
GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0) 
...  ...  
558  549 
} 
559  550 
} 
560  551  
561 
if(skip_reserved(bc, end)  check_checksum(bc)){


552 
if(skip_reserved(bc, end)  get_checksum(bc)){


562  553 
av_log(s, AV_LOG_ERROR, "Index checksum mismatch\n"); 
563  554 
return 1; 
564  555 
} 
Also available in: Unified diff