Opened 9 years ago

Closed 9 years ago

#51223 closed defect (fixed)

OpenSceneGraph, OpenSceneGraph-devel: build of ffmpeg plugin fails when using ffmpeg-3.0+

Reported by: dbevans (David B. Evans) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: OpenSceneGraph OpenSceneGraph-devel

Description

Taking OpenSceneGraph-devel as an example (OpenSceneGraph fails is the same fashion and OpenSceneGraph-devel represents the latest git master)

:info:build [ 61%] Building CXX object src/osgPlugins/ffmpeg/CMakeFiles/osgdb_ffmpeg.dir/FFmpegDecoderAudio.cpp.o
:info:build cd /opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_OpenSceneGraph-devel/OpenSceneGraph-devel/work/build/src/osgPlugins/ffmpeg && /Applications/Xcode-7.2/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++   -DUSE_AVRESAMPLE -DUSE_SWRESAMPLE -DUSE_SWSCALE -D__STDC_CONSTANT_MACROS -Dosgdb_ffmpeg_EXPORTS -I/opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_OpenSceneGraph-devel/OpenSceneGraph-devel/work/OpenSceneGraph-ae9b9c57b65723fa0cbd4d55bbe7e235e32d89b5/include -F//System/Library/Frameworks -I/opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_OpenSceneGraph-devel/OpenSceneGraph-devel/work/build/include -I/opt/local/include -I/opt/local/include/libswscale -I/opt/local/include/libswresample -I/opt/local/include/libavresample  -pipe -Os   -std=c++11 -stdlib=libc++  -Wno-conversion -Wno-deprecated-declarations -DNDEBUG -arch x86_64 -mmacosx-version-min=10.10 -fPIC   -o CMakeFiles/osgdb_ffmpeg.dir/FFmpegDecoderAudio.cpp.o -c /opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_OpenSceneGraph-devel/OpenSceneGraph-devel/work/OpenSceneGraph-ae9b9c57b65723fa0cbd4d55bbe7e235e32d89b5/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp
:info:build /opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_OpenSceneGraph-devel/OpenSceneGraph-devel/work/OpenSceneGraph-ae9b9c57b65723fa0cbd4d55bbe7e235e32d89b5/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp:230:20: error: no member named 'get_buffer' in 'AVCodecContext'; did you mean 'get_buffer2'?
:info:build         m_context->get_buffer = avcodec_default_get_buffer;
:info:build                    ^~~~~~~~~~
:info:build                    get_buffer2
:info:build /opt/local/include/libavcodec/avcodec.h:2442:11: note: 'get_buffer2' declared here
:info:build     int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
:info:build           ^
:info:build /opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_OpenSceneGraph-devel/OpenSceneGraph-devel/work/OpenSceneGraph-ae9b9c57b65723fa0cbd4d55bbe7e235e32d89b5/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp:230:33: error: use of undeclared identifier 'avcodec_default_get_buffer'; did you mean 'avcodec_default_get_buffer2'?
:info:build         m_context->get_buffer = avcodec_default_get_buffer;
:info:build                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build                                 avcodec_default_get_buffer2
:info:build /opt/local/include/libavcodec/avcodec.h:4219:5: note: 'avcodec_default_get_buffer2' declared here
:info:build int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
:info:build     ^
:info:build /opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_OpenSceneGraph-devel/OpenSceneGraph-devel/work/OpenSceneGraph-ae9b9c57b65723fa0cbd4d55bbe7e235e32d89b5/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp:231:20: error: no member named 'release_buffer' in 'AVCodecContext'
:info:build         m_context->release_buffer = avcodec_default_release_buffer;
:info:build         ~~~~~~~~~  ^
:info:build 1 warning generated.
:info:build /opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_OpenSceneGraph-devel/OpenSceneGraph-devel/work/OpenSceneGraph-ae9b9c57b65723fa0cbd4d55bbe7e235e32d89b5/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp:231:37: error: use of undeclared identifier 'avcodec_default_release_buffer'; did you mean 'avcodec_default_get_buffer2'?
:info:build         m_context->release_buffer = avcodec_default_release_buffer;
:info:build                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build                                     avcodec_default_get_buffer2
:info:build /opt/local/include/libavcodec/avcodec.h:4219:5: note: 'avcodec_default_get_buffer2' declared here
:info:build int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
:info:build     ^

In ffmpeg-3.0, the deprecated get_buffer, release_buffer API has been removed in favor of the newer get_buffer2 and friends. The newer API introduces refcounted buffers and, therefore, behaves in a somewhat different manner. The solution here will require a more extensive rewrite/redesign than most.

For more details on the necessary changes, see FFmpeg APIchanges under Reference counted buffers circa 2013-03-08.

Note also that these errors effect the FFmpeg audio module. It's likely that there are other issues in the FFmpeg video module and perhaps elsewhere as well.

I'm reporting this upstream for action by someone who understands the code better than I. Until this is resolved, after upgrading ffmpeg to the version 3.0 series, the only choice will be to disable the FFmpeg plugin. I'd be interested in some feedback from actual OSG users who could quantify what the impact would be if this were the case.

Attachments (2)

main.log (2.9 MB) - added by dbevans (David B. Evans) 9 years ago.
Build log showing build failure with ffmpeg-3.0 (10.10.5)
patch-ffmpeg3.txt (6.3 KB) - added by woodsb02@… 9 years ago.
Patch that allows OpenSceneGraph to build against FFmpeg 3.0.x (obtained from ArchLinux)

Change History (4)

comment:1 Changed 9 years ago by mf2k (Frank Schima)

Port: OpenSceneGraph, OpenSceneGraph-develOpenSceneGraph OpenSceneGraph-devel

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

Attachment: main.log added

Build log showing build failure with ffmpeg-3.0 (10.10.5)

Changed 9 years ago by woodsb02@…

Attachment: patch-ffmpeg3.txt added

Patch that allows OpenSceneGraph to build against FFmpeg 3.0.x (obtained from ArchLinux)

comment:2 Changed 9 years ago by dbevans (David B. Evans)

Resolution: fixed
Status: newclosed

Patch applied and tested with OpenSceneGraph 3.4.0 and OpenSceneGraph-devel 3.5.2 git master using both ffmpeg 2.8.6 and 3.0.1. Looks good.

Changes committed in r148093. Thanks!!

Note: See TracTickets for help on using tickets.