-
Notifications
You must be signed in to change notification settings - Fork 260
Add const to input_fmt #335
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
Conversation
This is a bit of an annoying one. Our current ffmpeg build v4.3 requires a non-const value to
so this change will break existing builds. But as you noted, for ffmpeg v5.0 and later this will have to change to a const. Unfortunately, I don't think we can take this change as-is yet as we are not ready to move to ffmpeg v5.0 in our releases just yet. |
You can see the compile error from the CI build here. |
@@ -129,7 +129,7 @@ void LibAvEncoder::initVideoCodec(VideoOptions const *options, StreamInfo const | |||
|
|||
void LibAvEncoder::initAudioInCodec(VideoOptions const *options, StreamInfo const &info) | |||
{ | |||
AVInputFormat *input_fmt = (AVInputFormat *)av_find_input_format("pulse"); | |||
const AVInputFormat *input_fmt = (AVInputFormat *)av_find_input_format("pulse"); | |||
|
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.
Perhaps things would work for all versions if you changed const
to ff_const59
?
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.
Probably not - see avformat.h:
/**
* The ff_const59 define is not part of the public API and will
* be removed without further warning.
*/
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.
You may be able to use the FF_API_AVIOFORMAT
define, It's not clear what exactly that is meant to be used for, but might work for our problem here.
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.
It sounds like FF_API_AVIOFORMAT is also private, re: https://www.mail-archive.com/ffmpeg-devel@ffmpeg.org/msg81099.html
Could you add a comment stating that, much like the FF_API_ defines, this ff_const59 define is not part of the public API and will eventually disappear without warning?
It seems like LIBAVUTIL_VERSION_MAJOR is intended for public consumption tho, so I've given that a shot.
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.
Looks good. Once the checks have passed, I'll merge this in. Thanks!
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.
I'm not sure if it's correct but it passes your CI and also builds with 5.0 over here :)
Actually, would you be able to re-submit this as a single patch instead of 2 commits? Would be tidier in the history. |
The ffmpeg API changed in 5.0 to make a bunch of additional things const. This patch attempts to make things compile cleanly againt both ffmpeg 5.0 and earlier versions.
e1a15ba
to
03719c4
Compare
Squashed down to one commit, I tried to write a better commit message for you too |
Great, I'll merge this as soon as the tests have completed. |
Hey folks, ran into a compile error building this against ffmpeg 5.0 - the compiler really wanted the input_fmt to be const.