[MPlayer-dev-eng] [PATCH 2/6] gui: Use new lavc decode API for PNG decode.

Ingo Brückl ib at wupperonline.de
Sun Dec 20 20:30:50 EET 2020


Reimar Döffinger wrote on Sun, 20 Dec 2020 18:50:30 +0100:

>  gui/util/bitmap.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)

I' ve prepared a patch for this case more than 2 years ago, which looks
easier to me (avcodec_register_all() is still missing in mine, though).

The remaining question is only whether == 0 or >= 0 is a correct return
value.

--- a/gui/util/bitmap.c
+++ b/gui/util/bitmap.c
@@ -139,7 +139,8 @@
     /* 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));


More information about the MPlayer-dev-eng mailing list