]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/wv.c
lavc: add a OpenEXR decoder
[ffmpeg] / libavformat / wv.c
index 33f69d8a1f81dfd6a0a3d43bfc225a240e3e772a..767f4f48ef52becab204f45776042c66187167c4 100644 (file)
@@ -203,8 +203,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
     return 0;
 }
 
-static int wv_read_header(AVFormatContext *s,
-                          AVFormatParameters *ap)
+static int wv_read_header(AVFormatContext *s)
 {
     AVIOContext *pb = s->pb;
     WVContext *wc = s->priv_data;
@@ -252,6 +251,7 @@ static int wv_read_packet(AVFormatContext *s,
     int ret;
     int size, ver, off;
     int64_t pos;
+    uint32_t block_samples;
 
     if (url_feof(s->pb))
         return AVERROR(EIO);
@@ -317,6 +317,12 @@ static int wv_read_packet(AVFormatContext *s,
     pkt->stream_index = 0;
     wc->block_parsed = 1;
     pkt->pts = wc->soff;
+    block_samples = AV_RN32(wc->extra);
+    if (block_samples > INT32_MAX)
+        av_log(s, AV_LOG_WARNING, "Too many samples in block: %"PRIu32"\n", block_samples);
+    else
+        pkt->duration = block_samples;
+
     av_add_index_entry(s->streams[0], pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
     return 0;
 }