[FFmpeg-devel] [PATCH 2/2] Set AV_PKT_FLAG_KEY based on nupplevideo header

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Sep 17 16:03:41 CEST 2011


On Sun, Sep 11, 2011 at 06:11:27PM +0200, Joakim Plate wrote:
> Based from lipbmpdemux/nupplevideo.h and from myth NuppelVideoRecorder.cpp
> ---
>  libavformat/nuv.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)

> diff --git a/libavformat/nuv.c b/libavformat/nuv.c
> index 999546f..1ad0fb7 100644
> --- a/libavformat/nuv.c
> +++ b/libavformat/nuv.c
> @@ -219,12 +219,13 @@ 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->pts = AV_RL32(&hdr[4]);
>                  pkt->stream_index = ctx->v_id;
> +                if(hdr[2] == 0) {
> +                    pkt->flags |= AV_PKT_FLAG_KEY;
> +                }

Two suggestions (do as you consider best to do):
1) Drop the pointless {} (maybe even use ?: for consistency with your other
patch)
2) Change the order, ->pts is hdr[4], this uses hdr[2], so I think it
would be good if they are close together with the flags first.

Otherwise I think we should try it.
If there's a problem we could also try to force a parser in to generate
the KEY flag if it is necessary after all.


More information about the ffmpeg-devel mailing list