Bug 214190

Summary: emulators/visualboyadvance-m: fails to build with ffmpeg 3.x (FFMPEG=on)
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Only Me CC: root
Priority: --- Keywords: patch, patch-ready
Version: LatestFlags: bugzilla: maintainer-feedback? (root)
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 207547    
Attachments:
Description Flags
incomplete fix
none
incomplete fix
none
upstream fix, v1 jbeich: maintainer-approval? (root)

Description Jan Beich freebsd_committer freebsd_triage 2016-11-04 04:56:17 UTC
In file included from src/common/ffmpeg.cpp:62:
src/common/ffmpeg.h:70:5: error: unknown type name 'PixelFormat'; did you mean 'AVPixelFormat'?
    priv_PixelFormat pixfmt;
    ^~~~~~~~~~~~~~~~
    AVPixelFormat
src/common/ffmpeg.cpp:61:26: note: expanded from macro 'priv_PixelFormat'
#define priv_PixelFormat PixelFormat
                         ^
/usr/local/include/libavutil/pixfmt.h:60:6: note: 'AVPixelFormat' declared here
enum AVPixelFormat {
     ^
src/common/ffmpeg.cpp:81:11: error: use of undeclared identifier 'avcodec_alloc_frame'
    pic = avcodec_alloc_frame();
          ^
src/common/ffmpeg.cpp:92:28: error: use of undeclared identifier 'CODEC_ID_NONE'; did you mean 'AV_CODEC_ID_NONE'?
    if(fmt->audio_codec == CODEC_ID_NONE)
                           ^~~~~~~~~~~~~
                           AV_CODEC_ID_NONE
/usr/local/include/libavcodec/avcodec.h:192:5: note: 'AV_CODEC_ID_NONE' declared here
    AV_CODEC_ID_NONE,
    ^
src/common/ffmpeg.cpp:163:11: error: use of undeclared identifier 'PIX_FMT_RGB24'; did you mean 'AV_PIX_FMT_RGB24'?
        pixfmt = PIX_FMT_RGB24;
                 ^~~~~~~~~~~~~
                 AV_PIX_FMT_RGB24
/usr/local/include/libavutil/pixfmt.h:64:5: note: 'AV_PIX_FMT_RGB24' declared here
    AV_PIX_FMT_RGB24,     ///< packed RGB 8:8:8, 24bpp, RGBRGB...
    ^
src/common/ffmpeg.cpp:416:13: error: use of undeclared identifier 'avcodec_encode_video'; did you mean 'avcodec_encode_video2'?
        pkt.size = avcodec_encode_video(ctx, video_buf, VIDEO_BUF_LEN, f);
                   ^~~~~~~~~~~~~~~~~~~~
                   avcodec_encode_video2
/usr/local/include/libavcodec/avcodec.h:5322:5: note: 'avcodec_encode_video2' declared here
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
    ^
src/common/ffmpeg.cpp:416:13: warning: 'avcodec_encode_video2' is deprecated [-Wdeprecated-declarations]
        pkt.size = avcodec_encode_video(ctx, video_buf, VIDEO_BUF_LEN, f);
                   ^
/usr/local/include/libavcodec/avcodec.h:5322:5: note: 'avcodec_encode_video2' has been explicitly marked deprecated here
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
    ^
src/common/ffmpeg.cpp:468:13: error: use of undeclared identifier 'avcodec_encode_audio'; did you mean 'avcodec_encode_audio2'?
        pkt.size = avcodec_encode_audio(ctx, audio_buf, frame_len,
                   ^~~~~~~~~~~~~~~~~~~~
                   avcodec_encode_audio2
/usr/local/include/libavcodec/avcodec.h:5283:5: note: 'avcodec_encode_audio2' declared here
int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
    ^
src/common/ffmpeg.cpp:468:13: warning: 'avcodec_encode_audio2' is deprecated [-Wdeprecated-declarations]
        pkt.size = avcodec_encode_audio(ctx, audio_buf, frame_len,
                   ^
/usr/local/include/libavcodec/avcodec.h:5283:5: note: 'avcodec_encode_audio2' has been explicitly marked deprecated here
int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
    ^

http://package23.nyi.freebsd.org/data/103i386-default-PR207547/2016-10-04_18h24m30s/logs/errors/visualboyadvance-m-2.0.0b2.log
Comment 1 Jan Beich freebsd_committer freebsd_triage 2016-11-04 16:37:11 UTC
Created attachment 176631 [details]
incomplete fix

Is upstream alive? I haven't found examples how to convert avcodec_encode_audio to avcodec_encode_audio2 in the ports tree.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2016-11-04 16:51:56 UTC
Created attachment 176634 [details]
incomplete fix

Oops, minor style.
Comment 3 Jan Beich freebsd_committer freebsd_triage 2016-11-04 16:57:18 UTC
Comment on attachment 176634 [details]
incomplete fix

FreeBSD 10.1 i386 + ffmpeg 2.8 build log: http://sprunge.us/JHVG
Comment 5 Jan Beich freebsd_committer freebsd_triage 2016-11-05 17:08:16 UTC
Comment on attachment 176634 [details]
incomplete fix

Actually, upstream supports new API in trunk and it builds fine here.

https://github.com/visualboyadvance-m/visualboyadvance-m/commits/master/src/common/ffmpeg.cpp
Comment 6 Jan Beich freebsd_committer freebsd_triage 2016-11-05 19:00:25 UTC
Created attachment 176664 [details]
upstream fix, v1

FreeBSD 10.1 i386 + ffmpeg 2.8 build log: http://sprunge.us/EaWX
Comment 7 commit-hook freebsd_committer freebsd_triage 2016-11-18 22:01:39 UTC
A commit references this bug:

Author: jbeich
Date: Fri Nov 18 22:00:57 UTC 2016
New revision: 426345
URL: https://svnweb.freebsd.org/changeset/ports/426345

Log:
  emulators/visualboyadvance-m: unbreak build with ffmpeg 3.x

  In file included from src/common/ffmpeg.cpp:62:
  src/common/ffmpeg.h:70:5: error: unknown type name 'PixelFormat'; did you mean 'AVPixelFormat'?
      priv_PixelFormat pixfmt;
      ^~~~~~~~~~~~~~~~
      AVPixelFormat
  src/common/ffmpeg.cpp:61:26: note: expanded from macro 'priv_PixelFormat'
   #define priv_PixelFormat PixelFormat
                            ^
  /usr/local/include/libavutil/pixfmt.h:60:6: note: 'AVPixelFormat' declared here
  enum AVPixelFormat {
       ^
  src/common/ffmpeg.cpp:81:11: error: use of undeclared identifier 'avcodec_alloc_frame'
      pic = avcodec_alloc_frame();
            ^
  src/common/ffmpeg.cpp:92:28: error: use of undeclared identifier 'CODEC_ID_NONE'; did you mean 'AV_CODEC_ID_NONE'?
      if(fmt->audio_codec == CODEC_ID_NONE)
                             ^~~~~~~~~~~~~
                             AV_CODEC_ID_NONE
  /usr/local/include/libavcodec/avcodec.h:192:5: note: 'AV_CODEC_ID_NONE' declared here
      AV_CODEC_ID_NONE,
      ^
  src/common/ffmpeg.cpp:163:11: error: use of undeclared identifier 'PIX_FMT_RGB24'; did you mean 'AV_PIX_FMT_RGB24'?
          pixfmt = PIX_FMT_RGB24;
                   ^~~~~~~~~~~~~
                   AV_PIX_FMT_RGB24
  /usr/local/include/libavutil/pixfmt.h:64:5: note: 'AV_PIX_FMT_RGB24' declared here
      AV_PIX_FMT_RGB24,     ///< packed RGB 8:8:8, 24bpp, RGBRGB...
      ^
  src/common/ffmpeg.cpp:416:13: error: use of undeclared identifier 'avcodec_encode_video'; did you mean 'avcodec_encode_video2'?
          pkt.size = avcodec_encode_video(ctx, video_buf, VIDEO_BUF_LEN, f);
                     ^~~~~~~~~~~~~~~~~~~~
                     avcodec_encode_video2
  /usr/local/include/libavcodec/avcodec.h:5322:5: note: 'avcodec_encode_video2' declared here
  int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
      ^
  src/common/ffmpeg.cpp:468:13: error: use of undeclared identifier 'avcodec_encode_audio'; did you mean 'avcodec_encode_audio2'?
          pkt.size = avcodec_encode_audio(ctx, audio_buf, frame_len,
                     ^~~~~~~~~~~~~~~~~~~~
                     avcodec_encode_audio2
  /usr/local/include/libavcodec/avcodec.h:5283:5: note: 'avcodec_encode_audio2' declared here
  int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
      ^

  PR:		214190
  Obtained from:	upstream
  Approved by:	maintainer timeout (2 weeks)

Changes:
  head/emulators/visualboyadvance-m/Makefile
  head/emulators/visualboyadvance-m/files/patch-src_common_ffmpeg.cpp