2009-03-13 18:43:16 +01:00
|
|
|
/*
|
2014-01-13 22:30:36 +01:00
|
|
|
* Copyright (C) 2003-2014 The Music Player Daemon Project
|
2009-03-13 18:43:16 +01:00
|
|
|
* http://www.musicpd.org
|
2004-02-24 00:41:20 +01:00
|
|
|
*
|
|
|
|
* 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.
|
2009-03-13 18:43:16 +01:00
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-02-24 00:41:20 +01:00
|
|
|
*/
|
|
|
|
|
2009-11-12 09:12:38 +01:00
|
|
|
#include "config.h"
|
2013-01-03 17:34:51 +01:00
|
|
|
#include "ls.hxx"
|
2013-11-28 18:48:35 +01:00
|
|
|
#include "util/StringUtil.hxx"
|
2013-04-08 23:30:21 +02:00
|
|
|
#include "util/UriUtil.hxx"
|
2014-01-24 00:26:53 +01:00
|
|
|
#include "client/Client.hxx"
|
2013-01-03 10:33:04 +01:00
|
|
|
|
2009-01-04 17:46:42 +01:00
|
|
|
#include <assert.h>
|
2009-03-03 17:01:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* file:// is not included in remoteUrlPrefixes, the connection method
|
|
|
|
* is detected at runtime and displayed as a urlhandler if the client is
|
|
|
|
* connected by IPC socket.
|
|
|
|
*/
|
2008-02-05 11:17:33 +01:00
|
|
|
static const char *remoteUrlPrefixes[] = {
|
2013-04-17 21:46:16 +02:00
|
|
|
#if defined(ENABLE_CURL)
|
2006-07-20 18:02:40 +02:00
|
|
|
"http://",
|
2013-09-03 13:07:33 +02:00
|
|
|
"https://",
|
2009-01-29 21:42:10 +01:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_MMS
|
|
|
|
"mms://",
|
|
|
|
"mmsh://",
|
|
|
|
"mmst://",
|
|
|
|
"mmsu://",
|
2010-05-18 20:48:52 +02:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_FFMPEG
|
|
|
|
"gopher://",
|
|
|
|
"rtp://",
|
|
|
|
"rtsp://",
|
|
|
|
"rtmp://",
|
|
|
|
"rtmpt://",
|
|
|
|
"rtmps://",
|
2010-12-21 22:23:01 +01:00
|
|
|
#endif
|
2013-12-29 00:36:57 +01:00
|
|
|
#ifdef ENABLE_SMBCLIENT
|
|
|
|
"smb://",
|
|
|
|
#endif
|
2014-02-06 07:29:26 +01:00
|
|
|
#ifdef ENABLE_NFS
|
|
|
|
"nfs://",
|
|
|
|
#endif
|
2010-12-21 22:23:01 +01:00
|
|
|
#ifdef ENABLE_CDIO_PARANOIA
|
|
|
|
"cdda://",
|
2011-03-27 08:41:05 +02:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_DESPOTIFY
|
|
|
|
"spt://",
|
add draft ALSA input plugin
I've created an elementary input plugin that plays sound from the
soundcard, so you can use MPD to listen to anything connected to the
line-in jack, or to Video4Linux FM radio cards that send audio through
the soundcard. There has been a small number of posts here in the
past requesting line-in input, so here is a first, simplistic stab at
it.
The patch adds a new sheme, alsa://, which causes mpd to play data
read directly from a souncdard. It defaults to hw:0,0, but you can
pass any ALSA device name in the URI. So, using mpc for example:
mpc add alsa://
mpc play
will play from device hw:0,0.
To use a diffferent device:
mpc add alsa://hw:1,0
2013-12-15 17:52:21 +01:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_ALSA
|
|
|
|
"alsa://",
|
2008-10-26 19:32:43 +01:00
|
|
|
#endif
|
2004-06-02 03:26:15 +02:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2009-03-03 17:01:42 +01:00
|
|
|
void print_supported_uri_schemes_to_fp(FILE *fp)
|
|
|
|
{
|
|
|
|
const char **prefixes = remoteUrlPrefixes;
|
|
|
|
|
|
|
|
#ifdef HAVE_UN
|
2012-06-12 22:29:04 +02:00
|
|
|
fprintf(fp, " file://");
|
2009-03-03 17:01:42 +01:00
|
|
|
#endif
|
|
|
|
while (*prefixes) {
|
2012-06-12 22:29:04 +02:00
|
|
|
fprintf(fp, " %s", *prefixes);
|
2009-03-03 17:01:42 +01:00
|
|
|
prefixes++;
|
|
|
|
}
|
2009-03-03 22:07:34 +01:00
|
|
|
fprintf(fp,"\n");
|
2009-03-03 17:01:42 +01:00
|
|
|
}
|
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
void print_supported_uri_schemes(Client &client)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2008-02-05 11:17:33 +01:00
|
|
|
const char **prefixes = remoteUrlPrefixes;
|
2004-06-03 01:22:37 +02:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
while (*prefixes) {
|
2008-09-07 14:02:40 +02:00
|
|
|
client_printf(client, "handler: %s\n", *prefixes);
|
2006-07-20 18:02:40 +02:00
|
|
|
prefixes++;
|
|
|
|
}
|
2004-06-03 01:22:37 +02:00
|
|
|
}
|
|
|
|
|
2009-01-04 17:46:42 +01:00
|
|
|
bool uri_supported_scheme(const char *uri)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2008-02-05 11:17:33 +01:00
|
|
|
const char **urlPrefixes = remoteUrlPrefixes;
|
2004-05-14 23:35:20 +02:00
|
|
|
|
2009-01-04 17:46:42 +01:00
|
|
|
assert(uri_has_scheme(uri));
|
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
while (*urlPrefixes) {
|
2013-11-28 18:48:35 +01:00
|
|
|
if (StringStartsWith(uri, *urlPrefixes))
|
2008-12-16 21:18:33 +01:00
|
|
|
return true;
|
2004-05-14 23:35:20 +02:00
|
|
|
urlPrefixes++;
|
2004-05-13 20:46:38 +02:00
|
|
|
}
|
|
|
|
|
2008-12-16 21:18:33 +01:00
|
|
|
return false;
|
2004-05-13 20:46:38 +02:00
|
|
|
}
|