[Ffmpeg-cvslog] r8820 - trunk/libavformat/tta.c

conrad subversion
Thu Apr 26 01:22:05 CEST 2007


Author: conrad
Date: Thu Apr 26 01:22:05 2007
New Revision: 8820

Log:
Support for seeking in TTA files.

Modified:
   trunk/libavformat/tta.c

Modified: trunk/libavformat/tta.c
==============================================================================
--- trunk/libavformat/tta.c	(original)
+++ trunk/libavformat/tta.c	Thu Apr 26 01:22:05 2007
@@ -120,6 +120,20 @@ static int tta_read_packet(AVFormatConte
     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",
 };




More information about the ffmpeg-cvslog mailing list