Revision ed0bb7be libavformat/nut.c

View differences:

libavformat/nut.c
217 217
	    stream_length = s->streams[i]->duration * (AV_TIME_BASE / 1000);
218 218
    }
219 219

  
220
    put_packetheader(nut, bc, 120);
221
    
222 220
    /* main header */
223 221
    put_be64(bc, MAIN_STARTCODE);
222
    put_packetheader(nut, bc, 120);
224 223
    put_v(bc, 0); /* version */
225 224
    put_v(bc, s->nb_streams);
226 225
    put_v(bc, 0); /* file size */
......
234 233
    {
235 234
	codec = &s->streams[i]->codec;
236 235
	
237
	put_packetheader(nut, bc, 120);
238 236
	put_be64(bc, STREAM_STARTCODE);
237
	put_packetheader(nut, bc, 120);
239 238
	put_v(bc, i /*s->streams[i]->index*/);
240 239
	put_v(bc, (codec->codec_type == CODEC_TYPE_AUDIO) ? 32 : 0);
241 240
	if (codec->codec_tag)
......
285 284

  
286 285
#if 0
287 286
    /* info header */
287
    put_be64(bc, INFO_STARTCODE);
288 288
    put_packetheader(nut, bc, 16+strlen(s->author)+strlen(s->title)+
289 289
        strlen(s->comment)+strlen(s->copyright)); 
290
    put_be64(bc, INFO_STARTCODE);
291 290
    if (s->author[0])
292 291
    {
293 292
        put_v(bc, 5); /* type */
......
339 338
    if (enc->codec_type == CODEC_TYPE_VIDEO)
340 339
	key_frame = enc->coded_frame->key_frame;
341 340

  
342
    put_packetheader(nut, bc, size+(key_frame?8:0)+20);
343

  
344 341
    if (key_frame)
345 342
	put_be64(bc, KEYFRAME_STARTCODE);
346 343
    
......
352 349
    flags<<=1; flags|=0; //reserved
353 350

  
354 351
    put_byte(bc, flags);
352

  
353
    put_packetheader(nut, bc, size+20);
355 354
    put_v(bc, stream_index);
356 355
    put_s(bc, force_pts); /* lsb_timestamp */
357 356
    update_packetheader(nut, bc, size);
......
374 373

  
375 374
    for (i = 0; s->nb_streams; i++)
376 375
    {
377
	put_packetheader(nut, bc, 64);
378 376
	put_be64(bc, INDEX_STARTCODE);
377
	put_packetheader(nut, bc, 64);
379 378
	put_v(bc, s->streams[i]->id);
380 379
	put_v(bc, ...);
381 380
	put_be32(bc, 0); /* FIXME: checksum */
......
412 411
    int cur_stream, nb_streams;
413 412
    
414 413
    /* main header */
415
    get_packetheader(nut, bc);
416 414
    tmp = get_be64(bc);
417 415
    if (tmp != MAIN_STARTCODE)
418 416
	fprintf(stderr, "damaged? startcode!=1 (%Ld)\n", tmp);
417
    get_packetheader(nut, bc);
419 418
    
420 419
    tmp = get_v(bc);
421 420
    if (tmp != 0)
......
436 435
	int class;
437 436
	AVStream *st;
438 437
	
439
	get_packetheader(nut, bc);
440 438
	tmp = get_be64(bc);
441 439
	if (tmp != STREAM_STARTCODE)
442 440
	    fprintf(stderr, "damaged? startcode!=1 (%Ld)\n", tmp);
441
	get_packetheader(nut, bc);
443 442
	st = av_new_stream(s, get_v(bc));
444 443
	if (!st)
445 444
	    return AVERROR_NOMEM;
......
508 507
    int key_frame = 0;
509 508
    uint64_t tmp;
510 509

  
511
    get_packetheader(nut, bc);
512 510

  
513 511
    if (url_feof(bc))
514 512
	return -1;
......
527 525
	else
528 526
	    fprintf(stderr, "error in zero bit / startcode %LX\n", tmp);
529 527
    }
528
    get_packetheader(nut, bc);
530 529
#if 0
531 530
    if (((tmp & 0x60)>>5) > 3) /* priority <= 3 */
532 531
	fprintf(stderr, "sanity check failed!\n");
......
573 572
#elif defined(CONFIG_MP3LAME)
574 573
    CODEC_ID_MP3LAME,
575 574
#else
576
    CODEC_ID_AC3,
575
    CODEC_ID_MP2, /* AC3 needs liba52 decoder */
577 576
#endif
578 577
    CODEC_ID_MPEG4,
579 578
    nut_write_header,

Also available in: Unified diff