---
 libavformat/idcin.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 638377c..67915e6 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -89,7 +89,7 @@ typedef struct IdcinDemuxContext {
     int next_chunk_is_video;
     int audio_present;
 
-    int64_t pts;
+    int64_t first_pkt_pos;
 } IdcinDemuxContext;
 
 static int idcin_probe(AVProbeData *p)
@@ -232,6 +232,7 @@ static int idcin_read_header(AVFormatContext *s)
     }
 
     idcin->next_chunk_is_video = 1;
+    idcin->first_pkt_pos = avio_tell(s->pb);
 
     return 0;
 }
@@ -317,6 +318,23 @@ static int idcin_read_packet(AVFormatContext *s,
     return ret;
 }
 
+static int idcin_read_seek(AVFormatContext *s, int stream_index,
+                           int64_t timestamp, int flags)
+{
+    IdcinDemuxContext *idcin = s->priv_data;
+
+    if (idcin->first_pkt_pos > 0) {
+        int ret = avio_seek(s->pb, idcin->first_pkt_pos, SEEK_SET);
+        if (ret < 0)
+            return ret;
+        ff_update_cur_dts(s, s->streams[idcin->video_stream_index], 0);
+        idcin->next_chunk_is_video = 1;
+        idcin->current_audio_chunk = 0;
+        return 0;
+    }
+    return -1;
+}
+
 AVInputFormat ff_idcin_demuxer = {
     .name           = "idcin",
     .long_name      = NULL_IF_CONFIG_SMALL("id Cinematic"),
@@ -324,4 +342,5 @@ AVInputFormat ff_idcin_demuxer = {
     .read_probe     = idcin_probe,
     .read_header    = idcin_read_header,
     .read_packet    = idcin_read_packet,
+    .read_seek      = idcin_read_seek,
 };
-- 
1.7.1

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to