ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: Boldin Pavel <boldin.pavel@gmail.com>
To: ALT Linux Sisyphus discussion list <sisyphus@altlinux.ru>,
	Michael Shigorin <mike@osdn.org.ua>
Subject: Re: [sisyphus] Re: xmms падает
Date: Sat, 23 Jul 2005 03:50:24 +0500
Message-ID: <42E17830.9050706@inbox.ru> (raw)
In-Reply-To: <20050721103748.GD14505@osdn.org.ua>

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

Michael Shigorin пишет:

>On Wed, Jul 20, 2005 at 07:53:42PM +0400, Sergey V Turchin wrote:
>  
>
>>>2 zerg: давай-ка всё-таки забьём на поддержку aoss в
>>>soundwrapper?  Уж лучше пусть один поток работает, чем N --
>>>глючат.
>>>      
>>>
>>А зачем его через oss пускать с alsa?  Давай лучше автодетект
>>доделаем?  К тому же рыба есть в виде патча для arts.
>>    
>>
>
>Хорошо бы, да:
>
>- ты уверен, что эти грабли специфичны для xmms?
>- я сейчас не могу этим заняться (люди заняты).
>  
>
ловите аттач. собирается...

-- 

Boldin Pavel aka davinchi. mail-to: ldavinchi /at\ inbox _dot_ ru
    ZU - Zagovor Unixoidov. SSAU 303.



[-- Attachment #2: xmms-1.2.10-alt-alsa.patch --]
[-- Type: text/x-patch, Size: 2603 bytes --]

diff -NurpP -x compile -x '*-config' -x '*.Tpo' -x '.*' -x 'output.*' -x autom4te.cache -x '*.orig' -x '*.o' -x '*.so*' -x '*.a' -x missing -x install-sh -x depcomp -x core -x '*~' -x '*.m4' -x 'config.*' -x configure -x '*.sh' -x libtool -x 'Makefile*' -x 'stamp*' xmms-1.2.10.orig/xmms/main.c xmms-1.2.10/xmms/main.c
--- xmms-1.2.10.orig/xmms/main.c	2005-07-23 02:07:34 +0500
+++ xmms-1.2.10/xmms/main.c	2005-07-23 03:49:03 +0500
@@ -303,6 +303,66 @@ static const int mainwin_general_menu_en
 	sizeof(mainwin_general_menu_entries) / 
 	sizeof(mainwin_general_menu_entries[0]);
 
+#include <dlfcn.h>
+#include <alsa/asoundlib.h>
+
+/* Check if alsa is configured */
+static int	alsa_configured(void)
+{
+	void *alsa_handle;
+	int (*mixer_open)(snd_mixer_t **mixer, int mode);
+	int (*mixer_close)(snd_mixer_t *mixer);
+	int (*mixer_attach)(snd_mixer_t *mixer, const char *name);
+	int (*mixer_detach)(snd_mixer_t *mixer, const char *name);
+	char buf[64];
+	int ret;
+	int err;
+	int i;
+	snd_mixer_t *handle;
+	snd_ctl_t	*control;
+
+	ret = 0;
+
+	alsa_handle = dlopen("libasound.so", RTLD_NOW);
+	if (!alsa_handle)
+		return 0;
+	
+	mixer_open = dlsym(alsa_handle, "snd_mixer_open");
+	mixer_close = dlsym(alsa_handle, "snd_mixer_close");
+	mixer_attach = dlsym(alsa_handle, "snd_mixer_attach");
+	mixer_detach = dlsym(alsa_handle, "snd_mixer_detach");
+	if (!mixer_open || !mixer_close ||
+		!mixer_attach || !mixer_detach)
+	{
+		dlclose(alsa_handle);
+		return 0;
+	}
+
+	if ((err = mixer_open(&handle, 0)) < 0)
+	{
+		dlclose(alsa_handle);
+		return 0;
+	}
+
+	for (i = 0; i < 32; i++)
+	{
+		snprintf(buf, 64, "hw:%d", i);
+
+		if (mixer_attach(handle,  buf) < 0)
+			continue;
+
+		if (mixer_detach(handle, buf) < 0)
+			continue;
+
+		ret = 1;
+		break;
+	}
+
+	mixer_close(handle);
+	dlclose(alsa_handle);
+	return ret;
+}
+
 static void make_xmms_dir(void)
 {
 	gchar *filename;
@@ -499,6 +559,22 @@ static void read_config(void)
 		cfg.gentitle_format = g_strdup("%p - %t");
 	if (cfg.outputplugin == NULL)
 	{
+		if (alsa_configured())
+		{
+			cfg.outputplugin = g_strdup_printf("%s/%s/libALSA.so", PLUGIN_DIR,
+					plugin_dir_list[0]);
+			if (access(cfg.outputplugin, R_OK))
+			{
+				g_free(cfg.outputplugin);
+				cfg.outputplugin = NULL;
+				fprintf(stderr, "** ALSA configured, install xmms-out-alsa please\n");
+			}
+			else
+				fprintf(stderr, "** ALSA configured, auto enabling ALSA output plugin\n");
+		}
+	}
+	if (cfg.outputplugin == NULL)
+	{
 #ifdef HAVE_OSS
 		cfg.outputplugin = g_strdup_printf("%s/%s/libOSS.so", PLUGIN_DIR, plugin_dir_list[0]);
 #elif defined(sun)

  parent reply	other threads:[~2005-07-22 22:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-20 14:28 [sisyphus] " Michael Bykov
2005-07-20 10:40 ` Michael Isachenkov
2005-07-20 10:47 ` [sisyphus] " Michael Shigorin
2005-07-20 11:15   ` Artem
2005-07-20 12:00 ` [sisyphus] " Eugene Vlasov
2005-07-20 18:08   ` Michael Bykov
2005-07-20 15:34     ` [sisyphus] " Michael Shigorin
2005-07-20 15:53       ` Sergey V Turchin
2005-07-20 16:30         ` Andrey Rahmatullin
2005-07-20 17:09           ` [sisyphus] " Sergey V Turchin
2005-07-21 10:37         ` [sisyphus] " Michael Shigorin
2005-07-21 11:04           ` Sergey V Turchin
2005-07-21 12:03             ` Michael Shigorin
2005-07-22 22:50           ` Boldin Pavel [this message]
2005-07-20 17:17     ` [sisyphus] " Eugene Vlasov
2005-07-21 18:44       ` Artem
2005-07-22 15:47         ` [sisyphus] " Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42E17830.9050706@inbox.ru \
    --to=boldin.pavel@gmail.com \
    --cc=ldavinchi@inbox.ru \
    --cc=mike@osdn.org.ua \
    --cc=sisyphus@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git