Revision dcc9bde0 libavformat/nutenc.c

View differences:

libavformat/nutenc.c
251 251
        nut->time_base[j]= nut->stream[i].time_base;
252 252
        if(j==nut->time_base_count)
253 253
            nut->time_base_count++;
254

  
255
        if(av_q2d(nut->stream[i].time_base) >= 0.001)
256
            nut->stream[i].msb_pts_shift = 7;
257
        else
258
            nut->stream[i].msb_pts_shift = 14;
259
        nut->stream[i].max_pts_distance= FFMAX(1/av_q2d(nut->stream[i].time_base), 1);
254 260
    }
255 261
//FIXME make nut->stream[i].time_base pointers into nut->time_base
256 262

  
......
320 326

  
321 327
    update_packetheader(nut, bc, 0, 1);
322 328

  
329
    for (i=0; i < s->nb_streams; i++){
330
        codec = s->streams[i]->codec;
331

  
332
        put_be64(bc, STREAM_STARTCODE);
333
        put_packetheader(nut, bc, 120/*FIXME check*/ + codec->extradata_size, 1);
334
        put_v(bc, i);
335
        switch(codec->codec_type){
336
        case CODEC_TYPE_VIDEO: put_v(bc, 0); break;
337
        case CODEC_TYPE_AUDIO: put_v(bc, 1); break;
338
//        case CODEC_TYPE_TEXT : put_v(bc, 2); break;
339
        default              : put_v(bc, 3); break;
340
        }
341
        put_v(bc, 4);
342
        if (codec->codec_tag){
343
            put_le32(bc, codec->codec_tag);
344
        }else
345
            return -1;
346

  
347
        put_v(bc, 0); //FIXME
348
        put_v(bc, nut->stream[i].msb_pts_shift);
349
        put_v(bc, nut->stream[i].max_pts_distance);
350
        put_v(bc, codec->has_b_frames);
351
        put_byte(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */
352

  
353
        put_v(bc, codec->extradata_size);
354
        put_buffer(bc, codec->extradata, codec->extradata_size);
355

  
356
        switch(codec->codec_type){
357
        case CODEC_TYPE_AUDIO:
358
            put_v(bc, codec->sample_rate);
359
            put_v(bc, 1);
360
            put_v(bc, codec->channels);
361
            break;
362
        case CODEC_TYPE_VIDEO:
363
            put_v(bc, codec->width);
364
            put_v(bc, codec->height);
365
            put_v(bc, codec->sample_aspect_ratio.num);
366
            put_v(bc, codec->sample_aspect_ratio.den);
367
            put_v(bc, 0); /* csp type -- unknown */
368
            break;
369
        default:
370
            break;
371
        }
372
        update_packetheader(nut, bc, 0, 1);
373
    }
374

  
323 375
    put_flush_packet(bc);
324 376

  
325
    //FIXME stream header, ...
377
    //FIXME info header, header repeation, header packet CRC, ...
326 378

  
327 379
    return 0;
328 380
}
......
350 402
    write_packet,
351 403
//    write_trailer,
352 404
    .flags = AVFMT_GLOBALHEADER,
405
    .codec_tag= (const AVCodecTag*[]){codec_bmp_tags, codec_wav_tags, 0},
353 406
};

Also available in: Unified diff