[SCM] blender/master: debian/patches/: patchset updated

mfv at users.alioth.debian.org mfv at users.alioth.debian.org
Sun Apr 24 07:19:19 UTC 2016


The following commit has been merged in the master branch:
commit 0e1b8ff820d7a64b6198441237f3c184c6af7936
Author: Matteo F. Vescovi <mfv at debian.org>
Date:   Fri Apr 22 21:24:09 2016 +0200

    debian/patches/: patchset updated
    
    - 0001-blender_thumbnailer.patch refreshed
    - 0002-install_in_usr_share.patch refreshed
    - 0003-locales_directory_install.patch updated
    - 0004-update_manpages.patch refreshed
    - 0005-do_not_use_version_number_in_system_path.patch updated
    - 0006-look_for_dejavu_ttf_with_fontconfig.patch updated
    
    Thanks: Gleb Fotengauer-Malinovskiy for the updated patches.

diff --git a/debian/patches/0001-blender_thumbnailer.patch b/debian/patches/0001-blender_thumbnailer.patch
index 0f54928..21de67c 100644
--- a/debian/patches/0001-blender_thumbnailer.patch
+++ b/debian/patches/0001-blender_thumbnailer.patch
@@ -33,10 +33,10 @@ index fe5d462..5d2dd95 100755
  # ##### BEGIN GPL LICENSE BLOCK #####
  #
 diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
-index 8feb882..d10de41 100644
+index ff6544c..e7729d4 100644
 --- a/source/creator/CMakeLists.txt
 +++ b/source/creator/CMakeLists.txt
