Skip to content
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

cannot compile with FFmpeg v7 #57

Open
SingingBush opened this issue Nov 3, 2024 · 1 comment
Open

cannot compile with FFmpeg v7 #57

SingingBush opened this issue Nov 3, 2024 · 1 comment

Comments

@SingingBush
Copy link

SingingBush commented Nov 3, 2024

While doing my PR for #56 I found that the project will not compile on the recently released Fedora 41 due to the newer version of FFmpeg having removed fields that were previously deprecated. This is likely to be an issue for other distros such as Arch and Opensuse.

videoencoder.cpp:908:8: error: 'AVCodecContext' {aka 'struct AVCodecContext'} has no member named 'channels'
  908 |     c->channels    = channels;
      |        ^~~~~~~~
videoencoder.cpp:909:12: error: 'AVCodecContext' {aka 'struct AVCodecContext'} has no member named 'channels'
  909 |     if (c->channels < 2)
      |            ^~~~~~~~
videoencoder.cpp:910:12: error: 'AVCodecContext' {aka 'struct AVCodecContext'} has no member named 'channel_layout'; did you mean 'ch_layout'?
  910 |         c->channel_layout = AV_CH_LAYOUT_MONO;
      |            ^~~~~~~~~~~~~~
      |            ch_layout
videoencoder.cpp:912:12: error: 'AVCodecContext' {aka 'struct AVCodecContext'} has no member named 'channel_layout'; did you mean 'ch_layout'?
  912 |         c->channel_layout = AV_CH_LAYOUT_STEREO;
      |            ^~~~~~~~~~~~~~
      |            ch_layout
videoencoder.cpp: In member function 'int VideoEncoder::open_audio(AVStream*)':
videoencoder.cpp:989:18: error: 'AVFrame' {aka 'struct AVFrame'} has no member named 'channels'
  989 |     pAudioFrame->channels       = pAudioCodecCtx->channels;
      |                  ^~~~~~~~
videoencoder.cpp:989:51: error: 'AVCodecContext' {aka 'struct AVCodecContext'} has no member named 'channels'
  989 |     pAudioFrame->channels       = pAudioCodecCtx->channels;
      |                                                   ^~~~~~~~
videoencoder.cpp: In member function 'int VideoEncoder::encodeAudio(void*)':
videoencoder.cpp:1016:71: error: 'AVCodecContext' {aka 'struct AVCodecContext'} has no member named 'channels'
 1016 |     int bufferSize = av_samples_get_buffer_size(NULL, pAudioCodecCtx->channels, pAudioCodecCtx->frame_size,
      |                                                                       ^~~~~~~~
videoencoder.cpp:1022:29: error: 'AVCodecContext' {aka 'struct AVCodecContext'} has no member named 'channels'
 1022 |             pAudioCodecCtx->channels, pAudioCodecCtx->sample_fmt);
      |                             ^~~~~~~~
videoencoder.cpp:1027:65: error: 'AVCodecContext' {aka 'struct AVCodecContext'} has no member named 'channels'
 1027 |     ret = avcodec_fill_audio_frame(pAudioFrame, pAudioCodecCtx->channels, pAudioCodecCtx->sample_fmt,
      |                                                                 ^~~~~~~~
videoencoder.cpp:1034:29: error: 'AVCodecContext' {aka 'struct AVCodecContext'} has no member named 'channels'
 1034 |             pAudioCodecCtx->channels, pAudioCodecCtx->sample_fmt);
      |                             ^~~~~~~~

I don't mind doing some work on this but my existing PR should probably get merged first.

@SingingBush
Copy link
Author

worth noting that according to the readme Ubuntu 18.04 is the min-supported os. 18.04 shipped with libavcodec57 so where there are version checks for LIBAVCODEC_VER_AT_LEAST then it's only worth checking above version 57.

It's worth considering dropping support for v57 altogether and just use code for 58 and above (61 is the current latest in FFmpeg source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant