source ${genode_dir}/repos/libports/run/qt5_common.inc

import_from_depot [depot_user]/raw/qt5_avplay \
                  [depot_user]/src/avplay \
                  [depot_user]/src/libav \
                  [depot_user]/src/qt5_avplay \
                  [depot_user]/src/qt5_qnitpickerviewwidget \
                  [depot_user]/src/qt5_widgets \
                  [depot_user]/src/qt5_xml \
                  [depot_user]/src/sdl

set feature(Audio_out) 1

#
# Build
#

append build_components [qt5_build_components feature]

build $build_components

#
# Download media file
#

set media_url "ftp://ftp.untergrund.net/users/ae/dhstv/escape-chotro.mp4"
if {![file exists bin/mediafile]} {
	puts "downloading media file from $media_url"
	catch { exec wget -O bin/mediafile $media_url }
}

#
# Generate config
#

append config {
<config>
	<parent-provides>}
append config [qt5_parent_provides feature]
append config {
	</parent-provides>
	<default caps="100"/>
	<default-route>
		<any-service> <parent/> <any-child/> </any-service>
	</default-route>}

append config [qt5_start_nodes feature]

append config {
	<start name="qt_avplay" caps="400">
		<resource name="RAM" quantum="2G"/>
		<config>
			<vfs>
				<dir name="dev">
					<log/>
					<inline name="rtc">2018-01-01 00:01</inline>
				</dir>
				<tar name="qt5_dejavusans.tar"/>
				<rom name="player_play.png"/>
				<rom name="player_pause.png"/>
				<rom name="player_stop.png"/>
				<rom name="volume.png"/>
			</vfs>
			<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
			<mediafile name="mediafile"/>
		</config>
		<route>
			<service name="Nitpicker"> <child name="wm"/> </service>
			<service name="Report" label="shape">
				<child name="pointer" label="wm -> qt_avplay -> shape"/>
			</service>
			<service name="ROM" label="egl_drv.lib.so"> <parent label="egl_swrast.lib.so" /> </service>
			<any-service> <parent /> <any-child/> </any-service>
		</route>
	</start>
</config>
}

install_config $config

#
# Boot modules
#

append boot_modules [qt5_boot_modules feature]

append boot_modules {
	mediafile
}

build_boot_image $boot_modules

append qemu_args " -m 768 -soundhw es1370"

run_genode_until forever

