Fix future FFMpeg API changes
See merge request OpenMW/openmw!922
(cherry picked from commit 3794e6d4b20b6c9f47aeaf3f937118c49de700e5)
70a02290 Fix future FFMpeg API changes
Not everything is supported but it does build with the following CMakeSettings.json
variables and dependencies from vcpkg:
"variables": [
{ "name": "OPENMW_USE_SYSTEM_BULLET", "value": "False", "type": "BOOL" },
{ "name": "OPENMW_USE_SYSTEM_MYGUI", "value": "False", "type": "BOOL" },
{ "name": "OPENMW_USE_SYSTEM_OSG", "value": "False", "type": "BOOL" },
{ "name": "BULLET_STATIC", "value": "True", "type": "BOOL" },
{ "name": "OSG_STATIC", "value": "False", "type": "BOOL" },
{ "name": "MYGUI_STATIC", "value": "False", "type": "BOOL" }
],
What works: it builds
What does not work: Not all DLLs are copied into the output directory with this set up
(SDL2, MyGUI, Bullet, OSG, are not copied).
Updates Bullet to include https://github.com/bulletphysics/bullet3/pull/3287
This massively improves heightfield collision detection performance in
some areas.
E.g. with single-threaded bullet in the `--skip-menu` starting area
on my test desktop: 30 FPS -> 60 FPS
The most substantial memory leak came from `PacketQueue::get`
not unreferencing its argument packet.
Other leaks came from using `av_free` instead of type-specific free
functions.
Also modifies `PacketQueue::put` for readability.
osg-ffmpeg-videoplayer handled frame allocation incorrectly.
It used a `vector<uint8_t>` as its buffer, meaning the addresses could
did not respect alignment.
Instead, changes it to use `AVFrame` as buffers, allocated via `av_image_alloc`.
We also now only allocate the buffer once, instead of on every frame,
which should improve the framerate of videos.
Fixes the following crash on startup on ARM:
> Invalid address alignment (signal 7)
Fixes#5807