ffmpeg impasse

Steven Robbins <[email protected]> Thu, 27 Oct 2022 00:09:00 -0500
Newsgroups gmane.comp.kde.digikam.devel
Message-ID <1807209.atdPhlSkOF@riemann>
Hello,

After staring at ffmpeg docs and digikam/qtav code for a couple days: it seems 
to me the qtav  code is fundamentally mismatched for decoding.

As far as I can work out, the ffmpeg model is that a single packet from the 
demuxer may generate an arbitrary number of frames.  In contrast, qtav assumes 
that a packet may generate only a single frame.

On the ffmpeg side, example code [1] shows the avcodec_receive_frame() loop 
after sending the packet to the codec.

[1] https://ffmpeg.org/doxygen/5.1/filtering_audio_8c-example.html

On the qtav side, the AudioDecoderFFmpeg::decode() function [2] has a single 
avcodec_receive_frame() following the avcodec_send_packet().

[2] https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/video/
qtav/codec/audio/AudioDecoderFFmpeg.cpp#L110


Have I overlooked something in this analysis?  The qtav code uses layers 
exuberantly so I may well have gotten confused. 

If the analysis is correct: I don't see a simple path forward.  I think it 
will need rewriting the AVDecoder class hierarchy -- because that is where 
decode() is declared.

Also of note: as far as I can work out, this code has always been wrong, even 
for ffmpeg version 4.

-Steve
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEy89k8fa3rclNjyokyeVeL63I9LkFAmNaEmwACgkQyeVeL63I
9LnQSg//dh6ECYw9xuBjcWBy21GGXFJfIlYUMwh/AsYdSLAiLSyu4Ooi4lNPnh0Y
CaJR4ECR5vQcCKv0FfuRWdzx74Q1u0fBtmoKzWqhldXKOxUhD5qERV7aQz70Ei3E
l+gwXICCF8v8huq+7+l3xu/hvsW6I74+2sPo7xcCMFXDmuK4RGrCBbwwIG8Ssno7
UYb5arYwtCO7PQDUiMTESdEr0cVYu3mk8S6oJUjKhCs0xH4GSwhG+8gOD7zLR0ym
nC3wEGk1+Y7qoq2qud59gK0FCOeA0Z+xsSvRmdGKWJgQB1lLvqTJkSt+/7+851/o
a9KWeAPZpDYT841P9ZVnAK13dsnpQ1ufs/YxoID+hDHWtS5KivfhuwqgQCZn1o2k
moDVz2dY29fB7ak+v5dxI8dH3qFIDy7Eks/IHUH1g5lKhfbMRmQT+XuIFri8t4+n
jfyUfk/1jN2sGbX8rGSXQ0NrmUtpTOITmoy0O/vttyCtXkzVqFQcUiI2r3IK3C31
JhFiCAwuQAusHZzHIzrxvnq808FJU0v8UfmEJOfJKaMNW26N8ha7U/LWAQQfI+b+
9AcuwlqfTKQy1wemFPdEtcX9c5Ny7f6kiV1e/Me4LzT63TRf1VzpEakKI/godLyL
oh334qle2vsM4ZZNPD7VzHBaZAkjvbmLg/WFgR/p2M68fzvGpPQ=
=Kt/T
-----END PGP SIGNATURE-----