[SCM] cmus/master: Add RoarOutput plugin (Closes: #609202), thanks to Philipp "ph3-der-loewe" Schafft <lion at lion.leolix.org> for the patch.

alessio at users.alioth.debian.org alessio at users.alioth.debian.org
Tue Jan 11 13:29:53 UTC 2011


The following commit has been merged in the master branch:
commit 8b8f80da41ab109fb408818ebe5818e228c52332
Author: Alessio Treglia <alessio at debian.org>
Date:   Tue Jan 11 14:29:19 2011 +0100

    Add RoarOutput plugin (Closes: #609202), thanks to Philipp "ph3-der-loewe" Schafft <lion at lion.leolix.org> for the patch.

diff --git a/debian/patches/10-roaraudio_support.patch b/debian/patches/10-roaraudio_support.patch
new file mode 100644
index 0000000..9ee23aa
--- /dev/null
+++ b/debian/patches/10-roaraudio_support.patch
@@ -0,0 +1,410 @@
+Author: Philipp "ph3-der-loewe" Schafft <lion at lion.leolix.org>
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=609202
+Applied-Upstream: http://gitorious.org/cmus/cmus/commit/90a5baf0
+Description: Add RoarAudio output plugin.
+---
+ Makefile  |    6 +
+ configure |   10 +
+ roar.c    |  322 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 337 insertions(+), 1 deletion(-)
+
+--- /dev/null
++++ cmus/roar.c
+@@ -0,0 +1,322 @@
++/*
++ * Copyright 2006 Johannes Weißl
++ * Copyright 2010 Philipp 'ph3-der-loewe' Schafft
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of the
++ * License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
++ * 02111-1307, USA.
++ */
++
++#include "op.h"
++#include "mixer.h"
++#include "xmalloc.h"
++#include "utils.h"
++#include "misc.h"
++
++#include <roaraudio.h>
++
++// we do not use native 2^16-1 here as they use signed ints with 16 bit
++// so we use 2^(16-1)-1 here.
++#define MIXER_BASE_VOLUME 32767
++
++static roar_vs_t *vss = NULL;
++static int err;
++static sample_format_t format;
++
++/* configuration */
++static char *host = NULL;
++static char *role = NULL;
++
++static inline void _err_to_errno(void)
++{
++	roar_errno = err;
++	roar_err_to_errno();
++}
++
++static int op_roar_dummy(void)
++{
++	return 0;
++}
++
++static int op_roar_exit(void)
++{
++	if (host != NULL)
++		free(host);
++	if (role != NULL)
++		free(role);
++	return 0;
++}
++
++static int _set_role(void)
++{
++	int roleid = ROAR_ROLE_UNKNOWN;
++
++	if (role == NULL)
++		return 0;
++
++	roleid = roar_str2role(role);
++
++	if (roleid == ROAR_ROLE_UNKNOWN) {
++		// TODO: warn if role is invalid.
++		return 0;
++	}
++
++	if (roar_vs_role(vss, roleid, &err) == -1) {
++		return -OP_ERROR_ERRNO;
++	}
++
++	return 0;
++}
++
++static int op_roar_open(sample_format_t sf)
++{
++	int codec = -1;
++	int ret;
++
++	ROAR_DBG("op_roar_open(*) = ?");
++
++	format = sf;
++
++	if (sf_get_bigendian(sf)) {
++		if (sf_get_signed(sf)) {
++			codec = ROAR_CODEC_PCM_S_BE;
++		} else {
++			codec = ROAR_CODEC_PCM_U_BE;
++		}
++	} else {
++		if (sf_get_signed(sf)) {
++			codec = ROAR_CODEC_PCM_S_LE;
++		} else {
++			codec = ROAR_CODEC_PCM_U_LE;
++		}
++	}
++
++	ROAR_DBG("op_roar_open(*) = ?");
++
++	vss = roar_vs_new_playback(host, "C* Music Player (cmus)", sf_get_rate(sf), sf_get_channels(sf), codec, sf_get_bits(sf), &err);
++
++	if (vss == NULL) {
++		ROAR_DBG("op_roar_open(*) = ?");
++
++		_err_to_errno();
++		return -OP_ERROR_ERRNO;
++	}
++
++	ROAR_DBG("op_roar_open(*) = ?");
++
++	if (roar_vs_buffer(vss, 2048*8, &err) == -1) {
++		roar_vs_close(vss, ROAR_VS_TRUE, NULL);
++		_err_to_errno();
++		return -OP_ERROR_ERRNO;
++	}
++
++	ROAR_DBG("op_roar_open(*) = ?");
++
++	ret = _set_role();
++	if (ret != 0) {
++		roar_vs_close(vss, ROAR_VS_TRUE, NULL);
++		_err_to_errno();
++		return ret;
++	}
++
++	ROAR_DBG("op_roar_open(*) = ?");
++
++	roar_vs_blocking(vss, ROAR_VS_FALSE, &err);
++
++	ROAR_DBG("op_roar_open(*) = 0");
++
++	return 0;
++}
++
++static int op_roar_close(void)
++{
++	roar_vs_close(vss, ROAR_VS_FALSE, &err);
++	return 0;
++}
++
++static int op_roar_drop(void)
++{
++	roar_vs_reset_buffer(vss, ROAR_VS_TRUE, ROAR_VS_TRUE, &err);
++	return 0;
++}
++
++static int op_roar_write(const char *buffer, int count)
++{
++	int ret;
++	int i;
++	ret = roar_vs_write(vss, buffer, count, &err);
++	for (i = 0; i < 8; i++)
++		roar_vs_iterate(vss, ROAR_VS_NOWAIT, NULL);
++	return ret;
++}
++
++static int op_roar_buffer_space(void)
++{
++	ssize_t ret;
++	int i;
++	int fs = sf_get_frame_size(format);
++
++	for (i = 0; i < 8; i++)
++		roar_vs_iterate(vss, ROAR_VS_NOWAIT, NULL);
++
++	ret = roar_vs_get_avail_write(vss, &err);
++
++	ret -= ret % fs;
++
++	return ret;
++}
++
++static int op_roar_pause(void) {
++	if (roar_vs_pause(vss, ROAR_VS_TRUE, &err) == -1) {
++		_err_to_errno();
++		return -OP_ERROR_ERRNO;
++	}
++	return 0;
++}
++static int op_roar_unpause(void) {
++	if (roar_vs_pause(vss, ROAR_VS_FALSE, &err) == -1) {
++		_err_to_errno();
++		return -OP_ERROR_ERRNO;
++	}
++	return 0;
++}
++
++
++static int op_roar_set_option(int key, const char *val)
++{
++	switch (key) {
++	case 0:
++		if (host != NULL)
++			free(host);
++		host = xstrdup(val);
++		break;
++	case 1:
++		if (role != NULL)
++			free(role);
++		role = xstrdup(val);
++		_set_role();
++		break;
++	default:
++		return -OP_ERROR_NOT_OPTION;
++	}
++	return 0;
++}
++
++static int op_roar_get_option(int key, char **val)
++{
++	switch (key) {
++	case 0:
++		if (host != NULL)
++			*val = xstrdup(host);
++		break;
++	case 1:
++		if (role != NULL)
++			*val = xstrdup(role);
++		break;
++	default:
++		return -OP_ERROR_NOT_OPTION;
++	}
++	return 0;
++}
++
++static int op_roar_mixer_open(int *volume_max)
++{
++	*volume_max = MIXER_BASE_VOLUME;
++	return 0;
++}
++
++static int op_roar_mixer_set_volume(int l, int r)
++{
++	float lf, rf;
++
++	if (vss == NULL)
++		return -OP_ERROR_NOT_OPEN;
++
++	lf = (float)l / (float)MIXER_BASE_VOLUME;
++	rf = (float)r / (float)MIXER_BASE_VOLUME;
++
++	if (roar_vs_volume_stereo(vss, lf, rf, &err) == -1) {
++		_err_to_errno();
++		return -OP_ERROR_ERRNO;
++	}
++
++	return 0;
++}
++static int op_roar_mixer_get_volume(int *l, int *r)
++{
++	float lf, rf;
++
++	if (vss == NULL)
++		return -OP_ERROR_NOT_OPEN;
++
++	if (roar_vs_volume_get(vss, &lf, &rf, &err) == -1) {
++		_err_to_errno();
++		return -OP_ERROR_ERRNO;
++	}
++
++	lf *= (float)MIXER_BASE_VOLUME;
++	rf *= (float)MIXER_BASE_VOLUME;
++
++	*l = lf;
++	*r = rf;
++
++	return 0;
++}
++
++static int op_roar_mixer_set_option(int key, const char *val)
++{
++	return -OP_ERROR_NOT_OPTION;
++}
++static int op_roar_mixer_get_option(int key, char **val)
++{
++	return -OP_ERROR_NOT_OPTION;
++}
++
++const struct output_plugin_ops op_pcm_ops = {
++	.init = op_roar_dummy,
++	.exit = op_roar_exit,
++	.open = op_roar_open,
++	.close = op_roar_close,
++	.drop = op_roar_drop,
++	.write = op_roar_write,
++	.buffer_space = op_roar_buffer_space,
++	.pause = op_roar_pause,
++	.unpause = op_roar_unpause,
++	.set_option = op_roar_set_option,
++	.get_option = op_roar_get_option
++};
++
++const char * const op_pcm_options[] = {
++	"server",
++	"role",
++	NULL
++};
++
++const struct mixer_plugin_ops op_mixer_ops = {
++	.init = op_roar_dummy,
++	.exit = op_roar_dummy,
++	.open = op_roar_mixer_open,
++	.close = op_roar_dummy,
++	.get_fds = NULL,
++	.set_volume = op_roar_mixer_set_volume,
++	.get_volume = op_roar_mixer_get_volume,
++	.set_option = op_roar_mixer_set_option,
++	.get_option = op_roar_mixer_get_option
++};
++
++const char * const op_mixer_options[] = {
++	NULL
++};
++
++const int op_priority = -2;
+--- cmus.orig/Makefile
++++ cmus/Makefile
+@@ -141,6 +141,7 @@ oss-objs		:= oss.lo mixer_oss.lo
+ sun-objs		:= sun.lo mixer_sun.lo
+ ao-objs			:= ao.lo
+ waveout-objs		:= waveout.lo
++roar-objs		:= roar.lo
+ 
+ op-$(CONFIG_PULSE)	+= pulse.so
+ op-$(CONFIG_ALSA)	+= alsa.so
+@@ -149,6 +150,7 @@ op-$(CONFIG_OSS)	+= oss.so
+ op-$(CONFIG_SUN)	+= sun.so
+ op-$(CONFIG_AO)		+= ao.so
+ op-$(CONFIG_WAVEOUT)	+= waveout.so
++op-$(CONFIG_WAVEOUT)	+= roar.so
+ 
+ $(pulse-objs): CFLAGS	+= $(PULSE_CFLAGS)
+ $(alsa-objs): CFLAGS	+= $(ALSA_CFLAGS)
+@@ -157,6 +159,7 @@ $(oss-objs):  CFLAGS	+= $(OSS_CFLAGS)
+ $(sun-objs):  CFLAGS	+= $(SUN_CFLAGS)
+ $(ao-objs):   CFLAGS	+= $(AO_CFLAGS)
+ $(waveout-objs): CFLAGS += $(WAVEOUT_CFLAGS)
++$(roar-objs): CFLAGS += $(ROAR_CFLAGS)
+ 
+ pulse.so: $(pulse-objs) $(libcmus-y)
+ 	$(call cmd,ld_dl,$(PULSE_LIBS))
+@@ -178,6 +181,9 @@ ao.so: $(ao-objs) $(libcmus-y)
+ 
+ waveout.so: $(waveout-objs) $(libcmus-y)
+ 	$(call cmd,ld_dl,$(WAVEOUT_LIBS))
++
++roar.so: $(roar-objs) $(libcmus-y)
++	$(call cmd,ld_dl,$(ROAR_LIBS))
+ # }}}
+ 
+ # man {{{
+--- cmus.orig/configure
++++ cmus/configure
+@@ -260,6 +260,12 @@ check_waveout()
+ 	return 1
+ }
+ 
++check_roar()
++{
++	pkg_config ROAR "libroar >= 0.4.2" "" "-lroar"
++	return $?
++}
++
+ check_mp4()
+ {
+ 	check_header mp4v2/mp4v2.h
+@@ -319,6 +325,7 @@ Optional Features: y/n
+   CONFIG_MP4      MPEG-4 AAC (.mp4, .m4a, .m4b)                   [auto]
+   CONFIG_AAC      AAC (.aac, audio/aac, audio/aacp)               [auto]
+   CONFIG_FFMPEG   FFMPEG (.shn, .wma)                             [auto]
++  CONFIG_ROAR     native RoarAudio output                         [auto]
+   CONFIG_PULSE    native PulseAudio output                        [auto]
+   CONFIG_ALSA     ALSA                                            [auto]
+   CONFIG_AO       Libao cross-platform audio library              [auto]
+@@ -376,6 +383,7 @@ check check_arts    CONFIG_ARTS
+ check check_oss     CONFIG_OSS
+ check check_sun     CONFIG_SUN
+ check check_waveout CONFIG_WAVEOUT
++check check_roar	CONFIG_ROAR
+ 
+ test "$WORDS_BIGENDIAN" = y && CFLAGS="${CFLAGS} -DWORDS_BIGENDIAN"
+ 
+@@ -392,6 +400,6 @@ config_header config/curses.h HAVE_RESIZ
+ 
+ makefile_vars bindir datadir libdir mandir exampledir
+ makefile_vars CONFIG_FLAC CONFIG_MAD CONFIG_MIKMOD CONFIG_MODPLUG CONFIG_MPC CONFIG_VORBIS CONFIG_WAVPACK CONFIG_WAV CONFIG_MP4 CONFIG_AAC CONFIG_FFMPEG
+-makefile_vars CONFIG_PULSE CONFIG_ALSA CONFIG_AO CONFIG_ARTS CONFIG_OSS CONFIG_SUN CONFIG_WAVEOUT
++makefile_vars CONFIG_ROAR CONFIG_PULSE CONFIG_ALSA CONFIG_AO CONFIG_ARTS CONFIG_OSS CONFIG_SUN CONFIG_WAVEOUT
+ 
+ generate_config_mk
diff --git a/debian/patches/series b/debian/patches/series
index 6d2095b..6feb1b9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 01_spelling_mistakes.diff
 02_cmus-tutorial_whatis.diff
 03-terminal_corruption.patch
+10-roaraudio_support.patch

-- 
cmus packaging



More information about the pkg-multimedia-commits mailing list