Mercurial > libavformat.hg
comparison utils.c @ 1925:9012fcda4257 libavformat
simplify
author | michael |
---|---|
date | Sat, 17 Mar 2007 02:03:59 +0000 |
parents | 3983fe904b71 |
children | 5e66b1924b43 |
comparison
equal
deleted
inserted
replaced
1924:3983fe904b71 | 1925:9012fcda4257 |
---|---|
616 // 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); | 616 // 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); |
617 /* interpolate PTS and DTS if they are not present */ | 617 /* interpolate PTS and DTS if they are not present */ |
618 if (presentation_delayed) { | 618 if (presentation_delayed) { |
619 /* DTS = decompression time stamp */ | 619 /* DTS = decompression time stamp */ |
620 /* PTS = presentation time stamp */ | 620 /* PTS = presentation time stamp */ |
621 if (pkt->dts == AV_NOPTS_VALUE) { | 621 if (pkt->dts == AV_NOPTS_VALUE) |
622 /* if we know the last pts, use it */ | 622 pkt->dts = st->last_IP_pts; |
623 if(st->last_IP_pts != AV_NOPTS_VALUE) | 623 if (pkt->dts == AV_NOPTS_VALUE) |
624 st->cur_dts = pkt->dts = st->last_IP_pts; | 624 pkt->dts = st->cur_dts; |
625 else | 625 |
626 pkt->dts = st->cur_dts; | |
627 } else { | |
628 st->cur_dts = pkt->dts; | |
629 } | |
630 /* this is tricky: the dts must be incremented by the duration | 626 /* this is tricky: the dts must be incremented by the duration |
631 of the frame we are displaying, i.e. the last I or P frame */ | 627 of the frame we are displaying, i.e. the last I or P frame */ |
632 if (st->last_IP_duration == 0) | 628 if (st->last_IP_duration == 0) |
633 st->cur_dts += pkt->duration; | 629 st->last_IP_duration = pkt->duration; |
634 else | 630 st->cur_dts = pkt->dts + st->last_IP_duration; |
635 st->cur_dts += st->last_IP_duration; | |
636 st->last_IP_duration = pkt->duration; | 631 st->last_IP_duration = pkt->duration; |
637 st->last_IP_pts= pkt->pts; | 632 st->last_IP_pts= pkt->pts; |
638 /* cannot compute PTS if not present (we can compute it only | 633 /* cannot compute PTS if not present (we can compute it only |
639 by knowing the futur */ | 634 by knowing the futur */ |
640 } else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){ | 635 } else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){ |