Re: [PATCH 2/6] gui: Use new lavc decode API for PNG decode.

Reimar Döffinger <[email protected]>
Newsgroups gmane.comp.video.mplayer.devel
Message-ID <[email protected]>
On 20 December 2020 19:30:50 CET, "Ingo Brückl" <[email protected]> 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... 
_______________________________________________
MPlayer-dev-eng mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.