Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#51221 closed defect (fixed)

py-bob-io-video: build fails with ffmpeg-3.0+

Reported by: dbevans (David B. Evans) Owned by: tiago.pereira@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: andre.anjos@…, laurent.el-shafey@…
Port: py-bob-io-video

Description

As noted in #50694, the current version of py{27,34}-bob-io-video fails to build with ffmpeg 3.0+ due to the use of deprecated API removed in ffmpeg 3.0.

[ 25%] Building CXX object CMakeFiles/bob_io_video.dir/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp.o
/Applications/Xcode-7.2/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++   -DBLITZ_VERSION=\"0.10\" -DHAVE_AVFORMAT_ALLOC_OUTPUT_CONTEXT2=None -DHAVE_BLITZ=1 -DHAVE_LIBAVCODEC=1 -DHAVE_LIBAVFORMAT=1 -DHAVE_LIBAVUTIL=1 -DHAVE_LIBSWSCALE=1 -DLIBAVCODEC_VERSION=\"57.24.102\" -DLIBAVFORMAT_VERSION=\"57.25.100\" -DLIBAVUTIL_VERSION=\"55.17.103\" -DLIBSWSCALE_VERSION=\"4.0.100\" -DNO_IMPORT_ARRAY=1 -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -DPY_ARRAY_UNIQUE_SYMBOL=BOB_NUMPY_C_API -D__STDC_CONSTANT_MACROS=None -Dbob_io_video_EXPORTS -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bob/io/base/include -isystem /opt/local/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bob/core/include -I/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bob/blitz/include -isystem /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include  -std=c++0x -pedantic -Wall -pthread -Qunused-arguments -m64 -arch x86_64  -isysroot /Applications/Xcode-7.2/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.10 -fPIC   -o CMakeFiles/bob_io_video.dir/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp.o -c /opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp
In file included from /opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:28:
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/include/bob.io.video/utils.h:125:7: error: unknown type name 'PixelFormat'; did you mean 'AVPixelFormat'?
      PixelFormat source_pixel_format, PixelFormat dest_pixel_format);
      ^~~~~~~~~~~
      AVPixelFormat
/opt/local/include/libavutil/pixfmt.h:61:6: note: 'AVPixelFormat' declared here
enum AVPixelFormat {
     ^
In file included from /opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:28:
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/include/bob.io.video/utils.h:125:40: error: unknown type name 'PixelFormat'; did you mean 'AVPixelFormat'?
      PixelFormat source_pixel_format, PixelFormat dest_pixel_format);
                                       ^~~~~~~~~~~
                                       AVPixelFormat
/opt/local/include/libavutil/pixfmt.h:61:6: note: 'AVPixelFormat' declared here
enum AVPixelFormat {
     ^
In file included from /opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:28:
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/include/bob.io.video/utils.h:138:49: error: unknown type name 'PixelFormat'; did you mean 'AVPixelFormat'?
      boost::shared_ptr<AVCodecContext> stream, PixelFormat pixfmt);
                                                ^~~~~~~~~~~
                                                AVPixelFormat
