GSCapture: Fix build with FFmpeg 8/9 - #14872
Closed
tleibert wants to merge 1 commit into
Closed
Conversation
FFmpeg 8.0 (lavc 62) removed the public AVCodec::pix_fmts and AVCodec::sample_fmts fields, breaking compilation of GSCapture.cpp on distributions shipping FFmpeg 8 or newer (e.g. Arch Linux now ships FFmpeg 9). Query the supported pixel/sample formats through avcodec_get_supported_config() when building against lavc >= 62, and keep the old field access for older FFmpeg versions. The symbol is only imported on lavc >= 62, so dynamic loading on older versions is unaffected.
Contributor
There was a problem hiding this comment.
Thank you for submitting a contribution to PCSX2
As this is your first pull request, please be aware of the contributing guidelines.
Additionally, as per recent changes in GitHub Actions, your pull request will need to be approved by a maintainer before GitHub Actions can run against it. You can find more information about this change here.
Please be patient until this happens. In the meantime if you'd like to confirm the builds are passing, you have the option of opening a PR on your own fork, just make sure your fork's master branch is up to date!
Contributor
|
Duplicate of #14831 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FFmpeg 8.0 (lavc 62) removed the public
AVCodec::pix_fmtsandAVCodec::sample_fmtsfields, soGSCapture.cppno longer compiles on distributions shipping FFmpeg 8+ (Arch Linux currently ships FFmpeg 9.0.1, where this was caught).This replaces the direct field access with
avcodec_get_supported_config()(added in FFmpeg 8.0) when building against lavc >= 62, and keeps the existing field access for older FFmpeg versions. The new symbol is only added to the dynamic import list on lavc >= 62, so runtime loading on older FFmpeg is unaffected.Changes:
BeginCapture()now queriesAV_CODEC_CONFIG_PIX_FORMAT.AV_CODEC_CONFIG_SAMPLE_FORMAT; when the codec reports no list (i.e. all formats are supported), the requested format is assumed to be fine.GetVideoFormatList()builds its list from the queried config.Tested on Arch Linux (FFmpeg 9.0.1, clang 22): the modified translation unit compiles cleanly.