Install OpenSceneGraph 2.9.6 with Collada support in Ubuntu 12.04

Although I usually install OpenSceneGraph 2.8.3 to work with osgART 2.0 RC3 it is also posible to use OpenSceneGraph 2.9.6 (in fact is the latests version compatible with osgART UPDATE: read this post to see how to make osgART 2.0 RC3 work with OpenSceneGraph 2.9.7 and further). You can download it using SVN:

svn checkout http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-2.9.6 OpenSceneGraph-2.9.6

The steps to install OSG 2.9.6 with Collada support in Ubuntu 12.04 are just the same as I explained before in “Install OpenSceneGraph 2.8.3 with Collada support in Ubuntu 12.04“, but you have to do some more changes on the source code because of FFMpeg. So just add those changes to the source code of OSG 2.9.6 and then do just the same as if you were installing OSG 2.8.3:

/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp
- In line 276 change this:

const int bytes_decoded = avcodec_decode_audio2(m_context, reinterpret_cast(buffer), &data_size, m_packet_data, m_bytes_remaining);

To this:

#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR==52 && LIBAVCODEC_VERSION_MINOR>=32)
            AVPacket avpkt;
            av_init_packet(&avpkt);
            avpkt.data = const_cast(m_packet_data);
            avpkt.size = m_bytes_remaining;

            const int bytes_decoded = avcodec_decode_audio3(m_context, reinterpret_cast(buffer), &data_size, &avpkt);
#else
            // fallback for older versions of ffmpeg that don't have avcodec_decode_audio3.
            const int bytes_decoded = avcodec_decode_audio2(m_context, reinterpret_cast(buffer), &data_size, m_packet_data, m_bytes_remaining);
#endif

/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp

- In line 168 change this:

const int bytes_decoded = avcodec_decode_video(m_context, m_frame.get(), &frame_finished, m_packet_data, m_bytes_remaining);

To this:

#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR==52 && LIBAVCODEC_VERSION_MINOR>=32)
            AVPacket avpkt;
            av_init_packet(&avpkt);
            avpkt.data = const_cast(m_packet_data);
            avpkt.size = m_bytes_remaining;

            const int bytes_decoded = avcodec_decode_video2(m_context, m_frame.get(), &frame_finished, &avpkt);
#else
            // fallback for older versions of ffmpeg that don't have avcodec_decode_video2.
            const int bytes_decoded = avcodec_decode_video(m_context, m_frame.get(), &frame_finished, m_packet_data, m_bytes_remaining);
#endif

Sources: http://code.metager.de/source/xref/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp

You might also like

osgART 2.0 RC3 with OpenSceneGraph 2.9.7 or later (including 3.0.0)
Long time ago I had problems using osgART 2.0 RC3 with OpenSceneGraph 2.9.7 or later, I couldn't get...
Install osgART 2.0 RC3 with OpenSceneGraph 2.8.3 or 2.9.6 with Collada support in Ubuntu 12.04
Before installing osgART we need to install ARToolKit, collada-dom and OpenSceneGraph so look at those...
Installation scripts for ARToolKit, Collada DOM, OpenSceneGraph and osgART
I've created some scripts and patches so installation of all this libraries will be much less painful....
Install OpenSceneGraph 2.8.3 with Collada support in Ubuntu 12.04
We are going to install OpenSceneGraph 2.8.3 (for now on OSG) to use it with osgART 2.0 RC3. As far as...
Leave a comment ?

3 Comments.

    Leave a Comment

    Trackbacks and Pingbacks: