Mercurial > libavformat.hg
comparison utils.c @ 3999:19dbf5d63f15 libavformat
Move code setting delay and presentation_delayed a little up so
that the variables are available sooner.
author | michael |
---|---|
date | Sat, 18 Oct 2008 22:41:21 +0000 |
parents | 549a09cf23fe |
children | f0580597dc48 |
comparison
equal
deleted
inserted
replaced
3998:692e5298a27a | 3999:19dbf5d63f15 |
---|---|
822 AVCodecParserContext *pc, AVPacket *pkt) | 822 AVCodecParserContext *pc, AVPacket *pkt) |
823 { | 823 { |
824 int num, den, presentation_delayed, delay, i; | 824 int num, den, presentation_delayed, delay, i; |
825 int64_t offset; | 825 int64_t offset; |
826 | 826 |
827 /* do we have a video B-frame ? */ | |
828 delay= st->codec->has_b_frames; | |
829 presentation_delayed = 0; | |
830 /* XXX: need has_b_frame, but cannot get it if the codec is | |
831 not initialized */ | |
832 if (delay && | |
833 pc && pc->pict_type != FF_B_TYPE) | |
834 presentation_delayed = 1; | |
835 | |
827 if(pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && pkt->dts > pkt->pts && st->pts_wrap_bits<63 | 836 if(pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && pkt->dts > pkt->pts && st->pts_wrap_bits<63 |
828 /*&& pkt->dts-(1LL<<st->pts_wrap_bits) < pkt->pts*/){ | 837 /*&& pkt->dts-(1LL<<st->pts_wrap_bits) < pkt->pts*/){ |
829 pkt->dts -= 1LL<<st->pts_wrap_bits; | 838 pkt->dts -= 1LL<<st->pts_wrap_bits; |
830 } | 839 } |
831 | 840 |
848 pkt->pts += offset; | 857 pkt->pts += offset; |
849 if(pkt->dts != AV_NOPTS_VALUE) | 858 if(pkt->dts != AV_NOPTS_VALUE) |
850 pkt->dts += offset; | 859 pkt->dts += offset; |
851 } | 860 } |
852 | 861 |
853 /* do we have a video B-frame ? */ | |
854 delay= st->codec->has_b_frames; | |
855 presentation_delayed = 0; | |
856 /* XXX: need has_b_frame, but cannot get it if the codec is | |
857 not initialized */ | |
858 if (delay && | |
859 pc && pc->pict_type != FF_B_TYPE) | |
860 presentation_delayed = 1; | |
861 /* This may be redundant, but it should not hurt. */ | 862 /* This may be redundant, but it should not hurt. */ |
862 if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts) | 863 if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts) |
863 presentation_delayed = 1; | 864 presentation_delayed = 1; |
864 | 865 |
865 // 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); | 866 // 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); |