Mercurial > libavcodec.hg
comparison h263.c @ 1831:cd2d7fcfab7a libavcodec
use AVFrame.pts=AV_NOPTS_VALUE instead of AVFrame.pts=0
move AV_NOPTS_VALUE & AV_TIME_BASE from avformat.h -> avcodec.h
related fixes
author | michael |
---|---|
date | Wed, 25 Feb 2004 17:35:52 +0000 |
parents | 7ae26b6e197f |
children | 92e94c550def |
comparison
equal
deleted
inserted
replaced
1830:024752284c25 | 1831:cd2d7fcfab7a |
---|---|
2154 | 2154 |
2155 /* must be called before writing the header */ | 2155 /* must be called before writing the header */ |
2156 void ff_set_mpeg4_time(MpegEncContext * s, int picture_number){ | 2156 void ff_set_mpeg4_time(MpegEncContext * s, int picture_number){ |
2157 int time_div, time_mod; | 2157 int time_div, time_mod; |
2158 | 2158 |
2159 assert(s->current_picture_ptr->pts); | 2159 assert(s->current_picture_ptr->pts != AV_NOPTS_VALUE); |
2160 s->time= (s->current_picture_ptr->pts*s->time_increment_resolution + 500*1000)/(1000*1000); | 2160 s->time= (s->current_picture_ptr->pts*s->time_increment_resolution + AV_TIME_BASE/2)/AV_TIME_BASE; |
2161 | 2161 |
2162 time_div= s->time/s->time_increment_resolution; | 2162 time_div= s->time/s->time_increment_resolution; |
2163 time_mod= s->time%s->time_increment_resolution; | 2163 time_mod= s->time%s->time_increment_resolution; |
2164 | 2164 |
2165 if(s->pict_type==B_TYPE){ | 2165 if(s->pict_type==B_TYPE){ |
2177 int64_t time; | 2177 int64_t time; |
2178 | 2178 |
2179 put_bits(&s->pb, 16, 0); | 2179 put_bits(&s->pb, 16, 0); |
2180 put_bits(&s->pb, 16, GOP_STARTCODE); | 2180 put_bits(&s->pb, 16, GOP_STARTCODE); |
2181 | 2181 |
2182 if(s->current_picture_ptr->pts && s->reordered_input_picture[1]){ | 2182 time= s->current_picture_ptr->pts; |
2183 time= FFMIN(s->reordered_input_picture[1]->pts, s->current_picture_ptr->pts); | 2183 if(s->reordered_input_picture[1]) |
2184 time= (time*s->time_increment_resolution + 500*1000)/(1000*1000); | 2184 time= FFMIN(time, s->reordered_input_picture[1]->pts); |
2185 }else | 2185 time= (time*s->time_increment_resolution + AV_TIME_BASE/2)/AV_TIME_BASE; |
2186 time= av_rescale(s->current_picture_ptr->coded_picture_number*(int64_t)s->avctx->frame_rate_base, s->time_increment_resolution, s->avctx->frame_rate); | |
2187 | 2186 |
2188 seconds= time/s->time_increment_resolution; | 2187 seconds= time/s->time_increment_resolution; |
2189 minutes= seconds/60; seconds %= 60; | 2188 minutes= seconds/60; seconds %= 60; |
2190 hours= minutes/60; minutes %= 60; | 2189 hours= minutes/60; minutes %= 60; |
2191 hours%=24; | 2190 hours%=24; |
5707 - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2; | 5706 - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2; |
5708 s->pb_field_time= ( ROUNDED_DIV(s->time, s->t_frame) | 5707 s->pb_field_time= ( ROUNDED_DIV(s->time, s->t_frame) |
5709 - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2; | 5708 - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2; |
5710 } | 5709 } |
5711 | 5710 |
5712 s->current_picture_ptr->pts= s->time*1000LL*1000LL / s->time_increment_resolution; | 5711 s->current_picture_ptr->pts= s->time*(int64_t)AV_TIME_BASE / s->time_increment_resolution; |
5713 if(s->avctx->debug&FF_DEBUG_PTS) | 5712 if(s->avctx->debug&FF_DEBUG_PTS) |
5714 av_log(s->avctx, AV_LOG_DEBUG, "MPEG4 PTS: %f\n", s->current_picture_ptr->pts/(1000.0*1000.0)); | 5713 av_log(s->avctx, AV_LOG_DEBUG, "MPEG4 PTS: %f\n", s->current_picture_ptr->pts/(float)AV_TIME_BASE); |
5715 | 5714 |
5716 check_marker(gb, "before vop_coded"); | 5715 check_marker(gb, "before vop_coded"); |
5717 | 5716 |
5718 /* vop coded */ | 5717 /* vop coded */ |
5719 if (get_bits1(gb) != 1){ | 5718 if (get_bits1(gb) != 1){ |