Revision f0a9978c
libavformat/nutenc.c  

191  191 
#endif 
192  192  
193  193 
//FIXME remove calculate_checksum 
194 
static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc, int calculate_checksum){ 

194 
static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){


195  195 
uint8_t *dyn_buf=NULL; 
196  196 
int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); 
197  197 
int forw_ptr= dyn_size + 4*calculate_checksum; 
198  198  
199  199 
if(forw_ptr > 4096) 
200 
init_checksum(bc, av_crc04C11DB7_update, 0); //FIXME this is supposed to include the start code 

200 
init_checksum(bc, av_crc04C11DB7_update, 0); 

201 
put_be64(bc, startcode); 

201  202 
put_v(bc, forw_ptr); 
202  203 
if(forw_ptr > 4096) 
203  204 
put_le32(bc, get_checksum(bc)); 
...  ...  
315  316 
ByteIOContext dyn_bc; 
316  317 
int i; 
317  318  
318 
put_be64(bc, MAIN_STARTCODE); 

319  319 
url_open_dyn_buf(&dyn_bc); 
320  320 
write_mainheader(nut, &dyn_bc); 
321 
put_packet(nut, bc, &dyn_bc, 1); 

321 
put_packet(nut, bc, &dyn_bc, 1, MAIN_STARTCODE);


322  322  
323  323 
for (i=0; i < nut>avf>nb_streams; i++){ 
324  324 
AVCodecContext *codec = nut>avf>streams[i]>codec; 
325  325  
326 
put_be64(bc, STREAM_STARTCODE); 

327  326 
url_open_dyn_buf(&dyn_bc); 
328  327 
write_streamheader(nut, &dyn_bc, codec, i); 
329 
put_packet(nut, bc, &dyn_bc, 1); 

328 
put_packet(nut, bc, &dyn_bc, 1, STREAM_STARTCODE);


330  329 
} 
331  330 
} 
332  331  
...  ...  
416  415 
ff_nut_reset_ts(nut, *nus>time_base, pkt>dts); 
417  416  
418  417 
nut>last_syncpoint_pos= url_ftell(bc); 
419 
put_be64(bc, SYNCPOINT_STARTCODE); 

420  418 
url_open_dyn_buf(&dyn_bc); 
421  419 
put_t(nut, nus, &dyn_bc, pkt>dts); 
422  420 
put_v(&dyn_bc, 0); //FIXME back_ptr_div16 
423 
put_packet(nut, bc, &dyn_bc, 1); 

421 
put_packet(nut, bc, &dyn_bc, 1, SYNCPOINT_STARTCODE);


424  422 
} 
425  423 
assert(nus>last_pts != AV_NOPTS_VALUE); 
426  424 
Also available in: Unified diff