summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-02-26 23:47:32 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-02-26 23:47:32 +0000
commit3797c74ba5350692122a81db62a7bf2ce152f7fc (patch)
tree937ea6305b90b405b4760bcabf0d23de1379a869 /ffmpeg.c
parent83569729d461d4a9465ad90d6a6e36eb2c358cb5 (diff)
Add ticks_per_frame, this should hopefully fix the regressions caused
by the time_base change. Originally committed as revision 17630 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index f757eb5019..1e31570fd0 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1261,7 +1261,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
goto discard_packet;
}
if (ist->st->codec->time_base.num != 0) {
- int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : 1;
+ int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
ist->next_pts += ((int64_t)AV_TIME_BASE *
ist->st->codec->time_base.num * ticks) /
ist->st->codec->time_base.den;
@@ -1290,7 +1290,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
break;
case CODEC_TYPE_VIDEO:
if (ist->st->codec->time_base.num != 0) {
- int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : 1;
+ int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
ist->next_pts += ((int64_t)AV_TIME_BASE *
ist->st->codec->time_base.num * ticks) /
ist->st->codec->time_base.den;
@@ -1750,9 +1750,10 @@ static int av_encode(AVFormatContext **output_files,
codec->bit_rate = icodec->bit_rate;
codec->extradata= icodec->extradata;
codec->extradata_size= icodec->extradata_size;
- if(av_q2d(icodec->time_base) > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000)
+ if(av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000){
codec->time_base = icodec->time_base;
- else
+ codec->time_base.num *= icodec->ticks_per_frame;
+ }else
codec->time_base = ist->st->time_base;
switch(codec->codec_type) {
case CODEC_TYPE_AUDIO: