Revision a2704c97 libavformat/nutdec.c
libavformat/nutdec.c  

98  98 
static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode) 
99  99 
{ 
100  100 
int64_t size; 
101 
// start= url_ftell(bc)  8;


101 
// start= avio_tell(bc)  8;


102  102  
103  103 
startcode= av_be2ne64(startcode); 
104  104 
startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8); 
...  ...  
148  148 
for(;;){ 
149  149 
uint64_t startcode= find_any_startcode(bc, pos); 
150  150 
if(startcode == code) 
151 
return url_ftell(bc)  8;


151 
return avio_tell(bc)  8;


152  152 
else if(startcode == 0) 
153  153 
return 1; 
154  154 
pos=1; 
...  ...  
176  176 
dst= tmp; 
177  177  
178  178 
static int skip_reserved(AVIOContext *bc, int64_t pos){ 
179 
pos = url_ftell(bc);


179 
pos = avio_tell(bc);


180  180 
if(pos<0){ 
181  181 
avio_seek(bc, pos, SEEK_CUR); 
182  182 
return 1; 
...  ...  
196  196 
int64_t tmp_match; 
197  197  
198  198 
end= get_packetheader(nut, bc, 1, MAIN_STARTCODE); 
199 
end += url_ftell(bc);


199 
end += avio_tell(bc);


200  200  
201  201 
GET_V(tmp , tmp >=2 && tmp <= 3) 
202  202 
GET_V(stream_count , tmp > 0 && tmp <= NUT_MAX_STREAMS) 
...  ...  
267  267 
} 
268  268 
assert(nut>frame_code['N'].flags == FLAG_INVALID); 
269  269  
270 
if(end > url_ftell(bc) + 4){


270 
if(end > avio_tell(bc) + 4){


271  271 
int rem= 1024; 
272  272 
GET_V(nut>header_count, tmp<128U) 
273  273 
nut>header_count++; 
...  ...  
306  306 
AVStream *st; 
307  307  
308  308 
end= get_packetheader(nut, bc, 1, STREAM_STARTCODE); 
309 
end += url_ftell(bc);


309 
end += avio_tell(bc);


310  310  
311  311 
GET_V(stream_id, tmp < s>nb_streams && !nut>stream[tmp].time_base); 
312  312 
stc= &nut>stream[stream_id]; 
...  ...  
409  409 
AVMetadata **metadata = NULL; 
410  410  
411  411 
end= get_packetheader(nut, bc, 1, INFO_STARTCODE); 
412 
end += url_ftell(bc);


412 
end += avio_tell(bc);


413  413  
414  414 
GET_V(stream_id_plus1, tmp <= s>nb_streams) 
415  415 
chapter_id = get_s(bc); 
...  ...  
480  480 
AVIOContext *bc = s>pb; 
481  481 
int64_t end, tmp; 
482  482  
483 
nut>last_syncpoint_pos= url_ftell(bc)8;


483 
nut>last_syncpoint_pos= avio_tell(bc)8;


484  484  
485  485 
end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE); 
486 
end += url_ftell(bc);


486 
end += avio_tell(bc);


487  487  
488  488 
tmp= ff_get_v(bc); 
489  489 
*back_ptr= nut>last_syncpoint_pos  16*ff_get_v(bc); 
...  ...  
521  521 
} 
522  522  
523  523 
end= get_packetheader(nut, bc, 1, INDEX_STARTCODE); 
524 
end += url_ftell(bc);


524 
end += avio_tell(bc);


525  525  
526  526 
ff_get_v(bc); //max_pts 
527  527 
GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0) 
...  ...  
635  635 
pos=0; 
636  636 
for(;;){ 
637  637 
uint64_t startcode= find_any_startcode(bc, pos); 
638 
pos= url_ftell(bc);


638 
pos= avio_tell(bc);


639  639  
640  640 
if(startcode==0){ 
641  641 
av_log(s, AV_LOG_ERROR, "EOF before video frames\n"); 
...  ...  
653  653 
s>data_offset= pos8; 
654  654  
655  655 
if(!url_is_streamed(bc)){ 
656 
int64_t orig_pos= url_ftell(bc);


656 
int64_t orig_pos= avio_tell(bc);


657  657 
find_and_decode_index(nut); 
658  658 
avio_seek(bc, orig_pos, SEEK_SET); 
659  659 
} 
...  ...  
671  671 
int size, flags, size_mul, pts_delta, i, reserved_count; 
672  672 
uint64_t tmp; 
673  673  
674 
if(url_ftell(bc) > nut>last_syncpoint_pos + nut>max_distance){


675 
av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", url_ftell(bc), nut>last_syncpoint_pos, nut>max_distance);


674 
if(avio_tell(bc) > nut>last_syncpoint_pos + nut>max_distance){


675 
av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", avio_tell(bc), nut>last_syncpoint_pos, nut>max_distance);


676  676 
return AVERROR_INVALIDDATA; 
677  677 
} 
678  678  
...  ...  
763  763  
764  764 
av_new_packet(pkt, size + nut>header_len[header_idx]); 
765  765 
memcpy(pkt>data, nut>header[header_idx], nut>header_len[header_idx]); 
766 
pkt>pos= url_ftell(bc); //FIXME


766 
pkt>pos= avio_tell(bc); //FIXME


767  767 
avio_read(bc, pkt>data + nut>header_len[header_idx], size); 
768  768  
769  769 
pkt>stream_index = stream_id; 
...  ...  
782  782 
int64_t ts, back_ptr; 
783  783  
784  784 
for(;;){ 
785 
int64_t pos= url_ftell(bc);


785 
int64_t pos= avio_tell(bc);


786  786 
uint64_t tmp= nut>next_startcode; 
787  787 
nut>next_startcode=0; 
788  788 
Also available in: Unified diff