# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CRATES="
	ab_glyph@0.2.20
	ab_glyph_rasterizer@0.1.8
	accesskit@0.9.0
	accesskit_consumer@0.13.0
	accesskit_macos@0.5.0
	accesskit_unix@0.2.0
	accesskit_windows@0.12.0
	accesskit_winit@0.10.0
	adler@1.0.2
	ahash@0.8.3
	aho-corasick@0.7.20
	android-activity@0.4.1
	android-properties@0.2.2
	anyhow@1.0.70
	approx@0.5.1
	arboard@3.2.0
	arrayref@0.3.7
	arrayvec@0.7.2
	async-broadcast@0.5.1
	async-channel@1.8.0
	async-executor@1.5.0
	async-fs@1.6.0
	async-io@1.13.0
	async-lock@2.7.0
	async-recursion@1.0.4
	async-task@4.4.0
	async-trait@0.1.68
	atk-sys@0.16.0
	atomic-waker@1.1.0
	atomic_refcell@0.1.9
	atspi@0.8.7
	atspi-macros@0.1.4
	autocfg@1.1.0
	base64@0.13.1
	base64@0.21.0
	bit_field@0.10.2
	bitflags@1.3.2
	block@0.1.6
	block-buffer@0.10.4
	block-sys@0.1.0-beta.1
	block2@0.2.0-alpha.6
	blocking@1.3.0
	bumpalo@3.12.0
	bytemuck@1.13.1
	bytemuck_derive@1.4.1
	byteorder@1.4.3
	bytes@1.4.0
	cairo-sys-rs@0.16.3
	calloop@0.10.5
	cc@1.0.79
	cesu8@1.1.0
	cfg-expr@0.14.0
	cfg-if@1.0.0
	cfg_aliases@0.1.1
	cgl@0.3.2
	clipboard-win@4.5.0
	color_quant@1.1.0
	combine@4.6.6
	concurrent-queue@2.1.0
	confy@0.5.1
	conv@0.3.3
	core-foundation@0.9.3
	core-foundation-sys@0.8.3
	core-graphics@0.22.3
	core-graphics-types@0.1.1
	cpufeatures@0.2.6
	crc32fast@1.3.2
	crossbeam-channel@0.5.7
	crossbeam-deque@0.8.3
	crossbeam-epoch@0.9.14
	crossbeam-utils@0.8.15
	crunchy@0.2.2
	crypto-common@0.1.6
	custom_derive@0.1.7
	derivative@2.2.0
	digest@0.10.6
	directories@4.0.1
	dirs@4.0.0
	dirs-sys@0.3.7
	dispatch@0.2.0
	dlib@0.5.0
	downcast-rs@1.2.0
	ecolor@0.21.0
	eframe@0.21.3
	egui@0.21.0
	egui-winit@0.21.1
	egui_extras@0.21.0
	egui_glow@0.21.0
	either@1.8.1
	emath@0.21.0
	encoding_rs@0.8.32
	enum-iterator@1.4.0
	enum-iterator-derive@1.2.0
	enumflags2@0.7.6
	enumflags2_derive@0.7.6
	epaint@0.21.0
	errno@0.3.0
	errno-dragonfly@0.1.2
	error-code@2.3.1
	event-listener@2.5.3
	exr@1.6.3
	fastrand@1.9.0
	ffmpeg-sidecar@0.3.3
	flate2@1.0.25
	flume@0.10.14
	fnv@1.0.7
	foreign-types@0.3.2
	foreign-types-shared@0.1.1
	form_urlencoded@1.1.0
	futures-channel@0.3.28
	futures-core@0.3.28
	futures-io@0.3.28
	futures-lite@1.12.0
	futures-sink@0.3.28
	futures-task@0.3.28
	futures-util@0.3.28
	gdk-pixbuf-sys@0.16.3
	gdk-sys@0.16.0
	generic-array@0.14.7
	gethostname@0.2.3
	getrandom@0.1.16
	getrandom@0.2.8
	getset@0.1.2
	gif@0.12.0
	gio-sys@0.16.3
	git2@0.16.1
	github_release_check@0.2.1
	gl_generator@0.14.0
	glib-sys@0.16.3
	glow@0.12.1
	glutin@0.30.7
	glutin-winit@0.3.0
	glutin_egl_sys@0.4.0
	glutin_glx_sys@0.4.0
	glutin_wgl_sys@0.4.0
	gobject-sys@0.16.3
	gtk-sys@0.16.0
	h2@0.3.16
	half@2.2.1
	hashbrown@0.12.3
	heck@0.4.1
	hermit-abi@0.2.6
	hermit-abi@0.3.1
	hex@0.4.3
	http@0.2.9
	http-body@0.4.5
	httparse@1.8.0
	httpdate@1.0.2
	hyper@0.14.25
	hyper-tls@0.5.0
	idna@0.3.0
	image@0.24.6
	imageproc@0.23.0
	indexmap@1.9.3
	instant@0.1.12
	io-lifetimes@1.0.9
	ipnet@2.7.2
	itertools@0.10.5
	itoa@1.0.6
	jni@0.21.1
	jni-sys@0.3.0
	jobserver@0.1.26
	jpeg-decoder@0.3.0
	js-sys@0.3.61
	khronos_api@3.1.0
	lazy_static@1.4.0
	lebe@0.5.2
	libc@0.2.140
	libgit2-sys@0.14.2+1.5.1
	libloading@0.7.4
	libz-sys@1.1.8
	linux-raw-sys@0.3.1
	lock_api@0.4.9
	log@0.4.17
	malloc_buf@0.0.6
	matrixmultiply@0.3.2
	memchr@2.5.0
	memmap2@0.5.10
	memoffset@0.6.5
	memoffset@0.7.1
	memoffset@0.8.0
	mime@0.3.17
	minimal-lexical@0.2.1
	miniz_oxide@0.6.2
	mio@0.8.6
	nalgebra@0.30.1
	nanorand@0.7.0
	native-tls@0.2.11
	ndk@0.7.0
	ndk-context@0.1.1
	ndk-sys@0.4.1+23.1.7779620
	nix@0.24.3
	nix@0.25.1
	nix@0.26.2
	nohash-hasher@0.2.0
	nom@7.1.3
	ntapi@0.4.0
	nu-ansi-term@0.46.0
	num@0.4.0
	num-bigint@0.4.3
	num-complex@0.4.3
	num-integer@0.1.45
	num-iter@0.1.43
	num-rational@0.4.1
	num-traits@0.2.15
	num_cpus@1.15.0
	num_enum@0.5.11
	num_enum_derive@0.5.11
	objc@0.2.7
	objc-foundation@0.1.1
	objc-sys@0.2.0-beta.2
	objc2@0.3.0-beta.3
	objc2-encode@2.0.0-pre.2
	objc_id@0.1.1
	once_cell@1.17.1
	openssl@0.10.49
	openssl-macros@0.1.1
	openssl-probe@0.1.5
	openssl-sys@0.9.84
	orbclient@0.3.43
	ordered-stream@0.2.0
	overload@0.1.1
	owned_ttf_parser@0.15.2
	owned_ttf_parser@0.18.1
	pango-sys@0.16.3
	parking@2.0.0
	parking_lot@0.12.1
	parking_lot_core@0.9.7
	parse-display@0.8.0
	parse-display-derive@0.8.0
	paste@1.0.12
	percent-encoding@2.2.0
	pin-project@1.0.12
	pin-project-internal@1.0.12
	pin-project-lite@0.2.9
	pin-utils@0.1.0
	pkg-config@0.3.26
	png@0.17.7
	poll-promise@0.2.1
	polling@2.6.0
	ppv-lite86@0.2.17
	proc-macro-crate@1.3.1
	proc-macro-error@1.0.4
	proc-macro-error-attr@1.0.4
	proc-macro2@1.0.55
	qoi@0.4.1
	quote@1.0.26
	rand@0.7.3
	rand@0.8.5
	rand_chacha@0.2.2
	rand_chacha@0.3.1
	rand_core@0.5.1
	rand_core@0.6.4
	rand_distr@0.2.2
	rand_hc@0.2.0
	raw-window-handle@0.5.2
	rawpointer@0.2.1
	rayon@1.7.0
	rayon-core@1.11.0
	redox_syscall@0.2.16
	redox_syscall@0.3.5
	redox_users@0.4.3
	regex@1.7.3
	regex-syntax@0.6.29
	reqwest@0.11.16
	rfd@0.11.3
	ron@0.8.0
	rustc_version@0.4.0
	rustix@0.37.6
	rusttype@0.9.3
	rustversion@1.0.12
	ryu@1.0.13
	safe_arch@0.6.0
	same-file@1.0.6
	schannel@0.1.21
	scoped-tls@1.0.1
	scopeguard@1.1.0
	sctk-adwaita@0.5.3
	security-framework@2.8.2
	security-framework-sys@2.8.0
	semver@1.0.17
	serde@1.0.159
	serde-big-array@0.5.1
	serde-xml-rs@0.4.1
	serde_derive@1.0.159
	serde_json@1.0.95
	serde_repr@0.1.12
	serde_spanned@0.6.1
	serde_urlencoded@0.7.1
	sha1@0.10.5
	sharded-slab@0.1.4
	simba@0.7.3
	simd-adler32@0.3.5
	slab@0.4.8
	slotmap@1.0.6
	smallvec@1.10.0
	smithay-client-toolkit@0.16.0
	smithay-clipboard@0.6.6
	socket2@0.4.9
	spin@0.9.7
	srtparse@0.2.0
	static_assertions@1.1.0
	str-buf@1.0.6
	strict-num@0.1.0
	structmeta@0.1.6
	structmeta-derive@0.1.6
	syn@1.0.109
	syn@2.0.13
	sysinfo@0.27.8
	system-deps@6.0.4
	tempfile@3.5.0
	thiserror@1.0.40
	thiserror-impl@1.0.40
	thread_local@1.1.7
	tiff@0.8.1
	time@0.3.20
	time-core@0.1.0
	time-macros@0.2.8
	tiny-skia@0.8.3
	tiny-skia-path@0.8.3
	tinyvec@1.6.0
	tinyvec_macros@0.1.1
	tokio@1.27.0
	tokio-native-tls@0.3.1
	tokio-util@0.7.7
	toml@0.7.3
	toml_datetime@0.6.1
	toml_edit@0.19.8
	tower-service@0.3.2
	tracing@0.1.37
	tracing-appender@0.2.2
	tracing-attributes@0.1.23
	tracing-core@0.1.30
	tracing-log@0.1.3
	tracing-subscriber@0.3.16
	try-lock@0.2.4
	ttf-parser@0.15.2
	ttf-parser@0.18.1
	typenum@1.16.0
	uds_windows@1.0.2
	unicode-bidi@0.3.13
	unicode-ident@1.0.8
	unicode-normalization@0.1.22
	url@2.3.1
	valuable@0.1.0
	vcpkg@0.2.15
	vec_map@0.8.2
	vergen@7.5.1
	version-compare@0.1.1
	version_check@0.9.4
	waker-fn@1.1.0
	walkdir@2.3.3
	want@0.3.0
	wasi@0.9.0+wasi-snapshot-preview1
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen@0.2.84
	wasm-bindgen-backend@0.2.84
	wasm-bindgen-futures@0.4.34
	wasm-bindgen-macro@0.2.84
	wasm-bindgen-macro-support@0.2.84
	wasm-bindgen-shared@0.2.84
	wayland-client@0.29.5
	wayland-commons@0.29.5
	wayland-cursor@0.29.5
	wayland-protocols@0.29.5
	wayland-scanner@0.29.5
	wayland-sys@0.29.5
	wayland-sys@0.30.1
	web-sys@0.3.61
	webbrowser@0.8.8
	weezl@0.1.7
	wide@0.7.8
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.5
	winapi-wsapoll@0.1.1
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows@0.42.0
	windows@0.44.0
	windows-implement@0.42.0
	windows-sys@0.42.0
	windows-sys@0.45.0
	windows-targets@0.42.2
	windows_aarch64_gnullvm@0.42.2
	windows_aarch64_msvc@0.42.2
	windows_i686_gnu@0.42.2
	windows_i686_msvc@0.42.2
	windows_x86_64_gnu@0.42.2
	windows_x86_64_gnullvm@0.42.2
	windows_x86_64_msvc@0.42.2
	winit@0.28.3
	winnow@0.4.1
	winreg@0.10.1
	x11-dl@2.21.0
	x11rb@0.10.1
	x11rb-protocol@0.10.0
	xcursor@0.3.4
	xml-rs@0.8.4
	zbus@3.11.1
	zbus_macros@3.11.1
	zbus_names@2.5.0
	zune-inflate@0.2.53
	zvariant@3.12.0
	zvariant_derive@3.12.0
	zvariant_utils@1.0.0
