comparison movenc.c @ 710:020ebcb662d5 libavformat

trying to fix a few minor values in the mp4/mov muxer
author michael
date Wed, 23 Mar 2005 00:26:43 +0000
parents 095009fc2f35
children 03157dc4ac6f
comparison
equal deleted inserted replaced
709:ee513d354673 710:020ebcb662d5
70 MOVTrack tracks[MAX_STREAMS]; 70 MOVTrack tracks[MAX_STREAMS];
71 } MOVContext; 71 } MOVContext;
72 72
73 static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack* track); 73 static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack* track);
74 74
75 const CodecTag ff_mov_obj_type[] = {
76 { CODEC_ID_MPEG4 , 32 },
77 { CODEC_ID_AAC , 64 },
78 { CODEC_ID_MPEG1VIDEO, 106 },
79 { CODEC_ID_MPEG2VIDEO, 96 },//mpeg2 profiles
80 { CODEC_ID_MP2 , 107 },//FIXME mpeg2 mpeg audio -> 105
81 { CODEC_ID_MP3 , 107 },//FIXME mpeg2 mpeg audio -> 105
82 { CODEC_ID_H264 , 241 },
83 { CODEC_ID_H263 , 242 },
84 { CODEC_ID_H261 , 243 },
85 { CODEC_ID_MJPEG , 108 },
86 { CODEC_ID_PCM_S16LE , 224 },
87 { CODEC_ID_VORBIS , 225 },
88 { CODEC_ID_AC3 , 226 },
89 { CODEC_ID_PCM_ALAW , 227 },
90 { CODEC_ID_PCM_MULAW , 228 },
91 { CODEC_ID_PCM_S16BE , 230 },
92 { 0,0 },
93 };
94
75 //FIXME supprt 64bit varaint with wide placeholders 95 //FIXME supprt 64bit varaint with wide placeholders
76 static int updateSize (ByteIOContext *pb, int pos) 96 static int updateSize (ByteIOContext *pb, int pos)
77 { 97 {
78 long curpos = url_ftell(pb); 98 long curpos = url_ftell(pb);
79 url_fseek(pb, pos, SEEK_SET); 99 url_fseek(pb, pos, SEEK_SET);
428 put_be32(pb, 0); // Version 448 put_be32(pb, 0); // Version
429 449
430 // ES descriptor 450 // ES descriptor
431 putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) + 451 putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) +
432 descrLength(1)); 452 descrLength(1));
433 put_be16(pb, 0x0001); // ID (= 1) 453 put_be16(pb, track->trackID);
434 put_byte(pb, 0x00); // flags (= no flags) 454 put_byte(pb, 0x00); // flags (= no flags)
435 455
436 // DecoderConfig descriptor 456 // DecoderConfig descriptor
437 putDescr(pb, 0x04, 13 + decoderSpecificInfoLen); 457 putDescr(pb, 0x04, 13 + decoderSpecificInfoLen);
438 458
439 if(track->enc->codec_id == CODEC_ID_AAC) 459 // Object type indication
440 put_byte(pb, 0x40); // Object type indication 460 put_byte(pb, codec_get_tag(ff_mov_obj_type, track->enc->codec_id));
441 else if(track->enc->codec_id == CODEC_ID_MPEG4)
442 put_byte(pb, 0x20); // Object type indication (Visual 14496-2)
443 461
444 if(track->enc->codec_type == CODEC_TYPE_AUDIO) 462 if(track->enc->codec_type == CODEC_TYPE_AUDIO)
445 put_byte(pb, 0x15); // flags (= Audiostream) 463 put_byte(pb, 0x15); // flags (= Audiostream)
446 else 464 else
447 put_byte(pb, 0x11); // flags (= Visualstream) 465 put_byte(pb, 0x11); // flags (= Visualstream)
448 466
449 put_byte(pb, 0x0); // Buffersize DB (24 bits) 467 put_byte(pb, track->enc->rc_buffer_size>>(3+16)); // Buffersize DB (24 bits)
450 put_be16(pb, 0x0dd2); // Buffersize DB 468 put_be16(pb, (track->enc->rc_buffer_size>>3)&0xFFFF); // Buffersize DB
451 469
452 // TODO: find real values for these 470 put_be32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window)
453 put_be32(pb, track->enc->bit_rate); // maxbitrate 471 if(track->enc->rc_max_rate != track->enc->rc_min_rate || track->enc->rc_min_rate==0)
454 put_be32(pb, track->enc->bit_rate); // avg bitrate 472 put_be32(pb, 0); // vbr
473 else
474 put_be32(pb, track->enc->rc_max_rate); // avg bitrate
455 475
456 if (track->vosLen) 476 if (track->vosLen)
457 { 477 {
458 // DecoderSpecific info descriptor 478 // DecoderSpecific info descriptor
459 putDescr(pb, 0x05, track->vosLen); 479 putDescr(pb, 0x05, track->vosLen);