diff options
author | Nathan Kurz <nate@verse.com> | 2004-09-18 00:32:36 +0000 |
---|---|---|
committer | Roman Shaposhnik <roman@shaposhnik.org> | 2004-09-18 00:32:36 +0000 |
commit | 0bf4e2b8a3d073ce7b86d177c8f3e6e8284a6c1f (patch) | |
tree | fb3c5e6355c51325049d1e6129d947cc44cfa4ec /libavformat | |
parent | 66d1cdb6728e266a2eb2c58b6fd6adffee413717 (diff) | |
download | ffmpeg-0bf4e2b8a3d073ce7b86d177c8f3e6e8284a6c1f.tar.gz |
* seek in raw DV patch by Nathan Kurz (nate at verse dot com)
Originally committed as revision 3477 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/dv.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libavformat/dv.c b/libavformat/dv.c index 4baa7a9d6d..31b3522056 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -821,10 +821,19 @@ int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, int64_t dv_frame_offset(DVDemuxContext *c, int64_t timestamp) { - const DVprofile* sys = dv_codec_profile(&c->vst->codec); + const DVprofile* sys; + + // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk) + sys = dv_codec_profile(&c->vst->codec); + + // timestamp was scaled by time_base/AV_BASE_RATE by av_seek_frame() + int64_t frame_number = av_rescale(sys->frame_rate, timestamp, + (int64_t) 30000 * sys->frame_rate_base); + + // offset must be a multiple of frame_size else dv_read_packet() will fail + int64_t offset = (int64_t) sys->frame_size * frame_number; - return sys->frame_size * ((timestamp * sys->frame_rate) / - (AV_TIME_BASE * sys->frame_rate_base)); + return offset; } /************************************************************ |