-
Notifications
You must be signed in to change notification settings - Fork 63
Handle AVCodec fields deprecated in FFmpeg 7 #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle AVCodec fields deprecated in FFmpeg 7 #898
Conversation
479147c
to
a17b466
Compare
supportedSampleRates = avCodec.supported_samplerates; | ||
#endif | ||
|
||
if (supportedSampleRates == nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've been trying to keep FFmpeg version ifdef-ing out of the mainline logic, and keep it all in functions defined in FFMPEGCommon
. I think we should defined there as something like:
const int* getSupportedSampleRates(const AVCodec& avCodec);
#else | ||
supportedSampleFormats = avCodec.sample_fmts; | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto here about creating a function in FFMPEGCommon
.
&avCodec, | ||
AV_CODEC_CONFIG_SAMPLE_RATE, | ||
0, | ||
(const void**)&supportedSampleRates, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do a reinterpret_cast
here; https://en.cppreference.com/w/cpp/language/reinterpret_cast.html. In general, we should never do a C-style cast, as it's not always obvious what kind of cast a C-style cast will actually become: https://en.cppreference.com/w/cpp/language/explicit_cast.html
&avCodec, | ||
AV_CODEC_CONFIG_SAMPLE_FORMAT, | ||
0, | ||
(const void**)&supportedSampleFormats, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditt on reinterpret_cast
.
&avCodec, | ||
AV_CODEC_CONFIG_CHANNEL_LAYOUT, | ||
0, | ||
(const void**)&supported_layouts, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto on reinterpret_cast
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do the reinterpret_cast
changes before merging. Otherwise, this is great! Thanks for fixing it.
This PR resolves the AVCodec fields deprecated in FFmpeg 7, described in #873.
This field is replaced by avcodec_get_supported_config, which supports retrieval of multiple AVCodecConfig