comparison matroskaenc.c @ 2490:06d0bb96139a libavformat

Use PRIu64/PRId64
author conrad
date Wed, 05 Sep 2007 00:24:58 +0000
parents 3ef5728030da
children 51d707a515f2
comparison
equal deleted inserted replaced
2489:3ef5728030da 2490:06d0bb96139a
143 // don't care how many bytes are used, so use the min 143 // don't care how many bytes are used, so use the min
144 bytes = needed_bytes; 144 bytes = needed_bytes;
145 else if (needed_bytes > bytes) { 145 else if (needed_bytes > bytes) {
146 // the bytes needed to write the given size would exceed the bytes 146 // the bytes needed to write the given size would exceed the bytes
147 // that we need to use, so write unknown size. This shouldn't happen. 147 // that we need to use, so write unknown size. This shouldn't happen.
148 av_log(NULL, AV_LOG_WARNING, "Size of %llu needs %d bytes but only %d bytes reserved\n", 148 av_log(NULL, AV_LOG_WARNING, "Size of %" PRIu64 " needs %d bytes but only %d bytes reserved\n",
149 size, needed_bytes, bytes); 149 size, needed_bytes, bytes);
150 put_ebml_size_unknown(pb, bytes); 150 put_ebml_size_unknown(pb, bytes);
151 return; 151 return;
152 } 152 }
153 153
690 static void mkv_write_block(AVFormatContext *s, unsigned int blockid, AVPacket *pkt, int flags) 690 static void mkv_write_block(AVFormatContext *s, unsigned int blockid, AVPacket *pkt, int flags)
691 { 691 {
692 MatroskaMuxContext *mkv = s->priv_data; 692 MatroskaMuxContext *mkv = s->priv_data;
693 ByteIOContext *pb = &s->pb; 693 ByteIOContext *pb = &s->pb;
694 694
695 av_log(s, AV_LOG_DEBUG, "Writing block at offset %llu, size %d, pts %lld, dts %lld, duration %d, flags %d\n", 695 av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
696 url_ftell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags); 696 url_ftell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
697 put_ebml_id(pb, blockid); 697 put_ebml_id(pb, blockid);
698 put_ebml_size(pb, mkv_block_size(pkt), 0); 698 put_ebml_size(pb, mkv_block_size(pkt), 0);
699 put_byte(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 699 put_byte(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126
700 put_be16(pb, pkt->pts - mkv->cluster_pts); 700 put_be16(pb, pkt->pts - mkv->cluster_pts);
709 AVCodecContext *codec = s->streams[pkt->stream_index]->codec; 709 AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
710 int keyframe = !!(pkt->flags & PKT_FLAG_KEY); 710 int keyframe = !!(pkt->flags & PKT_FLAG_KEY);
711 711
712 // start a new cluster every 5 MB or 5 sec 712 // start a new cluster every 5 MB or 5 sec
713 if (url_ftell(pb) > mkv->cluster_pos + 5*1024*1024 || pkt->pts > mkv->cluster_pts + 5000) { 713 if (url_ftell(pb) > mkv->cluster_pos + 5*1024*1024 || pkt->pts > mkv->cluster_pts + 5000) {
714 av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %llu bytes, pts %llu\n", url_ftell(pb), pkt->pts); 714 av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %" PRIu64 " bytes, pts %" PRIu64 "\n", url_ftell(pb), pkt->pts);
715 end_ebml_master(pb, mkv->cluster); 715 end_ebml_master(pb, mkv->cluster);
716 716
717 if (mkv_add_seekhead_entry(mkv->cluster_seekhead, MATROSKA_ID_CLUSTER, url_ftell(pb)) < 0) 717 if (mkv_add_seekhead_entry(mkv->cluster_seekhead, MATROSKA_ID_CLUSTER, url_ftell(pb)) < 0)
718 return -1; 718 return -1;
719 719
756 mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES , cuespos); 756 mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES , cuespos);
757 mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_SEEKHEAD, second_seekhead); 757 mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_SEEKHEAD, second_seekhead);
758 mkv_write_seekhead(pb, mkv->main_seekhead); 758 mkv_write_seekhead(pb, mkv->main_seekhead);
759 759
760 // update the duration 760 // update the duration
761 av_log(s, AV_LOG_DEBUG, "end duration = %llu\n", mkv->duration); 761 av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration);
762 currentpos = url_ftell(pb); 762 currentpos = url_ftell(pb);
763 url_fseek(pb, mkv->duration_offset, SEEK_SET); 763 url_fseek(pb, mkv->duration_offset, SEEK_SET);
764 put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration); 764 put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration);
765 765
766 // write the md5sum of some frames as the segment UID 766 // write the md5sum of some frames as the segment UID