Support for seeking in TTA files.

Originally committed as revision 8820 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
David Conrad 2007-04-25 23:22:05 +00:00
parent 2bd8416e7c
commit 70fa2486a1
1 changed files with 15 additions and 0 deletions

View File

@ -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",
};