Mercurial > libavcodec.hg
comparison h263.c @ 2813:6fd9dbb8c385 libavcodec
try to check for nonsense time_base instead of setting fake one
author | michael |
---|---|
date | Sun, 31 Jul 2005 10:00:25 +0000 |
parents | 18b231c1cb3d |
children | 48fb350b0ec9 |
comparison
equal
deleted
inserted
replaced
2812:18b231c1cb3d | 2813:6fd9dbb8c385 |
---|---|
5154 s->avctx->time_base.den= 1800000; | 5154 s->avctx->time_base.den= 1800000; |
5155 s->avctx->time_base.num= 1000 + get_bits1(&s->gb); | 5155 s->avctx->time_base.num= 1000 + get_bits1(&s->gb); |
5156 s->avctx->time_base.num*= get_bits(&s->gb, 7); | 5156 s->avctx->time_base.num*= get_bits(&s->gb, 7); |
5157 if(s->avctx->time_base.num == 0){ | 5157 if(s->avctx->time_base.num == 0){ |
5158 av_log(s, AV_LOG_ERROR, "zero framerate\n"); | 5158 av_log(s, AV_LOG_ERROR, "zero framerate\n"); |
5159 s->avctx->time_base= (AVRational){1001, 30000}; //prevent crash | |
5160 return -1; | 5159 return -1; |
5161 } | 5160 } |
5162 gcd= ff_gcd(s->avctx->time_base.den, s->avctx->time_base.num); | 5161 gcd= ff_gcd(s->avctx->time_base.den, s->avctx->time_base.num); |
5163 s->avctx->time_base.den /= gcd; | 5162 s->avctx->time_base.den /= gcd; |
5164 s->avctx->time_base.num /= gcd; | 5163 s->avctx->time_base.num /= gcd; |
5799 if(s->partitioned_frame) | 5798 if(s->partitioned_frame) |
5800 s->decode_mb= mpeg4_decode_partitioned_mb; | 5799 s->decode_mb= mpeg4_decode_partitioned_mb; |
5801 else | 5800 else |
5802 s->decode_mb= ff_mpeg4_decode_mb; | 5801 s->decode_mb= ff_mpeg4_decode_mb; |
5803 | 5802 |
5804 if(s->avctx->time_base.den==0){ | |
5805 s->avctx->time_base.den=1; | |
5806 // fprintf(stderr, "time_increment_resolution is illegal\n"); | |
5807 } | |
5808 time_incr=0; | 5803 time_incr=0; |
5809 while (get_bits1(gb) != 0) | 5804 while (get_bits1(gb) != 0) |
5810 time_incr++; | 5805 time_incr++; |
5811 | 5806 |
5812 check_marker(gb, "before time_increment"); | 5807 check_marker(gb, "before time_increment"); |
5854 s->pb_field_time= ( ROUNDED_DIV(s->time, s->t_frame) | 5849 s->pb_field_time= ( ROUNDED_DIV(s->time, s->t_frame) |
5855 - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2; | 5850 - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2; |
5856 } | 5851 } |
5857 //av_log(s->avctx, AV_LOG_DEBUG, "last nonb %Ld last_base %d time %Ld pp %d pb %d t %d ppf %d pbf %d\n", s->last_non_b_time, s->last_time_base, s->time, s->pp_time, s->pb_time, s->t_frame, s->pp_field_time, s->pb_field_time); | 5852 //av_log(s->avctx, AV_LOG_DEBUG, "last nonb %Ld last_base %d time %Ld pp %d pb %d t %d ppf %d pbf %d\n", s->last_non_b_time, s->last_time_base, s->time, s->pp_time, s->pb_time, s->t_frame, s->pp_field_time, s->pb_field_time); |
5858 | 5853 |
5859 s->current_picture_ptr->pts= (s->time + s->avctx->time_base.num/2) / s->avctx->time_base.num; | 5854 if(s->avctx->time_base.num) |
5855 s->current_picture_ptr->pts= (s->time + s->avctx->time_base.num/2) / s->avctx->time_base.num; | |
5856 else | |
5857 s->current_picture_ptr->pts= AV_NOPTS_VALUE; | |
5860 if(s->avctx->debug&FF_DEBUG_PTS) | 5858 if(s->avctx->debug&FF_DEBUG_PTS) |
5861 av_log(s->avctx, AV_LOG_DEBUG, "MPEG4 PTS: %Ld\n", s->current_picture_ptr->pts); | 5859 av_log(s->avctx, AV_LOG_DEBUG, "MPEG4 PTS: %Ld\n", s->current_picture_ptr->pts); |
5862 | 5860 |
5863 check_marker(gb, "before vop_coded"); | 5861 check_marker(gb, "before vop_coded"); |
5864 | 5862 |