Mercurial > libavcodec.hg
comparison h263.c @ 654:850098147a3c libavcodec
export pts from stream if available
store pts in stream if available (otherwise use frame_rate)
author | michaelni |
---|---|
date | Thu, 12 Sep 2002 10:54:53 +0000 |
parents | dddcff6841f2 |
children | e47fa3e3f2d5 |
comparison
equal
deleted
inserted
replaced
653:714795876872 | 654:850098147a3c |
---|---|
1312 s->time_increment_resolution= s->frame_rate/ff_gcd(s->frame_rate, FRAME_RATE_BASE); | 1312 s->time_increment_resolution= s->frame_rate/ff_gcd(s->frame_rate, FRAME_RATE_BASE); |
1313 if(s->time_increment_resolution>=256*256) s->time_increment_resolution= 256*128; | 1313 if(s->time_increment_resolution>=256*256) s->time_increment_resolution= 256*128; |
1314 | 1314 |
1315 s->time_increment_bits = av_log2(s->time_increment_resolution - 1) + 1; | 1315 s->time_increment_bits = av_log2(s->time_increment_resolution - 1) + 1; |
1316 } | 1316 } |
1317 | 1317 |
1318 s->time= picture_number*(INT64)FRAME_RATE_BASE*s->time_increment_resolution/s->frame_rate; | 1318 if(s->avctx->pts) |
1319 s->time= (s->avctx->pts*s->time_increment_resolution + 500*1000)/(1000*1000); | |
1320 else | |
1321 s->time= picture_number*(INT64)FRAME_RATE_BASE*s->time_increment_resolution/s->frame_rate; | |
1319 time_div= s->time/s->time_increment_resolution; | 1322 time_div= s->time/s->time_increment_resolution; |
1320 time_mod= s->time%s->time_increment_resolution; | 1323 time_mod= s->time%s->time_increment_resolution; |
1321 | 1324 |
1322 if(s->pict_type==B_TYPE){ | 1325 if(s->pict_type==B_TYPE){ |
1323 s->bp_time= s->last_non_b_time - s->time; | 1326 s->bp_time= s->last_non_b_time - s->time; |
3991 if(s->pp_time <=s->bp_time){ | 3994 if(s->pp_time <=s->bp_time){ |
3992 // printf("messed up order, seeking?, skiping current b frame\n"); | 3995 // printf("messed up order, seeking?, skiping current b frame\n"); |
3993 return FRAME_SKIPED; | 3996 return FRAME_SKIPED; |
3994 } | 3997 } |
3995 } | 3998 } |
3996 | 3999 |
4000 s->avctx->pts= s->time*1000LL*1000LL / s->time_increment_resolution; | |
4001 | |
3997 if(check_marker(&s->gb, "before vop_coded")==0 && s->picture_number==0){ | 4002 if(check_marker(&s->gb, "before vop_coded")==0 && s->picture_number==0){ |
3998 printf("hmm, seems the headers arnt complete, trying to guess time_increment_bits\n"); | 4003 printf("hmm, seems the headers arnt complete, trying to guess time_increment_bits\n"); |
3999 for(s->time_increment_bits++ ;s->time_increment_bits<16; s->time_increment_bits++){ | 4004 for(s->time_increment_bits++ ;s->time_increment_bits<16; s->time_increment_bits++){ |
4000 if(get_bits1(&s->gb)) break; | 4005 if(get_bits1(&s->gb)) break; |
4001 } | 4006 } |