Skip to content

cannot compile with FFmpeg v7 #57

Description

@SingingBush

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions