aboutsummaryrefslogtreecommitdiff
path: root/libavformat/tta.c
diff options
context:
space:
mode:
authorDavid Conrad2007-04-25 23:22:05 +0000
committerDavid Conrad2007-04-25 23:22:05 +0000
commit70fa2486a151200725489bb89c4f919c0a790420 (patch)
treee2878ef22f9b076060671ece706df455d83237f6 /libavformat/tta.c
parent2bd8416e7cc3ef52ca1202a3d26ac75268c125dd (diff)
Support for seeking in TTA files.
Originally committed as revision 8820 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/tta.c')
-rw-r--r--libavformat/tta.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 3168a071b1..b4b3522696 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -120,6 +120,20 @@ static int tta_read_packet(AVFormatContext *s, AVPacket *pkt)
return av_get_packet(&s->pb, pkt, size);
}
+static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
+{
+ TTAContext *c = s->priv_data;
+ AVStream *st = s->streams[stream_index];
+ int index = av_index_search_timestamp(st, timestamp, flags);
+ if (index < 0)
+ return -1;
+
+ c->currentframe = index;
+ url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
+
+ return 0;
+}
+
AVInputFormat tta_demuxer = {
"tta",
"true-audio",
@@ -128,5 +142,6 @@ AVInputFormat tta_demuxer = {
tta_read_header,
tta_read_packet,
NULL,
+ tta_read_seek,
.extensions = "tta",
};