Browse Source

Merge pull request #4480 from IvanSavenko/update_prebuilts

Update ffmpeg
Ivan Savenko 1 year ago
parent
commit
ff33fbd3a0

+ 1 - 1
CI/android-32/before_install.sh

@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 
 
-DEPS_FILENAME=armeabi-v7a
+DEPS_FILENAME=dependencies-android-32
 . CI/android/before_install.sh
 . CI/android/before_install.sh

+ 1 - 1
CI/android-64/before_install.sh

@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 
 
-DEPS_FILENAME=aarch64-v8a
+DEPS_FILENAME=dependencies-android-64
 . CI/android/before_install.sh
 . CI/android/before_install.sh

+ 1 - 3
CI/android/before_install.sh

@@ -4,6 +4,4 @@ echo "ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/25.2.9519653" >> $GITHUB_ENV
 
 
 brew install ninja
 brew install ninja
 
 
-mkdir ~/.conan ; cd ~/.conan
-curl -L "https://github.com/vcmi/vcmi-dependencies/releases/download/android-1.1/$DEPS_FILENAME.txz" \
-	| tar -xf - --xz
+. CI/install_conan_dependencies.sh "$DEPS_FILENAME"

+ 9 - 0
CI/install_conan_dependencies.sh

@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+RELEASE_TAG="1.2"
+FILENAME="$1"
+DOWNLOAD_URL="https://github.com/vcmi/vcmi-dependencies/releases/download/$RELEASE_TAG/$FILENAME.txz"
+
+mkdir ~/.conan
+cd ~/.conan
+curl -L "$DOWNLOAD_URL" | tar -xf - --xz

+ 1 - 3
CI/ios/before_install.sh

@@ -2,6 +2,4 @@
 
 
 echo DEVELOPER_DIR=/Applications/Xcode_14.2.app >> $GITHUB_ENV
 echo DEVELOPER_DIR=/Applications/Xcode_14.2.app >> $GITHUB_ENV
 
 
-mkdir ~/.conan ; cd ~/.conan
-curl -L 'https://github.com/vcmi/vcmi-ios-deps/releases/download/1.2.1/ios-arm64.txz' \
-	| tar -xf -
+. CI/install_conan_dependencies.sh "dependencies-ios"

+ 1 - 1
CI/mac-arm/before_install.sh

@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 
 
-DEPS_FILENAME=intel-cross-arm
+DEPS_FILENAME=dependencies-mac-arm
 . CI/mac/before_install.sh
 . CI/mac/before_install.sh

+ 1 - 1
CI/mac-intel/before_install.sh

@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 
 
-DEPS_FILENAME=intel
+DEPS_FILENAME=dependencies-mac-intel
 . CI/mac/before_install.sh
 . CI/mac/before_install.sh

+ 1 - 3
CI/mac/before_install.sh

@@ -4,6 +4,4 @@ echo DEVELOPER_DIR=/Applications/Xcode_14.2.app >> $GITHUB_ENV
 
 
 brew install ninja
 brew install ninja
 
 
-mkdir ~/.conan ; cd ~/.conan
-curl -L "https://github.com/vcmi/vcmi-deps-macos/releases/download/1.2.1/$DEPS_FILENAME.txz" \
-	| tar -xf -
+. CI/install_conan_dependencies.sh "$DEPS_FILENAME"

+ 1 - 3
CI/mingw-32/before_install.sh

@@ -11,6 +11,4 @@ curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-
 curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-i686-dev_10.0.0-3_all.deb \
 curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-i686-dev_10.0.0-3_all.deb \
   && sudo dpkg -i mingw-w64-i686-dev_10.0.0-3_all.deb;
   && sudo dpkg -i mingw-w64-i686-dev_10.0.0-3_all.deb;
 
 
-mkdir ~/.conan ; cd ~/.conan
-curl -L "https://github.com/vcmi/vcmi-deps-windows-conan/releases/download/1.2/vcmi-deps-windows-conan-w32.tgz" \
-	| tar -xzf -
+. CI/install_conan_dependencies.sh "dependencies-mingw-32"

+ 1 - 3
CI/mingw/before_install.sh

@@ -11,6 +11,4 @@ curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-
 curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-x86-64-dev_10.0.0-3_all.deb \
 curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-x86-64-dev_10.0.0-3_all.deb \
   && sudo dpkg -i mingw-w64-x86-64-dev_10.0.0-3_all.deb;
   && sudo dpkg -i mingw-w64-x86-64-dev_10.0.0-3_all.deb;
 
 
-mkdir ~/.conan ; cd ~/.conan
-curl -L "https://github.com/vcmi/vcmi-deps-windows-conan/releases/download/1.2/vcmi-deps-windows-conan-w64.tgz" \
-	| tar -xzf -
+. CI/install_conan_dependencies.sh "dependencies-mingw"

+ 3 - 2
client/media/CVideoHandler.cpp

@@ -339,10 +339,11 @@ FFMpegStream::~FFMpegStream()
 {
 {
 	av_frame_free(&frame);
 	av_frame_free(&frame);
 
 
+#if (LIBAVCODEC_VERSION_MAJOR < 61 )
+	// deprecated, apparently no longer necessary - avcodec_free_context should suffice
 	avcodec_close(codecContext);
 	avcodec_close(codecContext);
-	avcodec_free_context(&codecContext);
+#endif
 
 
-	avcodec_close(codecContext);
 	avcodec_free_context(&codecContext);
 	avcodec_free_context(&codecContext);
 
 
 	avformat_close_input(&formatContext);
 	avformat_close_input(&formatContext);

+ 48 - 7
conanfile.py

@@ -20,6 +20,7 @@ class VCMI(ConanFile):
         "sdl_mixer/[~2.0.4]",
         "sdl_mixer/[~2.0.4]",
         "sdl_ttf/[~2.0.18]",
         "sdl_ttf/[~2.0.18]",
         "onetbb/[^2021.3]",
         "onetbb/[^2021.3]",
+        "xz_utils/[>=5.2.5]", # Required for innoextract
     ]
     ]
 
 
     requires = _libRequires + _clientRequires
     requires = _libRequires + _clientRequires
@@ -87,24 +88,64 @@ class VCMI(ConanFile):
         self.options["boost"].without_type_erasure = True
         self.options["boost"].without_type_erasure = True
         self.options["boost"].without_wave = True
         self.options["boost"].without_wave = True
 
 
-        self.options["ffmpeg"].avdevice = False
-        self.options["ffmpeg"].avfilter = False
-        self.options["ffmpeg"].postproc = False
-        self.options["ffmpeg"].swresample = False
-        self.options["ffmpeg"].with_asm = self.settings.os != "Android"
+        self.options["ffmpeg"].disable_all_bitstream_filters = True
+        self.options["ffmpeg"].disable_all_decoders = True
+        self.options["ffmpeg"].disable_all_demuxers = True
+        self.options["ffmpeg"].disable_all_encoders = True
+        self.options["ffmpeg"].disable_all_filters = True
+        self.options["ffmpeg"].disable_all_hardware_accelerators = True
+        self.options["ffmpeg"].disable_all_muxers = True
+        self.options["ffmpeg"].disable_all_parsers = True
+        self.options["ffmpeg"].disable_all_protocols = True
+
+        self.options["ffmpeg"].with_asm = False
+        self.options["ffmpeg"].with_bzip2 = False
         self.options["ffmpeg"].with_freetype = False
         self.options["ffmpeg"].with_freetype = False
-        self.options["ffmpeg"].with_libfdk_aac = False
+        self.options["ffmpeg"].with_libaom = False
+        self.options["ffmpeg"].with_libdav1d = False
+        self.options["ffmpeg"].with_libiconv = False
         self.options["ffmpeg"].with_libmp3lame = False
         self.options["ffmpeg"].with_libmp3lame = False
+        self.options["ffmpeg"].with_libsvtav1 = False
         self.options["ffmpeg"].with_libvpx = False
         self.options["ffmpeg"].with_libvpx = False
         self.options["ffmpeg"].with_libwebp = False
         self.options["ffmpeg"].with_libwebp = False
         self.options["ffmpeg"].with_libx264 = False
         self.options["ffmpeg"].with_libx264 = False
         self.options["ffmpeg"].with_libx265 = False
         self.options["ffmpeg"].with_libx265 = False
+        self.options["ffmpeg"].with_lzma = True
         self.options["ffmpeg"].with_openh264 = False
         self.options["ffmpeg"].with_openh264 = False
         self.options["ffmpeg"].with_openjpeg = False
         self.options["ffmpeg"].with_openjpeg = False
         self.options["ffmpeg"].with_opus = False
         self.options["ffmpeg"].with_opus = False
         self.options["ffmpeg"].with_programs = False
         self.options["ffmpeg"].with_programs = False
+        self.options["ffmpeg"].with_sdl = False
         self.options["ffmpeg"].with_ssl = False
         self.options["ffmpeg"].with_ssl = False
         self.options["ffmpeg"].with_vorbis = False
         self.options["ffmpeg"].with_vorbis = False
+        self.options["ffmpeg"].with_zlib = False
+        if self.settings.os != "Android":
+            self.options["ffmpeg"].with_libfdk_aac = False
+
+        self.options["ffmpeg"].avcodec = True
+        self.options["ffmpeg"].avdevice = False
+        self.options["ffmpeg"].avfilter = False
+        self.options["ffmpeg"].avformat = True
+        self.options["ffmpeg"].postproc = False
+        self.options["ffmpeg"].swresample = True # For resampling of audio in 'planar' formats
+        self.options["ffmpeg"].swscale = True    # For video scaling
+
+        # We want following options supported:
+        # H3:SoD - .bik and .smk
+        # H3:HD  -  ogg container / theora video / vorbis sound (not supported by vcmi at the moment, but might be supported in future)
+        # and for mods - webm container / vp8 or vp9 video / opus sound
+        # TODO: add av1 support for mods (requires enabling libdav1d which currently fails to build via Conan)
+        self.options["ffmpeg"].enable_protocols = "file"
+        self.options["ffmpeg"].enable_demuxers = "bink,binka,ogg,smacker,webm_dash_manifest"
+        self.options["ffmpeg"].enable_parsers = "opus,vorbis,vp8,vp9,webp"
+        self.options["ffmpeg"].enable_decoders = "bink,binkaudio_dct,binkaudio_rdft,smackaud,smacker,theora,vorbis,vp8,vp9,opus"
+
+        #optionally, for testing - enable ffplay/ffprobe binaries in conan package:
+        #if self.settings.os == "Windows":
+        #    self.options["ffmpeg"].with_programs = True
+        #    self.options["ffmpeg"].avfilter = True
+        #    self.options["ffmpeg"].with_sdl = True
+        #    self.options["ffmpeg"].enable_filters = "aresample,scale"
 
 
         self.options["sdl"].sdl2main = self.settings.os != "iOS"
         self.options["sdl"].sdl2main = self.settings.os != "iOS"
         self.options["sdl"].vulkan = False
         self.options["sdl"].vulkan = False
@@ -198,7 +239,7 @@ class VCMI(ConanFile):
 
 
         # client
         # client
         if self.options.with_ffmpeg:
         if self.options.with_ffmpeg:
-            self.requires("ffmpeg/[^4.4]")
+            self.requires("ffmpeg/[>=4.4]")
 
 
         # launcher
         # launcher
         if self.settings.os == "Android":
         if self.settings.os == "Android":

+ 5 - 5
docs/developers/Conan.md

@@ -27,12 +27,12 @@ The following platforms are supported and known to work, others might require ch
     - **Windows**: libraries are built with x86_64-mingw-w64-gcc version 10 (which is available in repositories of Ubuntu 22.04)
     - **Windows**: libraries are built with x86_64-mingw-w64-gcc version 10 (which is available in repositories of Ubuntu 22.04)
     - **Android**: libraries are built with NDK r25c (25.2.9519653)
     - **Android**: libraries are built with NDK r25c (25.2.9519653)
 
 
