add avconv support
This commit is contained in:
committed by
Norman Feske
parent
000dd13860
commit
98f052076f
2
recipes/pkg/avconv/README
Normal file
2
recipes/pkg/avconv/README
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
Simple software-rendering demo application
|
||||
6
recipes/pkg/avconv/archives
Normal file
6
recipes/pkg/avconv/archives
Normal file
@@ -0,0 +1,6 @@
|
||||
_/src/avconv
|
||||
_/src/libc
|
||||
_/src/libav
|
||||
_/src/vfs
|
||||
_/src/posix
|
||||
_/src/zlib
|
||||
1
recipes/pkg/avconv/hash
Normal file
1
recipes/pkg/avconv/hash
Normal file
@@ -0,0 +1 @@
|
||||
2020-04-28 bf8ed8bc1c0676b5b46374063f1c41272c224d53
|
||||
44
recipes/pkg/avconv/runtime
Normal file
44
recipes/pkg/avconv/runtime
Normal file
@@ -0,0 +1,44 @@
|
||||
<runtime ram="128M" caps="200" binary="avconv">
|
||||
|
||||
<requires>
|
||||
<framebuffer/>
|
||||
<file_system label="output"/>
|
||||
</requires>
|
||||
|
||||
<content>
|
||||
<rom label="avconv"/>
|
||||
<rom label="libc.lib.so"/>
|
||||
<rom label="vfs.lib.so"/>
|
||||
<rom label="libm.lib.so"/>
|
||||
<rom label="zlib.lib.so"/>
|
||||
<rom label="posix.lib.so"/>
|
||||
<rom label="avfilter.lib.so"/>
|
||||
<rom label="avutil.lib.so"/>
|
||||
<rom label="avcodec.lib.so"/>
|
||||
<rom label="avformat.lib.so"/>
|
||||
<rom label="swscale.lib.so"/>
|
||||
<rom label="avresample.lib.so"/>
|
||||
<rom label="avdevice.lib.so"/>
|
||||
</content>
|
||||
|
||||
<config>
|
||||
<arg value="avconv"/>
|
||||
<!-- <arg value="-v"/> <arg value="100"/> -->
|
||||
<arg value="-f"/> <arg value="fbdev"/>
|
||||
<arg value="-r"/> <arg value="20"/>
|
||||
<arg value="-i"/> <arg value="/dev/lxfb"/>
|
||||
<!-- <arg value="-t"/> <arg value="30"/> -->
|
||||
<arg value="-qscale"/> <arg value="1"/>
|
||||
<arg value="vfs/out.avi"/>
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/>
|
||||
<inline name="rtc">2018-01-01 00:01</inline>
|
||||
<lxfb/>
|
||||
</dir>
|
||||
<dir name="vfs"><fs label="output"/></dir>
|
||||
</vfs>
|
||||
</config>
|
||||
|
||||
</runtime>
|
||||
20
recipes/src/avconv/content.mk
Normal file
20
recipes/src/avconv/content.mk
Normal file
@@ -0,0 +1,20 @@
|
||||
content: src/app/avconv lib/import LICENSE
|
||||
|
||||
PORT_DIR := $(call port_dir,$(REP_DIR)/ports/libav)
|
||||
|
||||
lib/import:
|
||||
mkdir -p $@
|
||||
cp $(REP_DIR)/$@/import-av.inc $@
|
||||
|
||||
src/app/avconv:
|
||||
mkdir -p $@
|
||||
cp $(PORT_DIR)/src/lib/libav/avconv.c \
|
||||
$(PORT_DIR)/src/lib/libav/avconv_opt.c \
|
||||
$(PORT_DIR)/src/lib/libav/avconv_filter.c \
|
||||
$(PORT_DIR)/src/lib/libav/cmdutils.* $@
|
||||
cp $(REP_DIR)/src/app/avconv/* $@
|
||||
cp $(REP_DIR)/src/lib/libav/config.h $@
|
||||
rm $@/avconv.patch
|
||||
|
||||
LICENSE:
|
||||
cp $(PORT_DIR)/src/lib/libav/LICENSE $@
|
||||
1
recipes/src/avconv/hash
Normal file
1
recipes/src/avconv/hash
Normal file
@@ -0,0 +1 @@
|
||||
2020-04-28 befe86737c7e2a1fdf73acf4abc644fa875df38a
|
||||
8
recipes/src/avconv/used_apis
Normal file
8
recipes/src/avconv/used_apis
Normal file
@@ -0,0 +1,8 @@
|
||||
base
|
||||
os
|
||||
so
|
||||
libc
|
||||
vfs
|
||||
libav
|
||||
posix
|
||||
framebuffer_session
|
||||
255
run/avconv.run
Normal file
255
run/avconv.run
Normal file
@@ -0,0 +1,255 @@
|
||||
#
|
||||
# Build
|
||||
#
|
||||
|
||||
# depends on genodelabs/genode#1806
|
||||
|
||||
if {[have_spec pbxa9] || (![have_spec nova] && ![have_spec foc])} {
|
||||
puts "Platform is unsupported."
|
||||
exit 0
|
||||
}
|
||||
|
||||
set mke2fs [installed_command mke2fs]
|
||||
set dd [installed_command dd]
|
||||
|
||||
set build_components {
|
||||
core init timer
|
||||
app/avconv
|
||||
drivers/ahci server/vfs
|
||||
lib/vfs/rump
|
||||
drivers/framebuffer drivers/input
|
||||
server/nitpicker server/nit_fb
|
||||
app/launchpad app/pointer
|
||||
lib/mesa/swrast
|
||||
test/mesa_demo/gears
|
||||
server/fb_splitter
|
||||
}
|
||||
|
||||
source ${genode_dir}/repos/base/run/platform_drv.inc
|
||||
append_platform_drv_build_components
|
||||
|
||||
build $build_components
|
||||
|
||||
#
|
||||
# Build EXT2-file-system image
|
||||
#
|
||||
catch { exec $dd if=/dev/zero of=bin/ext2.raw bs=1M count=16 }
|
||||
catch { exec $mke2fs -F bin/ext2.raw }
|
||||
|
||||
#
|
||||
# Generate config
|
||||
#
|
||||
|
||||
create_boot_directory
|
||||
|
||||
set config {
|
||||
<config prio_levels="4">
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="RAM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="TRACE"/>
|
||||
</parent-provides>
|
||||
<default-route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</default-route>
|
||||
|
||||
<default caps="300"/>
|
||||
<affinity-space width="2" />
|
||||
}
|
||||
|
||||
append_platform_drv_config
|
||||
|
||||
append config {
|
||||
<start name="ahci_drv" priority="-1">
|
||||
<resource name="RAM" quantum="10M" />
|
||||
<affinity xpos="1" width="1" />
|
||||
<provides><service name="Block" /></provides>
|
||||
<config ata="yes">
|
||||
<policy label="vfs -> " device="0" writeable="yes" />
|
||||
</config>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec sdl] config {
|
||||
<start name="fb_sdl">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides>
|
||||
<service name="Input"/>
|
||||
<service name="Framebuffer"/>
|
||||
</provides>
|
||||
<config width="800" height="600"/>
|
||||
</start>
|
||||
<alias name="fb_drv" child="fb_sdl"/>
|
||||
<alias name="input_drv" child="fb_sdl"/>}
|
||||
|
||||
append_if [have_spec framebuffer] config {
|
||||
<start name="fb_drv" priority="-1">
|
||||
<binary name="vesa_fb_drv"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
<config width="1024" height="768" buffered="yes"/>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec ps2] config {
|
||||
<start name="ps2_drv" priority="-1">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Input"/></provides>
|
||||
</start>
|
||||
<alias name="input_drv" child="ps2_drv"/>}
|
||||
|
||||
append config {
|
||||
|
||||
<start name="fb_splitter" priority="-1">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
<route>
|
||||
<service name="Framebuffer"><child name="fb_drv"/></service>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="nitpicker" priority="-1">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Nitpicker"/></provides>
|
||||
<config>
|
||||
<domain name="pointer" layer="1" content="client" label="no" origin="pointer" />
|
||||
<domain name="default" layer="2" content="client" focus="click" hover="always" />
|
||||
<policy label="pointer -> " domain="pointer"/>
|
||||
<policy label="nit_fb -> " domain="default"/>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Input"><child name="input_drv"/></service>
|
||||
<service name="Framebuffer"><child name="fb_splitter"/></service>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="pointer" priority="-1">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
</start>
|
||||
|
||||
<start name="nit_fb" priority="-1">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides>
|
||||
<service name="Input"/>
|
||||
<service name="Framebuffer"/>
|
||||
</provides>
|
||||
<route>
|
||||
<service name="Framebuffer"><child name="nitpicker"/></service>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</route>
|
||||
<config xpos="50" ypos="50" width="900" height="700" />
|
||||
</start>
|
||||
|
||||
<start name="vfs" priority="-1">
|
||||
<resource name="RAM" quantum="16M" />
|
||||
<affinity xpos="1" width="1" />
|
||||
<provides><service name="File_system"/></provides>
|
||||
<config>
|
||||
<vfs> <rump fs="ext2fs" ram="14M" writeable="yes"/> </vfs>
|
||||
<policy label="avconv -> vfs" root="/" writeable="yes"/>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Block"><child name="ahci_drv"/></service>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="gears" priority="-2">
|
||||
<resource name="RAM" quantum="28M"/>
|
||||
<route>
|
||||
<service name="ROM" label="egl_drv.lib.so">
|
||||
<parent label="egl_swrast.lib.so"/>
|
||||
</service>
|
||||
<service name="Framebuffer"><child name="nit_fb"/></service>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</route>
|
||||
<config>
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/>
|
||||
<inline name="rtc">2018-01-01 00:01</inline>
|
||||
</dir>
|
||||
</vfs>
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="timer">
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
|
||||
<start name="avconv" priority="-1">
|
||||
<resource name="RAM" quantum="128M"/>
|
||||
<affinity xpos="1" width="1" />
|
||||
<config>
|
||||
<arg value="avconv"/>
|
||||
<!-- <arg value="-codec"/> <arg value="h263"/> -->
|
||||
<!-- <arg value="-encoders"/> -->
|
||||
<!-- <arg value="-v"/> <arg value="100"/> -->
|
||||
<arg value="-f"/> <arg value="fbdev"/>
|
||||
<arg value="-r"/> <arg value="10"/>
|
||||
<arg value="-i"/> <arg value="/dev/lxfb"/>
|
||||
<arg value="-t"/> <arg value="30"/>
|
||||
<arg value="-qscale"/> <arg value="1"/>
|
||||
<arg value="vfs/out.avi"/>
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/>
|
||||
<inline name="rtc">2018-01-01 00:01</inline>
|
||||
<lxfb/>
|
||||
</dir>
|
||||
<dir name="vfs"><fs label="vfs"/></dir>
|
||||
</vfs>
|
||||
</config>
|
||||
<route>
|
||||
<service name="File_system"><child name="vfs"/></service>
|
||||
<service name="Framebuffer"><child name="fb_splitter"/></service>
|
||||
<any-service><parent/><any-child/></any-service>
|
||||
</route>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
||||
install_config $config
|
||||
|
||||
#
|
||||
# Boot modules
|
||||
#
|
||||
|
||||
set boot_modules {
|
||||
core init timer
|
||||
avconv vfs.lib.so avresample.lib.so
|
||||
ld.lib.so libc.lib.so libm.lib.so posix.lib.so zlib.lib.so
|
||||
avdevice.lib.so avfilter.lib.so avutil.lib.so avcodec.lib.so
|
||||
avformat.lib.so swscale.lib.so
|
||||
ahci_drv rump.lib.so rump_fs.lib.so vfs vfs_rump.lib.so
|
||||
nitpicker nit_fb
|
||||
launchpad pointer
|
||||
gears egl.lib.so expat.lib.so glapi.lib.so mesa.lib.so stdcxx.lib.so egl_swrast.lib.so
|
||||
fb_splitter
|
||||
}
|
||||
|
||||
lappend_if [have_spec linux] boot_modules fb_sdl
|
||||
lappend_if [have_spec linux] boot_modules sdl.lib.so
|
||||
lappend_if [have_spec x86] boot_modules vesa_fb_drv
|
||||
lappend_if [have_spec ps2] boot_modules ps2_drv
|
||||
|
||||
append_platform_drv_boot_modules
|
||||
|
||||
build_boot_image $boot_modules
|
||||
|
||||
append qemu_args " -smp 4,cores=4 "
|
||||
append qemu_args " -drive id=disk,file=bin/ext2.raw,if=none -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 -boot d"
|
||||
|
||||
run_genode_until {.*child "avconv" exited with exit value 0.*} 60
|
||||
|
||||
puts "Test succeeded"
|
||||
21
src/app/avconv/avconv.patch
Normal file
21
src/app/avconv/avconv.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
- avoid compile error "‘for’ loop initial declarations are only
|
||||
allowed in C99 or C11 mode"
|
||||
|
||||
+++ src/lib/libav/avconv.c
|
||||
@@ -426,6 +426,7 @@ static int alloc_buffer(InputStream *ist, FrameBuffer **pbuf)
|
||||
int h_chroma_shift, v_chroma_shift;
|
||||
int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq1
|
||||
int w = s->width, h = s->height;
|
||||
+ int i;
|
||||
|
||||
if (!buf)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -449,7 +450,7 @@ static int alloc_buffer(InputStream *ist, FrameBuffer **pbuf)
|
||||
memset(buf->base[0], 128, ret);
|
||||
|
||||
avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
|
||||
- for (int i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
|
||||
+ for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
|
||||
const int h_shift = i==0 ? 0 : h_chroma_shift;
|
||||
const int v_shift = i==0 ? 0 : v_chroma_shift;
|
||||
if (s->flags & CODEC_FLAG_EMU_EDGE)
|
||||
23
src/app/avconv/target.mk
Normal file
23
src/app/avconv/target.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
include $(REP_DIR)/lib/import/import-av.inc
|
||||
|
||||
TARGET = avconv
|
||||
SRC_C = avconv.c cmdutils.c avconv_opt.c avconv_filter.c
|
||||
LIBS += avfilter avformat avcodec avutil avdevice swscale avresample
|
||||
LIBS += base posix
|
||||
|
||||
CC_WARN += -Wno-parentheses -Wno-switch -Wno-uninitialized \
|
||||
-Wno-format-zero-length -Wno-pointer-sign
|
||||
|
||||
LIBAV_PORT_DIR := $(call select_from_ports,libav)
|
||||
|
||||
# version.h
|
||||
INC_DIR += $(PRG_DIR)
|
||||
|
||||
# config.h
|
||||
INC_DIR += $(REP_DIR)/src/lib/libav
|
||||
|
||||
CC_C_OPT += -DLIBAV_VERSION=\"0.8\"
|
||||
|
||||
vpath %.c $(LIBAV_PORT_DIR)/src/lib/libav
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
||||
0
src/app/avconv/version.h
Normal file
0
src/app/avconv/version.h
Normal file
Reference in New Issue
Block a user