From 87b6d70bf20131cc12902eb025eadcdf58acb426 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Tue, 11 Aug 2020 11:14:58 +0000 Subject: [PATCH] Update virtual_oss to 1.2.6 - Added support for configurable main output and recording level compressor. - Added support for simple HTTP streaming frontend. - Added system startup rc.d script. - Fixed a jitter bug. - Updated documentation. Approved by: pi (implicit) --- audio/virtual_oss/Makefile | 8 +- audio/virtual_oss/distinfo | 6 +- audio/virtual_oss/files/virtual_oss.in | 122 +++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 5 deletions(-) create mode 100644 audio/virtual_oss/files/virtual_oss.in diff --git a/audio/virtual_oss/Makefile b/audio/virtual_oss/Makefile index 55fe5f73de67..3f43739294db 100644 --- a/audio/virtual_oss/Makefile +++ b/audio/virtual_oss/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= virtual_oss -PORTVERSION= 1.2.5 +PORTVERSION= 1.2.6 CATEGORIES= audio MASTER_SITES= http://www.selasky.org/hans_petter/distfiles/ \ http://home.selasky.org/distfiles/ @@ -15,8 +15,9 @@ LICENSE= BSD2CLAUSE LIB_DEPENDS= libsamplerate.so:audio/libsamplerate USES= tar:bzip2 uidfix +USE_RC_SUBR= virtual_oss -OPTIONS_DEFINE= BLUETOOTH BT_SPEAKER DEBUG EQUALIZER +OPTIONS_DEFINE= BLUETOOTH BT_SPEAKER DEBUG EQUALIZER HTTPD OPTIONS_DEFAULT=BLUETOOTH EQUALIZER MAKE_ARGS= HAVE_CUSE="YES" @@ -37,6 +38,9 @@ EQUALIZER_LIB_DEPENDS= libfftw3.so:math/fftw3 EQUALIZER_PLIST_FILES= sbin/virtual_equalizer \ man/man8/virtual_equalizer.8.gz +HTTPD_DESC= Build with HTTP server support +HTTPD_MAKE_ARGS= HAVE_HTTPD="YES" + PLIST_FILES= sbin/virtual_oss \ man/man8/virtual_oss.8.gz diff --git a/audio/virtual_oss/distinfo b/audio/virtual_oss/distinfo index b26885ee6c3f..7e1f3a54115b 100644 --- a/audio/virtual_oss/distinfo +++ b/audio/virtual_oss/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1583245310 -SHA256 (virtual_oss-1.2.5.tar.bz2) = a6e1b66df121f4684113f9c9d560dc6faf8d1f793cd2098644f1a2b4f516fba9 -SIZE (virtual_oss-1.2.5.tar.bz2) = 46118 +TIMESTAMP = 1597143009 +SHA256 (virtual_oss-1.2.6.tar.bz2) = c17d28bf7abaecd9b190146f946bfdd9445baf064277db6c9acbded0bdc22ce2 +SIZE (virtual_oss-1.2.6.tar.bz2) = 53212 diff --git a/audio/virtual_oss/files/virtual_oss.in b/audio/virtual_oss/files/virtual_oss.in new file mode 100644 index 000000000000..0480a9b749f9 --- /dev/null +++ b/audio/virtual_oss/files/virtual_oss.in @@ -0,0 +1,122 @@ +#!/bin/sh +# $FreeBSD$ +# +# PROVIDE: virtual_oss +# BEFORE: LOGIN sndiod +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf.local, /etc/rc.conf or +# /etc/rc.conf.d/virtual_oss to enable this service: +# +# virtual_oss_enable (bool): Set to NO by default. +# Set it to "YES" to enable virtual_oss. +# virtual_oss_configs (string): List of configurations to use +# Default is "dsp" +# virtual_oss_dsp (string): Arguments passed to virtual_oss config named dsp +# Default is +# -T /dev/sndstat # register vdsp in sndstat +# -C 2 -c 2 # use two channels +# -S # resample if needed +# -i 8 # real-time priority +# -r 48000 # sample rate +# -b 24 # bit depth +# -s 1024 # buffer (can be 5.2ms) +# -f /dev/dsp0 # hardware device to use +# -d dsp # vdev to create +# -t dsp.ctl # control device + +. /etc/rc.subr + +name=virtual_oss +desc="Virtual OSS device manager" +rcvar=${name}_enable +start_precmd="${name}_precmd" +start_cmd="${name}_start" +stop_cmd="${name}_stop" +# required_modules="cuse" +virtual_oss_default_args="\ + -T /dev/sndstat \ + -S \ + -i 8 \ + -C 2 -c 2 \ + -r 48000 \ + -b 24 \ + -s 1024 \ + -f /dev/dsp0 \ + -c 2 \ + -d dsp \ + -t dsp.ctl" +configs= + +load_rc_config $name + +: ${virtual_oss_enable:="NO"} +: ${virtual_oss_configs:="dsp"} +: ${virtual_oss_dsp:="$virtual_oss_default_args"} +: ${virtual_oss_delay:=1} + +command="%%PREFIX%%/sbin/${name}" +command_args="-B" + +pidpath="/var/run/${name}" + +virtual_oss_precmd() +{ + /usr/bin/install -d -m 0755 -o root ${pidpath} +} + +start_instance() +{ + config=$* + instance_args=$(eval "echo \$virtual_oss_${config}") + if [ -z "${instance_args}" ]; then + echo "No such config ${config}" + else + echo -n "Starting Virtual OSS config ${config} ..." + ${command} \ + ${command_args} \ + -D ${pidpath}/${config}.pid \ + ${instance_args} + echo " done" + fi +} + +stop_instance() +{ + config=$* + instance_args=`eval "echo \$virtual_oss_${config}"` + if [ -z "${instance_args}" ]; then + echo "No such config ${config}" + elif [ -e "${pidpath}/${config}.pid" ]; then + pid=`check_pidfile ${pidpath}/${config}.pid ${command}` + if [ ! -z "${pid}" ]; then + echo -n "Stopping Virtual OSS config ${config} ... " + kill $pid + rm -f ${pidpath}/${config}.pid + echo "done" + fi + fi +} + +virtual_oss_start() +{ + configs=$* + [ -z "${configs}" ] && configs="${virtual_oss_configs}" + for config in ${configs}; do + start_instance $config + sleep ${virtual_oss_delay} + done +} + +virtual_oss_stop() +{ + configs=$* + [ -z "${configs}" ] && configs="${virtual_oss_configs}" + for config in ${configs}; do + stop_instance ${config} + sleep ${virtual_oss_delay} + done +} + +run_rc_command $*