changeset 31730:6be4d46328dd

Switch to non-deprecated avcodec_decode_video2 API.
author reimar
date Sun, 25 Jul 2010 09:22:37 +0000
parents 302e69a83e99
children a0f828ae372d
files gui/bitmap.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/bitmap.c	Sun Jul 25 09:13:43 2010 +0000
+++ b/gui/bitmap.c	Sun Jul 25 09:22:37 2010 +0000
@@ -34,6 +34,7 @@
  int             len;
  AVCodecContext *avctx;
  AVFrame        *frame;
+ AVPacket       pkt;
 
  FILE *fp=fopen( fname,"rb" );
  if ( !fp )
@@ -53,7 +54,12 @@
  frame = avcodec_alloc_frame();
  avcodec_register_all();
  avcodec_open(avctx, avcodec_find_decoder(CODEC_ID_PNG));
- avcodec_decode_video(avctx, frame, &decode_ok, data, len);
+ av_init_packet(&pkt);
+ pkt.data = data;
+ pkt.size = len;
+ // HACK: make PNGs decode normally instead of as CorePNG delta frames
+ pkt.flags = PKT_FLAG_KEY;
+ avcodec_decode_video2(avctx, frame, &decode_ok, &pkt);
  memset(bf, 0, sizeof(*bf));
  switch (avctx->pix_fmt) {
    case PIX_FMT_GRAY8:    bf->BPP =  8; break;