-2. Download the binaries archive and unpack it to `~/.conan` directory:
+2. Download the binaries archive and unpack it to `~/.conan` directory from https://github.com/vcmi/vcmi-dependencies/releases/latest
 
 
-    - [macOS](https://github.com/vcmi/vcmi-deps-macos/releases/latest): pick **intel.txz** if you have Intel Mac, otherwise - **intel-cross-arm.txz**
-    - [iOS](https://github.com/vcmi/vcmi-ios-deps/releases/latest)
-    - [Windows](https://github.com/vcmi/vcmi-deps-windows-conan/releases/latest): pick **vcmi-deps-windows-conan-w64.tgz** if you want x86_64, otherwise pick **vcmi-deps-windows-conan-w32.tgz**
-    - [Android](https://github.com/vcmi/vcmi-dependencies/releases): current limitation is that building works only on a macOS host due to Qt 5 for Android being compiled on macOS. Simply delete directory `~/.conan/data/qt/5.15.x/_/_/package` (`5.15.x` is a placeholder) after unpacking the archive and build Qt from source. Alternatively, if you have (or are [willing to build](https://github.com/vcmi/vcmi-ios-deps#note-for-arm-macs)) Qt host tools for your platform, then simply replace those in the archive with yours and most probably it would work.
+    - macOS: pick **dependencies-mac-intel.txz** if you have Intel Mac, otherwise - **dependencies-mac-arm.txz**
+    - iOS: pick ***dependencies-ios.txz***
+    - Windows: currently only mingw is supported. Pick **dependencies-mingw.tgz** if you want x86_64, otherwise pick **dependencies-mingw-32.tgz**
+    - Android: current limitation is that building works only on a macOS host due to Qt 5 for Android being compiled on macOS. Simply delete directory `~/.conan/data/qt/5.15.x/_/_/package` (`5.15.x` is a placeholder) after unpacking the archive and build Qt from source. Alternatively, if you have (or are [willing to build](https://github.com/vcmi/vcmi-ios-deps#note-for-arm-macs)) Qt host tools for your platform, then simply replace those in the archive with yours and most probably it would work.
 
 
 3. Only if you have Apple Silicon Mac and trying to build for macOS or iOS:
 3. Only if you have Apple Silicon Mac and trying to build for macOS or iOS:
 
 

+ 80 - 0
docs/modders/File_Formats.md

@@ -0,0 +1,80 @@
+# File Formats
+
+This page describes which file formats are supported by vcmi. 
+
+In most cases, VCMI supports formats that were supported by Heroes III, with addition of new formats that are more convenient to use without specialized tools. See categories below for more details on specific formats
+
+### Images
+
+For images VCMI supports:
+- png. Recommended for usage in mods
+- bmp. While this format is supported, bmp images have no compressions leading to large file sizes
+- pcx (h3 version). Note that this is format that is specific to Heroes III and has nothing in common with widely known .pcx format. Files in this format generally can only be found inside of .lod archive of Heroes III and are usually extracted as .bmp files
+
+Transparency support:
+VCMI supports transparency (alpha) channel, both in png and in bmp images. There may be cases where transparency is not fully supported. If you discover such cases, please report them.
+
+For performance reasons, please use alpha channel only in places where transparency is actually required and remove alpha channel from image othervice
+
+Palette support:
+TODO: describe how palettes work in vcmi
+
+### Animations
+
+For animations VCMI supports .def format from Heroes III as well as alternative json-based. See [Animation Format](Animation_Format.md) for more details
+
+### Sounds
+
+For sounds VCMI currently requires .wav format. Generally, VCMI will support any .wav parameters, however you might want to use high-bitrate versions, such as 44100 Hz or 48000 Hz, 32 bit, 1 or 2 channels
+
+Support for additional formats, such as ogg/vorbis and ogg/opus is likely to be added in future
+
+### Music
+
+For sounds VCMI currently requires .mp3 format. Support for additional formats, such as ogg/vorbis and ogg/opus is likely to be added in future
+
+### Video
+
+Starting from VCMI 1.6, following video container formats are supported by VCMI:
+
+- .bik - one of the formats used by Heroes III
+- .smk - one of the formats used by Heroes III. Note that these videos generally have lower quality and are only used as fallback if no other formats are found
+- .ogv - format used by Heroes III: HD Edition
+- .webm - modern, free format that is recommended for modding.
+
+Supported video codecs:
+- bink and smacker - formats used by Heroes III, should be used only to avoid re-encoding
+- theora - used by Heroes III: HD Edition
+- vp8 - modern format with way better compression compared to formats used by Heroes III
+- vp9 - recommended, this format is improvement of vp9 format and should be used as a default option
+
+Support for av1 video codec is likely to be added in future.
+
+Supported audio codecs:
+- binkaudio and smackaud - formats used by Heroes III
+- vorbis - modern format with good compression level
+- opus - recommended, improvement over vorbis. Any bitrate is supported, with 128 kbit probably being the best option
+
+### Json
+
+For most of configuration files, VCMI uses [JSON format](http://en.wikipedia.org/wiki/Json) with some extensions from [JSON5](https://spec.json5.org/) format, such as comments.
+
+### Maps
+
+TODO: describe
+
+### Campaigns
+
+TODO: describe
+
+### Map Templates
+
+TODO: describe
+
+### Archives
+
+TODO: describe
+
+### Txt
+
+TODO: describe

+ 3 - 1
docs/modders/Readme.md

@@ -19,8 +19,10 @@ Example of how directory structure of your mod may look like:
                 music/   - music files. Mp3 and ogg/vorbis are supported
                 music/   - music files. Mp3 and ogg/vorbis are supported
                 sounds/  - sound files, in wav format.
                 sounds/  - sound files, in wav format.
                 sprites/ - animation, image sets (H3 .def files or VCMI .json files)
                 sprites/ - animation, image sets (H3 .def files or VCMI .json files)
-                video/   - video files, .bik or .smk
+                video/   - video files, .bik, .smk, .ogv .webm
 ```
 ```
+See [File Formats](File_Formats.md) page for more information on which formats are supported or recommended for vcmi
+
 
 
 ## Creating mod file
 ## Creating mod file
 
 

+ 1 - 0
lib/filesystem/ResourcePath.cpp

@@ -115,6 +115,7 @@ EResType EResTypeHelper::getTypeFromExtension(std::string extension)
 		{".FLAC",  EResType::SOUND},
 		{".FLAC",  EResType::SOUND},
 		{".SMK",   EResType::VIDEO_LOW_QUALITY},
 		{".SMK",   EResType::VIDEO_LOW_QUALITY},
 		{".BIK",   EResType::VIDEO},
 		{".BIK",   EResType::VIDEO},
+		{".OGV",   EResType::VIDEO},
 		{".WEBM",  EResType::VIDEO},
 		{".WEBM",  EResType::VIDEO},
 		{".ZIP",   EResType::ARCHIVE_ZIP},
 		{".ZIP",   EResType::ARCHIVE_ZIP},
 		{".LOD",   EResType::ARCHIVE_LOD},
 		{".LOD",   EResType::ARCHIVE_LOD},

+ 1 - 1
lib/filesystem/ResourcePath.h

@@ -28,7 +28,7 @@ class JsonSerializeFormat;
  * Font: .fnt
  * Font: .fnt
  * Image: .bmp, .jpg, .pcx, .png, .tga
  * Image: .bmp, .jpg, .pcx, .png, .tga
  * Sound: .wav .82m
  * Sound: .wav .82m
- * Video: .smk, .bik .mjpg .mpg .webm
+ * Video: .smk, .bik .ogv .webm
  * Music: .mp3, .ogg
  * Music: .mp3, .ogg
  * Archive: .lod, .snd, .vid .pac .zip
  * Archive: .lod, .snd, .vid .pac .zip
  * Palette: .pal
  * Palette: .pal