comparison utils.c @ 1443:404048ea11bc libavformat

Replace most of the %lld and %llx by their (cleaner) PRI*64 counterparts. patch by Steve Lhomme, slhomme divxcorp com
author diego
date Wed, 01 Nov 2006 22:39:58 +0000
parents c2b748de9b35
children 74cb68ad9dce
comparison
equal deleted inserted replaced
1442:c2b748de9b35 1443:404048ea11bc
683 if(st->cur_dts == AV_NOPTS_VALUE){ 683 if(st->cur_dts == AV_NOPTS_VALUE){
684 if(presentation_delayed) st->cur_dts = -pkt->duration; 684 if(presentation_delayed) st->cur_dts = -pkt->duration;
685 else st->cur_dts = 0; 685 else st->cur_dts = 0;
686 } 686 }
687 687
688 // av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%lld, dts:%lld cur_dts:%lld st:%d pc:%p\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, pkt->stream_index, pc); 688 // av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, pkt->stream_index, pc);
689 /* interpolate PTS and DTS if they are not present */ 689 /* interpolate PTS and DTS if they are not present */
690 if (presentation_delayed) { 690 if (presentation_delayed) {
691 /* DTS = decompression time stamp */ 691 /* DTS = decompression time stamp */
692 /* PTS = presentation time stamp */ 692 /* PTS = presentation time stamp */
693 if (pkt->dts == AV_NOPTS_VALUE) { 693 if (pkt->dts == AV_NOPTS_VALUE) {
713 if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){ 713 if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){
714 int64_t old_diff= FFABS(st->cur_dts - pkt->duration - pkt->pts); 714 int64_t old_diff= FFABS(st->cur_dts - pkt->duration - pkt->pts);
715 int64_t new_diff= FFABS(st->cur_dts - pkt->pts); 715 int64_t new_diff= FFABS(st->cur_dts - pkt->pts);
716 if(old_diff < new_diff && old_diff < (pkt->duration>>3)){ 716 if(old_diff < new_diff && old_diff < (pkt->duration>>3)){
717 pkt->pts += pkt->duration; 717 pkt->pts += pkt->duration;
718 // av_log(NULL, AV_LOG_DEBUG, "id:%d old:%Ld new:%Ld dur:%d cur:%Ld size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size); 718 // av_log(NULL, AV_LOG_DEBUG, "id:%d old:%"PRId64" new:%"PRId64" dur:%d cur:%"PRId64" size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size);
719 } 719 }
720 } 720 }
721 721
722 /* presentation is not delayed : PTS and DTS are the same */ 722 /* presentation is not delayed : PTS and DTS are the same */
723 if (pkt->pts == AV_NOPTS_VALUE) { 723 if (pkt->pts == AV_NOPTS_VALUE) {
733 st->cur_dts = pkt->pts; 733 st->cur_dts = pkt->pts;
734 pkt->dts = pkt->pts; 734 pkt->dts = pkt->pts;
735 } 735 }
736 st->cur_dts += pkt->duration; 736 st->cur_dts += pkt->duration;
737 } 737 }
738 // av_log(NULL, AV_LOG_DEBUG, "OUTdelayed:%d pts:%lld, dts:%lld cur_dts:%lld\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts); 738 // av_log(NULL, AV_LOG_DEBUG, "OUTdelayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts);
739 739
740 /* update flags */ 740 /* update flags */
741 if (pc) { 741 if (pc) {
742 pkt->flags = 0; 742 pkt->flags = 0;
743 /* key frame computation */ 743 /* key frame computation */
2202 //FIXME merge with compute_pkt_fields 2202 //FIXME merge with compute_pkt_fields
2203 static int compute_pkt_fields2(AVStream *st, AVPacket *pkt){ 2203 static int compute_pkt_fields2(AVStream *st, AVPacket *pkt){
2204 int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames); 2204 int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
2205 int num, den, frame_size, i; 2205 int num, den, frame_size, i;
2206 2206
2207 // av_log(NULL, AV_LOG_DEBUG, "av_write_frame: pts:%lld dts:%lld cur_dts:%lld b:%d size:%d st:%d\n", pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index); 2207 // av_log(st->codec, AV_LOG_DEBUG, "av_write_frame: pts:%"PRId64" dts:%"PRId64" cur_dts:%"PRId64" b:%d size:%d st:%d\n", pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index);
2208 2208
2209 /* if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE) 2209 /* if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE)
2210 return -1;*/ 2210 return -1;*/
2211 2211
2212 /* duration field */ 2212 /* duration field */
2242 if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){ 2242 if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){
2243 av_log(NULL, AV_LOG_ERROR, "error, pts < dts\n"); 2243 av_log(NULL, AV_LOG_ERROR, "error, pts < dts\n");
2244 return -1; 2244 return -1;
2245 } 2245 }
2246 2246
2247 // av_log(NULL, AV_LOG_DEBUG, "av_write_frame: pts2:%lld dts2:%lld\n", pkt->pts, pkt->dts); 2247 // av_log(NULL, AV_LOG_DEBUG, "av_write_frame: pts2:%"PRId64" dts2:%"PRId64"\n", pkt->pts, pkt->dts);
2248 st->cur_dts= pkt->dts; 2248 st->cur_dts= pkt->dts;
2249 st->pts.val= pkt->dts; 2249 st->pts.val= pkt->dts;
2250 2250
2251 /* update pts */ 2251 /* update pts */
2252 switch (st->codec->codec_type) { 2252 switch (st->codec->codec_type) {
2348 } 2348 }
2349 2349
2350 memset(streams, 0, sizeof(streams)); 2350 memset(streams, 0, sizeof(streams));
2351 pktl= s->packet_buffer; 2351 pktl= s->packet_buffer;
2352 while(pktl){ 2352 while(pktl){
2353 //av_log(s, AV_LOG_DEBUG, "show st:%d dts:%lld\n", pktl->pkt.stream_index, pktl->pkt.dts); 2353 //av_log(s, AV_LOG_DEBUG, "show st:%d dts:%"PRId64"\n", pktl->pkt.stream_index, pktl->pkt.dts);
2354 if(streams[ pktl->pkt.stream_index ] == 0) 2354 if(streams[ pktl->pkt.stream_index ] == 0)
2355 stream_count++; 2355 stream_count++;
2356 streams[ pktl->pkt.stream_index ]++; 2356 streams[ pktl->pkt.stream_index ]++;
2357 pktl= pktl->next; 2357 pktl= pktl->next;
2358 } 2358 }
2405 2405
2406 //FIXME/XXX/HACK drop zero sized packets 2406 //FIXME/XXX/HACK drop zero sized packets
2407 if(st->codec->codec_type == CODEC_TYPE_AUDIO && pkt->size==0) 2407 if(st->codec->codec_type == CODEC_TYPE_AUDIO && pkt->size==0)
2408 return 0; 2408 return 0;
2409 2409
2410 //av_log(NULL, AV_LOG_DEBUG, "av_interleaved_write_frame %d %Ld %Ld\n", pkt->size, pkt->dts, pkt->pts); 2410 //av_log(NULL, AV_LOG_DEBUG, "av_interleaved_write_frame %d %"PRId64" %"PRId64"\n", pkt->size, pkt->dts, pkt->pts);
2411 if(compute_pkt_fields2(st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) 2411 if(compute_pkt_fields2(st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
2412 return -1; 2412 return -1;
2413 2413
2414 if(pkt->dts == AV_NOPTS_VALUE) 2414 if(pkt->dts == AV_NOPTS_VALUE)
2415 return -1; 2415 return -1;