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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Dec 21 22:21:59 EET 2020


On 20 December 2020 19:30:50 CET, "Ingo Brückl" <ib at wupperonline.de> wrote:
>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);

The main difference is that I changed decode_ok to preserve the exact error return value, mostly because I thought it might be useful for debug.
But as that's not actually used I can change it back to a bool.
I thought that there was not much sense in checking the send_packet result though.
In principle both of our patches have the issue that they do not flush the decoder, but adding that actually just broke things in all kinds of ways... 


More information about the MPlayer-dev-eng mailing list