Menu

#720 Pease add support for ffmpeg 5.x

common
open
nobody
None
5
2022-11-21
2022-03-14
No

Hi,

In ffmpeg 5.0 lot of deprecated functions have been removed ans thus dvdstyler doesn't build.

mediaenc_ffmpeg.cpp: In member function 'bool wxFfmpegMediaEncoder::BeginEncode(const wxString&, VideoFormat, AudioFormat, AspectRatio, int, bool)':
mediaenc_ffmpeg.cpp:91:47: error: invalid conversion from 'const AVOutputFormat*' to 'AVOutputFormat*' [-fpermissive]
   91 |                 outputFormat = av_guess_format(NULL, (const char*) fileName.ToUTF8(), NULL);
      |                                ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                               |
      |                                               const AVOutputFormat*
mediaenc_ffmpeg.cpp:93:47: error: invalid conversion from 'const AVOutputFormat*' to 'AVOutputFormat*' [-fpermissive]
   93 |                 outputFormat = av_guess_format("dvd", NULL, NULL);
      |                                ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      |                                               |
      |                                               const AVOutputFormat*
mediaenc_ffmpeg.cpp: In member function 'bool wxFfmpegMediaEncoder::addVideoStream(int, VideoFormat, AspectRatio, int, bool)':
mediaenc_ffmpeg.cpp:175:48: error: invalid conversion from 'const AVCodec*' to 'AVCodec*' [-fpermissive]
  175 |         AVCodec* encoder = avcodec_find_encoder((AVCodecID) codecId);
      |                            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                                                |
      |                                                const AVCodec*
mediaenc_ffmpeg.cpp:181:24: error: 'avcodec_alloc_context3' was not declared in this scope; did you mean 'avio_alloc_context'?
  181 |         m_videoCodec = avcodec_alloc_context3(encoder);
      |                        ^~~~~~~~~~~~~~~~~~~~~~
      |                        avio_alloc_context
