SUMMARY="A cross-platform multimedia framework"
DESCRIPTION="QtAV is a multimedia playback library based on Qt and FFmpeg. \
It can help you to write a player with less effort than ever \
before.

QtAV can meet your most demands:

* Hardware decoding suppprt: DXVA2, VAAPI, VDA/VideoToolbox, CedarX, CUDA
* OpenGL and ES2 support for almost all formats including Hi10P videos
* Real time preview
* Video capture in rgb and yuv format
* OSD and custom filters
* Filters in libavfilter, for example stero3d, blur
* Subtitle track select. Dynamic change FFmpeg and libass engine
* Play frame by frame
* Playback speed control
* Variant streams: locale file, http, rtsp etc. and your custom streams
* Audio channel, tracks and external audio tracks
* Dynamically change render engine when playing.
* Dynamically change video decoder
* Multiple video outputs for 1 player
* Video eq(software and OpenGL): brightness, contrast, saturation, hue
* QML support. Most playback APIs are compatible with QtMultimedia module
* Compatiblity: QtAV can be built with both Qt4 and Qt5, FFmpeg(>=1.0) \
and Libav (>=9.0). Latest FFmpeg release is recommended.

Extensible Framework

Some components in QtAV are designed to be extensible. For example, \
you can write your decoder, audio output for particular platform."
HOMEPAGE="http://www.qtav.org/"
COPYRIGHT="2013-2019 Wang Bin"
LICENSE="GNU LGPL v2.1"
REVISION="7"
SOURCE_URI="https://github.com/wang-bin/QtAV/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="65ab859985d73521c2d17e72117baae0f3f6242b69f59994acada76fa5364193"
SOURCE_DIR="QtAV-$portVersion"
PATCHES="qtav-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	qtav$secondaryArchSuffix = $portVersion
	lib:libqtav$secondaryArchSuffix = 1.11.0 compat >= 1
	lib:libqtavwidgets$secondaryArchSuffix = 1.11.0 compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libass$secondaryArchSuffix
	lib:libavcodec$secondaryArchSuffix
	lib:libavdevice$secondaryArchSuffix
	lib:libavfilter$secondaryArchSuffix
	lib:libavformat$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libswresample$secondaryArchSuffix
	lib:libswscale$secondaryArchSuffix
	lib:libuchardet$secondaryArchSuffix
	"

PROVIDES_devel="
	qtav${secondaryArchSuffix}_devel = $portVersion
	devel:libqtav$secondaryArchSuffix = 1.11.0 compat >= 1
	devel:libqtavwidgets$secondaryArchSuffix = 1.11.0 compat >= 1
	"
REQUIRES_devel="
	haiku${secondaryArchSuffix}_devel
	qtav$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libass$secondaryArchSuffix
	devel:libavcodec$secondaryArchSuffix
	devel:libavdevice$secondaryArchSuffix
	devel:libavfilter$secondaryArchSuffix
	devel:libavformat$secondaryArchSuffix
	devel:libavutil$secondaryArchSuffix
	devel:libgl$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libswresample$secondaryArchSuffix
	devel:libswscale$secondaryArchSuffix
	devel:libuchardet$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:find
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:xargs
	"

BUILD()
{
	mkdir -p build
	cd build
	cmake .. \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DCMAKE_INSTALL_HEADERS=$includeDir \
		-DCMAKE_INSTALL_LIBS=$libDir \
		-DCMAKE_INSTALL_BINS=$binDir \
		-DCMAKE_INSTALL_QML=$dataDir/Qt5/qml \
		-DBUILD_TESTS=OFF \
		-DBUILD_EXAMPLES=OFF \
		-DBUILD_PLAYERS=OFF \
		-DBUILD_QT5OPENGL=ON \
		-DHAVE_PORTAUDIO=OFF \
		-DHAVE_PULSE=OFF \
		-DHAVE_VAAPI=OFF

	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libQtAV \
		libQtAVWidgets

	# devel package
	packageEntries devel \
		$developDir \
		$libDir/cmake
}
