diff options
author | ace20022 <ace20022@ymail.com> | 2016-02-04 15:06:11 +0100 |
---|---|---|
committer | ace20022 <ace20022@ymail.com> | 2016-02-05 13:59:13 +0100 |
commit | d44338baf1f6d1e6b76cd7dbab6453d76cc2ac31 (patch) | |
tree | 8924ced73de3415c8560f528130d82412f69dc36 | |
parent | e95c344be86287e149f5905e41255b0b9e79fdd8 (diff) |
[guilib][depends] Remove libgif from core. It's still needed for TexturePacker.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Kodi.xcodeproj/project.pbxproj | 10 | ||||
-rw-r--r-- | configure.ac | 39 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj | 3 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj.filters | 9 | ||||
-rw-r--r-- | tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj | 4 | ||||
-rw-r--r-- | tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj.filters | 8 | ||||
-rw-r--r-- | tools/depends/target/Makefile | 2 | ||||
-rw-r--r-- | tools/depends/target/giflib/01-android.patch | 18 | ||||
-rw-r--r-- | tools/depends/target/giflib/Makefile | 48 | ||||
-rw-r--r-- | xbmc/DllPaths_generated.h.in | 1 | ||||
-rw-r--r-- | xbmc/DllPaths_generated_android.h.in | 1 | ||||
-rw-r--r-- | xbmc/DllPaths_win32.h | 1 | ||||
-rw-r--r-- | xbmc/guilib/DllLibGif.h | 195 | ||||
-rw-r--r-- | xbmc/guilib/Gif.cpp | 679 | ||||
-rw-r--r-- | xbmc/guilib/Gif.h | 120 | ||||
-rw-r--r-- | xbmc/guilib/Makefile.in | 6 | ||||
-rw-r--r-- | xbmc/guilib/TextureManager.cpp | 3 | ||||
-rw-r--r-- | xbmc/guilib/imagefactory.cpp | 8 | ||||
-rw-r--r-- | xbmc/system.h | 5 |
20 files changed, 4 insertions, 1157 deletions
diff --git a/.gitignore b/.gitignore index 76ff243427..18ccaf3483 100644 --- a/.gitignore +++ b/.gitignore @@ -270,7 +270,6 @@ lib/cpluff/stamp-h1 /system/libexif.dll /system/libexpat.dll /system/libidn-11.dll -/system/libgif.dll /system/libssh2.dll /system/libssl32.dll /system/ssh.dll diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj index 989f06e4fb..8d92d3bb8f 100644 --- a/Kodi.xcodeproj/project.pbxproj +++ b/Kodi.xcodeproj/project.pbxproj @@ -728,8 +728,6 @@ DF2345E415FA639500A934F6 /* UPnPServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2345DF15FA639500A934F6 /* UPnPServer.cpp */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP -I$SRCROOT/lib/libUPnP/Neptune/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer"; }; }; DF2401261B41A26F001E02DA /* ImageResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2401241B41A26E001E02DA /* ImageResource.cpp */; }; DF2401271B41A26F001E02DA /* ImageResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2401241B41A26E001E02DA /* ImageResource.cpp */; }; - DF2863B719918B07008994AB /* Gif.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2863B519918B07008994AB /* Gif.cpp */; }; - DF2863B819918B07008994AB /* Gif.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF2863B519918B07008994AB /* Gif.cpp */; }; DF28DF4D17B8379E0077F41A /* ProfilesOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF28DF4B17B8379E0077F41A /* ProfilesOperations.cpp */; }; DF28DF4E17B8379E0077F41A /* ProfilesOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF28DF4B17B8379E0077F41A /* ProfilesOperations.cpp */; }; DF28EDA2170E1A11005FA9D2 /* GUIDialogLockSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF28ED94170E1A11005FA9D2 /* GUIDialogLockSettings.cpp */; }; @@ -3521,9 +3519,6 @@ DF2345E015FA639500A934F6 /* UPnPServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPServer.h; sourceTree = "<group>"; }; DF2401241B41A26E001E02DA /* ImageResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageResource.cpp; sourceTree = "<group>"; }; DF2401251B41A26E001E02DA /* ImageResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageResource.h; sourceTree = "<group>"; }; - DF2863B419918B07008994AB /* DllLibGif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DllLibGif.h; sourceTree = "<group>"; }; - DF2863B519918B07008994AB /* Gif.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Gif.cpp; sourceTree = "<group>"; }; - DF2863B619918B07008994AB /* Gif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gif.h; sourceTree = "<group>"; }; DF28DF4B17B8379E0077F41A /* ProfilesOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProfilesOperations.cpp; sourceTree = "<group>"; }; DF28DF4C17B8379E0077F41A /* ProfilesOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProfilesOperations.h; sourceTree = "<group>"; }; DF28ED94170E1A11005FA9D2 /* GUIDialogLockSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogLockSettings.cpp; sourceTree = "<group>"; }; @@ -4999,14 +4994,11 @@ F558F27A13ABD56600631E12 /* DirtyRegionSolvers.h */, F558F27D13ABD57400631E12 /* DirtyRegionTracker.cpp */, F558F27E13ABD57400631E12 /* DirtyRegionTracker.h */, - DF2863B419918B07008994AB /* DllLibGif.h */, 39C38CDF1BCD600E000F59F5 /* FFmpegImage.cpp */, 39C38CE01BCD600E000F59F5 /* FFmpegImage.h */, 18B7C7591294222E009E7A26 /* FrameBufferObject.cpp */, 18B7C6FB1294222D009E7A26 /* FrameBufferObject.h */, 18B7C6FC1294222D009E7A26 /* Geometry.h */, - DF2863B519918B07008994AB /* Gif.cpp */, - DF2863B619918B07008994AB /* Gif.h */, 18B7C75A1294222E009E7A26 /* GraphicContext.cpp */, 18B7C6FD1294222D009E7A26 /* GraphicContext.h */, 18B7C6FE1294222D009E7A26 /* gui3d.h */, @@ -10203,7 +10195,6 @@ 7CF34D9F1930264A00D543C5 /* AudioEncoder.cpp in Sources */, 7C973CFA1B5038580002A874 /* GUIDialogAudioDSPManager.cpp in Sources */, 7CF80DC919710DC2003B2B34 /* KeyboardLayout.cpp in Sources */, - DF2863B719918B07008994AB /* Gif.cpp in Sources */, B179BD6B1AD8EA7B00EA8D49 /* InputCodingTableBaiduPY.cpp in Sources */, DFD7173B1C09FEC60025D964 /* OSXGNUReplacements.c in Sources */, B179BD6E1AD8EA7B00EA8D49 /* InputCodingTableBasePY.cpp in Sources */, @@ -11273,7 +11264,6 @@ 7CF34DA01930264A00D543C5 /* AudioEncoder.cpp in Sources */, 395C29F71A98B44B00EBC7AD /* AddonModuleXbmcwsgi.cpp in Sources */, 7CF80DCA19710DC2003B2B34 /* KeyboardLayout.cpp in Sources */, - DF2863B819918B07008994AB /* Gif.cpp in Sources */, B179BD6C1AD8EA7B00EA8D49 /* InputCodingTableBaiduPY.cpp in Sources */, B179BD6F1AD8EA7B00EA8D49 /* InputCodingTableBasePY.cpp in Sources */, B179BD721AD8EA7B00EA8D49 /* InputCodingTableFactory.cpp in Sources */, diff --git a/configure.ac b/configure.ac index 3c469097b5..c2170297d5 100644 --- a/configure.ac +++ b/configure.ac @@ -194,8 +194,6 @@ librtmp_not_found="== Could not find libRTMP. RTMP support disabled. ==" librtmp_disabled="== RTMP support disabled. ==" libnfs_not_found="== Could not find libnfs. NFS client support disabled. ==" libnfs_disabled="== NFS support disabled. ==" -libgif_not_found="== Could not find libgif. libgif support disabled. ==" -libgif_disabled="== libgif support disabled. ==" libshairplay_not_found="== Could not find libshairplay. ==" samba_disabled="== SAMBA support disabled. ==" libplist_not_found="== Could not find libplist. AirPlay support disabled. ==" @@ -360,12 +358,6 @@ AC_ARG_ENABLE([nfs], [use_libnfs=$enableval], [use_libnfs=auto]) -AC_ARG_ENABLE([gif], - [AS_HELP_STRING([--enable-gif], - [enable gif support via libgif (default is auto)])], - [use_libgif=$enableval], - [use_libgif=auto]) - AC_ARG_ENABLE([airplay], [AS_HELP_STRING([--enable-airplay], [enable AirPlay support(default is auto)])], @@ -1394,30 +1386,6 @@ else AC_MSG_NOTICE($libnfs_disabled) fi -# libgif -if test "$use_libgif" != "no"; then - AC_CHECK_HEADERS([gif_lib.h],, - [if test "$use_libgif" = "yes"; then - AC_MSG_ERROR($libgif_not_found) - USE_LIBGIF=0 - elif test "$use_libgif" != "no"; then - AC_MSG_NOTICE($libgif_not_found) - use_libgif="no" - USE_LIBGIF=0 - fi - ]) - if test "$use_libgif" != "no"; then - XB_FIND_SONAME([GIF], [gif], [use_libgif]) - fi - if test "$use_libgif" != "no"; then - AC_DEFINE([HAVE_LIBGIF], [1], [Whether to use libgif library.]) - USE_LIBGIF=1 - fi -else - USE_LIBGIF=0 - AC_MSG_NOTICE($libgif_disabled) -fi - # libplist for airplay feature USE_AIRPLAY=0 if test "$use_airplay" != "no"; then @@ -2176,12 +2144,6 @@ else final_message="$final_message\n libnfs client support:No" fi -if test "$use_libgif" != "no"; then - final_message="$final_message\n libgif support:\tYes" -else - final_message="$final_message\n libgif support:\tNo" -fi - if test "$use_airplay" != "no"; then final_message="$final_message\n AirPlay support:\tYes" else @@ -2421,7 +2383,6 @@ AC_SUBST(USE_VDPAU) AC_SUBST(USE_VAAPI) AC_SUBST(USE_LIBSMBCLIENT) AC_SUBST(USE_LIBNFS) -AC_SUBST(USE_LIBGIF) AC_SUBST(USE_AIRPLAY) AC_SUBST(USE_OPENMAX) AC_SUBST(USE_PULSE) diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 39af01c554..4ab45701cd 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -451,7 +451,6 @@ <ClCompile Include="..\..\xbmc\guilib\DirtyRegionSolvers.cpp" /> <ClCompile Include="..\..\xbmc\guilib\DirtyRegionTracker.cpp" /> <ClCompile Include="..\..\xbmc\guilib\FFmpegImage.cpp" /> - <ClCompile Include="..\..\xbmc\guilib\Gif.cpp" /> <ClCompile Include="..\..\xbmc\guilib\GraphicContext.cpp" /> <ClCompile Include="..\..\xbmc\guilib\GUIAction.cpp" /> <ClCompile Include="..\..\xbmc\guilib\GUIAudioManager.cpp" /> @@ -1006,7 +1005,6 @@ <ClInclude Include="..\..\xbmc\guiinfo\GUIInfoLabels.h" /> <ClInclude Include="..\..\xbmc\guilib\DispResource.h" /> <ClInclude Include="..\..\xbmc\guilib\FFmpegImage.h" /> - <ClInclude Include="..\..\xbmc\guilib\Gif.h" /> <ClInclude Include="..\..\xbmc\guilib\GUIKeyboard.h" /> <ClInclude Include="..\..\xbmc\guilib\GUIKeyboardFactory.h" /> <ClInclude Include="..\..\xbmc\guilib\GUIShaderDX.h" /> @@ -1859,7 +1857,6 @@ <ClInclude Include="..\..\xbmc\guilib\DirtyRegion.h" /> <ClInclude Include="..\..\xbmc\guilib\DirtyRegionSolvers.h" /> <ClInclude Include="..\..\xbmc\guilib\DirtyRegionTracker.h" /> - <ClInclude Include="..\..\xbmc\guilib\DllLibGif.h" /> <ClInclude Include="..\..\xbmc\guilib\Geometry.h" /> <ClInclude Include="..\..\xbmc\guilib\GraphicContext.h" /> <ClInclude Include="..\..\xbmc\guilib\gui3d.h" /> diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index f1af3e75f8..7f2f934938 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -3093,9 +3093,6 @@ <ClCompile Include="..\..\xbmc\video\jobs\VideoLibraryRefreshingJob.cpp"> <Filter>video\jobs</Filter> </ClCompile> - <ClCompile Include="..\..\xbmc\guilib\Gif.cpp"> - <Filter>guilib</Filter> - </ClCompile> <ClCompile Include="..\..\xbmc\messaging\helpers\DialogHelper.cpp"> <Filter>messaging\helpers</Filter> </ClCompile> @@ -4760,9 +4757,6 @@ <ClInclude Include="..\..\xbmc\guilib\DirtyRegionTracker.h"> <Filter>guilib</Filter> </ClInclude> - <ClInclude Include="..\..\xbmc\guilib\DllLibGif.h"> - <Filter>guilib</Filter> - </ClInclude> <ClInclude Include="..\..\xbmc\guilib\DirtyRegion.h"> <Filter>guilib</Filter> </ClInclude> @@ -6112,9 +6106,6 @@ <ClInclude Include="..\..\xbmc\utils\win32\memcpy_sse2.h"> <Filter>utils\win32</Filter> </ClInclude> - <ClInclude Include="..\..\xbmc\guilib\Gif.h"> - <Filter>guilib</Filter> - </ClInclude> <ClInclude Include="..\..\xbmc\messaging\helpers\DialogHelper.h"> <Filter>messaging\helpers</Filter> </ClInclude> diff --git a/tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj b/tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj index 4c6af51ed2..118141f0e5 100644 --- a/tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj +++ b/tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj @@ -118,11 +118,9 @@ <ClInclude Include="..\decoder\IDecoder.h" />
<ClInclude Include="..\decoder\JPGDecoder.h" />
<ClInclude Include="..\decoder\PNGDecoder.h" />
- <ClInclude Include="..\Gif.h" />
<ClInclude Include="..\rgbaimage.h" />
<ClInclude Include="dirent.h" />
<ClInclude Include="..\md5.h" />
- <ClInclude Include="..\SDL_anigif.h" />
<ClInclude Include="..\..\..\..\..\..\xbmc\guilib\XBTF.h" />
<ClInclude Include="..\XBTFWriter.h" />
</ItemGroup>
@@ -135,4 +133,4 @@ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
\ No newline at end of file +</Project>
diff --git a/tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj.filters b/tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj.filters index 2fd8f28e89..0d9ffaaff5 100644 --- a/tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj.filters +++ b/tools/depends/native/TexturePacker/src/Win32/TexturePacker.vcxproj.filters @@ -59,18 +59,12 @@ <ClInclude Include="..\md5.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\SDL_anigif.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="..\..\..\..\..\..\xbmc\guilib\XBTF.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\XBTFWriter.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="..\Gif.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="..\rgbaimage.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -101,4 +95,4 @@ <Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
-</Project>
\ No newline at end of file +</Project>
diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile index fd8ab37bb6..8226bd1d36 100644 --- a/tools/depends/target/Makefile +++ b/tools/depends/target/Makefile @@ -16,7 +16,7 @@ DEPENDS = \ libplist libcec libbluray tinyxml dummy-libxbmc \ libamplayer libssh taglib libusb libnfs \ pythonmodule-pil pythonmodule-setuptools \ - libxslt ffmpeg platform crossguid libdcadec giflib + libxslt ffmpeg platform crossguid libdcadec FFMPEG_DEPENDS = gnutls libdcadec diff --git a/tools/depends/target/giflib/01-android.patch b/tools/depends/target/giflib/01-android.patch deleted file mode 100644 index 2f3a61cab8..0000000000 --- a/tools/depends/target/giflib/01-android.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- lib/egif_lib.c Thu Aug 29 19:56:40 2013 -+++ lib/egif_libnew.c Thu Mar 13 10:08:38 2014 -@@ -22,6 +22,15 @@ - #endif /* _WIN32 */ - #include <sys/stat.h> - -+#if defined(ANDROID) -+#if !defined(S_IREAD) -+#define S_IREAD S_IRUSR -+#endif -+#if !defined(S_IWRITE) -+#define S_IWRITE S_IWUSR -+#endif -+#endif -+ - #include "gif_lib.h" - #include "gif_lib_private.h" - diff --git a/tools/depends/target/giflib/Makefile b/tools/depends/target/giflib/Makefile deleted file mode 100644 index b2977af0c0..0000000000 --- a/tools/depends/target/giflib/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -include ../../Makefile.include -DEPS= ../../Makefile.include Makefile - -# lib name, version -LIBNAME=giflib -VERSION=5.1.0 -SOURCE=$(LIBNAME)-$(VERSION) -ARCHIVE=$(SOURCE).tar.bz2 - -# configuration settings -CONFIGURE=./configure --prefix=$(PREFIX) - -LIBDYLIB=$(PLATFORM)/lib/.libs/$(LIBNAME).a - -CLEAN_FILES=$(ARCHIVE) $(PLATFORM) - -all: .installed-$(PLATFORM) - -$(TARBALLS_LOCATION)/$(ARCHIVE): - cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE) - -$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - -rm -rf $(PLATFORM); mkdir -p $(PLATFORM) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) -ifeq ($(OS),android) - cd $(PLATFORM); patch -p0 < ../01-android.patch -endif - cd $(PLATFORM); $(CONFIGURE) - -$(LIBDYLIB): $(PLATFORM) - $(MAKE) -C $(PLATFORM) - -.installed-$(PLATFORM): $(LIBDYLIB) - $(MAKE) -C $(PLATFORM) install -ifeq ($(OS),android) - rm -f $(PREFIX)/lib/libgif.la $(PREFIX)/lib/libgif.so $(PREFIX)/lib/libgif.so.7 - mv -f $(PREFIX)/lib/libgif.so.7.0.0 $(PREFIX)/lib/libgif.so - $(RPL) -e "libgif.so.7" "libgif.so\x00\x00" $(PREFIX)/lib/libgif.so - -$(READELF) --dynamic $(PREFIX)/lib/libgif.so | grep ibrary -endif - touch $@ -clean: - $(MAKE) -C $(PLATFORM) clean - rm -r .installed-$(PLATFORM) - rm -rf $(PLATFORM) - -distclean:: - rm -rf $(PLATFORM) .installed-$(PLATFORM) diff --git a/xbmc/DllPaths_generated.h.in b/xbmc/DllPaths_generated.h.in index fe8c00e315..4e7b74b13f 100644 --- a/xbmc/DllPaths_generated.h.in +++ b/xbmc/DllPaths_generated.h.in @@ -30,7 +30,6 @@ #define DLL_PATH_LIBRTMP "@RTMP_SONAME@" #define DLL_PATH_LIBNFS "@NFS_SONAME@" -#define DLL_PATH_LIBGIF "@GIF_SONAME@" #define DLL_PATH_LIBPLIST "@PLIST_SONAME@" #define DLL_PATH_LIBSHAIRPLAY "@SHAIRPLAY_SONAME@" diff --git a/xbmc/DllPaths_generated_android.h.in b/xbmc/DllPaths_generated_android.h.in index 35b200acda..16d78e3f4e 100644 --- a/xbmc/DllPaths_generated_android.h.in +++ b/xbmc/DllPaths_generated_android.h.in @@ -32,7 +32,6 @@ #define DLL_PATH_LIBRTMP "@RTMP_SONAME@" #define DLL_PATH_LIBNFS "@NFS_SONAME@" -#define DLL_PATH_LIBGIF "@GIF_SONAME@" #define DLL_PATH_LIBPLIST "@PLIST_SONAME@" #define DLL_PATH_LIBSHAIRPLAY "@SHAIRPLAY_SONAME@" #define DLL_PATH_LIBCEC "@LIBCEC_SONAME@" diff --git a/xbmc/DllPaths_win32.h b/xbmc/DllPaths_win32.h index be1148d2f5..ec3c3467ea 100644 --- a/xbmc/DllPaths_win32.h +++ b/xbmc/DllPaths_win32.h @@ -24,7 +24,6 @@ /* libraries */ #define DLL_PATH_CPLUFF "special://xbmcbin/system/cpluff.dll" #define DLL_PATH_LIBEXIF "special://xbmcbin/system/libexif.dll" -#define DLL_PATH_LIBGIF "special://xbmcbin/system/libgif.dll" #define DLL_PATH_LIBCURL "special://xbmcbin/system/libcurl.dll" #define DLL_PATH_LIBNFS "special://xbmcbin/system/libnfs.dll" #define DLL_PATH_LIBPLIST "special://xbmcbin/system/airplay/libplist.dll" diff --git a/xbmc/guilib/DllLibGif.h b/xbmc/guilib/DllLibGif.h deleted file mode 100644 index e082f697db..0000000000 --- a/xbmc/guilib/DllLibGif.h +++ /dev/null @@ -1,195 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2014 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include <gif_lib.h> -#include "DynamicDll.h" -#ifndef CONTINUE_EXT_FUNC_CODE -#define CONTINUE_EXT_FUNC_CODE 0 -#endif - -#ifndef DISPOSAL_UNSPECIFIED -#define DISPOSAL_UNSPECIFIED 0 -#endif - -#ifndef DISPOSE_DO_NOT -#define DISPOSE_DO_NOT 1 -#endif - -#ifndef DISPOSE_BACKGROUND -#define DISPOSE_BACKGROUND 2 -#endif - -#ifndef DISPOSE_PREVIOUS -#define DISPOSE_PREVIOUS 3 -#endif - -class DllLibGifInterface -{ -public: - virtual ~DllLibGifInterface() {} -#if GIFLIB_MAJOR == 5 - virtual const char* GifErrorString(int ErrorCode) = 0; - virtual GifFileType* DGifOpenFileName(const char *GifFileName, int *Error) = 0; - virtual GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error) = 0; - virtual int DGifSavedExtensionToGCB(GifFileType *GifFile, int ImageIndex, GraphicsControlBlock *GCB) = 0; -#if GIFLIB_MINOR >= 1 - virtual int DGifCloseFile(GifFileType* GifFile, int *Error)=0; -#else - virtual int DGifCloseFile(GifFileType* GifFile) = 0; -#endif -#else - virtual GifFileType* DGifOpenFileName(const char *GifFileName) = 0; - virtual GifFileType *DGifOpen(void *userPtr, InputFunc readFunc)=0; - virtual int DGifGetExtension(GifFileType * GifFile, int *GifExtCode, GifByteType ** GifExtension) = 0; - virtual int DGifGetExtensionNext(GifFileType * GifFile, GifByteType ** GifExtension) = 0; - virtual int DGifCloseFile(GifFileType* GifFile)=0; -#endif - virtual int DGifSlurp(GifFileType* GifFile)=0; -}; - -class DllLibGif : public DllDynamic, DllLibGifInterface -{ - DECLARE_DLL_WRAPPER(DllLibGif, DLL_PATH_LIBGIF) - -#if GIFLIB_MAJOR == 5 - DEFINE_METHOD1(const char*, GifErrorString, (int p1)) - DEFINE_METHOD2(GifFileType*, DGifOpenFileName, (const char *p1, int *p2)) - DEFINE_METHOD3(GifFileType*, DGifOpen, (void *p1, InputFunc p2, int *p3)) - DEFINE_METHOD3(int, DGifSavedExtensionToGCB, (GifFileType *p1, int p2, GraphicsControlBlock *p3)) -#if GIFLIB_MINOR >= 1 - DEFINE_METHOD2(int, DGifCloseFile, (GifFileType* p1, int *p2)) -#else - DEFINE_METHOD1(int, DGifCloseFile, (GifFileType* p1)) -#endif -#else - DEFINE_METHOD0(int, GifLastError) - DEFINE_METHOD1(GifFileType*, DGifOpenFileName, (const char *p1)) - DEFINE_METHOD2(GifFileType*, DGifOpen, (void *p1, InputFunc p2)) - DEFINE_METHOD3(int, DGifGetExtension, (GifFileType *p1, int *p2, GifByteType **p3)) - DEFINE_METHOD2(int, DGifGetExtensionNext, (GifFileType *p1, GifByteType **p2)) - DEFINE_METHOD1(int, DGifCloseFile, (GifFileType* p1)) -#endif - DEFINE_METHOD1(int, DGifSlurp, (GifFileType* p1)) - BEGIN_METHOD_RESOLVE() - RESOLVE_METHOD(DGifOpenFileName) - RESOLVE_METHOD(DGifOpen) - RESOLVE_METHOD(DGifCloseFile) - RESOLVE_METHOD(DGifSlurp) -#if GIFLIB_MAJOR == 5 - RESOLVE_METHOD(DGifSavedExtensionToGCB) - RESOLVE_METHOD(GifErrorString) -#else - RESOLVE_METHOD(GifLastError) - RESOLVE_METHOD(DGifGetExtension) - RESOLVE_METHOD(DGifGetExtensionNext) -#endif - END_METHOD_RESOLVE() - -#if GIFLIB_MAJOR != 5 -public: - /* - taken from giflib 5.1.0 - */ - const char* GifErrorString(int ErrorCode) - { - const char *Err; - - switch (ErrorCode) { - case E_GIF_ERR_OPEN_FAILED: - Err = "Failed to open given file"; - break; - case E_GIF_ERR_WRITE_FAILED: - Err = "Failed to write to given file"; - break; - case E_GIF_ERR_HAS_SCRN_DSCR: - Err = "Screen descriptor has already been set"; - break; - case E_GIF_ERR_HAS_IMAG_DSCR: - Err = "Image descriptor is still active"; - break; - case E_GIF_ERR_NO_COLOR_MAP: - Err = "Neither global nor local color map"; - break; - case E_GIF_ERR_DATA_TOO_BIG: - Err = "Number of pixels bigger than width * height"; - break; - case E_GIF_ERR_NOT_ENOUGH_MEM: - Err = "Failed to allocate required memory"; - break; - case E_GIF_ERR_DISK_IS_FULL: - Err = "Write failed (disk full?)"; - break; - case E_GIF_ERR_CLOSE_FAILED: - Err = "Failed to close given file"; - break; - case E_GIF_ERR_NOT_WRITEABLE: - Err = "Given file was not opened for write"; - break; - case D_GIF_ERR_OPEN_FAILED: - Err = "Failed to open given file"; - break; - case D_GIF_ERR_READ_FAILED: - Err = "Failed to read from given file"; - break; - case D_GIF_ERR_NOT_GIF_FILE: - Err = "Data is not in GIF format"; - break; - case D_GIF_ERR_NO_SCRN_DSCR: - Err = "No screen descriptor detected"; - break; - case D_GIF_ERR_NO_IMAG_DSCR: - Err = "No Image Descriptor detected"; - break; - case D_GIF_ERR_NO_COLOR_MAP: - Err = "Neither global nor local color map"; - break; - case D_GIF_ERR_WRONG_RECORD: - Err = "Wrong record type detected"; - break; - case D_GIF_ERR_DATA_TOO_BIG: - Err = "Number of pixels bigger than width * height"; - break; - case D_GIF_ERR_NOT_ENOUGH_MEM: - Err = "Failed to allocate required memory"; - break; - case D_GIF_ERR_CLOSE_FAILED: - Err = "Failed to close given file"; - break; - case D_GIF_ERR_NOT_READABLE: - Err = "Given file was not opened for read"; - break; - case D_GIF_ERR_IMAGE_DEFECT: - Err = "Image is defective, decoding aborted"; - break; - case D_GIF_ERR_EOF_TOO_SOON: - Err = "Image EOF detected before image complete"; - break; - default: - Err = NULL; - break; - } - return Err; - } -#endif -}; - diff --git a/xbmc/guilib/Gif.cpp b/xbmc/guilib/Gif.cpp deleted file mode 100644 index 9f85d4001f..0000000000 --- a/xbmc/guilib/Gif.cpp +++ /dev/null @@ -1,679 +0,0 @@ -/* -* Copyright (C) 2005-2014 Team XBMC -* http://www.xbmc.org -* -* This Program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2, or (at your option) -* any later version. -* -* This Program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with XBMC; see the file COPYING. If not, see -* <http://www.gnu.org/licenses/>. -* -*/ -#include "system.h" -#if defined(HAS_GIFLIB) -#include "Gif.h" -#include "utils/log.h" -#include "utils/StringUtils.h" -#include "guilib/Texture.h" -#include "filesystem/File.h" -#include <algorithm> - -#define UNSIGNED_LITTLE_ENDIAN(lo, hi) ((lo) | ((hi) << 8)) -#define GIF_MAX_MEMORY 82944000U // about 79 MB, which is equivalent to 10 full hd frames. - -class Gifreader -{ -public: - unsigned char* buffer; - unsigned int buffSize; - unsigned int readPosition; - - Gifreader() : buffer(nullptr), buffSize(0), readPosition(0) {} -}; - -int ReadFromMemory(GifFileType* gif, GifByteType* gifbyte, int len) -{ - unsigned int alreadyRead = static_cast<Gifreader*>(gif->UserData)->readPosition; - int buffSizeLeft = static_cast<Gifreader*>(gif->UserData)->buffSize - alreadyRead; - int readBytes = len; - - if (len <= 0) - readBytes = 0; - - if (len > buffSizeLeft) - readBytes = buffSizeLeft; - - if (readBytes > 0) - { - unsigned char* src = static_cast<Gifreader*>(gif->UserData)->buffer + alreadyRead; - memcpy(gifbyte, src, readBytes); - static_cast<Gifreader*>(gif->UserData)->readPosition += readBytes; - } - return readBytes; -} - -int ReadFromVfs(GifFileType* gif, GifByteType* gifbyte, int len) -{ - XFILE::CFile *gifFile = static_cast<XFILE::CFile*>(gif->UserData); - return gifFile->Read(gifbyte, len); -} - - -Gif::Gif() : - m_imageSize(0), - m_pitch(0), - m_loops(0), - m_numFrames(0), - m_filename(""), - m_gif(nullptr), - m_pTemplate(nullptr), - m_isAnimated(-1) -{ - if (!m_dll.Load()) - CLog::Log(LOGERROR, "Gif::Gif(): Could not load giflib"); - m_gifFile = new XFILE::CFile(); -} - -Gif::~Gif() -{ - if (m_dll.IsLoaded()) - { - Close(m_gif); - - m_dll.Unload(); - Release(); - } - delete m_gifFile; -} - -void Gif::Close(GifFileType* gif) -{ - int err = 0; - int reason = 0; -#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 - err = m_dll.DGifCloseFile(gif, &reason); -#else - err = m_dll.DGifCloseFile(gif); -#if GIFLIB_MAJOR < 5 - reason = m_dll.GifLastError(); -#endif - if (err == GIF_ERROR) - free(gif); -#endif - if (err == GIF_ERROR) - PrettyPrintError(StringUtils::Format("Gif::~Gif(): closing file %s failed", memOrFile().c_str()), reason); -} - -void Gif::Release() -{ - delete[] m_pTemplate; - m_pTemplate = nullptr; - m_globalPalette.clear(); - m_frames.clear(); -} - -void Gif::ConvertColorTable(std::vector<GifColor> &dest, ColorMapObject* src, unsigned int size) -{ - for (unsigned int i = 0; i < size; ++i) - { - GifColor c; - - c.r = src->Colors[i].Red; - c.g = src->Colors[i].Green; - c.b = src->Colors[i].Blue; - c.a = 0xff; - dest.push_back(c); - } -} - -bool Gif::LoadGifMetaData(GifFileType* gif) -{ - if (!m_dll.IsLoaded() || !Slurp(gif)) - return false; - - m_height = gif->SHeight; - m_width = gif->SWidth; - if (!m_height || !m_width) - { - CLog::Log(LOGERROR, "Gif::LoadGif(): Zero sized image. File %s", memOrFile().c_str()); - return false; - } - - m_numFrames = gif->ImageCount; - if (m_numFrames > 0) - { - ExtensionBlock* extb = gif->SavedImages[0].ExtensionBlocks; - if (extb && extb->Function == APPLICATION_EXT_FUNC_CODE) - { - // Read number of loops - if (++extb && extb->Function == CONTINUE_EXT_FUNC_CODE) - { - uint8_t low = static_cast<uint8_t>(extb->Bytes[1]); - uint8_t high = static_cast<uint8_t>(extb->Bytes[2]); - m_loops = UNSIGNED_LITTLE_ENDIAN(low, high); - } - } - } - else - { - CLog::Log(LOGERROR, "Gif::LoadGif(): No images found in file %s", memOrFile().c_str()); - return false; - } - - m_pitch = m_width * sizeof(GifColor); - m_imageSize = m_pitch * m_height; - unsigned long memoryUsage = m_numFrames * m_imageSize; - if (memoryUsage > GIF_MAX_MEMORY) - { - // at least 1 image - m_numFrames = std::max(1U, GIF_MAX_MEMORY / m_imageSize); - CLog::Log(LOGERROR, "Gif::LoadGif(): Memory consumption too high: %lu bytes. Restricting animation to %u. File %s", memoryUsage, m_numFrames, memOrFile().c_str()); - } - - return true; -} - -bool Gif::LoadGifMetaData(const char* file) -{ - if (!m_dll.IsLoaded()) - return false; - - m_gifFile->Close(); - if (!m_gifFile->Open(file) || !Open(m_gif, m_gifFile, ReadFromVfs)) - return false; - - return LoadGifMetaData(m_gif); -} - -bool Gif::Slurp(GifFileType* gif) -{ - if (m_dll.DGifSlurp(gif) == GIF_ERROR) - { - int reason = 0; -#if GIFLIB_MAJOR == 5 - reason = gif->Error; -#else - reason = m_dll.GifLastError(); -#endif - PrettyPrintError(StringUtils::Format("Gif::LoadGif(): Could not read file %s", memOrFile().c_str()), reason); - return false; - } - - return true; -} - -bool Gif::LoadGif(const char* file) -{ - m_filename = file; - if (!LoadGifMetaData(m_filename.c_str())) - return false; - - try - { - InitTemplateAndColormap(); - - int extractedFrames = ExtractFrames(m_numFrames); - if (extractedFrames < 0) - { - CLog::Log(LOGDEBUG, "Gif::LoadGif(): Could not extract any frame. File %s", memOrFile().c_str()); - return false; - } - else if (extractedFrames < (int)m_numFrames) - { - CLog::Log(LOGDEBUG, "Gif::LoadGif(): Could only extract %d/%d frames. File %s", extractedFrames, m_numFrames, memOrFile().c_str()); - m_numFrames = extractedFrames; - } - - return true; - } - catch (std::bad_alloc& ba) - { - CLog::Log(LOGERROR, "Gif::Load(): Out of memory while reading file %s - %s", memOrFile().c_str(), ba.what()); - Release(); - return false; - } -} - -bool Gif::IsAnimated(const char* file) -{ - if (!m_dll.IsLoaded()) - return false; - - if (m_isAnimated < 0) - { - m_filename = file; - m_isAnimated = 0; - - GifFileType* gif = nullptr; - XFILE::CFile gifFile; - - if (!gifFile.Open(file) || !Open(gif, &gifFile, ReadFromVfs)) - return false; - - if (gif) - { - if (Slurp(gif) && gif->ImageCount > 1) - m_isAnimated = 1; - - Close(gif); - gifFile.Close(); - } - } - return m_isAnimated > 0; -} - -bool Gif::Open(GifFileType*& gif, void *dataPtr, InputFunc readFunc) -{ - int err = 0; -#if GIFLIB_MAJOR == 5 - gif = m_dll.DGifOpen(dataPtr, readFunc, &err); -#else - gif = m_dll.DGifOpen(dataPtr, readFunc); - if (!gif) - err = m_dll.GifLastError(); -#endif - - if (!gif) - { - PrettyPrintError(StringUtils::Format("Gif::Open(): Could not open file %s", memOrFile().c_str()), err); - return false; - } - - return true; -} - -void Gif::InitTemplateAndColormap() -{ - m_pTemplate = new unsigned char[m_imageSize]; - memset(m_pTemplate, 0, m_imageSize); - - if (m_gif->SColorMap) - { - m_globalPalette.clear(); - ConvertColorTable(m_globalPalette, m_gif->SColorMap, m_gif->SColorMap->ColorCount); - } - else - m_globalPalette.clear(); -} - -bool Gif::GcbToFrame(GifFrame &frame, unsigned int imgIdx) -{ - int transparent = -1; - frame.m_delay = 0; - frame.m_disposal = 0; - - if (m_gif->ImageCount > 0) - { -#if GIFLIB_MAJOR == 5 - GraphicsControlBlock gcb; - if (!m_dll.DGifSavedExtensionToGCB(m_gif, imgIdx, &gcb)) - { - PrettyPrintError(StringUtils::Format("Gif::GcbToFrame(): Could not read GraphicsControlBlock of frame %d in file %s", - imgIdx, memOrFile().c_str()), m_gif->Error); - return false; - } - // delay in ms - frame.m_delay = gcb.DelayTime * 10; - frame.m_disposal = gcb.DisposalMode; - transparent = gcb.TransparentColor; -#else - ExtensionBlock* extb = m_gif->SavedImages[imgIdx].ExtensionBlocks; - while (extb && extb->Function != GRAPHICS_EXT_FUNC_CODE) - extb++; - - if (!extb || extb->ByteCount != 4) - { - CLog::Log(LOGERROR, "Gif::GcbToFrame() : Could not read GraphicsControlBlock of frame %d in file %s", - imgIdx, memOrFile().c_str()); - return false; - } - else - { - uint8_t low = static_cast<uint8_t>(extb->Bytes[1]); - uint8_t high = static_cast<uint8_t>(extb->Bytes[2]); - frame.m_delay = UNSIGNED_LITTLE_ENDIAN(low, high) * 10; - frame.m_disposal = (extb->Bytes[0] >> 2) & 0x07; - if (extb->Bytes[0] & 0x01) - { - transparent = static_cast<uint8_t>(extb->Bytes[3]); - } - else - transparent = -1; - } - -#endif - } - - if (transparent >= 0 && (unsigned)transparent < frame.m_palette.size()) - frame.m_palette[transparent].a = 0; - return true; -} - -int Gif::ExtractFrames(unsigned int count) -{ - if (!m_gif) - return -1; - - if (!m_pTemplate) - { - CLog::Log(LOGDEBUG, "Gif::ExtractFrames(): No frame template available"); - return -1; - } - - int extracted = 0; - for (unsigned int i = 0; i < count; i++) - { - FramePtr frame(new GifFrame); - SavedImage savedImage = m_gif->SavedImages[i]; - GifImageDesc imageDesc = m_gif->SavedImages[i].ImageDesc; - frame->m_height = imageDesc.Height; - frame->m_width = imageDesc.Width; - frame->m_top = imageDesc.Top; - frame->m_left = imageDesc.Left; - - if (frame->m_top + frame->m_height > m_height || frame->m_left + frame->m_width > m_width - || !frame->m_width || !frame->m_height - || frame->m_width > m_width || frame->m_height > m_height) - { - CLog::Log(LOGDEBUG, "Gif::ExtractFrames(): Illegal frame dimensions: width: %d, height: %d, left: %d, top: %d instead of (%d,%d), skip it", - frame->m_width, frame->m_height, frame->m_left, frame->m_top, m_width, m_height); - continue; - } - - if (imageDesc.ColorMap) - { - frame->m_palette.clear(); - ConvertColorTable(frame->m_palette, imageDesc.ColorMap, imageDesc.ColorMap->ColorCount); - // TODO save a backup of the palette for frames without a table in case there's no global table. - } - else if (m_gif->SColorMap) - { - frame->m_palette = m_globalPalette; - } - else - { - CLog::Log(LOGDEBUG, "Gif::ExtractFrames(): No color map found for frame %d, skip it", i); - continue; - } - - // fill delay, disposal and transparent color into frame - if (!GcbToFrame(*frame, i)) - { - CLog::Log(LOGDEBUG, "Gif::ExtractFrames(): Corrupted Graphics Control Block for frame %d, skip it", i); - continue; - } - - frame->m_pImage = new unsigned char[m_imageSize]; - frame->m_imageSize = m_imageSize; - memcpy(frame->m_pImage, m_pTemplate, m_imageSize); - - ConstructFrame(*frame, savedImage.RasterBits); - - if (!PrepareTemplate(*frame)) - { - CLog::Log(LOGDEBUG, "Gif::ExtractFrames(): Could not prepare template after frame %d, skip it", i); - continue; - } - - extracted++; - m_frames.push_back(frame); - } - return extracted; -} - -void Gif::ConstructFrame(GifFrame &frame, const unsigned char* src) const -{ - size_t paletteSize = frame.m_palette.size(); - - for (unsigned int dest_y = frame.m_top, src_y = 0; src_y < frame.m_height; ++dest_y, ++src_y) - { - unsigned char *to = frame.m_pImage + (dest_y * m_pitch) + (frame.m_left * sizeof(GifColor)); - - const unsigned char *from = src + (src_y * frame.m_width); - for (unsigned int src_x = 0; src_x < frame.m_width; ++src_x) - { - unsigned char index = *from++; - - if (index >= paletteSize) - { - CLog::Log(LOGDEBUG, "Gif::ConstructFrame(): Pixel (%d,%d) has no valid palette entry, skip it", src_x, src_y); - continue; - } - - GifColor col = frame.m_palette[index]; - if (col.a != 0) - memcpy(to, &col, sizeof(GifColor)); - - to += 4; - } - } -} - -bool Gif::PrepareTemplate(GifFrame &frame) -{ - switch (frame.m_disposal) - { - /* No disposal specified. */ - case DISPOSAL_UNSPECIFIED: - /* Leave image in place */ - case DISPOSE_DO_NOT: - memcpy(m_pTemplate, frame.m_pImage, m_imageSize); - break; - - /* - Clear the frame's area to transparency. - The disposal names is misleading. Do not restore to the background color because - this part of the specification is ignored by all browsers/image viewers. - */ - case DISPOSE_BACKGROUND: - { - ClearFrameAreaToTransparency(m_pTemplate, frame); - break; - } - /* Restore to previous content */ - case DISPOSE_PREVIOUS: - { - - /* - * This disposal method makes no sense for the first frame - * Since browsers etc. handle that too, we'll fall back to DISPOSE_DO_NOT - */ - if (m_frames.empty()) - { - frame.m_disposal = DISPOSE_DO_NOT; - return PrepareTemplate(frame); - } - - bool valid = false; - - for (int i = m_frames.size() - 1; i >= 0; --i) - { - if (m_frames[i]->m_disposal != DISPOSE_PREVIOUS) - { - memcpy(m_pTemplate, m_frames[i]->m_pImage, m_imageSize); - valid = true; - break; - } - } - if (!valid) - { - CLog::Log(LOGDEBUG, "Gif::PrepareTemplate(): Disposal method DISPOSE_PREVIOUS encountered, but could not find a suitable frame."); - return false; - } - break; - } - default: - { - CLog::Log(LOGDEBUG, "Gif::PrepareTemplate(): Unknown disposal method: %d. Using DISPOSAL_UNSPECIFIED, the animation might be wrong now.", frame.m_disposal); - frame.m_disposal = DISPOSAL_UNSPECIFIED; - return PrepareTemplate(frame); - } - } - return true; -} - -void Gif::ClearFrameAreaToTransparency(unsigned char* dest, const GifFrame &frame) -{ - for (unsigned int dest_y = frame.m_top, src_y = 0; src_y < frame.m_height; ++dest_y, ++src_y) - { - unsigned char *to = dest + (dest_y * m_pitch) + (frame.m_left * sizeof(GifColor)); - for (unsigned int src_x = 0; src_x < frame.m_width; ++src_x) - { - to += 3; - *to++ = 0; - } - } -} - -bool Gif::LoadImageFromMemory(unsigned char* buffer, unsigned int bufSize, unsigned int width, unsigned int height) -{ - if (!m_dll.IsLoaded()) - return false; - - if (!buffer || !bufSize || !width || !height) - return false; - - Gifreader reader; - reader.buffer = buffer; - reader.buffSize = bufSize; - - if (!Open(m_gif, static_cast<void *>(&reader), ReadFromMemory)) - return false; - - if (!LoadGifMetaData(m_gif)) - return false; - - m_originalWidth = m_width; - m_originalHeight = m_height; - - try - { - InitTemplateAndColormap(); - - int extractedFrames = ExtractFrames(m_numFrames); - if (extractedFrames < 0) - { - CLog::Log(LOGDEBUG, "Gif::LoadGif(): Could not extract any frame. File %s", memOrFile().c_str()); - return false; - } - else if (extractedFrames < (int)m_numFrames) - { - CLog::Log(LOGDEBUG, "Gif::LoadGif(): Could only extract %d/%d frames. File %s", extractedFrames, m_numFrames, memOrFile().c_str()); - m_numFrames = extractedFrames; - } - - return true; - } - catch (std::bad_alloc& ba) - { - CLog::Log(LOGERROR, "Gif::LoadImageFromMemory(): Out of memory while extracting gif frames - %s", ba.what()); - Release(); - return false; - } - - return true; -} - -bool Gif::Decode(unsigned char* const pixels, unsigned int width, unsigned int height, unsigned int pitch, unsigned int format) -{ - if (m_width == 0 || m_height == 0 - || !m_dll.IsLoaded() || !m_gif - || format != XB_FMT_A8R8G8B8 || !m_numFrames) - return false; - - if (m_frames.empty() || !m_frames[0]->m_pImage) - return false; - - const unsigned char *src = m_frames[0]->m_pImage; - unsigned char* dst = pixels; - - unsigned int copyHeight = std::min(m_height, height); - unsigned int copyPitch = std::min(m_pitch, pitch); - - if (pitch == m_pitch && copyHeight == m_height) - { - memcpy(dst, src, m_imageSize); - } - else - { - for (unsigned int y = 0; y < copyHeight; y++) - { - memcpy(dst, src, copyPitch); - src += m_pitch; - dst += pitch; - } - } - - return true; -} - -bool Gif::CreateThumbnailFromSurface(unsigned char* bufferin, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const std::string& destFile, - unsigned char* &bufferout, unsigned int &bufferoutSize) -{ - CLog::Log(LOGERROR, "Gif::CreateThumbnailFromSurface(): Not implemented. Something went wrong, we don't store thumbnails as gifs!"); - return false; -} - -void Gif::PrettyPrintError(std::string messageTemplate, int reason) -{ - const char* error = m_dll.GifErrorString(reason); - std::string message; - if (error) - { - message = StringUtils::Format(messageTemplate.append(" - %s").c_str(), error); - } - else - { - message = messageTemplate.append(" (reason unknown)"); - } - CLog::Log(LOGERROR, "%s", message.c_str()); -} - -GifFrame::GifFrame() : - m_pImage(nullptr), - m_delay(0), - m_imageSize(0), - m_height(0), - m_width(0), - m_top(0), - m_left(0), - m_disposal(0) -{} - - -GifFrame::GifFrame(const GifFrame& src) : - m_pImage(nullptr), - m_delay(src.m_delay), - m_imageSize(src.m_imageSize), - m_height(src.m_height), - m_width(src.m_width), - m_top(src.m_top), - m_left(src.m_left), - m_disposal(src.m_disposal) -{ - if (src.m_pImage) - { - m_pImage = new unsigned char[m_imageSize]; - memcpy(m_pImage, src.m_pImage, m_imageSize); - } - - if (src.m_palette.size()) - { - m_palette = src.m_palette; - } -} - -GifFrame::~GifFrame() -{ - delete[] m_pImage; - m_pImage = nullptr; -} -#endif//HAS_GIFLIB diff --git a/xbmc/guilib/Gif.h b/xbmc/guilib/Gif.h deleted file mode 100644 index 2ad43e0ff2..0000000000 --- a/xbmc/guilib/Gif.h +++ /dev/null @@ -1,120 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2014 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "guilib/iimage.h" -#include "DllLibGif.h" -#include <memory> -#include <vector> -#include "URL.h" - -namespace XFILE -{ - class CFile; -}; - -#pragma pack(1) -struct GifColor -{ - uint8_t b, g, r, a; -}; -#pragma pack() - - -class GifFrame -{ - friend class Gif; - -public: - - GifFrame(); - virtual ~GifFrame(); - - unsigned char* m_pImage; - unsigned int m_delay; - -private: - GifFrame(const GifFrame& src); - - unsigned int m_imageSize; - unsigned int m_height; - unsigned int m_width; - unsigned int m_top; - unsigned int m_left; - std::vector<GifColor> m_palette; - unsigned int m_disposal; -}; - -class Gif : public IImage -{ -public: - typedef std::shared_ptr<GifFrame> FramePtr; - - Gif(); - virtual ~Gif(); - - bool LoadGifMetaData(const char* file); - bool LoadGif(const char* file); - - virtual bool LoadImageFromMemory(unsigned char* buffer, unsigned int bufSize, unsigned int width, unsigned int height); - virtual bool Decode(unsigned char* const pixels, unsigned int width, unsigned int height, unsigned int pitch, unsigned int format); - virtual bool CreateThumbnailFromSurface(unsigned char* bufferin, unsigned int width, unsigned int height, unsigned int format, unsigned int pitch, const std::string& destFile, - unsigned char* &bufferout, unsigned int &bufferoutSize); - bool IsAnimated(const char* file); - const std::vector<FramePtr>& GetFrames() const { return m_frames; } - unsigned int GetPitch() const { return m_pitch; } - unsigned int GetNumLoops() const { return m_loops; } - -private: - std::vector<FramePtr> m_frames; - unsigned int m_imageSize; - unsigned int m_pitch; - unsigned int m_loops; - unsigned int m_numFrames; - - DllLibGif m_dll; - std::string m_filename; - GifFileType* m_gif; - std::vector<GifColor> m_globalPalette; - unsigned char* m_pTemplate; - int m_isAnimated; - XFILE::CFile* m_gifFile; - - void InitTemplateAndColormap(); - bool LoadGifMetaData(GifFileType* gif); - bool Open(GifFileType*& gif, void *dataPtr, InputFunc readFunc); - void Close(GifFileType* gif); - bool Slurp(GifFileType* gif); - static void ConvertColorTable(std::vector<GifColor> &dest, ColorMapObject* src, unsigned int size); - bool GcbToFrame(GifFrame &frame, unsigned int imgIdx); - int ExtractFrames(unsigned int count); - void ClearFrameAreaToTransparency(unsigned char* dest, const GifFrame &frame); - void ConstructFrame(GifFrame &frame, const unsigned char* src) const; - bool PrepareTemplate(GifFrame &frame); - void Release(); - void PrettyPrintError(std::string messageTemplate, int reason); - - inline std::string memOrFile() - { - return m_filename.empty() ? std::string("memory file") : CURL::GetRedacted(m_filename); - } - -}; diff --git a/xbmc/guilib/Makefile.in b/xbmc/guilib/Makefile.in index 52781788e3..f8e35691c3 100644 --- a/xbmc/guilib/Makefile.in +++ b/xbmc/guilib/Makefile.in @@ -77,10 +77,6 @@ SRCS += VisibleEffect.cpp SRCS += XBTF.cpp SRCS += XBTFReader.cpp -ifeq (@USE_LIBGIF@,1) -SRCS += Gif.cpp -endif - ifeq (@USE_OPENGL@,1) SRCS += TextureGL.cpp SRCS += GUIFontTTFGL.cpp @@ -103,6 +99,6 @@ include @abs_top_srcdir@/Makefile.include -include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS))) try : try.o TextureBundle.o DirectXGraphics.o GUIFontTTF.o - g++ -o try try.o TextureBundle.o DirectXGraphics.o GraphicContext.o GUIIncludes.o ../utils/CriticalSection.o ../XBVideoConfig.o SkinInfo.o ../linux/CriticalSection.o GUIFontTTF.o GUIFontBase.o GUIFontManager.o GUIFont.o ../utils/XMLUtils.o GUIImage.o GUIControl.o TextureManager.o GUIMessage.o ../utils/SingleLock.o VisibleEffect.o GUIWindowManager.o AnimatedGif.o -lSDL_image -lSDL_gfx -lSDL -llzo -lfreetype + g++ -o try try.o TextureBundle.o DirectXGraphics.o GraphicContext.o GUIIncludes.o ../utils/CriticalSection.o ../XBVideoConfig.o SkinInfo.o ../linux/CriticalSection.o GUIFontTTF.o GUIFontBase.o GUIFontManager.o GUIFont.o ../utils/XMLUtils.o GUIImage.o GUIControl.o TextureManager.o GUIMessage.o ../utils/SingleLock.o VisibleEffect.o GUIWindowManager.o -lSDL_image -lSDL_gfx -lSDL -llzo -lfreetype diff --git a/xbmc/guilib/TextureManager.cpp b/xbmc/guilib/TextureManager.cpp index df1799b397..ac043fbd6a 100644 --- a/xbmc/guilib/TextureManager.cpp +++ b/xbmc/guilib/TextureManager.cpp @@ -38,9 +38,6 @@ #ifdef _DEBUG_TEXTURES #include "utils/TimeUtils.h" #endif -#if defined(HAS_GIFLIB) -#include "guilib/Gif.h" -#endif//HAS_GIFLIB #if defined(TARGET_DARWIN_IOS) #include "windowing/WindowingFactory.h" // for g_Windowing in CGUITextureManager::FreeUnusedTextures #endif diff --git a/xbmc/guilib/imagefactory.cpp b/xbmc/guilib/imagefactory.cpp index 8295ed8632..1500dfdba0 100644 --- a/xbmc/guilib/imagefactory.cpp +++ b/xbmc/guilib/imagefactory.cpp @@ -21,9 +21,6 @@ #include "imagefactory.h" #include "guilib/FFmpegImage.h" #include "utils/Mime.h" -#if defined(HAS_GIFLIB) -#include "guilib/Gif.h" -#endif//HAS_GIFLIB IImage* ImageFactory::CreateLoader(const std::string& strFileName) { @@ -41,10 +38,5 @@ IImage* ImageFactory::CreateLoader(const CURL& url) IImage* ImageFactory::CreateLoaderFromMimeType(const std::string& strMimeType) { -#if defined(HAS_GIFLIB) - if (strMimeType == "image/gif") - return new Gif(); -#endif//HAS_GIFLIB - return new CFFmpegImage(strMimeType); } diff --git a/xbmc/system.h b/xbmc/system.h index a1b90dc512..7781303ace 100644 --- a/xbmc/system.h +++ b/xbmc/system.h @@ -81,10 +81,6 @@ #define HAS_MDNS_EMBEDDED #endif -#if defined(HAVE_LIBGIF) - #define HAS_GIFLIB -#endif - /********************** * Non-free Components **********************/ @@ -124,7 +120,6 @@ #define HAVE_LIBVORBISENC #define HAS_MYSQL #define HAS_UPNP -#define HAS_GIFLIB #define DECLARE_UNUSED(a,b) a b; #endif |