"

declare -A GIT_CRATES=(
	[ffprobe]="https://github.com/avsaase/ffprobe-rs;8c863431ebf0df913e325ec490589023b193402f"
)

inherit cargo desktop

DESCRIPTION="Tool for rendering OSDs over Walksnail DVR recordings"
HOMEPAGE="https://github.com/avsaase/walksnail-osd-tool"
SRC_URI="https://github.com/avsaase/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}"
KEYWORDS="~amd64"

LICENSE="0BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD BSD-2 Boost-1.0 GPL-3 ISC UbuntuFontLicense-1.0 MIT OFL-1.1 Unicode-DFS-2016 Unlicense XC ZLIB"
SLOT="0"

RDEPEND="${DEPEND}
	media-video/ffmpeg"
BDEPEND=">=virtual/rust-1.71.1-r1"

PATCHES=(
	"${FILESDIR}/${P}-poll-promise-bump.patch"
	"${FILESDIR}/${P}-version-parse-fix.patch"
	"${FILESDIR}/${P}-build-remove-git-dep.patch"
)

src_unpack() {
	cargo_src_unpack
	mv ffprobe-rs-8c863431ebf0df913e325ec490589023b193402f ffprobe-8c863431ebf0df913e325ec490589023b193402f
}

src_install() {
	cargo_src_install

	cp resources/icons/app-icon.svg walksnail-osd-tool.svg
	doicon -s scalable walksnail-osd-tool.svg
	make_desktop_entry walksnail-osd-tool 'Walksnail OSD Tool' walksnail-osd-tool
}
