Bug#654395: additional patches for newer libav sources

John Vogel jvogel4 at stny.rr.com
Thu Jan 19 08:51:20 UTC 2012


I had the same problem with blender 2.61-1 segfaulting on my wheezy/sid 
box. So I went about trying to build from git. Right away had problems 
with missing headers declarations for libavutil/mathematics.h. Then, had 
problems with avformat_alloc_open_context2() in 
intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp. I found a fix in Gentoo's 
ebuild for blender-2.60a which negates most of the current
debian/patches/0009-fix_FTBFS_ffmpeg_debian.patch. So I added the first 
patch below and replaced the 0009 patch with the second patch below (the 
one I found for the Gentoo ebuild).

Builds fine and blender seems to running fine on my system, using up to 
date sid and strictly pure debian system other then my wacom driver 
(upstream kernel module and xorg driver).

---
  intern/ffmpeg/ffmpeg_compat.h |    4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index dfdad22..bf6e4a9 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -74,6 +74,10 @@
  #define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
  #endif

+#if (LIBAVUTIL_VERSION_MAJOR > 51) || ((LIBAVUTIL_VERSION_MAJOR == 51) 
&& (LIBAVUTIL_VERSION_MINOR >= 9))
+#include <libavutil/mathematics.h>
+#endif
+
  #ifndef FFMPEG_HAVE_AVIO
  #define AVIO_FLAG_WRITE URL_WRONLY
  #define avio_open url_fopen
-- 




---
  intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp |   13 ++++++++++---
  1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp 
b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
index 702c366..4fadbd1 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
@@ -38,6 +38,8 @@ extern "C" {
  #include <libavcodec/avcodec.h>
  #include <libavformat/avformat.h>
  #include <libavformat/avio.h>
+#include <libavutil/mathematics.h>
+#include <libavutil/avstring.h>
  #include "ffmpeg_compat.h"
  }

@@ -55,10 +57,15 @@ AUD_FFMPEGWriter::AUD_FFMPEGWriter(std::string 
filename, AUD_DeviceSpecs specs,
  {
  	static const char* formats[] = { NULL, "ac3", "flac", "matroska", 
"mp2", "mp3", "ogg", "wav" };

-	if(avformat_alloc_output_context2(&m_formatCtx, NULL, formats[format], 
filename.c_str()))
-		AUD_THROW(AUD_ERROR_FFMPEG, context_error);
+	m_formatCtx = avformat_alloc_context();
+        if (!m_formatCtx) AUD_THROW(AUD_ERROR_FFMPEG, context_error);

-	m_outputFmt = m_formatCtx->oformat;
+	av_strlcpy(m_formatCtx->filename, filename.c_str(), 
sizeof(m_formatCtx->filename));
+	m_outputFmt = m_formatCtx->oformat = av_guess_format(formats[format], 
filename.c_str(), NULL);
+	if (!m_outputFmt) {
+            avformat_free_context(m_formatCtx);
+            AUD_THROW(AUD_ERROR_FFMPEG, context_error);
+        }

  	switch(codec)
  	{
-- 

Perhaps you have already solved these issues, but since I had trouble 
building from anonscm.debian.org/pkg-multimedia/blender.git, I thought 
perhaps this may help.

Regards,
John Vogel <jvogel4 at stny.rr.com>





More information about the pkg-multimedia-maintainers mailing list