]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/dhav.c
hwcontext_vulkan: dlopen libvulkan
[ffmpeg] / libavformat / dhav.c
index 00e0d8476e4166e27f541ec5e614d1d4839226e2..92bbfab7c5cb7cf0deb25b4bdb6c67571dce9005 100644 (file)
@@ -173,18 +173,9 @@ static int read_chunk(AVFormatContext *s)
     if (avio_feof(s->pb))
         return AVERROR_EOF;
 
-    if (avio_rl32(s->pb) != MKTAG('D','H','A','V') && dhav->last_good_pos < INT64_MAX - 0x8000) {
-        dhav->last_good_pos += 0x8000;
-        avio_seek(s->pb, dhav->last_good_pos, SEEK_SET);
-
-        while (avio_rl32(s->pb) != MKTAG('D','H','A','V')) {
-            if (avio_feof(s->pb) || dhav->last_good_pos >= INT64_MAX - 0x8000)
-                return AVERROR_EOF;
-            dhav->last_good_pos += 0x8000;
-            ret = avio_skip(s->pb, 0x8000 - 4);
-            if (ret < 0)
-                return ret;
-        }
+    while (avio_r8(s->pb) != 'D' || avio_r8(s->pb) != 'H' || avio_r8(s->pb) != 'A' || avio_r8(s->pb) != 'V') {
+        if (avio_feof(s->pb))
+            return AVERROR_EOF;
     }
 
     start = avio_tell(s->pb) - 4;
@@ -290,6 +281,8 @@ static int dhav_read_header(AVFormatContext *s)
                 int seek_back;
 
                 seek_back = avio_rl32(s->pb) + 8;
+                if (seek_back < 9)
+                    break;
                 dhav->last_good_pos = avio_tell(s->pb);
                 avio_seek(s->pb, -seek_back, SEEK_CUR);
             }
@@ -458,7 +451,7 @@ static int dhav_read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-AVInputFormat ff_dhav_demuxer = {
+const AVInputFormat ff_dhav_demuxer = {
     .name           = "dhav",
     .long_name      = NULL_IF_CONFIG_SMALL("Video DAV"),
     .priv_data_size = sizeof(DHAVContext),