mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-12-24 11:52:06 +08:00
switch to native time bases
Originally committed as revision 4168 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -201,8 +201,8 @@ static int find_frame_rate_index(MpegEncContext *s){
|
||||
int64_t d;
|
||||
|
||||
for(i=1;i<14;i++) {
|
||||
int64_t n0= 1001LL/frame_rate_tab[i].den*frame_rate_tab[i].num*s->avctx->frame_rate_base;
|
||||
int64_t n1= 1001LL*s->avctx->frame_rate;
|
||||
int64_t n0= 1001LL/frame_rate_tab[i].den*frame_rate_tab[i].num*s->avctx->time_base.num;
|
||||
int64_t n1= 1001LL*s->avctx->time_base.den;
|
||||
if(s->avctx->strict_std_compliance >= 0 && i>=9) break;
|
||||
|
||||
d = ABS(n0 - n1);
|
||||
@@ -226,10 +226,10 @@ static int encode_init(AVCodecContext *avctx)
|
||||
|
||||
if(find_frame_rate_index(s) < 0){
|
||||
if(s->strict_std_compliance >=0){
|
||||
av_log(avctx, AV_LOG_ERROR, "MPEG1/2 does not support %d/%d fps\n", avctx->frame_rate, avctx->frame_rate_base);
|
||||
av_log(avctx, AV_LOG_ERROR, "MPEG1/2 does not support %d/%d fps\n", avctx->time_base.den, avctx->time_base.num);
|
||||
return -1;
|
||||
}else{
|
||||
av_log(avctx, AV_LOG_INFO, "MPEG1/2 does not support %d/%d fps, there may be AV sync issues\n", avctx->frame_rate, avctx->frame_rate_base);
|
||||
av_log(avctx, AV_LOG_INFO, "MPEG1/2 does not support %d/%d fps, there may be AV sync issues\n", avctx->time_base.den, avctx->time_base.num);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2099,8 +2099,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
|
||||
|
||||
if(avctx->sub_id==1){//s->codec_id==avctx->codec_id==CODEC_ID
|
||||
//mpeg1 fps
|
||||
avctx->frame_rate = frame_rate_tab[s->frame_rate_index].num;
|
||||
avctx->frame_rate_base= frame_rate_tab[s->frame_rate_index].den;
|
||||
avctx->time_base.den = frame_rate_tab[s->frame_rate_index].num;
|
||||
avctx->time_base.num= frame_rate_tab[s->frame_rate_index].den;
|
||||
//mpeg1 aspect
|
||||
avctx->sample_aspect_ratio= av_d2q(
|
||||
1.0/mpeg1_aspect[s->aspect_ratio_info], 255);
|
||||
@@ -2108,8 +2108,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
|
||||
}else{//mpeg2
|
||||
//mpeg2 fps
|
||||
av_reduce(
|
||||
&s->avctx->frame_rate,
|
||||
&s->avctx->frame_rate_base,
|
||||
&s->avctx->time_base.den,
|
||||
&s->avctx->time_base.num,
|
||||
frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num,
|
||||
frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
|
||||
1<<30);
|
||||
|
||||
Reference in New Issue
Block a user