/opt/local/include/libavutil/pixfmt.h:61:6: note: 'AVPixelFormat' declared here
enum AVPixelFormat {
     ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:716:34: error: use of undeclared identifier 'PIX_FMT_YUV420P'; did you mean 'AV_PIX_FMT_YUV420P'?
  retval->codec->pix_fmt       = AV_PIX_FMT_YUV420P;
                                 ^~~~~~~~~~~~~~~~~~
                                 AV_PIX_FMT_YUV420P
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:45:28: note: expanded from macro 'AV_PIX_FMT_YUV420P'
#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
                           ^
/opt/local/include/libavutil/pixfmt.h:63:5: note: 'AV_PIX_FMT_YUV420P' declared here
    AV_PIX_FMT_YUV420P,   ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
    ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:757:46: error: unknown type name 'PixelFormat'; did you mean 'AVPixelFormat'?
    boost::shared_ptr<AVCodecContext> codec, PixelFormat pixfmt) {
                                             ^~~~~~~~~~~
                                             AVPixelFormat
/opt/local/include/libavutil/pixfmt.h:61:6: note: 'AVPixelFormat' declared here
enum AVPixelFormat {
     ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:814:12: warning: 'avpicture_alloc' is deprecated [-Wdeprecated-declarations]
  int ok = avpicture_alloc(&picture, pixfmt, codec->width, codec->height);
           ^
/opt/local/include/libavcodec/avcodec.h:4871:5: note: 'avpicture_alloc' has been explicitly marked deprecated here
int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height);
    ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:862:2: error: unknown type name 'PixelFormat'; did you mean 'AVPixelFormat'?
 PixelFormat source_pixel_format, PixelFormat dest_pixel_format) {
 ^~~~~~~~~~~
 AVPixelFormat
/opt/local/include/libavutil/pixfmt.h:61:6: note: 'AVPixelFormat' declared here
enum AVPixelFormat {
     ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:862:35: error: unknown type name 'PixelFormat'; did you mean 'AVPixelFormat'?
 PixelFormat source_pixel_format, PixelFormat dest_pixel_format) {
                                  ^~~~~~~~~~~
                                  AVPixelFormat
/opt/local/include/libavutil/pixfmt.h:61:6: note: 'AVPixelFormat' declared here
enum AVPixelFormat {
     ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:1112:27: warning: 'av_free_packet' is deprecated [-Wdeprecated-declarations]
  if (p->size || p->data) av_free_packet(p);
                          ^
/opt/local/include/libavcodec/avcodec.h:4040:6: note: 'av_free_packet' has been explicitly marked deprecated here
void av_free_packet(AVPacket *pkt);
     ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:1149:26: warning: 'coded_frame' is deprecated [-Wdeprecated-declarations]
      if (stream->codec->coded_frame->key_frame) pkt->flags |= AV_PKT_FLAG_KEY;
                         ^
/opt/local/include/libavcodec/avcodec.h:2945:35: note: 'coded_frame' has been explicitly marked deprecated here
    attribute_deprecated AVFrame *coded_frame;
                                  ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:1272:26: warning: 'coded_frame' is deprecated [-Wdeprecated-declarations]
      if (stream->codec->coded_frame && stream->codec->coded_frame->key_frame)
                         ^
/opt/local/include/libavcodec/avcodec.h:2945:35: note: 'coded_frame' has been explicitly marked deprecated here
    attribute_deprecated AVFrame *coded_frame;
                                  ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:1272:56: warning: 'coded_frame' is deprecated [-Wdeprecated-declarations]
      if (stream->codec->coded_frame && stream->codec->coded_frame->key_frame)
                                                       ^
/opt/local/include/libavcodec/avcodec.h:2945:35: note: 'coded_frame' has been explicitly marked deprecated here
    attribute_deprecated AVFrame *coded_frame;
                                  ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:1425:5: warning: 'av_free_packet' is deprecated [-Wdeprecated-declarations]
    av_free_packet(pkt.get());
    ^
/opt/local/include/libavcodec/avcodec.h:4040:6: note: 'av_free_packet' has been explicitly marked deprecated here
void av_free_packet(AVPacket *pkt);
     ^
/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp:1519:5: warning: 'av_free_packet' is deprecated [-Wdeprecated-declarations]
    av_free_packet(pkt.get());
    ^
/opt/local/include/libavcodec/avcodec.h:4040:6: note: 'av_free_packet' has been explicitly marked deprecated here
void av_free_packet(AVPacket *pkt);
     ^
7 warnings and 7 errors generated.
make[2]: *** [CMakeFiles/bob_io_video.dir/opt/local/var/macports/build/_opt_macports_trunk_dports_python_py-bob-io-video/py27-bob-io-video/work/bob.io.video-2.0.5/bob/io/video/cpp/utils.cpp.o] Error 1
make[1]: *** [CMakeFiles/bob_io_video.dir/all] Error 2

Similar errors occur in bob/io/video/cpp/reader.cpp and bob/io/video/cpp/writer.cpp.

Attached is a proposed patch that fixes the ffmpeg 3.0 build errors without effecting builds on earlier versions. Tested with ffmpeg 2.8.6 and 3.0.1.

Let me know if you agree this patch can be committed. I'd like to do this as soon as possible so that we can upgrade ffmpeg to the 3.0 version series now at ffmpeg 3.0.1.

Thanks

Attachments (2)

py27-bob-io-video-main.log (214.6 KB) - added by dbevans (David B. Evans) 8 years ago.
Full build.log showing reported errors
patch-py-bob-io-video-ffmpeg-3.0.diff (6.2 KB) - added by dbevans (David B. Evans) 8 years ago.
Proposed patch allowing build with either ffmpeg 2.8 or 3.0+

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by dbevans (David B. Evans)

Attachment: py27-bob-io-video-main.log added

Full build.log showing reported errors

Changed 8 years ago by dbevans (David B. Evans)

Proposed patch allowing build with either ffmpeg 2.8 or 3.0+

comment:1 Changed 8 years ago by dbevans (David B. Evans)

Resolution: fixed
Status: newclosed

Patch committed in r148336, maintainer timeout.

Please sync upstream sources or propose an alternate fix. Thanks.

comment:2 Changed 8 years ago by tiagofrepereira2012 (Tiago Freitas Pereira)

Thanks for the patch @devans,

I will apply this fix in our master branch.

comment:3 Changed 8 years ago by dbevans (David B. Evans)

Thanks, Tiago.

comment:4 Changed 8 years ago by andre.dos.anjos@…

Changes where applied upstream. bob.io.video 2.0.8+ is ffmpeg 3.0.x ready. Thanks for the patch, A

Note: See TracTickets for help on using tickets.