[MPlayer-cvslog] r38246 - trunk/gui/util/bitmap.c
ib
subversion at mplayerhq.hu
Thu Jan 28 13:33:22 EET 2021
Author: ib
Date: Thu Jan 28 13:33:22 2021
New Revision: 38246
Log:
Use new lavc decode API for GUI's PNG decode.
Modified:
trunk/gui/util/bitmap.c
Modified: trunk/gui/util/bitmap.c
==============================================================================
--- trunk/gui/util/bitmap.c Mon Jan 25 23:25:40 2021 (r38245)
+++ trunk/gui/util/bitmap.c Thu Jan 28 13:33:22 2021 (r38246)
@@ -124,8 +124,6 @@ static int pngRead(const char *fname, gu
return 6;
}
- avcodec_register_all();
-
if (avcodec_open2(avctx, avcodec_find_decoder(AV_CODEC_ID_PNG), NULL) < 0) {
av_free(frame);
av_free(avctx);
@@ -139,7 +137,8 @@ static int pngRead(const char *fname, gu
/* HACK: Make PNGs decode normally instead of as CorePNG delta frames. */
pkt.flags = AV_PKT_FLAG_KEY;
- avcodec_decode_video2(avctx, frame, &decode_ok, &pkt);
+ decode_ok = (avcodec_send_packet(avctx, &pkt) == 0 &&
+ avcodec_receive_frame(avctx, frame) == 0);
memset(img, 0, sizeof(*img));
memset(palette, 0, sizeof(palette));
@@ -186,6 +185,8 @@ static int pngRead(const char *fname, gu
decode_ok = False;
}
+ avcodec_send_packet(avctx, NULL); // flush the decoder
+
avcodec_close(avctx);
av_free(frame);
av_free(avctx);
More information about the MPlayer-cvslog
mailing list