[packages/OpenSceneGraph] - up to 3.5.1 - fixed building with ffmpeg 3.x

baggins baggins at pld-linux.org
Mon Mar 21 12:20:28 CET 2016


commit 30ed4bf8a0535ed2c15efd09c108cb4731ad34bd
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Mon Mar 21 12:20:08 2016 +0100

    - up to 3.5.1
    - fixed building with ffmpeg 3.x

 OpenSceneGraph.spec |  46 +++++++--------
 ffmpeg3.patch       | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 giflib.patch        |  11 ----
 3 files changed, 182 insertions(+), 34 deletions(-)
---
diff --git a/OpenSceneGraph.spec b/OpenSceneGraph.spec
index 0653af2..d2d961e 100644
--- a/OpenSceneGraph.spec
+++ b/OpenSceneGraph.spec
@@ -1,15 +1,15 @@
 Summary:	Open Scene Graph - real-time visualization library
 Summary(pl.UTF-8):	Open Scene Graph - biblioteka do wizualizacji
 Name:		OpenSceneGraph
-Version:	3.3.2
-Release:	3
+Version:	3.5.1
+Release:	1
 License:	OpenSceneGraph Public Licence (based on LGPL with exceptions)
 Group:		X11/Libraries
-Source0:	http://www.openscenegraph.org/downloads/developer_releases/%{name}-%{version}.zip
-# Source0-md5:	6a7703a5b0d95b979dff1890fa0e0b53
+Source0:	http://trac.openscenegraph.org/downloads/developer_releases/%{name}-%{version}.zip
+# Source0-md5:	71b97b18f11b6c361631fc3e34fb4b67
 #Source1:	osg-doxygen-0.9.1.tar.gz
 ## Source1-md5:	7e6d785d1b763aaeae03c2dc4c148805
-Patch0:		giflib.patch
+Patch0:		ffmpeg3.patch
 URL:		http://www.openscenegraph.org/projects/osg/
 BuildRequires:	QtCore-devel
 BuildRequires:	QtOpenGL-devel
@@ -112,41 +112,41 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_libdir}/libOpenThreads.so.*.*.*
 %attr(755,root,root) %ghost %{_libdir}/libOpenThreads.so.20
 %attr(755,root,root) %{_libdir}/libosg.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosg.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosg.so.141
 %attr(755,root,root) %{_libdir}/libosgAnimation.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgAnimation.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgAnimation.so.141
 %attr(755,root,root) %{_libdir}/libosgDB.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgDB.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgDB.so.141
 %attr(755,root,root) %{_libdir}/libosgFX.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgFX.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgFX.so.141
 %attr(755,root,root) %{_libdir}/libosgGA.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgGA.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgGA.so.141
 %attr(755,root,root) %{_libdir}/libosgManipulator.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgManipulator.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgManipulator.so.141
 %attr(755,root,root) %{_libdir}/libosgParticle.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgParticle.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgParticle.so.141
 %attr(755,root,root) %{_libdir}/libosgPresentation.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgPresentation.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgPresentation.so.141
 %attr(755,root,root) %{_libdir}/libosgQt.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgQt.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgQt.so.141
 %attr(755,root,root) %{_libdir}/libosgShadow.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgShadow.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgShadow.so.141
 %attr(755,root,root) %{_libdir}/libosgSim.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgSim.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgSim.so.141
 %attr(755,root,root) %{_libdir}/libosgTerrain.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgTerrain.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgTerrain.so.141
 %attr(755,root,root) %{_libdir}/libosgText.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgText.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgText.so.141
 %attr(755,root,root) %{_libdir}/libosgUI.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgUI.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgUI.so.141
 %attr(755,root,root) %{_libdir}/libosgUtil.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgUtil.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgUtil.so.141
 %attr(755,root,root) %{_libdir}/libosgViewer.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgViewer.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgViewer.so.141
 %attr(755,root,root) %{_libdir}/libosgVolume.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgVolume.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgVolume.so.141
 %attr(755,root,root) %{_libdir}/libosgWidget.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libosgWidget.so.112
+%attr(755,root,root) %ghost %{_libdir}/libosgWidget.so.141
 
 %files plugins
 %defattr(644,root,root,755)
