Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QMovie jumpToFrame() API and CacheAll mode related problem
I am trying to use QMovie to play some .gif animation. Regarding the FastForward and Rewind function support, QMovie::jumpToFrame API is used. In order to make this API work properly, we have to enable the QMovie::cacheall mode. The problem is when we enable CacheAll, there will be memory leak. It seems someone else report the same problem but there is no solution. (Sorry I have not posted the bug number or link here).
So does anyone have a good solution for this QMovie problem or any good suggestion on alternatives for playing .gif in Qt?
Thanks and Regards,
Hi and welcome to devnet,
Can you explain more about that memory leak ? At least the link to the exact bug report would be a good thing.
Maybe I should not call it memory leak. For the cacheall mode, the whole content of the .gif will be cached in the memory. This buffering process occur when you play/fastforward/rewind and it took some time. So you will see the memory usage increase continuously till a very big value( for a 60M gif, it will increase to 900M).
What kind of gif are you loading ?
I think the QMovie should improve its cacheing method instead of limiting the user usage of .gif file.
That doesn't answer my question, what kind of gif is it ? What are the image characteristics ? A 60M file looks like a very big animated gif so it might not be the best format for such an animation.
QMovie caches each frame of your gif in a format suitable for displaying. If you think it's not optimum you are welcome to improve the class.