OSDN Git Service

Set AV_PKT_FLAG_KEY based on nupplevideo header
authorJoakim Plate <elupus@ecce.se>
Sun, 11 Sep 2011 15:59:32 +0000 (17:59 +0200)
committerJoakim Plate <elupus@ecce.se>
Sun, 18 Sep 2011 16:25:44 +0000 (18:25 +0200)
Based from lipbmpdemux/nupplevideo.h and from myth NuppelVideoRecorder.cpp

libavformat/nuv.c

index 20ca472..2444a50 100644 (file)
@@ -219,10 +219,9 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
                 ret = av_new_packet(pkt, copyhdrsize + size);
                 if (ret < 0)
                     return ret;
-                // HACK: we have no idea if it is a keyframe,
-                // but if we mark none seeking will not work at all.
-                pkt->flags |= AV_PKT_FLAG_KEY;
+
                 pkt->pos = pos;
+                pkt->flags |= hdr[2] == 0 ? AV_PKT_FLAG_KEY : 0;
                 pkt->pts = AV_RL32(&hdr[4]);
                 pkt->stream_index = ctx->v_id;
                 memcpy(pkt->data, hdr, copyhdrsize);