From 000dd1386081519f16476f8e1c2772757ee98a00 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Thu, 19 Dec 2019 10:46:31 +0100 Subject: [PATCH] libav: add avdevice support --- lib/import/import-avdevice.mk | 3 ++ lib/mk/avdevice.mk | 11 +++++++ lib/symbols/avdevice | 3 ++ ports/libav.hash | 2 +- ports/libav.port | 3 +- recipes/api/libav/content.mk | 2 ++ recipes/api/libav/hash | 2 +- recipes/pkg/avplay/hash | 2 +- recipes/pkg/avplay/runtime | 1 + recipes/src/avplay/hash | 2 +- recipes/src/libav/content.mk | 2 +- recipes/src/libav/hash | 2 +- recipes/src/libav/used_apis | 1 + run/avplay.run | 2 +- src/app/avplay/libc_dummies.c | 8 +++-- src/app/avplay/target.mk | 2 +- src/lib/libav/avdevice.patch | 11 +++++++ src/lib/libav/config.h | 16 ++++----- src/lib/libav/config.mak | 28 +++++++++++----- src/lib/libav/linux/fb.h | 62 +++++++++++++++++++++++++++++++++++ 20 files changed, 137 insertions(+), 28 deletions(-) create mode 100644 lib/import/import-avdevice.mk create mode 100644 lib/mk/avdevice.mk create mode 100644 lib/symbols/avdevice create mode 100644 src/lib/libav/avdevice.patch create mode 100644 src/lib/libav/linux/fb.h diff --git a/lib/import/import-avdevice.mk b/lib/import/import-avdevice.mk new file mode 100644 index 0000000..ab04490 --- /dev/null +++ b/lib/import/import-avdevice.mk @@ -0,0 +1,3 @@ +include $(call select_from_repositories,lib/import/import-av.inc) + +REP_INC_DIR += contrib/$(LIBAV)/libavdevice diff --git a/lib/mk/avdevice.mk b/lib/mk/avdevice.mk new file mode 100644 index 0000000..c0cafdb --- /dev/null +++ b/lib/mk/avdevice.mk @@ -0,0 +1,11 @@ +include $(REP_DIR)/lib/mk/av.inc + +include $(REP_DIR)/lib/import/import-avdevice.mk + +LIBAVDEVICE_DIR = $(call select_from_ports,libav)/src/lib/libav/libavdevice + +-include $(LIBAVDEVICE_DIR)/Makefile + +LIBS += avformat + +vpath % $(LIBAVDEVICE_DIR) diff --git a/lib/symbols/avdevice b/lib/symbols/avdevice new file mode 100644 index 0000000..e72f291 --- /dev/null +++ b/lib/symbols/avdevice @@ -0,0 +1,3 @@ +avdevice_register_all T +avdevice_version T +avdevice_configuration T diff --git a/ports/libav.hash b/ports/libav.hash index a136913..65e3d1b 100644 --- a/ports/libav.hash +++ b/ports/libav.hash @@ -1 +1 @@ -5441b0c6f799190b13b3ba1db6e60b5a2d13a6bb +50ddddd55494974ac7ef3c1102667f7cfd778a9c diff --git a/ports/libav.port b/ports/libav.port index b9e44b8..253281a 100644 --- a/ports/libav.port +++ b/ports/libav.port @@ -8,7 +8,8 @@ DIR(libav) := src/lib/libav SIG(libav) := ${URL(libav)}.asc PATCHES := src/app/avplay/avplay.patch \ - src/lib/libav/avcodec.patch + src/lib/libav/avcodec.patch \ + src/lib/libav/avdevice.patch include_subdirs := . libavcodec libavdevice libavfilter libavutil libavformat libswscale \ libavutil/x86 libavutil/arm libavutil/ppc libavcodec/x86 \ diff --git a/recipes/api/libav/content.mk b/recipes/api/libav/content.mk index 6b7b3b9..26d8815 100644 --- a/recipes/api/libav/content.mk +++ b/recipes/api/libav/content.mk @@ -1,10 +1,12 @@ MIRROR_FROM_REP_DIR := lib/symbols/avcodec \ + lib/symbols/avdevice \ lib/symbols/avfilter \ lib/symbols/avformat \ lib/symbols/avresample \ lib/symbols/avutil \ lib/import/import-av.inc \ lib/import/import-avcodec.mk \ + lib/import/import-avdevice.mk \ lib/import/import-avfilter.mk \ lib/import/import-avformat.mk \ lib/import/import-avresample.mk \ diff --git a/recipes/api/libav/hash b/recipes/api/libav/hash index cd09c61..61c2720 100644 --- a/recipes/api/libav/hash +++ b/recipes/api/libav/hash @@ -1 +1 @@ -2018-01-10 6e494745c06e22be75779d1d953d112ee24f2ab6 +2019-12-19 c064d35a45087303ca90896151f1998ea6133470 diff --git a/recipes/pkg/avplay/hash b/recipes/pkg/avplay/hash index 5927524..f69e143 100644 --- a/recipes/pkg/avplay/hash +++ b/recipes/pkg/avplay/hash @@ -1 +1 @@ -2019-03-21 c31c5af8df6d6607e9d434a52226071753e82a59 +2020-04-28 cae85f8b522646cf2c988a11401a37568d6b81a0 diff --git a/recipes/pkg/avplay/runtime b/recipes/pkg/avplay/runtime index b9180c5..7137114 100644 --- a/recipes/pkg/avplay/runtime +++ b/recipes/pkg/avplay/runtime @@ -20,6 +20,7 @@ + diff --git a/recipes/src/avplay/hash b/recipes/src/avplay/hash index 7bd88b8..ab7f710 100644 --- a/recipes/src/avplay/hash +++ b/recipes/src/avplay/hash @@ -1 +1 @@ -2019-01-02 254978760fef3136f72e19723dc834a8e0e254a7 +2020-04-28 e70ec524da0140b7e29d69c38253d00fbdce00dd diff --git a/recipes/src/libav/content.mk b/recipes/src/libav/content.mk index 147107d..abb975f 100644 --- a/recipes/src/libav/content.mk +++ b/recipes/src/libav/content.mk @@ -8,7 +8,7 @@ src/lib/libav: cp -r $(REP_DIR)/src/lib/libav/* $@ src/lib/libav/target.mk: src/lib/libav - echo "LIBS += avfilter avformat avcodec avutil avresample swscale" > $@ + echo "LIBS += avfilter avformat avcodec avutil avresample swscale avdevice" > $@ lib/import: mkdir -p $@ diff --git a/recipes/src/libav/hash b/recipes/src/libav/hash index 30d4755..180dd96 100644 --- a/recipes/src/libav/hash +++ b/recipes/src/libav/hash @@ -1 +1 @@ -2018-12-19 07a581adb879d499cb3cd43ee4e4ab013fbed44b +2020-04-28 d0b2291a03af52f9d7fb220e2c393d77bdb97215 diff --git a/recipes/src/libav/used_apis b/recipes/src/libav/used_apis index 8f11c5d..c5b0166 100644 --- a/recipes/src/libav/used_apis +++ b/recipes/src/libav/used_apis @@ -1,3 +1,4 @@ so libc zlib +base diff --git a/run/avplay.run b/run/avplay.run index 80182dc..f16197c 100644 --- a/run/avplay.run +++ b/run/avplay.run @@ -31,7 +31,7 @@ set boot_modules { avplay libc.lib.so vfs.lib.so vfs.lib.so vfs.lib.so libm.lib.so zlib.lib.so sdl.lib.so avfilter.lib.so avutil.lib.so avcodec.lib.so avformat.lib.so swscale.lib.so - avresample.lib.so + avresample.lib.so avdevice.lib.so mediafile } diff --git a/src/app/avplay/libc_dummies.c b/src/app/avplay/libc_dummies.c index 3782228..75a4082 100644 --- a/src/app/avplay/libc_dummies.c +++ b/src/app/avplay/libc_dummies.c @@ -5,11 +5,13 @@ */ /* - * Copyright (C) 2012-2017 Genode Labs GmbH + * Copyright (C) 2012-2019 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. */ -void feholdexcept() { } -void feupdateenv() { } +typedef struct fenv fenv_t; + +int feholdexcept(fenv_t *envp) { } +int feupdateenv(const fenv_t *envp) { } diff --git a/src/app/avplay/target.mk b/src/app/avplay/target.mk index 3b2dd24..25dd1f1 100644 --- a/src/app/avplay/target.mk +++ b/src/app/avplay/target.mk @@ -2,7 +2,7 @@ include $(REP_DIR)/lib/import/import-av.inc TARGET = avplay SRC_C = avplay.c cmdutils.c libc_dummies.c -LIBS += avfilter avformat avcodec avutil avresample swscale +LIBS += avfilter avformat avcodec avutil avresample swscale avdevice LIBS += base sdl libc libm CC_WARN += -Wno-parentheses -Wno-switch -Wno-uninitialized \ diff --git a/src/lib/libav/avdevice.patch b/src/lib/libav/avdevice.patch new file mode 100644 index 0000000..6a9a56b --- /dev/null +++ b/src/lib/libav/avdevice.patch @@ -0,0 +1,11 @@ +- support fbdev input devices with pixel format RGB565 + ++++ src/lib/libav/libavdevice/fbdev.c +@@ -58,6 +58,7 @@ + { 32, 3, 2, 8, 0, AV_PIX_FMT_ABGR }, + { 24, 0, 8, 16, 0, AV_PIX_FMT_RGB24 }, + { 24, 16, 8, 0, 0, AV_PIX_FMT_BGR24 }, ++ { 16, 11, 5, 0, 0, AV_PIX_FMT_RGB565 }, + }; + + static enum AVPixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *varinfo) diff --git a/src/lib/libav/config.h b/src/lib/libav/config.h index b659275..020ef01 100644 --- a/src/lib/libav/config.h +++ b/src/lib/libav/config.h @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef LIBAV_CONFIG_H #define LIBAV_CONFIG_H -#define LIBAV_CONFIGURATION "--disable-avdevice --disable-mmxext --disable-mmx" +#define LIBAV_CONFIGURATION "--disable-avdevice --disable-mmxext --disable-mmx --disable-devices --enable-indev=fbdev" #define LIBAV_LICENSE "LGPL version 2.1 or later" #define AVCONV_DATADIR "/usr/local/share/avconv" #define CC_IDENT "gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)" @@ -386,7 +386,7 @@ #define CONFIG_NONFREE 0 #define CONFIG_VERSION3 0 #define CONFIG_AVCODEC 1 -#define CONFIG_AVDEVICE 0 +#define CONFIG_AVDEVICE 1 #define CONFIG_AVFILTER 1 #define CONFIG_AVFORMAT 1 #define CONFIG_AVRESAMPLE 1 @@ -1173,15 +1173,15 @@ #define CONFIG_WMV3_DXVA2_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 #define CONFIG_WMV3_VDPAU_HWACCEL 0 -#define CONFIG_ALSA_INDEV 1 +#define CONFIG_ALSA_INDEV 0 #define CONFIG_BKTR_INDEV 0 -#define CONFIG_DV1394_INDEV 1 +#define CONFIG_DV1394_INDEV 0 #define CONFIG_FBDEV_INDEV 1 #define CONFIG_JACK_INDEV 0 -#define CONFIG_OSS_INDEV 1 +#define CONFIG_OSS_INDEV 0 #define CONFIG_PULSE_INDEV 0 #define CONFIG_SNDIO_INDEV 0 -#define CONFIG_V4L2_INDEV 1 +#define CONFIG_V4L2_INDEV 0 #define CONFIG_VFWCAP_INDEV 0 #define CONFIG_X11GRAB_INDEV 0 #define CONFIG_LIBCDIO_INDEV 0 @@ -1299,8 +1299,8 @@ #define CONFIG_WEBM_MUXER 1 #define CONFIG_WV_MUXER 1 #define CONFIG_YUV4MPEGPIPE_MUXER 1 -#define CONFIG_ALSA_OUTDEV 1 -#define CONFIG_OSS_OUTDEV 1 +#define CONFIG_ALSA_OUTDEV 0 +#define CONFIG_OSS_OUTDEV 0 #define CONFIG_SNDIO_OUTDEV 0 #define CONFIG_AAC_PARSER 1 #define CONFIG_AAC_LATM_PARSER 1 diff --git a/src/lib/libav/config.mak b/src/lib/libav/config.mak index ef89bdd..921c5c8 100644 --- a/src/lib/libav/config.mak +++ b/src/lib/libav/config.mak @@ -402,7 +402,7 @@ CONFIG_FILTERS=yes !CONFIG_HWACCELS=yes CONFIG_INDEVS=yes CONFIG_MUXERS=yes -CONFIG_OUTDEVS=yes +!CONFIG_OUTDEVS=yes CONFIG_PARSERS=yes CONFIG_PROTOCOLS=yes CONFIG_AVCODEC_EXAMPLE=yes @@ -465,7 +465,7 @@ CONFIG_SWSCALE_ALPHA=yes !CONFIG_NONFREE=yes !CONFIG_VERSION3=yes CONFIG_AVCODEC=yes -!CONFIG_AVDEVICE=yes +CONFIG_AVDEVICE=yes CONFIG_AVFILTER=yes CONFIG_AVFORMAT=yes CONFIG_AVRESAMPLE=yes @@ -1252,15 +1252,27 @@ CONFIG_NULLSINK_FILTER=yes !CONFIG_WMV3_DXVA2_HWACCEL=yes !CONFIG_WMV3_VAAPI_HWACCEL=yes !CONFIG_WMV3_VDPAU_HWACCEL=yes -CONFIG_ALSA_INDEV=yes + +!CONFIG_ALSA_INDEV=yes !CONFIG_BKTR_INDEV=yes -CONFIG_DV1394_INDEV=yes +!CONFIG_DV1394_INDEV=yes CONFIG_FBDEV_INDEV=yes !CONFIG_JACK_INDEV=yes -CONFIG_OSS_INDEV=yes +!CONFIG_OSS_INDEV=yes !CONFIG_PULSE_INDEV=yes !CONFIG_SNDIO_INDEV=yes -CONFIG_V4L2_INDEV=yes +!CONFIG_V4L2_INDEV=yes + + +!CONFIG_ALSA_INDEV=yes +!CONFIG_BKTR_INDEV=yes +!CONFIG_DV1394_INDEV=yes +CONFIG_FBDEV_INDEV=yes +!CONFIG_JACK_INDEV=yes +!CONFIG_OSS_INDEV=yes +!CONFIG_PULSE_INDEV=yes +!CONFIG_SNDIO_INDEV=yes +!CONFIG_V4L2_INDEV=yes !CONFIG_VFWCAP_INDEV=yes !CONFIG_X11GRAB_INDEV=yes !CONFIG_LIBCDIO_INDEV=yes @@ -1378,8 +1390,8 @@ CONFIG_WAV_MUXER=yes CONFIG_WEBM_MUXER=yes CONFIG_WV_MUXER=yes CONFIG_YUV4MPEGPIPE_MUXER=yes -CONFIG_ALSA_OUTDEV=yes -CONFIG_OSS_OUTDEV=yes +!CONFIG_ALSA_OUTDEV=yes +!CONFIG_OSS_OUTDEV=yes !CONFIG_SNDIO_OUTDEV=yes CONFIG_AAC_PARSER=yes CONFIG_AAC_LATM_PARSER=yes diff --git a/src/lib/libav/linux/fb.h b/src/lib/libav/linux/fb.h new file mode 100644 index 0000000..b1a1e8a --- /dev/null +++ b/src/lib/libav/linux/fb.h @@ -0,0 +1,62 @@ +/* + * \brief Minimal definition of a Linux framebuffer device + * \author Martin Stein + * \date 2016-02-10 + */ + +/* + * Copyright (C) 2016 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _LINUX__FB_H_ +#define _LINUX__FB_H_ + +/* Genode includes */ +#include + +/** + * IOCTLs for Linux framebuffer devices + */ +enum { + FBIOGET_VSCREENINFO=17920, + FBIOGET_FSCREENINFO=17922, +}; + + +/** + * Single channel descriptor within a pixel descriptor + */ +struct fb_bitfield +{ + genode_uint32_t offset; /* bit offset in pixel descriptor */ +}; + +/** + * Dynamic configuration of a framebuffer device file + */ +struct fb_var_screeninfo +{ + genode_uint32_t xres; /* visible resolution, width */ + genode_uint32_t yres; /* visible resolution, height */ + genode_uint32_t xoffset; /* X offset from virtual to visible res. */ + genode_uint32_t yoffset; /* Y offset from virtual to visible res. */ + genode_uint32_t bits_per_pixel; /* length of a pixel descriptor */ + struct fb_bitfield red; /* red channel bits in a pixel descr. */ + struct fb_bitfield green; /* green channel bits in a pixel descr. */ + struct fb_bitfield blue; /* blue channel bits in a pixel descr. */ +}; + +/** + * Fixed configuration of a framebuffe device file + */ +struct fb_fix_screeninfo +{ + unsigned long smem_start; /* base of framebuffer */ + genode_uint32_t smem_len; /* length of framebuffer in bytes */ + genode_uint32_t line_length; /* length of a framebuffer line in bytes */ +}; + +#endif /* _INCLUDE__VFS__FB_H_ */