]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/wvdec.c
Merge commit '82a10225f817b2612fdd2b23af9d4f0a3408df3b'
[ffmpeg] / libavformat / wvdec.c
index 4e58512393c2988c5e7ebd947d3291fa8c4d7d69..96a631fcf382008d627a9420f7df627e1535f373 100644 (file)
@@ -296,6 +296,7 @@ static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
         }
     }
     pkt->stream_index = 0;
+    pkt->pos          = pos;
     wc->block_parsed  = 1;
     pkt->pts          = wc->header.block_idx;
     block_samples     = wc->header.samples;
@@ -305,41 +306,6 @@ static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
     else
         pkt->duration = block_samples;
 
-    av_add_index_entry(s->streams[0], pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
-    return 0;
-}
-
-static int wv_read_seek(AVFormatContext *s, int stream_index,
-                        int64_t timestamp, int flags)
-{
-    AVStream  *st = s->streams[stream_index];
-    WVContext *wc = s->priv_data;
-    AVPacket pkt1, *pkt = &pkt1;
-    int ret;
-    int index = av_index_search_timestamp(st, timestamp, flags);
-    int64_t pos, pts;
-
-    /* if found, seek there */
-    if (index >= 0 &&
-        timestamp <= st->index_entries[st->nb_index_entries - 1].timestamp) {
-        wc->block_parsed = 1;
-        avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
-        return 0;
-    }
-    /* if timestamp is out of bounds, return error */
-    if (timestamp < 0 || timestamp >= s->duration)
-        return AVERROR(EINVAL);
-
-    pos = avio_tell(s->pb);
-    do {
-        ret = av_read_frame(s, pkt);
-        if (ret < 0) {
-            avio_seek(s->pb, pos, SEEK_SET);
-            return ret;
-        }
-        pts = pkt->pts;
-        av_free_packet(pkt);
-    } while(pts < timestamp);
     return 0;
 }
 
@@ -350,5 +316,5 @@ AVInputFormat ff_wv_demuxer = {
     .read_probe     = wv_probe,
     .read_header    = wv_read_header,
     .read_packet    = wv_read_packet,
-    .read_seek      = wv_read_seek,
+    .flags          = AVFMT_GENERIC_INDEX,
 };