From ba6dae9946ef2acc49aa91c414dabaf3fb637fbc Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Thu, 24 May 2012 20:09:26 +0200 Subject: [PATCH] 'avplay' media player With this patch the SDL-based 'avplay' media player, which is part of 'libav', can be built. The run script expects a media file named 'mediafile' in the 'bin' directory. Fixes #216. --- libports/ports/libav.mk | 1 + libports/run/avplay.run | 96 ++++++++++++++++++++++++++ libports/src/app/avplay/avplay.patch | 24 +++++++ libports/src/app/avplay/libc_dummies.c | 15 ++++ libports/src/app/avplay/target.mk | 14 ++++ 5 files changed, 150 insertions(+) create mode 100644 libports/run/avplay.run create mode 100644 libports/src/app/avplay/avplay.patch create mode 100644 libports/src/app/avplay/libc_dummies.c create mode 100644 libports/src/app/avplay/target.mk diff --git a/libports/ports/libav.mk b/libports/ports/libav.mk index 612c2a586..19dd31728 100644 --- a/libports/ports/libav.mk +++ b/libports/ports/libav.mk @@ -20,6 +20,7 @@ $(DOWNLOAD_DIR)/$(LIBAV_TGZ): $(CONTRIB_DIR)/$(LIBAV): $(DOWNLOAD_DIR)/$(LIBAV_TGZ) $(VERBOSE)tar xfz $< -C $(CONTRIB_DIR) && touch $@ + $(VERBOSE)patch -d $(CONTRIB_DIR)/$(LIBAV) -p1 -i ../../src/app/avplay/avplay.patch clean-libav: $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(LIBAV) diff --git a/libports/run/avplay.run b/libports/run/avplay.run new file mode 100644 index 000000000..923f52564 --- /dev/null +++ b/libports/run/avplay.run @@ -0,0 +1,96 @@ +build { + core init + drivers/timer + drivers/framebuffer drivers/pci drivers/input drivers/audio_out + app/avplay +} + +create_boot_directory + +set config { + + + + + + + + + + + + + + + + + +} + +append_if [have_spec sdl] config { + + + + + + + } + +append_if [have_spec pci] config { + + + + } + +append_if [have_spec vesa] config { + + + + } + +append_if [have_spec ps2] config { + + + + } + +append config { + + + + + + + + + + + + + + + + + +} + +install_config $config + +set boot_modules { + core init timer audio_out_drv avplay + ld.lib.so libc.lib.so libc_log.lib.so libc_rom.lib.so libm.lib.so pthread.lib.so zlib.lib.so sdl.lib.so + avfilter.lib.so avutil.lib.so avcodec.lib.so avformat.lib.so swscale.lib.so + mediafile +} + +lappend_if [have_spec linux] boot_modules fb_sdl +lappend_if [have_spec pci] boot_modules pci_drv +lappend_if [have_spec vesa] boot_modules vesa_drv +lappend_if [have_spec ps2] boot_modules ps2_drv + +build_boot_image $boot_modules + +append qemu_args " -m 256 -soundhw all" + +run_genode_until forever + diff --git a/libports/src/app/avplay/avplay.patch b/libports/src/app/avplay/avplay.patch new file mode 100644 index 000000000..9f5427b70 --- /dev/null +++ b/libports/src/app/avplay/avplay.patch @@ -0,0 +1,24 @@ +- don't show status messages +- fix audio/video synchronicity (needs more testing) + +diff --git a/avplay.c b/avplay.c +--- a/avplay.c ++++ b/avplay.c +@@ -235,7 +235,7 @@ + }; + static int seek_by_bytes = -1; + static int display_disable; +-static int show_status = 1; ++static int show_status = 0; + static int av_sync_type = AV_SYNC_AUDIO_MASTER; + static int64_t start_time = AV_NOPTS_VALUE; + static int64_t duration = AV_NOPTS_VALUE; +@@ -965,7 +965,7 @@ + 2 * is->audio_st->codec->channels; + } + if (bytes_per_sec) +- pts -= (double)hw_buf_size / bytes_per_sec; ++ pts -= 0.5; + return pts; + } + diff --git a/libports/src/app/avplay/libc_dummies.c b/libports/src/app/avplay/libc_dummies.c new file mode 100644 index 000000000..9ae02e4ac --- /dev/null +++ b/libports/src/app/avplay/libc_dummies.c @@ -0,0 +1,15 @@ +/* + * \brief Suppress 'not implemented' messages + * \author Christian Prochaska + * \date 2012-04-01 + */ + +/* + * Copyright (C) 2012 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. + */ + +void feholdexcept() { } +void feupdateenv() { } diff --git a/libports/src/app/avplay/target.mk b/libports/src/app/avplay/target.mk new file mode 100644 index 000000000..cb103a271 --- /dev/null +++ b/libports/src/app/avplay/target.mk @@ -0,0 +1,14 @@ +include $(REP_DIR)/lib/import/import-av.inc + +TARGET = avplay +SRC_C = avplay.c cmdutils.c libc_dummies.c +LIBS += avfilter avformat swscale sdl libc libc_log libc_rom config_args + +CC_WARN += -Wno-parentheses -Wno-switch -Wno-uninitialized -Wno-format-zero-length -Wno-pointer-sign + +# config.h +INC_DIR += $(REP_DIR)/src/lib/libav + +CC_C_OPT += -DLIBAV_VERSION=\"0.8\" + +vpath %.c $(REP_DIR)/contrib/$(LIBAV)