diff --git a/ffmpeg3.patch b/ffmpeg3.patch
new file mode 100644
index 0000000..3e1a9e1
--- /dev/null
+++ b/ffmpeg3.patch
@@ -0,0 +1,159 @@
+--- OpenSceneGraph-3.5.1/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp~	2015-06-01 15:40:20.000000000 +0200
++++ OpenSceneGraph-3.5.1/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp	2016-03-21 11:37:09.380644409 +0100
+@@ -226,9 +226,12 @@
+         // Open codec
+         if (avcodec_open2(m_context, p_codec, NULL) < 0)
+             throw std::runtime_error("avcodec_open() failed");
+-
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(55, 0, 0)
+         m_context->get_buffer = avcodec_default_get_buffer;
+         m_context->release_buffer = avcodec_default_release_buffer;
++#else
++        m_context->get_buffer2 = avcodec_default_get_buffer2;
++#endif
+ 
+     }
+ 
+--- OpenSceneGraph-3.5.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp.orig	2016-03-21 11:37:53.888177241 +0100
++++ OpenSceneGraph-3.5.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp	2016-03-21 11:54:04.889892930 +0100
+@@ -71,7 +71,7 @@
+     findAspectRatio();
+ 
+     // Find out whether we support Alpha channel
+-    m_alpha_channel = (m_context->pix_fmt == PIX_FMT_YUVA420P);
++    m_alpha_channel = (m_context->pix_fmt == AV_PIX_FMT_YUVA420P);
+ 
+     // Find out the framerate
+     #if LIBAVCODEC_VERSION_MAJOR >= 56
+@@ -95,20 +95,24 @@
+         throw std::runtime_error("avcodec_open() failed");
+ 
+     // Allocate video frame
+-    m_frame.reset(avcodec_alloc_frame());
++    m_frame.reset(av_frame_alloc());
+ 
+     // Allocate converted RGB frame
+-    m_frame_rgba.reset(avcodec_alloc_frame());
+-    m_buffer_rgba[0].resize(avpicture_get_size(PIX_FMT_RGB24, width(), height()));
++    m_frame_rgba.reset(av_frame_alloc());
++    m_buffer_rgba[0].resize(avpicture_get_size(AV_PIX_FMT_RGB24, width(), height()));
+     m_buffer_rgba[1].resize(m_buffer_rgba[0].size());
+ 
+     // Assign appropriate parts of the buffer to image planes in m_frame_rgba
+-    avpicture_fill((AVPicture *) (m_frame_rgba).get(), &(m_buffer_rgba[0])[0], PIX_FMT_RGB24, width(), height());
++    avpicture_fill((AVPicture *) (m_frame_rgba).get(), &(m_buffer_rgba[0])[0], AV_PIX_FMT_RGB24, width(), height());
+ 
+     // Override get_buffer()/release_buffer() from codec context in order to retrieve the PTS of each frame.
+     m_context->opaque = this;
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(55, 0, 0)
+     m_context->get_buffer = getBuffer;
+     m_context->release_buffer = releaseBuffer;
++#else
++    m_context->get_buffer2 = getBuffer;
++#endif
+ }
+ 
+ 
+@@ -267,8 +271,8 @@
+ #ifdef USE_SWSCALE
+     if (m_swscale_ctx==0)
+     {
+-        m_swscale_ctx = sws_getContext(src_width, src_height, (PixelFormat) src_pix_fmt,
+-                                      src_width, src_height, (PixelFormat) dst_pix_fmt,
++        m_swscale_ctx = sws_getContext(src_width, src_height, (AVPixelFormat) src_pix_fmt,
++                                      src_width, src_height, (AVPixelFormat) dst_pix_fmt,
+                                       /*SWS_BILINEAR*/ SWS_BICUBIC, NULL, NULL, NULL);
+     }
+ 
+@@ -315,14 +319,14 @@
+     AVPicture * const dst = (AVPicture *) m_frame_rgba.get();
+ 
+     // Assign appropriate parts of the buffer to image planes in m_frame_rgba
+-    avpicture_fill((AVPicture *) (m_frame_rgba).get(), &(m_buffer_rgba[m_writeBuffer])[0], PIX_FMT_RGB24, width(), height());
++    avpicture_fill((AVPicture *) (m_frame_rgba).get(), &(m_buffer_rgba[m_writeBuffer])[0], AV_PIX_FMT_RGB24, width(), height());
+ 
+     // Convert YUVA420p (i.e. YUV420p plus alpha channel) using our own routine
+ 
+-    if (m_context->pix_fmt == PIX_FMT_YUVA420P)
++    if (m_context->pix_fmt == AV_PIX_FMT_YUVA420P)
+         yuva420pToRgba(dst, src, width(), height());
+     else
+-        convert(dst, PIX_FMT_RGB24, src, m_context->pix_fmt, width(), height());
++        convert(dst, AV_PIX_FMT_RGB24, src, m_context->pix_fmt, width(), height());
+ 
+     // Wait 'delay' seconds before publishing the picture.
+     int i_delay = static_cast<int>(delay * 1000000 + 0.5);
+@@ -349,7 +353,7 @@
+ 
+ void FFmpegDecoderVideo::yuva420pToRgba(AVPicture * const dst, AVPicture * const src, int width, int height)
+ {
+-    convert(dst, PIX_FMT_RGB24, src, m_context->pix_fmt, width, height);
++    convert(dst, AV_PIX_FMT_RGB24, src, m_context->pix_fmt, width, height);
+ 
+     const size_t bpp = 4;
+ 
+@@ -369,6 +373,7 @@
+ 
+ 
+ 
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(55, 0, 0)
+ int FFmpegDecoderVideo::getBuffer(AVCodecContext * const context, AVFrame * const picture)
+ {
+     const FFmpegDecoderVideo * const this_ = reinterpret_cast<const FFmpegDecoderVideo*>(context->opaque);
+@@ -381,15 +386,31 @@
+ 
+     return result;
+ }
++#else
++int FFmpegDecoderVideo::getBuffer(AVCodecContext * const context, AVFrame * const picture, int flags)
++{
++    const FFmpegDecoderVideo * const this_ = reinterpret_cast<const FFmpegDecoderVideo*>(context->opaque);
++
++    const int result = avcodec_default_get_buffer2(context, picture, flags);
++    int64_t * p_pts = reinterpret_cast<int64_t*>( av_malloc(sizeof(int64_t)) );
++
++    *p_pts = this_->m_packet_pts;
++    picture->opaque = p_pts;
++
++    return result;
++}
++#endif
+ 
+ 
+ 
+ void FFmpegDecoderVideo::releaseBuffer(AVCodecContext * const context, AVFrame * const picture)
+ {
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(55, 0, 0)
+     if (picture != 0)
+         av_freep(&picture->opaque);
+ 
+     avcodec_default_release_buffer(context, picture);
++#endif
+ }
+ 
+ 
+--- OpenSceneGraph-3.5.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp.orig	2016-03-21 11:55:42.261200729 +0100
++++ OpenSceneGraph-3.5.1/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.hpp	2016-03-21 11:55:58.214746802 +0100
+@@ -94,7 +94,11 @@
+                 int src_pix_fmt, int src_width, int src_height);
+ 
+ 
++#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(55, 0, 0)
+     static int getBuffer(AVCodecContext * context, AVFrame * picture);
++#else
++    static int getBuffer(AVCodecContext * context, AVFrame * picture, int flags);
++#endif
+     static void releaseBuffer(AVCodecContext * context, AVFrame * picture);
+ 
+     PacketQueue &           m_packets;
+--- OpenSceneGraph-3.5.1/src/osgPlugins/ffmpeg/FFmpegParameters.cpp~	2013-09-05 12:04:56.000000000 +0200
++++ OpenSceneGraph-3.5.1/src/osgPlugins/ffmpeg/FFmpegParameters.cpp	2016-03-21 11:56:17.585004570 +0100
+@@ -19,7 +19,7 @@
+     #include <libavutil/pixdesc.h>
+ }
+ 
+-inline PixelFormat osg_av_get_pix_fmt(const char *name) { return av_get_pix_fmt(name); }
++inline AVPixelFormat osg_av_get_pix_fmt(const char *name) { return av_get_pix_fmt(name); }
+ 
+ 
+ namespace osgFFmpeg {
diff --git a/giflib.patch b/giflib.patch
deleted file mode 100644
index 9662899..0000000
--- a/giflib.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- OpenSceneGraph-3.3.2/src/osgPlugins/gif/ReaderWriterGIF.cpp~	2013-06-03 16:04:02.000000000 +0200
-+++ OpenSceneGraph-3.3.2/src/osgPlugins/gif/ReaderWriterGIF.cpp	2014-10-29 20:57:05.905350113 +0100
-@@ -561,7 +561,7 @@
-     *width_ret = giffile->SWidth;
-     *height_ret = giffile->SHeight;
-     *numComponents_ret = 4;
--    DGifCloseFile(giffile);
-+    DGifCloseFile(giffile, &Error);
-     return buffer;
- }
- 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/OpenSceneGraph.git/commitdiff/30ed4bf8a0535ed2c15efd09c108cb4731ad34bd



More information about the pld-cvs-commit mailing list