jp9000/obs-studio — pull request #307 by CounterPillow (2014-11-29 19:51:25+00:00)
Title: Allow the use of stb_image for image loading

ImageMagick is quite a heavy dependency and on some systems, notably Arch Linux, appears to be broken when it comes to loading PNG files.

stb_image is a public domain image loader that supports PNG, GIF, JPEG, BMP, TGA and some other more exotic formats, all in one source file which can be included in a project tree very easily, therefore making it a light but powerful dependency.

Users may build with stb_image as a provider by setting `LIBOBS_PREFER_IMAGEMAGICK` to false and setting `LIBOBS_PREFER_STBI` to true. If neither is set, the build process will use ffmpeg, if both are set, the build process will use ImageMagick.

Some Things to Consider
----------------------------------

### Build Script

The way the build script decides what image source provider it should use was clearly designed with just two options in mind. As I did not want to tear apart the build system and possibly ruin it, I simply introduced another preference option, but made it so that `LIBOBS_PREFER_IMAGEMAGICK` > `LIBOBS_PREFER_STBI` > ffmpeg.

### "Oh no, Additional Dependency!"

Having three mechanisms to load image sources seems overkill, and it is. However, stb_image is, as stated above, a very light dependency, and intended to be included in source trees directly. At the same time it provides support to load most everyday image formats. So to state it explicitly: To use this, no additional external libraries are needed. Everything that is required is directly in the source tree, namely stb_image.h. Licensing is no concern as it is released into public domain, as stated previously.

As I did not know why the decision was made to provide support for both ImageMagick and ffmpeg, I assumed that both had upsides and downsides or that the project was in a transitioning period of moving from one to the other. A third image loading mechanism may provide a third option if the former is the case, but will most likely be unnecessary if it's the latter.