-@@ -494,7 +494,7 @@ if(UNIX AND NOT APPLE)
+@@ -497,7 +497,7 @@ if(UNIX AND NOT APPLE)
  		)
  		install(
  			PROGRAMS ${CMAKE_SOURCE_DIR}/release/bin/blender-thumbnailer.py
diff --git a/debian/patches/0002-install_in_usr_share.patch b/debian/patches/0002-install_in_usr_share.patch
index d1dcf81..5c603e2 100644
--- a/debian/patches/0002-install_in_usr_share.patch
+++ b/debian/patches/0002-install_in_usr_share.patch
@@ -9,10 +9,10 @@ Subject: install_in_usr_share
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
-index d10de41..888475a 100644
+index e7729d4..118d807 100644
 --- a/source/creator/CMakeLists.txt
 +++ b/source/creator/CMakeLists.txt
-@@ -324,8 +324,8 @@ if(WITH_PYTHON)
+@@ -327,8 +327,8 @@ if(WITH_PYTHON)
  	endif()
  
  	install(
diff --git a/debian/patches/0003-locales_directory_install.patch b/debian/patches/0003-locales_directory_install.patch
index 310105f..a48bd03 100644
--- a/debian/patches/0003-locales_directory_install.patch
+++ b/debian/patches/0003-locales_directory_install.patch
@@ -1,11 +1,12 @@
 From: "Matteo F. Vescovi" <mfv at debian.org>
-Date: Fri, 23 Oct 2015 21:10:16 +0200
+Date: Fri, 22 Apr 2016 17:05:17 +0200
 Subject: locales_directory_install
 
 Change where locales are installed.
 
 Contributions by:
  Antonio Ospite <ospite at studenti.unina.it>
+ Gleb Fotengauer-Malinovskiy <glebfm at altlinux.org>
 ---
  source/blender/blenkernel/BKE_appdir.h           |  1 +
  source/blender/blenkernel/intern/appdir.c        |  3 +++
@@ -26,7 +27,7 @@ index 077fe2a..905106d 100644
  
  /* for BKE_appdir_folder_id_version only */
 diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
-index ee6710e..c95eb7a 100644
+index de21d91..aaf73ec 100644
 --- a/source/blender/blenkernel/intern/appdir.c
 +++ b/source/blender/blenkernel/intern/appdir.c
 @@ -398,6 +398,9 @@ const char *BKE_appdir_folder_id(const int folder_id, const char *subfolder)
@@ -83,10 +84,10 @@ index 1ad62fa..3c70e0c 100644
  	else {
  		printf("%s: 'locale' data path for translations not found, continuing\n", __func__);
 diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
-index 888475a..8b99a9c 100644
+index 118d807..7733b4b 100644
 --- a/source/creator/CMakeLists.txt
 +++ b/source/creator/CMakeLists.txt
-@@ -341,11 +341,11 @@ if(WITH_INTERNATIONAL)
+@@ -344,11 +344,11 @@ if(WITH_INTERNATIONAL)
  	install(
  		DIRECTORY
  			${CMAKE_SOURCE_DIR}/release/datafiles/fonts
diff --git a/debian/patches/0004-update_manpages.patch b/debian/patches/0004-update_manpages.patch
index b96108b..6b8de9f 100644
--- a/debian/patches/0004-update_manpages.patch
+++ b/debian/patches/0004-update_manpages.patch
@@ -148,10 +148,10 @@ index 0000000..5435c63
 +.SH AUTHORS
 +This manpage was written for a Debian by Kevin Roy <kiniou at gmail.com>.
 diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
-index 8b99a9c..1c75ff4 100644
+index 7733b4b..3edeb4a 100644
 --- a/source/creator/CMakeLists.txt
 +++ b/source/creator/CMakeLists.txt
-@@ -448,6 +448,7 @@ if(UNIX AND NOT APPLE)
+@@ -451,6 +451,7 @@ if(UNIX AND NOT APPLE)
  			FILES
  				${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
  				${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
@@ -159,7 +159,7 @@ index 8b99a9c..1c75ff4 100644
  			DESTINATION "."
  		)
  
-@@ -470,6 +471,10 @@ if(UNIX AND NOT APPLE)
+@@ -473,6 +474,10 @@ if(UNIX AND NOT APPLE)
  				FILES ${CMAKE_CURRENT_BINARY_DIR}/blender.1
  				DESTINATION share/man/man1
  			)
diff --git a/debian/patches/0005-do_not_use_version_number_in_system_path.patch b/debian/patches/0005-do_not_use_version_number_in_system_path.patch
index a83a225..bf62399 100644
--- a/debian/patches/0005-do_not_use_version_number_in_system_path.patch
+++ b/debian/patches/0005-do_not_use_version_number_in_system_path.patch
@@ -9,17 +9,17 @@ without version numbers.
 Contributions by:
  Antonio Ospite <ospite at studenti.unina.it>
 ---
- intern/ghost/intern/GHOST_SystemPathsX11.cpp | 3 +++
- source/creator/CMakeLists.txt                | 2 +-
+ intern/ghost/intern/GHOST_SystemPathsUnix.cpp | 3 +++
+ source/creator/CMakeLists.txt                 | 2 +-
  2 files changed, 4 insertions(+), 1 deletion(-)
 
-diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.cpp b/intern/ghost/intern/GHOST_SystemPathsX11.cpp
-index 5473e40..348b9c3 100644
---- a/intern/ghost/intern/GHOST_SystemPathsX11.cpp
-+++ b/intern/ghost/intern/GHOST_SystemPathsX11.cpp
-@@ -62,6 +62,9 @@ GHOST_SystemPathsX11::~GHOST_SystemPathsX11()
+diff --git a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
+index 8738b8d..91d336c 100644
+--- a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
++++ b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
+@@ -61,6 +61,9 @@ GHOST_SystemPathsUnix::~GHOST_SystemPathsUnix()
  
- const GHOST_TUns8 *GHOST_SystemPathsX11::getSystemDir(int, const char *versionstr) const
+ const GHOST_TUns8 *GHOST_SystemPathsUnix::getSystemDir(int, const char *versionstr) const
  {
 +	/* XXX On Debian ignore versionstr when building the system path */
 +	versionstr = "";
@@ -28,10 +28,10 @@ index 5473e40..348b9c3 100644
  	if (static_path) {
  		static string system_path = string(static_path) + "/blender/" + versionstr;
 diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
-index 1c75ff4..d129c1e 100644
+index 3edeb4a..5a84745 100644
 --- a/source/creator/CMakeLists.txt
 +++ b/source/creator/CMakeLists.txt
-@@ -279,7 +279,7 @@ if(UNIX AND NOT APPLE)
+@@ -281,7 +281,7 @@ if(UNIX AND NOT APPLE)
  		if(WITH_INSTALL_PORTABLE)
  			set(TARGETDIR_VER ${BLENDER_VERSION})
  		else()
diff --git a/debian/patches/0006-look_for_dejavu_ttf_with_fontconfig.patch b/debian/patches/0006-look_for_dejavu_ttf_with_fontconfig.patch
index 5acc689..f5c6d67 100644
--- a/debian/patches/0006-look_for_dejavu_ttf_with_fontconfig.patch
+++ b/debian/patches/0006-look_for_dejavu_ttf_with_fontconfig.patch
@@ -6,7 +6,7 @@ Subject: look_for_dejavu_ttf_with_fontconfig
   and use fontconfig to get Dajavu instead.
 * Remove bad installation of fonts directory into locales.
 ---
- CMakeLists.txt                                 | 11 ++++++
+ CMakeLists.txt                                 | 13 +++++++
  build_files/cmake/Modules/FindFontconfig.cmake | 48 ++++++++++++++++++++++++++
  build_files/cmake/macros.cmake                 |  6 ++++
  source/blender/blenfont/CMakeLists.txt         |  7 ++++
@@ -14,14 +14,14 @@ Subject: look_for_dejavu_ttf_with_fontconfig
  source/blender/blenlib/BLI_fileops.h           |  1 +
  source/blender/blenlib/intern/fileops.c        | 43 +++++++++++++++++++++++
  source/creator/CMakeLists.txt                  |  6 ----
- 8 files changed, 159 insertions(+), 7 deletions(-)
+ 8 files changed, 161 insertions(+), 7 deletions(-)
  create mode 100644 build_files/cmake/Modules/FindFontconfig.cmake
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 029198f..0823f0a 100644
+index 1efaa14..fa05865 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -198,6 +198,9 @@ option(WITH_BLENDER "Build blender (disable to build only the blender player)" O
+@@ -200,6 +200,9 @@ option(WITH_BLENDER "Build blender (disable to build only the blender player)" O
  mark_as_advanced(WITH_BLENDER)
  
  option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
@@ -31,7 +31,7 @@ index 029198f..0823f0a 100644
  
  option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
  option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON) 
-@@ -972,6 +975,13 @@ if(UNIX AND NOT APPLE)
+@@ -952,6 +955,13 @@ if(UNIX AND NOT APPLE)
  		endif()
  	endif()
  
@@ -45,14 +45,16 @@ index 029198f..0823f0a 100644
  	# Codecs
  	if(WITH_CODEC_SNDFILE)
  		find_package_wrapper(SndFile)
-@@ -2977,6 +2987,7 @@ if(FIRST_RUN)
+@@ -3100,6 +3110,9 @@ if(FIRST_RUN)
+ 		info_cfg_option(WITH_GL_ANGLE)
+ 	endif()
  
- 	info_cfg_text("Other:")
- 	info_cfg_option(WITH_OPENNL)
++	info_cfg_text("Other:")
 +	info_cfg_option(WITH_FONTCONFIG)
++
+ 	info_cfg_text("")
  
- 	# debug
- 	message(STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}")
+ 	message("${_config_msg}")
 diff --git a/build_files/cmake/Modules/FindFontconfig.cmake b/build_files/cmake/Modules/FindFontconfig.cmake
 new file mode 100644
 index 0000000..7dc09f3
@@ -108,10 +110,10 @@ index 0000000..7dc09f3
 +
 +endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
 diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
-index 90c4fbd..f740d4d 100644
+index 7bdf790..39926dc 100644
 --- a/build_files/cmake/macros.cmake
 +++ b/build_files/cmake/macros.cmake
-@@ -294,6 +294,9 @@ function(SETUP_LIBDIRS)
+@@ -298,6 +298,9 @@ function(SETUP_LIBDIRS)
  	if(WITH_MEM_JEMALLOC)
  		link_directories(${JEMALLOC_LIBPATH})
  	endif()
@@ -121,7 +123,7 @@ index 90c4fbd..f740d4d 100644
  
  	if(WIN32 AND NOT UNIX)
  		link_directories(${PTHREADS_LIBPATH})
-@@ -340,6 +343,9 @@ function(setup_liblinks
+@@ -344,6 +347,9 @@ function(setup_liblinks
  	if(WITH_SYSTEM_GLEW)
  		target_link_libraries(${target} ${BLENDER_GLEW_LIBRARIES})
  	endif()
@@ -236,19 +238,19 @@ index b6ff7ed..a208fde 100644
  
  	*r_unifont_size = unifont_mono_size;
 diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
-index 33dae45..76e80f9 100644
+index 91d139c..20cca01 100644
 --- a/source/blender/blenlib/BLI_fileops.h
 +++ b/source/blender/blenlib/BLI_fileops.h
 @@ -90,6 +90,7 @@ bool   BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
  bool   BLI_dir_create_recursive(const char *dir) ATTR_NONNULL();
  double BLI_dir_free_space(const char *dir) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
- char  *BLI_current_working_dir(char *dir, const size_t maxlen) ATTR_NONNULL();
+ char  *BLI_current_working_dir(char *dir, const size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 +char  *BLI_file_to_mem(const char *from_file, int *size_r) ATTR_NONNULL();
  
  /* Filelist */
  
 diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
-index ef9a7c0..42b7515 100644
+index db4b3bc..dc240ee 100644
 --- a/source/blender/blenlib/intern/fileops.c
 +++ b/source/blender/blenlib/intern/fileops.c
 @@ -159,6 +159,49 @@ char *BLI_file_ungzip_to_mem(const char *from_file, int *r_size)
@@ -302,10 +304,10 @@ index ef9a7c0..42b7515 100644
   * Returns true if the file with the specified name can be written.
   * This implementation uses access(2), which makes the check according
 diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
-index d129c1e..991e62b 100644
+index 5a84745..e1e72d2 100644
 --- a/source/creator/CMakeLists.txt
 +++ b/source/creator/CMakeLists.txt
-@@ -338,12 +338,6 @@ endif()
+@@ -341,12 +341,6 @@ endif()
  
  # localization
  if(WITH_INTERNATIONAL)
diff --git a/debian/patches/0007-look_for_dejavu_ttf_with_fontconfig.patch b/debian/patches/0007-look_for_dejavu_ttf_with_fontconfig.patch
deleted file mode 100644
index ddcb711..0000000
--- a/debian/patches/0007-look_for_dejavu_ttf_with_fontconfig.patch
+++ /dev/null
@@ -1,320 +0,0 @@
-From: "Matteo F. Vescovi" <mfv at debian.org>
-Date: Sun, 31 Jan 2016 14:37:05 +0100
-Subject: look_for_dejavu_ttf_with_fontconfig
-
-* Avoid using the droid font shipped with upstream source
-  and use fontconfig to get Dejavu instead.
-* Remove bad installation of fonts directory into locales.
----
- CMakeLists.txt                                   | 11 ++++++
- build_files/cmake/Modules/FindFontconfig.cmake   | 48 ++++++++++++++++++++++++
- build_files/cmake/macros.cmake                   |  6 +++
- source/blender/blenfont/CMakeLists.txt           |  7 ++++
- source/blender/blenfont/intern/blf_translation.c | 44 +++++++++++++++++++++-
- source/blender/blenlib/BLI_fileops.h             |  1 +
- source/blender/blenlib/intern/fileops.c          | 43 +++++++++++++++++++++
- source/creator/CMakeLists.txt                    |  6 ---
- 8 files changed, 159 insertions(+), 7 deletions(-)
- create mode 100644 build_files/cmake/Modules/FindFontconfig.cmake
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index b52dd05..4f59c65 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -192,6 +192,9 @@ option(WITH_BLENDER "Build blender (disable to build only the blender player)" O
- mark_as_advanced(WITH_BLENDER)
- 
- option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
-+if(UNIX AND NOT APPLE)
-+    option(WITH_FONTCONFIG "Enable Fontconfig (discovering fonts installed on Linux)" OFF)
-+endif()
- 
- option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
- option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON) 
-@@ -872,6 +875,13 @@ if(UNIX AND NOT APPLE)
- 		endif()
- 	endif()
- 
-+	if(WITH_FONTCONFIG)
-+		find_package(Fontconfig)
-+		if(NOT FONTCONFIG_FOUND)
-+			set(WITH_FONTCONFIG OFF)
-+		endif()
-+	endif()
-+
- 	# Codecs
- 	if(WITH_CODEC_SNDFILE)
- 		find_package_wrapper(SndFile)
-@@ -2847,6 +2857,7 @@ if(FIRST_RUN)
- 
- 	info_cfg_text("Other:")
- 	info_cfg_option(WITH_OPENNL)
-+	info_cfg_option(WITH_FONTCONFIG)
- 
- 	# debug
- 	message(STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}")
-diff --git a/build_files/cmake/Modules/FindFontconfig.cmake b/build_files/cmake/Modules/FindFontconfig.cmake
-new file mode 100644
-index 0000000..7dc09f3
---- /dev/null
-+++ b/build_files/cmake/Modules/FindFontconfig.cmake
-@@ -0,0 +1,48 @@
-+# Try to find the Fontconfig
-+# Once done this will define
-+#
-+#  FONTCONFIG_FOUND - system has Fontconfig
-+#  FONTCONFIG_INCLUDE_DIR - The include directory to use for the fontconfig headers
-+#  FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG
-+#  FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG
-+
-+# Copyright (c) 2006,2007 Laurent Montel <montel at kde.org>
-+#
-+# Redistribution and use is allowed according to the terms of the BSD license.
-+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-+
-+if (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
-+
-+  # in cache already
-+  set(FONTCONFIG_FOUND TRUE)
-+
-+else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
-+
-+  if (NOT WIN32)
-+    # use pkg-config to get the directories and then use these values
-+    # in the FIND_PATH() and FIND_LIBRARY() calls
-+    find_package(PkgConfig)
-+    pkg_check_modules(FONTCONFIG fontconfig)
-+
-+    set(FONTCONFIG_DEFINITIONS ${FONTCONFIG_CFLAGS_OTHER})
-+  endif (NOT WIN32)
-+
-+  find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h
-+    PATHS
-+    ${FONTCONFIG_INCLUDEDIR}
-+    ${FONTCONFIG_INCLUDE_DIRS}
-+    /usr/X11/include
-+  )
-+
-+  find_library(FONTCONFIG_LIBRARIES NAMES fontconfig
-+    PATHS
-+    ${FONTCONFIG_LIBDIR}
-+    ${FONTCONFIG_LIBRARY_DIRS}
-+  )
-+
-+  include(FindPackageHandleStandardArgs)
-+  FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
-+
-+  mark_as_advanced(FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
-+
-+endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
-diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
-index 33c7644..ab5ec3a 100644
---- a/build_files/cmake/macros.cmake
-+++ b/build_files/cmake/macros.cmake
-@@ -284,6 +284,9 @@ macro(SETUP_LIBDIRS)
- 	if(WITH_MEM_JEMALLOC)
- 		link_directories(${JEMALLOC_LIBPATH})
- 	endif()
-+	if(WITH_FONTCONFIG)
-+		link_directories(${FONTCONFIG_LIBPATH})
-+	endif()
- 
- 	if(WIN32 AND NOT UNIX)
- 		link_directories(${PTHREADS_LIBPATH})
-@@ -324,6 +327,9 @@ macro(setup_liblinks
- 	if(WITH_SYSTEM_GLEW)
- 		target_link_libraries(${target} ${BLENDER_GLEW_LIBRARIES})
- 	endif()
-+	if(WITH_FONTCONFIG)
-+		target_link_libraries(${target} ${FONTCONFIG_LIBRARIES})
-+	endif()
- 	if(WITH_BULLET AND WITH_SYSTEM_BULLET)
- 		target_link_libraries(${target} ${BULLET_LIBRARIES})
- 	endif()
-diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
-index 392a9ed..deb1f3c 100644
---- a/source/blender/blenfont/CMakeLists.txt
-+++ b/source/blender/blenfont/CMakeLists.txt
-@@ -66,6 +66,13 @@ if(WITH_INTERNATIONAL)
- 	add_definitions(-DWITH_INTERNATIONAL)
- endif()
- 
-+if(WITH_FONTCONFIG)
-+	list(APPEND INC_SYS
-+		${FONTCONFIG_INCLUDE_DIRS}
-+	)
-+	add_definitions(-DWITH_FONTCONFIG)
-+endif()
-+
- add_definitions(${GL_DEFINITIONS})
- 
- blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}")
-diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
-index 2a4a152..cbc3af0 100644
---- a/source/blender/blenfont/intern/blf_translation.c
-+++ b/source/blender/blenfont/intern/blf_translation.c
-@@ -52,10 +52,14 @@
- 
- #include "boost_locale_wrapper.h"
- 
-+#ifdef WITH_FONTCONFIG
-+#include <fontconfig/fontconfig.h>
-+#else
- static const char unifont_filename[] = "droidsans.ttf.gz";
-+static const char unifont_mono_filename[] = "bmonofont-i18n.ttf.gz";
-+#endif
- static unsigned char *unifont_ttf = NULL;
- static int unifont_size = 0;
--static const char unifont_mono_filename[] = "bmonofont-i18n.ttf.gz";
- static unsigned char *unifont_mono_ttf = NULL;
- static int unifont_mono_size = 0;
- #endif  /* WITH_INTERNATIONAL */
-@@ -64,6 +68,24 @@ unsigned char *BLF_get_unifont(int *r_unifont_size)
- {
- #ifdef WITH_INTERNATIONAL
- 	if (unifont_ttf == NULL) {
-+#ifdef WITH_FONTCONFIG
-+		FcFontSet *fontset = NULL;
-+		FcValue v;
-+		FcPattern *pattern = FcPatternBuild (0, FC_FAMILY, FcTypeString, "Dejavu Sans", FC_STYLE, FcTypeString, "Regular", (char *) 0);
-+		fontset = FcFontList(0,pattern,0);
-+		if (fontset->nfont > 0) {
-+			// Get the file of the first font in the fontset that match pattern
-+			FcPatternGet(fontset->fonts[0], FC_FILE, 0, &v);
-+			// Load the file stored in the union of FcValue into memory
-+			unifont_ttf = (unsigned char*)BLI_file_to_mem(
-+				(const char *)v.u.s,
-+				&unifont_size
-+			);
-+		}
-+		else {
-+			printf("%s: 'Dejavu Sans' font not found with fontconfig\n", __func__);
-+		}
-+#else
- 		const char * const fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts");
- 		if (fontpath) {
- 			char unifont_path[1024];
-@@ -75,6 +97,7 @@ unsigned char *BLF_get_unifont(int *r_unifont_size)
- 		else {
- 			printf("%s: 'fonts' data path not found for international font, continuing\n", __func__);
- 		}
-+#endif
- 	}
- 
- 	*r_unifont_size = unifont_size;
-@@ -99,6 +122,24 @@ unsigned char *BLF_get_unifont_mono(int *r_unifont_size)
- {
- #ifdef WITH_INTERNATIONAL
- 	if (unifont_mono_ttf == NULL) {
-+#ifdef WITH_FONTCONFIG
-+		FcFontSet *fontset = NULL;
-+		FcValue v;
-+		FcPattern *pattern = FcPatternBuild (0, FC_FAMILY, FcTypeString, "Dejavu Sans Mono", FC_STYLE, FcTypeString, "Regular", (char *) 0);
-+		fontset = FcFontList(0,pattern,0);
-+		if (fontset->nfont > 0) {
-+			// Get the file of the first font in the fontset that match pattern
-+			FcPatternGet(fontset->fonts[0], FC_FILE, 0, &v);
-+			// Load the file stored in the union of FcValue into memory
-+			unifont_mono_ttf = (unsigned char*)BLI_file_to_mem(
-+				(const char *)v.u.s,
-+				&unifont_mono_size
-+			);
-+		}
-+		else {
-+			printf("%s: 'Dejavu Sans Mono' font not found with fontconfig\n", __func__);
-+		}
-+#else
- 		const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts");
- 		if (fontpath) {
- 			char unifont_path[1024];
-@@ -110,6 +151,7 @@ unsigned char *BLF_get_unifont_mono(int *r_unifont_size)
- 		else {
- 			printf("%s: 'fonts' data path not found for international monospace font, continuing\n", __func__);
- 		}
-+#endif
- 	}
- 
- 	*r_unifont_size = unifont_mono_size;
-diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
-index 7898a54..0be8666 100644
---- a/source/blender/blenlib/BLI_fileops.h
-+++ b/source/blender/blenlib/BLI_fileops.h
-@@ -89,6 +89,7 @@ bool   BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
- void   BLI_dir_create_recursive(const char *dir) ATTR_NONNULL();
- double BLI_dir_free_space(const char *dir) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
- char  *BLI_current_working_dir(char *dir, const size_t maxlen) ATTR_NONNULL();
-+char  *BLI_file_to_mem(const char *from_file, int *size_r) ATTR_NONNULL();
- 
- /* Filelist */
- 
-diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
-index d6fe5e5..beb01da 100644
---- a/source/blender/blenlib/intern/fileops.c
-+++ b/source/blender/blenlib/intern/fileops.c
-@@ -159,6 +159,49 @@ char *BLI_file_ungzip_to_mem(const char *from_file, int *r_size)
- 	return mem;
- }
- 
-+/* Read the file in from_file and write it to memory to_mem,
-+   at most size bytes. Return the file size.
-+*/
-+char *BLI_file_to_mem(const char *from_file, int *size_r) {
-+
-+    FILE * file;
-+    int readsize, size, alloc_size = 0;
-+    char *mem = NULL;
-+    const int chunk_size = 512*1024;
-+
-+    size= 0;
-+
-+    file = fopen(from_file, "rb");
-+
-+    for(;;) {
-+        if(mem == NULL) {
-+            mem = MEM_callocN(chunk_size, "BLI_file_to_mem");
-+            alloc_size = chunk_size;
-+        } else {
-+            mem = MEM_reallocN(mem, size+chunk_size);
-+            alloc_size += chunk_size;
-+        }
-+
-+        readsize = fread(mem+size, 1, chunk_size, file);
-+        if(readsize > 0) {
-+            size += readsize;
-+        }
-+        else break;
-+    }
-+
-+    if(size == 0) {
-+        MEM_freeN(mem);
-+        mem = NULL;
-+    }
-+    else if(alloc_size != size)
-+        mem = MEM_reallocN(mem, size);
-+
-+    fclose(file);
-+    *size_r = size;
-+
-+    return mem;
-+}
-+
- /**
-  * Returns true if the file with the specified name can be written.
-  * This implementation uses access(2), which makes the check according
-diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
-index 7551c3e..f808402 100644
---- a/source/creator/CMakeLists.txt
-+++ b/source/creator/CMakeLists.txt
-@@ -326,12 +326,6 @@ endif()
- 
- # localization
- if(WITH_INTERNATIONAL)
--	install(
--		DIRECTORY
--			${CMAKE_SOURCE_DIR}/release/datafiles/fonts
--		DESTINATION ${CMAKE_INSTALL_PREFIX}/share/locale
--	)
--
- 	set(_locale_dir "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
- 	set(_locale_target_dir ${CMAKE_INSTALL_PREFIX}/share/locale)
- 
diff --git a/debian/patches/0008-ffmpeg_2.9.patch b/debian/patches/0008-ffmpeg_2.9.patch
deleted file mode 100644
index 8cb3478..0000000
--- a/debian/patches/0008-ffmpeg_2.9.patch
+++ /dev/null
@@ -1,699 +0,0 @@
-From: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
-Date: Sun, 31 Jan 2016 14:41:39 +0100
-Subject: ffmpeg_2.9
-
-Replace deprecated FFmpeg API.
----
- CMakeLists.txt                                 |   2 +-
- intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp   |   4 +-
- intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp   |   2 +-
- source/blender/blenkernel/intern/writeffmpeg.c |  36 ++++----
- source/blender/imbuf/intern/IMB_anim.h         |  11 +++
- source/blender/imbuf/intern/anim_movie.c       | 107 ++++++++++++++++++++----
- source/blender/imbuf/intern/indexer.c          |  10 +--
- source/gameengine/VideoTexture/VideoFFmpeg.cpp | 109 +++++++++++++++++++++----
- source/gameengine/VideoTexture/VideoFFmpeg.h   |  15 ++++
- 9 files changed, 235 insertions(+), 61 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 4f59c65..a7e0132 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -892,7 +892,7 @@ if(UNIX AND NOT APPLE)
- 
- 	if(WITH_CODEC_FFMPEG)
- 		set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
--		set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
-+		set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale avfilter CACHE STRING "FFMPEG Libraries")
- 
- 		mark_as_advanced(FFMPEG)
- 
-diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
-index ba961f0..bc351b9 100644
---- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
-+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
-@@ -58,9 +58,9 @@ int AUD_FFMPEGReader::decode(AVPacket& packet, AUD_Buffer& buffer)
- 		got_frame = 0;
- 
- 		if(!frame)
--			frame = avcodec_alloc_frame();
-+			frame = av_frame_alloc();
- 		else
--			avcodec_get_frame_defaults(frame);
-+			av_frame_unref(frame);
- 
- 		read_length = avcodec_decode_audio4(m_codecCtx, frame, &got_frame, &packet);
- 		if(read_length < 0)
-diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
-index 4ee99c7..4de7812 100644
---- a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
-+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.cpp
-@@ -202,7 +202,7 @@ AUD_FFMPEGWriter::AUD_FFMPEGWriter(std::string filename, AUD_DeviceSpecs specs,
- 			m_frame = av_frame_alloc();
- 			if (!m_frame)
- 				AUD_THROW(AUD_ERROR_FFMPEG, codec_error);
--			avcodec_get_frame_defaults(m_frame);
-+			av_frame_unref(m_frame);
- 			m_frame->linesize[0]    = m_input_size * samplesize;
- 			m_frame->format         = m_codecCtx->sample_fmt;
- 			m_frame->nb_samples     = m_input_size;
-diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
-index 128a5da..77d00a1 100644
---- a/source/blender/blenkernel/intern/writeffmpeg.c
-+++ b/source/blender/blenkernel/intern/writeffmpeg.c
-@@ -133,8 +133,8 @@ static int write_audio_frame(void)
- 	audio_time += (double) audio_input_samples / (double) c->sample_rate;
- 
- #ifdef FFMPEG_HAVE_ENCODE_AUDIO2
--	frame = avcodec_alloc_frame();
--	avcodec_get_frame_defaults(frame);
-+	frame = av_frame_alloc();
-+	av_frame_unref(frame);
- 	frame->pts = audio_time / av_q2d(c->time_base);
- 	frame->nb_samples = audio_input_samples;
- 	frame->format = c->sample_fmt;
-@@ -167,7 +167,7 @@ static int write_audio_frame(void)
- 	}
- 
- 	if (!got_output) {
--		avcodec_free_frame(&frame);
-+		av_frame_free(&frame);
- 		return 0;
- 	}
- #else
-@@ -197,7 +197,7 @@ static int write_audio_frame(void)
- 		if (av_interleaved_write_frame(outfile, &pkt) != 0) {
- 			fprintf(stderr, "Error writing audio packet!\n");
- 			if (frame)
--				avcodec_free_frame(&frame);
-+				av_frame_free(&frame);
- 			return -1;
- 		}
- 
-@@ -205,7 +205,7 @@ static int write_audio_frame(void)
- 	}
- 
- 	if (frame)
--		avcodec_free_frame(&frame);
-+		av_frame_free(&frame);
- 
- 	return 0;
- }
-@@ -219,7 +219,7 @@ static AVFrame *alloc_picture(int pix_fmt, int width, int height)
- 	int size;
- 	
- 	/* allocate space for the struct */
--	f = avcodec_alloc_frame();
-+	f = av_frame_alloc();
- 	if (!f) return NULL;
- 	size = avpicture_get_size(pix_fmt, width, height);
- 	/* allocate the actual picture buffer */
-@@ -358,8 +358,8 @@ static AVFrame *generate_video_frame(uint8_t *pixels, ReportList *reports)
- 	int height = c->height;
- 	AVFrame *rgb_frame;
- 
--	if (c->pix_fmt != PIX_FMT_BGR32) {
--		rgb_frame = alloc_picture(PIX_FMT_BGR32, width, height);
-+	if (c->pix_fmt != AV_PIX_FMT_BGR32) {
-+		rgb_frame = alloc_picture(AV_PIX_FMT_BGR32, width, height);
- 		if (!rgb_frame) {
- 			BKE_report(reports, RPT_ERROR, "Could not allocate temporary frame");
- 			return NULL;
-@@ -409,14 +409,14 @@ static AVFrame *generate_video_frame(uint8_t *pixels, ReportList *reports)
- 		}
- 	}
- 
--	if (c->pix_fmt != PIX_FMT_BGR32) {
-+	if (c->pix_fmt != AV_PIX_FMT_BGR32) {
- 		sws_scale(img_convert_ctx, (const uint8_t *const *) rgb_frame->data,
- 		          rgb_frame->linesize, 0, c->height,
- 		          current_frame->data, current_frame->linesize);
- 		delete_picture(rgb_frame);
- 	}
- 
--	current_frame->format = PIX_FMT_BGR32;
-+	current_frame->format = AV_PIX_FMT_BGR32;
- 	current_frame->width = width;
- 	current_frame->height = height;
- 
-@@ -581,12 +581,12 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
- 	}
- 	else {
- 		/* makes HuffYUV happy ... */
--		c->pix_fmt = PIX_FMT_YUV422P;
-+		c->pix_fmt = AV_PIX_FMT_YUV422P;
- 	}
- 
- 	if (ffmpeg_type == FFMPEG_XVID) {
- 		/* arghhhh ... */
--		c->pix_fmt = PIX_FMT_YUV420P;
-+		c->pix_fmt = AV_PIX_FMT_YUV420P;
- 		c->codec_tag = (('D' << 24) + ('I' << 16) + ('V' << 8) + 'X');
- 	}
- 
-@@ -599,26 +599,26 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
- 	/* Keep lossless encodes in the RGB domain. */
- 	if (codec_id == AV_CODEC_ID_HUFFYUV) {
- 		if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
--			c->pix_fmt = PIX_FMT_BGRA;
-+			c->pix_fmt = AV_PIX_FMT_BGRA;
- 		}
- 		else {
--			c->pix_fmt = PIX_FMT_RGB32;
-+			c->pix_fmt = AV_PIX_FMT_RGB32;
- 		}
- 	}
- 
- 	if (codec_id == AV_CODEC_ID_FFV1) {
--		c->pix_fmt = PIX_FMT_RGB32;
-+		c->pix_fmt = AV_PIX_FMT_RGB32;
- 	}
- 
- 	if (codec_id == AV_CODEC_ID_QTRLE) {
- 		if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
--			c->pix_fmt = PIX_FMT_ARGB;
-+			c->pix_fmt = AV_PIX_FMT_ARGB;
- 		}
- 	}
- 
- 	if (codec_id == AV_CODEC_ID_PNG) {
- 		if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
--			c->pix_fmt = PIX_FMT_RGBA;
-+			c->pix_fmt = AV_PIX_FMT_RGBA;
- 		}
- 	}
- 
-@@ -656,7 +656,7 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
- 
- 	current_frame = alloc_picture(c->pix_fmt, c->width, c->height);
- 
--	img_convert_ctx = sws_getContext(c->width, c->height, PIX_FMT_BGR32, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
-+	img_convert_ctx = sws_getContext(c->width, c->height, AV_PIX_FMT_BGR32, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
- 	                                 NULL, NULL, NULL);
- 	return st;
- }
-diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h
-index ed349e8..c6200f4 100644
---- a/source/blender/imbuf/intern/IMB_anim.h
-+++ b/source/blender/imbuf/intern/IMB_anim.h
-@@ -76,6 +76,9 @@
- #  include <libavformat/avformat.h>
- #  include <libavcodec/avcodec.h>
- #  include <libswscale/swscale.h>
-+#  include <libavfilter/avfilter.h>
-+#  include <libavfilter/buffersrc.h>
-+#  include <libavfilter/buffersink.h>
- #endif
- 
- #ifdef WITH_REDCODE
-@@ -179,6 +182,14 @@ struct anim {
- 	int64_t last_pts;
- 	int64_t next_pts;
- 	AVPacket next_packet;
-+
-+	AVFilterContext *buffersink_ctx;
-+	AVFilterContext *buffersrc_ctx;
-+	AVFilterGraph *filter_graph;
-+	AVFrame *filter_frame;
-+	int last_width;
-+	int last_height;
-+	enum AVPixelFormat last_pixfmt;
- #endif
- 
- #ifdef WITH_REDCODE
-diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
-index ffdecb7..9f36a6f 100644
---- a/source/blender/imbuf/intern/anim_movie.c
-+++ b/source/blender/imbuf/intern/anim_movie.c
-@@ -472,6 +472,10 @@ static int startffmpeg(struct anim *anim)
- 	const int *inv_table;
- #endif
- 
-+	anim->last_width = -1;
-+	anim->last_height = -1;
-+	anim->last_pixfmt = AV_PIX_FMT_NONE;
-+
- 	if (anim == NULL) return(-1);
- 
- 	streamcount = anim->streamindex;
-@@ -560,21 +564,21 @@ static int startffmpeg(struct anim *anim)
- 	anim->next_pts = -1;
- 	anim->next_packet.stream_index = -1;
- 
--	anim->pFrame = avcodec_alloc_frame();
-+	anim->pFrame = av_frame_alloc();
- 	anim->pFrameComplete = false;
--	anim->pFrameDeinterlaced = avcodec_alloc_frame();
--	anim->pFrameRGB = avcodec_alloc_frame();
-+	anim->pFrameDeinterlaced = av_frame_alloc();
-+	anim->pFrameRGB = av_frame_alloc();
- 
--	if (avpicture_get_size(PIX_FMT_RGBA, anim->x, anim->y) !=
-+	if (avpicture_get_size(AV_PIX_FMT_RGBA, anim->x, anim->y) !=
- 	    anim->x * anim->y * 4)
- 	{
- 		fprintf(stderr,
- 		        "ffmpeg has changed alloc scheme ... ARGHHH!\n");
- 		avcodec_close(anim->pCodecCtx);
- 		avformat_close_input(&anim->pFormatCtx);
--		av_free(anim->pFrameRGB);
--		av_free(anim->pFrameDeinterlaced);
--		av_free(anim->pFrame);
-+		av_frame_free(&anim->pFrameRGB);
-+		av_frame_free(&anim->pFrameDeinterlaced);
-+		av_frame_free(&anim->pFrame);
- 		anim->pCodecCtx = NULL;
- 		return -1;
- 	}
-@@ -604,7 +608,7 @@ static int startffmpeg(struct anim *anim)
- 	        anim->pCodecCtx->pix_fmt,
- 	        anim->x,
- 	        anim->y,
--	        PIX_FMT_RGBA,
-+	        AV_PIX_FMT_RGBA,
- 	        SWS_FAST_BILINEAR | SWS_PRINT_INFO | SWS_FULL_CHR_H_INT,
- 	        NULL, NULL, NULL);
- 		
-@@ -613,9 +617,9 @@ static int startffmpeg(struct anim *anim)
- 		        "Can't transform color space??? Bailing out...\n");
- 		avcodec_close(anim->pCodecCtx);
- 		avformat_close_input(&anim->pFormatCtx);
--		av_free(anim->pFrameRGB);
--		av_free(anim->pFrameDeinterlaced);
--		av_free(anim->pFrame);
-+		av_frame_free(&anim->pFrameRGB);
-+		av_frame_free(&anim->pFrameDeinterlaced);
-+		av_frame_free(&anim->pFrame);
- 		anim->pCodecCtx = NULL;
- 		return -1;
- 	}
-@@ -642,6 +646,74 @@ static int startffmpeg(struct anim *anim)
- 	return (0);
- }
- 
-+static void delete_filter_graph(struct anim *anim) {
-+    if (anim->filter_graph) {
-+        av_frame_free(&anim->filter_frame);
-+        avfilter_graph_free(&anim->filter_graph);
-+    }
-+}
-+
-+static int init_filter_graph(struct anim *anim, enum AVPixelFormat pixfmt, int width, int height) {
-+    AVFilterInOut *inputs = NULL, *outputs = NULL;
-+    char args[512];
-+    int res;
-+
-+    delete_filter_graph(anim);
-+    anim->filter_graph = avfilter_graph_alloc();
-+    snprintf(args, sizeof(args),
-+             "buffer=video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=0/1[in];"
-+             "[in]yadif[out];"
-+             "[out]buffersink",
-+             width, height, pixfmt);
-+    res = avfilter_graph_parse2(anim->filter_graph, args, &inputs, &outputs);
-+    if (res < 0)
-+        return res;
-+    if(inputs || outputs)
-+        return -1;
-+    res = avfilter_graph_config(anim->filter_graph, NULL);
-+    if (res < 0)
-+        return res;
-+
-+    anim->buffersrc_ctx = avfilter_graph_get_filter(anim->filter_graph, "Parsed_buffer_0");
-+    anim->buffersink_ctx = avfilter_graph_get_filter(anim->filter_graph, "Parsed_buffersink_2");
-+    if (!anim->buffersrc_ctx || !anim->buffersink_ctx)
-+        return -1;
-+    anim->filter_frame = av_frame_alloc();
-+    anim->last_width = width;
-+    anim->last_height = height;
-+    anim->last_pixfmt = pixfmt;
-+
-+    return 0;
-+}
-+
-+static int process_filter_graph(struct anim *anim, AVPicture *dst, const AVPicture *src,
-+                                enum AVPixelFormat pixfmt, int width, int height) {
-+    int res;
-+
-+    if (!anim->filter_graph || width != anim->last_width ||
-+        height != anim->last_height || pixfmt != anim->last_pixfmt) {
-+        res = init_filter_graph(anim, pixfmt, width, height);
-+        if (res < 0)
-+            return res;
-+    }
-+
-+    memcpy(anim->filter_frame->data, src->data, sizeof(src->data));
-+    memcpy(anim->filter_frame->linesize, src->linesize, sizeof(src->linesize));
-+    anim->filter_frame->width = width;
-+    anim->filter_frame->height = height;
-+    anim->filter_frame->format = pixfmt;
-+    res = av_buffersrc_add_frame(anim->buffersrc_ctx, anim->filter_frame);
-+    if (res < 0)
-+        return res;
-+    res = av_buffersink_get_frame(anim->buffersink_ctx, anim->filter_frame);
-+    if (res < 0)
-+        return res;
-+    av_picture_copy(dst, (const AVPicture *) anim->filter_frame, pixfmt, width, height);
-+    av_frame_unref(anim->filter_frame);
-+
-+    return 0;
-+}
-+
- /* postprocess the image in anim->pFrame and do color conversion
-  * and deinterlacing stuff.
-  *
-@@ -675,7 +747,8 @@ static void ffmpeg_postprocess(struct anim *anim)
- 
- 
- 	if (anim->ib_flags & IB_animdeinterlace) {
--		if (avpicture_deinterlace(
-+		if (process_filter_graph(
-+		        anim,
- 		        (AVPicture *)
- 		        anim->pFrameDeinterlaced,
- 		        (const AVPicture *)
-@@ -693,7 +766,7 @@ static void ffmpeg_postprocess(struct anim *anim)
- 	
- 	avpicture_fill((AVPicture *) anim->pFrameRGB,
- 	               (unsigned char *) ibuf->rect,
--	               PIX_FMT_RGBA, anim->x, anim->y);
-+	               AV_PIX_FMT_RGBA, anim->x, anim->y);
- 
- 	if (ENDIAN_ORDER == B_ENDIAN) {
- 		int *dstStride   = anim->pFrameRGB->linesize;
-@@ -1136,16 +1209,18 @@ static void free_anim_ffmpeg(struct anim *anim)
- {
- 	if (anim == NULL) return;
- 
-+	delete_filter_graph(anim);
-+
- 	if (anim->pCodecCtx) {
- 		avcodec_close(anim->pCodecCtx);
- 		avformat_close_input(&anim->pFormatCtx);
--		av_free(anim->pFrameRGB);
--		av_free(anim->pFrame);
-+		av_frame_free(&anim->pFrameRGB);
-+		av_frame_free(&anim->pFrame);
- 
- 		if (anim->ib_flags & IB_animdeinterlace) {
- 			MEM_freeN(anim->pFrameDeinterlaced->data[0]);
- 		}
--		av_free(anim->pFrameDeinterlaced);
-+		av_frame_free(&anim->pFrameDeinterlaced);
- 		sws_freeContext(anim->img_convert_ctx);
- 		IMB_freeImBuf(anim->last_frame);
- 		if (anim->next_packet.stream_index != -1) {
-diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
-index d028174..b12dde1 100644
---- a/source/blender/imbuf/intern/indexer.c
-+++ b/source/blender/imbuf/intern/indexer.c
-@@ -516,7 +516,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
- 		rv->c->pix_fmt = rv->codec->pix_fmts[0];
- 	}
- 	else {
--		rv->c->pix_fmt = PIX_FMT_YUVJ420P;
-+		rv->c->pix_fmt = AV_PIX_FMT_YUVJ420P;
- 	}
- 
- 	rv->c->sample_aspect_ratio =
-@@ -551,7 +551,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
- 	if (st->codec->width != width || st->codec->height != height ||
- 	    st->codec->pix_fmt != rv->c->pix_fmt)
- 	{
--		rv->frame = avcodec_alloc_frame();
-+		rv->frame = av_frame_alloc();
- 		avpicture_fill((AVPicture *) rv->frame,
- 		               MEM_mallocN(avpicture_get_size(
- 		                               rv->c->pix_fmt,
-@@ -672,7 +672,7 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx *ctx,
- 		sws_freeContext(ctx->sws_ctx);
- 
- 		MEM_freeN(ctx->frame->data[0]);
--		av_free(ctx->frame);
-+		av_frame_free(&ctx->frame);
- 	}
- 
- 	get_proxy_filename(ctx->anim, ctx->proxy_size, 
-@@ -902,7 +902,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
- 
- 	memset(&next_packet, 0, sizeof(AVPacket));
- 
--	in_frame = avcodec_alloc_frame();
-+	in_frame = av_frame_alloc();
- 
- 	stream_size = avio_size(context->iFormatCtx->pb);
- 
-@@ -970,7 +970,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
- 		} while (frame_finished);
- 	}
- 
--	av_free(in_frame);
-+	av_frame_free(&in_frame);
- 
- 	return 1;
- }
-diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
-index db76ba5..d188b88 100644
---- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
-+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
-@@ -79,11 +79,16 @@ m_isThreaded(false), m_isStreaming(false), m_stopThread(false), m_cacheStarted(f
- 	BLI_listbase_clear(&m_frameCacheBase);
- 	BLI_listbase_clear(&m_packetCacheFree);
- 	BLI_listbase_clear(&m_packetCacheBase);
-+	last_width = -1;
-+	last_height = -1;
-+	last_pixfmt = AV_PIX_FMT_NONE;
-+
- }
- 
- // destructor
- VideoFFmpeg::~VideoFFmpeg () 
- {
-+	delete_filter_graph(this);
- }
- 
- void VideoFFmpeg::refresh(void)
-@@ -140,23 +145,23 @@ bool VideoFFmpeg::release()
- AVFrame	*VideoFFmpeg::allocFrameRGB()
- {
- 	AVFrame *frame;
--	frame = avcodec_alloc_frame();
-+	frame = av_frame_alloc();
- 	if (m_format == RGBA32)
- 	{
- 		avpicture_fill((AVPicture*)frame, 
- 			(uint8_t*)MEM_callocN(avpicture_get_size(
--				PIX_FMT_RGBA,
-+				AV_PIX_FMT_RGBA,
- 				m_codecCtx->width, m_codecCtx->height),
- 				"ffmpeg rgba"),
--			PIX_FMT_RGBA, m_codecCtx->width, m_codecCtx->height);
-+			AV_PIX_FMT_RGBA, m_codecCtx->width, m_codecCtx->height);
- 	} else 
- 	{
- 		avpicture_fill((AVPicture*)frame, 
- 			(uint8_t*)MEM_callocN(avpicture_get_size(
--				PIX_FMT_RGB24,
-+				AV_PIX_FMT_RGB24,
- 				m_codecCtx->width, m_codecCtx->height),
- 				"ffmpeg rgb"),
--			PIX_FMT_RGB24, m_codecCtx->width, m_codecCtx->height);
-+			AV_PIX_FMT_RGB24, m_codecCtx->width, m_codecCtx->height);
- 	}
- 	return frame;
- }
-@@ -236,8 +241,8 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
- 	m_codecCtx = codecCtx;
- 	m_formatCtx = formatCtx;
- 	m_videoStream = videoStream;
--	m_frame = avcodec_alloc_frame();
--	m_frameDeinterlaced = avcodec_alloc_frame();
-+	m_frame = av_frame_alloc();
-+	m_frameDeinterlaced = av_frame_alloc();
- 
- 	// allocate buffer if deinterlacing is required
- 	avpicture_fill((AVPicture*)m_frameDeinterlaced, 
-@@ -248,10 +253,10 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
- 		m_codecCtx->pix_fmt, m_codecCtx->width, m_codecCtx->height);
- 
- 	// check if the pixel format supports Alpha
--	if (m_codecCtx->pix_fmt == PIX_FMT_RGB32 ||
--		m_codecCtx->pix_fmt == PIX_FMT_BGR32 ||
--		m_codecCtx->pix_fmt == PIX_FMT_RGB32_1 ||
--		m_codecCtx->pix_fmt == PIX_FMT_BGR32_1) 
-+	if (m_codecCtx->pix_fmt == AV_PIX_FMT_RGB32 ||
-+		m_codecCtx->pix_fmt == AV_PIX_FMT_BGR32 ||
-+		m_codecCtx->pix_fmt == AV_PIX_FMT_RGB32_1 ||
-+		m_codecCtx->pix_fmt == AV_PIX_FMT_BGR32_1)
- 	{
- 		// allocate buffer to store final decoded frame
- 		m_format = RGBA32;
-@@ -262,7 +267,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
- 			m_codecCtx->pix_fmt,
- 			m_codecCtx->width,
- 			m_codecCtx->height,
--			PIX_FMT_RGBA,
-+			AV_PIX_FMT_RGBA,
- 			SWS_FAST_BILINEAR,
- 			NULL, NULL, NULL);
- 	} else
-@@ -276,7 +281,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
- 			m_codecCtx->pix_fmt,
- 			m_codecCtx->width,
- 			m_codecCtx->height,
--			PIX_FMT_RGB24,
-+			AV_PIX_FMT_RGB24,
- 			SWS_FAST_BILINEAR,
- 			NULL, NULL, NULL);
- 	}
-@@ -293,13 +298,81 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
- 		av_free(m_frameDeinterlaced);
- 		m_frameDeinterlaced = NULL;
- 		MEM_freeN(m_frameRGB->data[0]);
--		av_free(m_frameRGB);
-+		av_frame_free(&m_frameRGB);
- 		m_frameRGB = NULL;
- 		return -1;
- 	}
- 	return 0;
- }
- 
-+void VideoFFmpeg::delete_filter_graph(VideoFFmpeg* video) {
-+    if (video->filter_graph) {
-+        av_frame_free(&video->filter_frame);
-+        avfilter_graph_free(&video->filter_graph);
-+    }
-+}
-+
-+int VideoFFmpeg::init_filter_graph(VideoFFmpeg* video, enum AVPixelFormat pixfmt, int width, int height) {
-+    AVFilterInOut *inputs = NULL, *outputs = NULL;
-+    char args[512];
-+    int res;
-+
-+    delete_filter_graph(video);
-+    video->filter_graph = avfilter_graph_alloc();
-+    snprintf(args, sizeof(args),
-+             "buffer=video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=0/1[in];"
-+             "[in]yadif[out];"
-+             "[out]buffersink",
-+             width, height, pixfmt);
-+    res = avfilter_graph_parse2(video->filter_graph, args, &inputs, &outputs);
-+    if (res < 0)
-+        return res;
-+    if(inputs || outputs)
-+        return -1;
-+    res = avfilter_graph_config(video->filter_graph, NULL);
-+    if (res < 0)
-+        return res;
-+
-+    video->buffersrc_ctx = avfilter_graph_get_filter(video->filter_graph, "Parsed_buffer_0");
-+    video->buffersink_ctx = avfilter_graph_get_filter(video->filter_graph, "Parsed_buffersink_2");
-+    if (!video->buffersrc_ctx || !video->buffersink_ctx)
-+        return -1;
-+    video->filter_frame = av_frame_alloc();
-+    video->last_width = width;
-+    video->last_height = height;
-+    video->last_pixfmt = pixfmt;
-+
-+    return 0;
-+}
-+
-+int VideoFFmpeg::process_filter_graph(VideoFFmpeg* video, AVPicture *dst, const AVPicture *src,
-+                                      enum AVPixelFormat pixfmt, int width, int height) {
-+    int res;
-+
-+    if (!video->filter_graph || width != video->last_width ||
-+        height != video->last_height || pixfmt != video->last_pixfmt) {
-+        res = init_filter_graph(video, pixfmt, width, height);
-+        if (res < 0)
-+            return res;
-+    }
-+
-+    memcpy(video->filter_frame->data, src->data, sizeof(src->data));
-+    memcpy(video->filter_frame->linesize, src->linesize, sizeof(src->linesize));
-+    video->filter_frame->width = width;
-+    video->filter_frame->height = height;
-+    video->filter_frame->format = pixfmt;
-+    res = av_buffersrc_add_frame(video->buffersrc_ctx, video->filter_frame);
-+    if (res < 0)
-+        return res;
-+    res = av_buffersink_get_frame(video->buffersink_ctx, video->filter_frame);
-+    if (res < 0)
-+        return res;
-+    av_picture_copy(dst, (const AVPicture *) video->filter_frame, pixfmt, width, height);
-+    av_frame_unref(video->filter_frame);
-+
-+    return 0;
-+}
-+
- /*
-  * This thread is used to load video frame asynchronously.
-  * It provides a frame caching service. 
-@@ -392,7 +465,7 @@ void *VideoFFmpeg::cacheThread(void *data)
- 					{
- 						if (video->m_deinterlace) 
- 						{
--							if (avpicture_deinterlace(
-+							if (process_filter_graph(video,
- 								(AVPicture*) video->m_frameDeinterlaced,
- 								(const AVPicture*) video->m_frame,
- 								video->m_codecCtx->pix_fmt,
-@@ -486,14 +559,14 @@ void VideoFFmpeg::stopCache()
- 		{
- 			BLI_remlink(&m_frameCacheBase, frame);
- 			MEM_freeN(frame->frame->data[0]);
--			av_free(frame->frame);
-+			av_frame_free(&frame->frame);
- 			delete frame;
- 		}
- 		while ((frame = (CacheFrame *)m_frameCacheFree.first) != NULL)
- 		{
- 			BLI_remlink(&m_frameCacheFree, frame);
- 			MEM_freeN(frame->frame->data[0]);
--			av_free(frame->frame);
-+			av_frame_free(&frame->frame);
- 			delete frame;
- 		}
- 		while ((packet = (CachePacket *)m_packetCacheBase.first) != NULL)
-@@ -1062,7 +1135,7 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
- 
- 				if (m_deinterlace) 
- 				{
--					if (avpicture_deinterlace(
-+					if (process_filter_graph(this,
- 						(AVPicture*) m_frameDeinterlaced,
- 						(const AVPicture*) m_frame,
- 						m_codecCtx->pix_fmt,
-diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h
-index 4834a7c..b62888a 100644
---- a/source/gameengine/VideoTexture/VideoFFmpeg.h
-+++ b/source/gameengine/VideoTexture/VideoFFmpeg.h
-@@ -39,6 +39,9 @@
- extern "C" {
- #include <pthread.h>
- #include "ffmpeg_compat.h"
-+#include <libavfilter/avfilter.h>
-+#include <libavfilter/buffersrc.h>
-+#include <libavfilter/buffersink.h>
- #include "DNA_listBase.h"
- #include "BLI_threads.h"
- #include "BLI_blenlib.h"
-@@ -207,6 +210,18 @@ private:
- 
- 	AVFrame	*allocFrameRGB();
- 	static void *cacheThread(void *);
-+
-+	AVFilterContext *buffersink_ctx;
-+	AVFilterContext *buffersrc_ctx;
-+	AVFilterGraph *filter_graph;
-+	AVFrame *filter_frame;
-+	int last_width;
-+	int last_height;
-+	enum AVPixelFormat last_pixfmt;
-+
-+	static void delete_filter_graph(VideoFFmpeg* video);
-+	static int init_filter_graph(VideoFFmpeg* video, enum AVPixelFormat pixfmt, int width, int height);
-+	static int process_filter_graph(VideoFFmpeg* video, AVPicture *dst, const AVPicture *src, enum AVPixelFormat pixfmt, int width, int height);
- };
- 
- inline VideoFFmpeg *getFFmpeg(PyImage *self)

-- 
blender packaging



More information about the pkg-multimedia-commits mailing list