mediaenc_ffmpeg.cpp:184:10: error: invalid use of incomplete type 'struct AVCodecContext'
  184 |         c->thread_count = m_threadCount;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:185:10: error: invalid use of incomplete type 'struct AVCodecContext'
  185 |         c->codec_id = (AVCodecID) codecId;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:186:10: error: invalid use of incomplete type 'struct AVCodecContext'
  186 |         c->codec_type = AVMEDIA_TYPE_VIDEO;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:187:10: error: invalid use of incomplete type 'struct AVCodecContext'
  187 |         c->bit_rate = videoBitrate * 1000;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:189:10: error: invalid use of incomplete type 'struct AVCodecContext'
  189 |         c->width = frameSize.GetWidth();
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:190:10: error: invalid use of incomplete type 'struct AVCodecContext'
  190 |         c->height = frameSize.GetHeight();
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:191:10: error: invalid use of incomplete type 'struct AVCodecContext'
  191 |         c->time_base.den = isNTSC(videoFormat) ? 30000 : 25;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:192:10: error: invalid use of incomplete type 'struct AVCodecContext'
  192 |         c->time_base.num = isNTSC(videoFormat) ? 1001 : 1;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:193:10: error: invalid use of incomplete type 'struct AVCodecContext'
  193 |         c->gop_size = m_gopSize > 0 ? m_gopSize : (isNTSC(videoFormat) ? 15 : 12);
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:194:10: error: invalid use of incomplete type 'struct AVCodecContext'
  194 |         c->pix_fmt = AV_PIX_FMT_YUV420P;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:195:10: error: invalid use of incomplete type 'struct AVCodecContext'
  195 |         c->rc_buffer_size = VIDEO_BUF_SIZE;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:196:10: error: invalid use of incomplete type 'struct AVCodecContext'
  196 |         c->rc_max_rate = cbr ? videoBitrate * 1000 : 9000000;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:197:10: error: invalid use of incomplete type 'struct AVCodecContext'
  197 |         c->rc_min_rate = cbr ? videoBitrate * 1000 : 0;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:200:10: error: invalid use of incomplete type 'struct AVCodecContext'
  200 |         c->sample_aspect_ratio = av_d2q(ar * c->height / c->width, 255);
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:200:47: error: invalid use of incomplete type 'struct AVCodecContext'
  200 |         c->sample_aspect_ratio = av_d2q(ar * c->height / c->width, 255);
      |                                               ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:200:59: error: invalid use of incomplete type 'struct AVCodecContext'
  200 |         c->sample_aspect_ratio = av_d2q(ar * c->height / c->width, 255);
      |                                                           ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:201:44: error: invalid use of incomplete type 'struct AVCodecContext'
  201 |         m_videoStm->sample_aspect_ratio = c->sample_aspect_ratio;
      |                                            ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:203:13: error: 'avcodec_open2' was not declared in this scope; did you mean 'avio_open2'?
  203 |         if (avcodec_open2(c, encoder, NULL) < 0) {
      |             ^~~~~~~~~~~~~
      |             avio_open2
mediaenc_ffmpeg.cpp:207:13: error: 'avcodec_parameters_from_context' was not declared in this scope; did you mean 'avcodec_parameters_free'?
  207 |         if (avcodec_parameters_from_context(m_videoStm->codecpar, c) < 0) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |             avcodec_parameters_free
mediaenc_ffmpeg.cpp:211:34: error: invalid use of incomplete type 'struct AVCodecContext'
  211 |         m_videoStm->time_base = c->time_base;
      |                                  ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:224:35: error: invalid use of incomplete type 'struct AVCodecContext'
  224 |         m_picture = allocPicture(c->pix_fmt, c->width, c->height);
      |                                   ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:224:47: error: invalid use of incomplete type 'struct AVCodecContext'
  224 |         m_picture = allocPicture(c->pix_fmt, c->width, c->height);
      |                                               ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:224:57: error: invalid use of incomplete type 'struct AVCodecContext'
  224 |         m_picture = allocPicture(c->pix_fmt, c->width, c->height);
      |                                                         ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:230:43: error: invalid use of incomplete type 'struct AVCodecContext'
  230 |         m_imgConvertCtx = sws_getContext(c->width, c->height, AV_PIX_FMT_RGB24, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
      |                                           ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:230:53: error: invalid use of incomplete type 'struct AVCodecContext'
  230 |         m_imgConvertCtx = sws_getContext(c->width, c->height, AV_PIX_FMT_RGB24, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
      |                                                     ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:230:82: error: invalid use of incomplete type 'struct AVCodecContext'
  230 |         m_imgConvertCtx = sws_getContext(c->width, c->height, AV_PIX_FMT_RGB24, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
      |                                                                                  ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:230:92: error: invalid use of incomplete type 'struct AVCodecContext'
  230 |         m_imgConvertCtx = sws_getContext(c->width, c->height, AV_PIX_FMT_RGB24, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
      |                                                                                            ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:230:103: error: invalid use of incomplete type 'struct AVCodecContext'
  230 |         m_imgConvertCtx = sws_getContext(c->width, c->height, AV_PIX_FMT_RGB24, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
      |                                                                                                       ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp: In member function 'bool wxFfmpegMediaEncoder::addAudioStream(int)':
mediaenc_ffmpeg.cpp:271:47: error: invalid conversion from 'const AVCodec*' to 'AVCodec*' [-fpermissive]
  271 |                 encoder = avcodec_find_encoder((AVCodecID) codecId );
      |                           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
      |                                               |
      |                                               const AVCodec*
mediaenc_ffmpeg.cpp:274:47: error: invalid conversion from 'const AVCodec*' to 'AVCodec*' [-fpermissive]
  274 |                 encoder = avcodec_find_encoder((AVCodecID) codecId );
      |                           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
      |                                               |
      |                                               const AVCodec*
mediaenc_ffmpeg.cpp:282:24: error: 'avcodec_alloc_context3' was not declared in this scope; did you mean 'avio_alloc_context'?
  282 |         m_audioCodec = avcodec_alloc_context3(encoder);
      |                        ^~~~~~~~~~~~~~~~~~~~~~
      |                        avio_alloc_context
mediaenc_ffmpeg.cpp:285:10: error: invalid use of incomplete type 'struct AVCodecContext'
  285 |         c->thread_count = m_threadCount;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:286:10: error: invalid use of incomplete type 'struct AVCodecContext'
  286 |         c->bit_rate = 64000;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:287:10: error: invalid use of incomplete type 'struct AVCodecContext'
  287 |         c->sample_rate = 48000;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:288:10: error: invalid use of incomplete type 'struct AVCodecContext'
  288 |         c->sample_fmt = sampleFmt;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:289:10: error: invalid use of incomplete type 'struct AVCodecContext'
  289 |         c->channels = 2;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:290:10: error: invalid use of incomplete type 'struct AVCodecContext'
  290 |         c->channel_layout = AV_CH_LAYOUT_STEREO;
      |          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:290:29: error: 'AV_CH_LAYOUT_STEREO' was not declared in this scope
  290 |         c->channel_layout = AV_CH_LAYOUT_STEREO;
      |                             ^~~~~~~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:291:27: error: 'avcodec_parameters_from_context' was not declared in this scope; did you mean 'avcodec_parameters_free'?
  291 |         if (m_audioStm && avcodec_parameters_from_context(m_audioStm->codecpar, c) < 0) {
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                           avcodec_parameters_free
mediaenc_ffmpeg.cpp:297:13: error: 'avcodec_open2' was not declared in this scope; did you mean 'avio_open2'?
  297 |         if (avcodec_open2(c, encoder, NULL) < 0) {
      |             ^~~~~~~~~~~~~
      |             avio_open2
mediaenc_ffmpeg.cpp:308:37: error: invalid use of incomplete type 'struct AVCodecContext'
  308 |         m_audioFrame->nb_samples = c->frame_size;
      |                                     ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:309:33: error: invalid use of incomplete type 'struct AVCodecContext'
  309 |         m_audioFrame->format = c->sample_fmt;
      |                                 ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:310:41: error: invalid use of incomplete type 'struct AVCodecContext'
  310 |         m_audioFrame->channel_layout = c->channel_layout;
      |                                         ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:320:30: error: invalid use of incomplete type 'struct AVCodecContext'
  320 |         for (int i = 0; i < c->channels; i++) {
      |                              ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:322:37: error: invalid use of incomplete type 'struct AVCodecContext'
  322 |                 memset(samples, 0, c->frame_size * av_get_bytes_per_sample(c->sample_fmt));
      |                                     ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:322:77: error: invalid use of incomplete type 'struct AVCodecContext'
  322 |                 memset(samples, 0, c->frame_size * av_get_bytes_per_sample(c->sample_fmt));
      |                                                                             ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp: In member function 'void wxFfmpegMediaEncoder::CloseAudioEncoder()':
mediaenc_ffmpeg.cpp:330:9: error: 'avcodec_free_context' was not declared in this scope; did you mean 'avformat_free_context'?
  330 |         avcodec_free_context(&m_audioCodec);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         avformat_free_context
mediaenc_ffmpeg.cpp: In member function 'void wxFfmpegMediaEncoder::CloseVideoEncoder()':
mediaenc_ffmpeg.cpp:344:9: error: 'avcodec_free_context' was not declared in this scope; did you mean 'avformat_free_context'?
  344 |         avcodec_free_context(&m_videoCodec);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         avformat_free_context
mediaenc_ffmpeg.cpp: In member function 'bool wxFfmpegMediaEncoder::EncodeImage(wxImage, int, AbstractProgressDialog*)':
mediaenc_ffmpeg.cpp:352:34: error: invalid use of incomplete type 'struct AVCodecContext'
  352 |         if (image.GetWidth() != c->width || image.GetHeight() != c->height) {
      |                                  ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:352:67: error: invalid use of incomplete type 'struct AVCodecContext'
  352 |         if (image.GetWidth() != c->width || image.GetHeight() != c->height) {
      |                                                                   ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:354:71: error: invalid use of incomplete type 'struct AVCodecContext'
  354 |                                 image.GetWidth(), image.GetHeight(), c->width, c->height);
      |                                                                       ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:354:81: error: invalid use of incomplete type 'struct AVCodecContext'
  354 |                                 image.GetWidth(), image.GetHeight(), c->width, c->height);
      |                                                                                 ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:360:59: error: invalid use of incomplete type 'struct AVCodecContext'
  360 |         sws_scale(m_imgConvertCtx, rgbSrc, rgbStride, 0, c->height, m_picture->data, m_picture->linesize);
      |                                                           ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:362:76: error: invalid use of incomplete type 'struct AVCodecContext'
  362 |         double duration = ((double) m_nextVideoPts + frames) * m_videoCodec->time_base.num / m_videoCodec->time_base.den;
      |                                                                            ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:362:106: error: invalid use of incomplete type 'struct AVCodecContext'
  362 |         double duration = ((double) m_nextVideoPts + frames) * m_videoCodec->time_base.num / m_videoCodec->time_base.den;
      |                                                                                                          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:364:88: error: invalid use of incomplete type 'struct AVCodecContext'
  364 |                 double audioPts = m_audioStm ? ((double) m_nextAudioPts) * m_audioCodec->time_base.num
      |                                                                                        ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:365:47: error: invalid use of incomplete type 'struct AVCodecContext'
  365 |                                 / m_audioCodec->time_base.den : 0.0;
      |                                               ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:366:75: error: invalid use of incomplete type 'struct AVCodecContext'
  366 |                 double videoPts = ((double) m_nextVideoPts) * m_videoCodec->time_base.num / m_videoCodec->time_base.den;
      |                                                                           ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:366:105: error: invalid use of incomplete type 'struct AVCodecContext'
  366 |                 double videoPts = ((double) m_nextVideoPts) * m_videoCodec->time_base.num / m_videoCodec->time_base.den;
      |                                                                                                         ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp: In function 'int encode(AVCodecContext*, AVFrame*, AVPacket*, FILE*)':
mediaenc_ffmpeg.cpp:391:11: error: 'avcodec_send_frame' was not declared in this scope; did you mean 'avcodec_get_name'?
  391 |     ret = avcodec_send_frame(ctx, frame);
      |           ^~~~~~~~~~~~~~~~~~
      |           avcodec_get_name
mediaenc_ffmpeg.cpp:400:15: error: 'avcodec_receive_packet' was not declared in this scope
  400 |         ret = avcodec_receive_packet(ctx, pkt);
      |               ^~~~~~~~~~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp: In member function 'bool wxFfmpegMediaEncoder::EncodeAudio(double, AbstractProgressDialog*)':
mediaenc_ffmpeg.cpp:419:98: error: invalid use of incomplete type 'struct AVCodecContext'
  419 |                         double audioPts = m_audioCodec ? ((double) m_nextAudioPts) * m_audioCodec->time_base.num
      |                                                                                                  ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:420:55: error: invalid use of incomplete type 'struct AVCodecContext'
  420 |                                         / m_audioCodec->time_base.den : 0.0;
      |                                                       ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:443:61: error: invalid use of incomplete type 'struct AVCodecContext'
  443 |                         double audioPts = ((double) pts) * c->time_base.num /c->time_base.den;
      |                                                             ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:443:79: error: invalid use of incomplete type 'struct AVCodecContext'
  443 |                         double audioPts = ((double) pts) * c->time_base.num /c->time_base.den;
      |                                                                               ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp: In function 'int encode(AVCodecContext*, AVPacket*, AVFrame*, int*)':
mediaenc_ffmpeg.cpp:470:15: error: 'avcodec_send_frame' was not declared in this scope; did you mean 'avcodec_get_name'?
  470 |         ret = avcodec_send_frame(avctx, frame);
      |               ^~~~~~~~~~~~~~~~~~
      |               avcodec_get_name
mediaenc_ffmpeg.cpp:474:15: error: 'avcodec_receive_packet' was not declared in this scope
  474 |         ret = avcodec_receive_packet(avctx, pkt);
      |               ^~~~~~~~~~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp: In member function 'bool wxFfmpegMediaEncoder::writeAudioFrame()':
mediaenc_ffmpeg.cpp:487:23: warning: 'void av_init_packet(AVPacket*)' is deprecated [-Wdeprecated-declarations]
  487 |         av_init_packet(&pkt);
      |         ~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:316,
                 from mediaenc_ffmpeg.cpp:29:
/usr/include/x86_64-linux-gnu/libavcodec/packet.h:506:6: note: declared here
  506 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp: In member function 'bool wxFfmpegMediaEncoder::writeVideoFrame()':
mediaenc_ffmpeg.cpp:517:23: warning: 'void av_init_packet(AVPacket*)' is deprecated [-Wdeprecated-declarations]
  517 |         av_init_packet(&pkt);
      |         ~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/x86_64-linux-gnu/libavformat/avformat.h:316,
                 from mediaenc_ffmpeg.cpp:29:
/usr/include/x86_64-linux-gnu/libavcodec/packet.h:506:6: note: declared here
  506 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:530:58: error: invalid use of incomplete type 'struct AVCodecContext'
  530 |                         pkt.pts = av_rescale_q(pkt.pts, c->time_base, m_videoStm->time_base);
      |                                                          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
mediaenc_ffmpeg.cpp:532:58: error: invalid use of incomplete type 'struct AVCodecContext'
  532 |                         pkt.dts = av_rescale_q(pkt.dts, c->time_base, m_videoStm->time_base);
      |                                                          ^~
In file included from mediaenc_ffmpeg.cpp:11:
mediaenc_ffmpeg.h:18:8: note: forward declaration of 'struct AVCodecContext'
   18 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
make[3]: *** [Makefile:696: mediaenc_ffmpeg.o] Error 1

Christian

Discussion

  • Sérgio M. Basto

    this patch fixes the first errors with ffmpeg 5.1 but next I got (tested with DVDStyler-3.3b2)

    mediaenc_ffmpeg.cpp: In member function 'bool wxFfmpegMediaEncoder::BeginEncode(const wxString&, VideoFormat, AudioFormat, AspectRatio, int, bool)':
    mediaenc_ffmpeg.cpp:97:35: error: assignment of member 'AVOutputFormat::video_codec' in read-only object
    97 | outputFormat->video_codec = videoFormat == vfNONE ? AV_CODEC_ID_NONE : AV_CODEC_ID_MPEG2VIDEO;
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    mediaenc_ffmpeg.cpp:99:43: error: assignment of member 'AVOutputFormat::audio_codec' in read-only object
    99 | outputFormat->audio_codec = AV_CODEC_ID_NONE;
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
    mediaenc_ffmpeg.cpp:101:43: error: assignment of member 'AVOutputFormat::audio_codec' in read-only object
    101 | outputFormat->audio_codec = AV_CODEC_ID_AC3;
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
    mediaenc_ffmpeg.cpp:103:43: error: assignment of member 'AVOutputFormat::audio_codec' in read-only object
    103 | outputFormat->audio_codec = AV_CODEC_ID_MP2;
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

     
  • Sérgio M. Basto

    new version of the patch

     
  • Sérgio M. Basto

    seems dvdstyler-3.3beta3 deals it it , Anyway we got some warning that should be fixed , IMO.

     
  • Sérgio M. Basto

    seems dvdstyler-3.3beta3 deals it it , Anyway we got some warning that should be fixed , IMO.

     

Log in to post a comment.

MongoDB Logo MongoDB