comparison matroskaenc.c @ 2519:0ddd5ae4c702 libavformat

Grammar nits
author conrad
date Wed, 05 Sep 2007 00:26:11 +0000
parents 8d649d879e65
children 9e93e15ea3c1
comparison
equal deleted inserted replaced
2518:8d649d879e65 2519:0ddd5ae4c702
96 while (i--) 96 while (i--)
97 put_byte(pb, id >> (i*8)); 97 put_byte(pb, id >> (i*8));
98 } 98 }
99 99
100 /** 100 /**
101 * Write an EBML size meaning "unknown size" 101 * Write an EBML size meaning "unknown size."
102 * 102 *
103 * @param bytes The number of bytes the size should occupy. Maximum of 8. 103 * @param bytes The number of bytes the size should occupy. Maximum of 8.
104 */ 104 */
105 static void put_ebml_size_unknown(ByteIOContext *pb, int bytes) 105 static void put_ebml_size_unknown(ByteIOContext *pb, int bytes)
106 { 106 {
233 * elements. If a maximum number of elements is specified, enough space 233 * elements. If a maximum number of elements is specified, enough space
234 * will be reserved at the current file location to write a seek head of 234 * will be reserved at the current file location to write a seek head of
235 * that size. 235 * that size.
236 * 236 *
237 * @param segment_offset The absolute offset to the position in the file 237 * @param segment_offset The absolute offset to the position in the file
238 * where the segment begins 238 * where the segment begins.
239 * @param numelements the maximum number of elements that will be indexed 239 * @param numelements The maximum number of elements that will be indexed
240 * by this seek head, 0 if unlimited. 240 * by this seek head, 0 if unlimited.
241 */ 241 */
242 static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, offset_t segment_offset, int numelements) 242 static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, offset_t segment_offset, int numelements)
243 { 243 {
244 mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead)); 244 mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
282 * Write the seek head to the file and free it. If a maximum number of 282 * Write the seek head to the file and free it. If a maximum number of
283 * elements was specified to mkv_start_seekhead(), the seek head will 283 * elements was specified to mkv_start_seekhead(), the seek head will
284 * be written at the location reserved for it. Otherwise, it is written 284 * be written at the location reserved for it. Otherwise, it is written
285 * at the current location in the file. 285 * at the current location in the file.
286 * 286 *
287 * @return the file offset where the seekhead was written 287 * @return The file offset where the seekhead was written.
288 */ 288 */
289 static offset_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead) 289 static offset_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead)
290 { 290 {
291 ebml_master metaseek, seekentry; 291 ebml_master metaseek, seekentry;
292 offset_t currentpos; 292 offset_t currentpos;
440 24000, 22050, 16000, 12000, 11025, 8000, 440 24000, 22050, 16000, 12000, 11025, 8000,
441 }; 441 };
442 int sri; 442 int sri;
443 443
444 if (codec->extradata_size < 2) { 444 if (codec->extradata_size < 2) {
445 av_log(s, AV_LOG_WARNING, "no AAC extradata, unable to determine samplerate\n"); 445 av_log(s, AV_LOG_WARNING, "No AAC extradata, unable to determine samplerate.\n");
446 return; 446 return;
447 } 447 }
448 448
449 sri = ((codec->extradata[0] << 1) & 0xE) | (codec->extradata[1] >> 7); 449 sri = ((codec->extradata[0] << 1) & 0xE) | (codec->extradata[1] >> 7);
450 if (sri > 12) { 450 if (sri > 12) {
481 put_buffer(&dyn_cp, codec->extradata, codec->extradata_size); 481 put_buffer(&dyn_cp, codec->extradata, codec->extradata_size);
482 } else if (codec->codec_type == CODEC_TYPE_VIDEO) { 482 } else if (codec->codec_type == CODEC_TYPE_VIDEO) {
483 if (!codec->codec_tag) 483 if (!codec->codec_tag)
484 codec->codec_tag = codec_get_tag(codec_bmp_tags, codec->codec_id); 484 codec->codec_tag = codec_get_tag(codec_bmp_tags, codec->codec_id);
485 if (!codec->codec_tag) { 485 if (!codec->codec_tag) {
486 av_log(s, AV_LOG_ERROR, "no bmp codec id found"); 486 av_log(s, AV_LOG_ERROR, "No bmp codec ID found.");
487 ret = -1; 487 ret = -1;
488 } 488 }
489 489
490 put_bmp_header(&dyn_cp, codec, codec_bmp_tags, 0); 490 put_bmp_header(&dyn_cp, codec, codec_bmp_tags, 0);
491 491
492 } else if (codec->codec_type == CODEC_TYPE_AUDIO) { 492 } else if (codec->codec_type == CODEC_TYPE_AUDIO) {
493 if (!codec->codec_tag) 493 if (!codec->codec_tag)
494 codec->codec_tag = codec_get_tag(codec_wav_tags, codec->codec_id); 494 codec->codec_tag = codec_get_tag(codec_wav_tags, codec->codec_id);
495 if (!codec->codec_tag) { 495 if (!codec->codec_tag) {
496 av_log(s, AV_LOG_ERROR, "no wav codec id found"); 496 av_log(s, AV_LOG_ERROR, "No wav codec ID found.");
497 ret = -1; 497 ret = -1;
498 } 498 }
499 499
500 put_wav_header(&dyn_cp, codec); 500 put_wav_header(&dyn_cp, codec);
501 } 501 }
541 if (st->language[0]) 541 if (st->language[0])
542 put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, st->language); 542 put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, st->language);
543 else 543 else
544 put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, "und"); 544 put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, "und");
545 545
546 // look for a codec id string specific to mkv to use, 546 // look for a codec ID string specific to mkv to use,
547 // if none are found, use AVI codes 547 // if none are found, use AVI codes
548 for (j = 0; ff_mkv_codec_tags[j].id != CODEC_ID_NONE; j++) { 548 for (j = 0; ff_mkv_codec_tags[j].id != CODEC_ID_NONE; j++) {
549 if (ff_mkv_codec_tags[j].id == codec->codec_id) { 549 if (ff_mkv_codec_tags[j].id == codec->codec_id) {
550 put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str); 550 put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str);
551 native_id = 1; 551 native_id = 1;
556 switch (codec->codec_type) { 556 switch (codec->codec_type) {
557 case CODEC_TYPE_VIDEO: 557 case CODEC_TYPE_VIDEO:
558 put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_VIDEO); 558 put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_VIDEO);
559 559
560 if (!native_id) 560 if (!native_id)
561 // if there is no mkv-specific codec id, use VFW mode 561 // if there is no mkv-specific codec ID, use VFW mode
562 put_ebml_string(pb, MATROSKA_ID_CODECID, MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC); 562 put_ebml_string(pb, MATROSKA_ID_CODECID, MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC);
563 563
564 subinfo = start_ebml_master(pb, MATROSKA_ID_TRACKVIDEO, 0); 564 subinfo = start_ebml_master(pb, MATROSKA_ID_TRACKVIDEO, 0);
565 // XXX: interlace flag? 565 // XXX: interlace flag?
566 put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , codec->width); 566 put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , codec->width);