'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.
This commit is contained in:
Christian Prochaska 2012-05-24 20:09:26 +02:00 committed by Christian Helmuth
parent 25a82d6dd5
commit ba6dae9946
5 changed files with 150 additions and 0 deletions

View File

@ -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)

96
libports/run/avplay.run Normal file
View File

@ -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 {
<config>
<parent-provides>
<service name="ROM"/>
<service name="RAM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="CAP"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="SIGNAL"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
}
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_if [have_spec vesa] config {
<start name="vesa_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start> }
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="audio_out_drv">
<resource name="RAM" quantum="2M"/>
<provides><service name="Audio_out"/></provides>
</start>
<start name="avplay">
<resource name="RAM" quantum="64M"/>
<config>
<arg value="avplay"/>
<arg value="mediafile"/>
<sdl_audio_volume value="100"/>
</config>
</start>
</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

View File

@ -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;
}

View File

@ -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() { }

View File

@ -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)