summaryrefslogtreecommitdiff
path: root/libavformat/r3d.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-06-26 13:10:01 +0200
committerAnton Khirnov <anton@khirnov.net>2012-07-29 08:06:30 +0200
commitaba232cfa9b193604ed98f3fa505378d006b1b3b (patch)
tree853cfd07d72dc8b0fa63ee1a7bc76e335321f845 /libavformat/r3d.c
parentf66eeff1c8fc5c1b2e5a563cf336865d52329006 (diff)
lavf: deprecate r_frame_rate.
According to its description, it is supposed to be the LCM of all the frame durations. The usability of such a thing is vanishingly small, especially since we cannot determine it with any amount of reliability. Therefore get rid of it after the next bump. Replace it with the average framerate where it makes sense. FATE results for the wtv and xmv demux tests change. In the wtv case this is caused by the file being corrupted (or possibly badly cut) and containing invalid timestamps. This results in lavf estimating the framerate wrong and making up wrong frame durations. In the xmv case the file contains pts jumps, so again the estimated framerate is far from anything sane and lavf again makes up different frame durations. In some other tests lavf starts making up frame durations from different frame.
Diffstat (limited to 'libavformat/r3d.c')
-rw-r--r--libavformat/r3d.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index f67d10eb80..1795631bea 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -87,8 +87,12 @@ static int r3d_read_red1(AVFormatContext *s)
framerate.num = avio_rb16(s->pb);
framerate.den = avio_rb16(s->pb);
- if (framerate.num && framerate.den)
- st->r_frame_rate = st->avg_frame_rate = framerate;
+ if (framerate.num && framerate.den) {
+#if FF_API_R_FRAME_RATE
+ st->r_frame_rate =
+#endif
+ st->avg_frame_rate = framerate;
+ }
tmp = avio_r8(s->pb); // audio channels
av_dlog(s, "audio channels %d\n", tmp);
@@ -135,10 +139,10 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
av_dlog(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]);
}
- if (st->r_frame_rate.num)
+ if (st->avg_frame_rate.num)
st->duration = av_rescale_q(r3d->video_offsets_count,
- (AVRational){st->r_frame_rate.den,
- st->r_frame_rate.num},
+ (AVRational){st->avg_frame_rate.den,
+ st->avg_frame_rate.num},
st->time_base);
av_dlog(s, "duration %"PRId64"\n", st->duration);
@@ -262,9 +266,9 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
pkt->stream_index = 0;
pkt->dts = dts;
- if (st->r_frame_rate.num)
+ if (st->avg_frame_rate.num)
pkt->duration = (uint64_t)st->time_base.den*
- st->r_frame_rate.den/st->r_frame_rate.num;
+ st->avg_frame_rate.den/st->avg_frame_rate.num;
av_dlog(s, "pkt dts %"PRId64" duration %d\n", pkt->dts, pkt->duration);
return 0;
@@ -362,11 +366,11 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i
R3DContext *r3d = s->priv_data;
int frame_num;
- if (!st->r_frame_rate.num)
+ if (!st->avg_frame_rate.num)
return -1;
frame_num = av_rescale_q(sample_time, st->time_base,
- (AVRational){st->r_frame_rate.den, st->r_frame_rate.num});
+ (AVRational){st->avg_frame_rate.den, st->avg_frame_rate.num});
av_dlog(s, "seek frame num %d timestamp %"PRId64"\n",
frame_num, sample_time);