Ticket #2618: wait_for_keyframes_to_enable_p-frames_in_png_fca435f.patch

File wait_for_keyframes_to_enable_p-frames_in_png_fca435f.patch, 1.0 KB (added by thilo.borgmann, 3 years ago)

Patch for todays revision that does not fix it anymore.

  • libavcodec/pngdec.c

    diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
    index 8b33826..5055360 100644
    a b typedef struct PNGDecContext { 
    5252    int channels; 
    5353    int bits_per_pixel; 
    5454    int bpp; 
     55    int has_keyframes; 
    5556 
    5657    uint8_t *image_buf; 
    5758    int image_linesize; 
    static int decode_frame(AVCodecContext *avctx, 
    819820        } 
    820821    } 
    821822 
    822      /* handle p-frames only if a predecessor frame is available */ 
    823      if (s->prev->data[0]) { 
     823    if (avpkt->flags & AV_PKT_FLAG_KEY) { 
     824        s->has_keyframes = 1; 
     825    } 
     826 
     827     /* handle p-frames only if a predecessor frame is available 
     828        and keyframes are indicated */ 
     829     if (s->prev->data[0] && s->has_keyframes) { 
    824830         if (   !(avpkt->flags & AV_PKT_FLAG_KEY) 
    825831            && s->prev->width == p->width 
    826832            && s->prev->height== p->height 
    static av_cold int png_dec_init(AVCodecContext *avctx) 
    875881 
    876882    s->avctx = avctx; 
    877883 
     884    s->has_keyframes = 0; 
     885 
    878886    return 0; 
    879887} 
    880888