aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-01-27 13:55:34 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-01-27 13:55:34 +0000
commit6ff6cff203f5e15a2f1733c5dd4b85e3731f127d (patch)
treea069d14514c0ddb9605b0492c3022645e5a9e6bb /libavcodec
parentac806113fefd13dc4fb40507148e8f799d28de97 (diff)
downloadffmpeg-6ff6cff203f5e15a2f1733c5dd4b85e3731f127d.tar.gz
first coded vs. first displayed pts (segfault & pts fix if b frames are used)
Originally committed as revision 2727 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h263.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
index 01caf044cc..1d6a09ee39 100644
--- a/libavcodec/h263.c
+++ b/libavcodec/h263.c
@@ -2173,11 +2173,18 @@ void ff_set_mpeg4_time(MpegEncContext * s, int picture_number){
static void mpeg4_encode_gop_header(MpegEncContext * s){
int hours, minutes, seconds;
+ int64_t time;
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, GOP_STARTCODE);
- seconds= s->time/s->time_increment_resolution;
+ if(s->current_picture_ptr->pts){
+ time= FFMIN(s->reordered_input_picture[1]->pts, s->current_picture_ptr->pts);
+ time= (time*s->time_increment_resolution + 500*1000)/(1000*1000);
+ }else
+ 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);
+
+ seconds= time/s->time_increment_resolution;
minutes= seconds/60; seconds %= 60;
hours= minutes/60; minutes %= 60;
hours%=24;
@@ -2190,7 +2197,7 @@ static void mpeg4_encode_gop_header(MpegEncContext * s){
put_bits(&s->pb, 1, !!(s->flags&CODEC_FLAG_CLOSED_GOP));
put_bits(&s->pb, 1, 0); //broken link == NO
- s->last_time_base= s->time_base;
+ s->last_time_base= time / s->time_increment_resolution;
ff_mpeg4_stuffing(&s->pb);
}