diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-04-30 21:43:59 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-04-30 21:43:59 +0000 |
commit | c0df9d75bd9a3170a793eb1651354076360998e8 (patch) | |
tree | 0f4c75f07fc395d168bf0a7fcd92d6f9d9e9281b /libavformat/img.c | |
parent | b7782b47c95c26d674df134973d1403e80fe9767 (diff) | |
download | ffmpeg-c0df9d75bd9a3170a793eb1651354076360998e8.tar.gz |
switch to native time bases
Originally committed as revision 4168 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/img.c')
-rw-r--r-- | libavformat/img.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/libavformat/img.c b/libavformat/img.c index d52e1a0f59..c30d455d8a 100644 --- a/libavformat/img.c +++ b/libavformat/img.c @@ -132,15 +132,13 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) s->is_pipe = 0; else s->is_pipe = 1; - - if (!ap || !ap->frame_rate) { - st->codec.frame_rate = 25; - st->codec.frame_rate_base = 1; + + if (!ap || !ap->time_base.num) { + st->codec.time_base= (AVRational){1,25}; } else { - st->codec.frame_rate = ap->frame_rate; - st->codec.frame_rate_base = ap->frame_rate_base; + st->codec.time_base= ap->time_base; } - + if (!s->is_pipe) { if (find_image_range(&first_index, &last_index, s->path) < 0) goto fail; @@ -149,9 +147,7 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) s->img_number = first_index; /* compute duration */ st->start_time = 0; - st->duration = ((int64_t)AV_TIME_BASE * - (last_index - first_index + 1) * - st->codec.frame_rate_base) / st->codec.frame_rate; + st->duration = last_index - first_index + 1; if (get_frame_filename(buf, sizeof(buf), s->path, s->img_number) < 0) goto fail; if (url_fopen(f, buf, URL_RDONLY) < 0) @@ -236,7 +232,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) } else { /* XXX: computing this pts is not necessary as it is done in the generic code too */ - pkt->pts = av_rescale((int64_t)s->img_count * s1->streams[0]->codec.frame_rate_base, s1->streams[0]->time_base.den, s1->streams[0]->codec.frame_rate) / s1->streams[0]->time_base.num; + pkt->pts = av_rescale((int64_t)s->img_count * s1->streams[0]->codec.time_base.num, s1->streams[0]->time_base.den, s1->streams[0]->codec.time_base.den) / s1->streams[0]->time_base.num; s->img_count++; s->img_number++; return 0; |