Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
bba127a3
Commit
bba127a3
authored
Mar 16, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solaris: new audio output plugin for Solaris /dev/audio
parent
18cb4fa2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
237 additions
and
0 deletions
+237
-0
Makefile.am
Makefile.am
+4
-0
NEWS
NEWS
+1
-0
configure.ac
configure.ac
+21
-0
user.xml
doc/user.xml
+32
-0
solaris_output_plugin.c
src/output/solaris_output_plugin.c
+175
-0
output_list.c
src/output_list.c
+4
-0
No files found.
Makefile.am
View file @
bba127a3
...
@@ -519,6 +519,10 @@ OUTPUT_SRC += \
...
@@ -519,6 +519,10 @@ OUTPUT_SRC += \
src/output/httpd_output_plugin.c
src/output/httpd_output_plugin.c
endif
endif
if
ENABLE_SOLARIS_OUTPUT
OUTPUT_SRC
+=
src/output/solaris_output_plugin.c
endif
#
#
# Sparse code analysis
# Sparse code analysis
...
...
NEWS
View file @
bba127a3
...
@@ -30,6 +30,7 @@ ver 0.15 - (200?/??/??)
...
@@ -30,6 +30,7 @@ ver 0.15 - (200?/??/??)
- mvp: fixed default device detection
- mvp: fixed default device detection
- pipe: new audio output plugin which runs a command
- pipe: new audio output plugin which runs a command
- alsa: better period_time default value for high sample rates
- alsa: better period_time default value for high sample rates
- solaris: new audio output plugin for Solaris /dev/audio
* commands:
* commands:
- "playlistinfo" supports a range now
- "playlistinfo" supports a range now
- added "sticker database", command "sticker", which allows clients
- added "sticker database", command "sticker", which allows clients
...
...
configure.ac
View file @
bba127a3
...
@@ -594,6 +594,20 @@ if test x$enable_shout = xyes; then
...
@@ -594,6 +594,20 @@ if test x$enable_shout = xyes; then
enable_shout=no)
enable_shout=no)
fi
fi
case "$host_os" in
solaris*)
AC_DEFINE(ENABLE_SOLARIS_OUTPUT, 1, [Define to enable Solaris /dev/audio support])
enable_solaris_output=yes
;;
*)
enable_solaris_output=no
;;
esac
echo "HOST_OS=$host_os"
AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
if test x$enable_oggvorbis_encoder = xyes; then
if test x$enable_oggvorbis_encoder = xyes; then
if test x$enable_oggvorbis = xno; then
if test x$enable_oggvorbis = xno; then
AC_MSG_WARN([disabling ogg shout streaming support because vorbis is not enabled])
AC_MSG_WARN([disabling ogg shout streaming support because vorbis is not enabled])
...
@@ -1144,6 +1158,12 @@ else
...
@@ -1144,6 +1158,12 @@ else
echo " SHOUTcast support .............disabled"
echo " SHOUTcast support .............disabled"
fi
fi
if test x$enable_solaris_output = xyes; then
echo " Solaris /dev/audio support ....enabled"
else
echo " Solaris /dev/audio support ....disabled"
fi
echo ""
echo ""
if
if
...
@@ -1151,6 +1171,7 @@ if
...
@@ -1151,6 +1171,7 @@ if
test x$enable_oss = xno &&
test x$enable_oss = xno &&
test x$enable_shout = xno &&
test x$enable_shout = xno &&
test x$enable_httpd_output = xno &&
test x$enable_httpd_output = xno &&
test x$enable_solaris_output = xno &&
test x$enable_alsa = xno &&
test x$enable_alsa = xno &&
test x$enable_osx = xno &&
test x$enable_osx = xno &&
test x$enable_pulse = xno &&
test x$enable_pulse = xno &&
...
...
doc/user.xml
View file @
bba127a3
...
@@ -424,6 +424,38 @@ cd mpd-0.14.2</programlisting>
...
@@ -424,6 +424,38 @@ cd mpd-0.14.2</programlisting>
or IceCast server. It forwards tags to this server.
or IceCast server. It forwards tags to this server.
</para>
</para>
</section>
</section>
<section>
<title><varname>
solaris
</varname></title>
<para>
The "Solaris" plugin runs only on SUN Solaris, and plays via
<filename>
/dev/audio
</filename>
.
</para>
<informaltable>
<tgroup
cols=
"2"
>
<thead>
<row>
<entry>
Setting
</entry>
<entry>
Description
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<varname>
device
</varname>
<parameter>
PATH
</parameter>
</entry>
<entry>
Sets the path of the audio device, defaults to
<filename>
/dev/audio
</filename>
.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
</section>
</section>
</chapter>
</chapter>
</book>
</book>
src/output/solaris_output_plugin.c
0 → 100644
View file @
bba127a3
/*
* Copyright (C) 2003-2009 The Music Player Daemon Project
* http://www.musicpd.org
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "output_api.h"
#include <glib.h>
#include <sys/audio.h>
#include <sys/stropts.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "solaris_output"
struct
solaris_output
{
/* configuration */
const
char
*
device
;
int
fd
;
};
/**
* The quark used for GError.domain.
*/
static
inline
GQuark
solaris_output_quark
(
void
)
{
return
g_quark_from_static_string
(
"solaris_output"
);
}
static
bool
solaris_output_test_default_device
(
void
)
{
struct
stat
st
;
return
stat
(
"/dev/audio"
,
&
st
)
==
0
&&
S_ISCHR
(
st
.
st_mode
)
&&
access
(
"/dev/audio"
,
W_OK
)
==
0
;
}
static
void
*
solaris_output_init
(
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
const
struct
config_param
*
param
,
G_GNUC_UNUSED
GError
**
error
)
{
struct
solaris_output
*
so
=
g_new
(
struct
solaris_output
,
1
);
so
->
device
=
config_get_block_string
(
param
,
"device"
,
"/dev/audio"
);
return
so
;
}
static
void
solaris_output_finish
(
void
*
data
)
{
struct
solaris_output
*
so
=
data
;
g_free
(
so
);
}
static
bool
solaris_output_open
(
void
*
data
,
struct
audio_format
*
audio_format
,
GError
**
error
)
{
struct
solaris_output
*
so
=
data
;
struct
audio_info
info
;
int
ret
,
flags
;
/* support only 16 bit mono/stereo for now; nothing else has
been tested */
audio_format
->
bits
=
16
;
/* open the device in non-blocking mode */
so
->
fd
=
open
(
so
->
device
,
O_WRONLY
|
O_NONBLOCK
);
if
(
so
->
fd
<
0
)
{
g_set_error
(
error
,
solaris_output_quark
(),
errno
,
"Failed to open %s: %s"
,
so
->
device
,
g_strerror
(
errno
));
return
false
;
}
/* restore blocking mode */
flags
=
fcntl
(
so
->
fd
,
F_GETFL
);
if
(
flags
>
0
&&
(
flags
&
O_NONBLOCK
)
!=
0
)
fcntl
(
so
->
fd
,
F_SETFL
,
flags
&
~
O_NONBLOCK
);
/* configure the audio device */
ret
=
ioctl
(
so
->
fd
,
AUDIO_GETINFO
,
&
info
);
if
(
ret
<
0
)
{
g_set_error
(
error
,
solaris_output_quark
(),
errno
,
"AUDIO_GETINFO failed: %s"
,
g_strerror
(
errno
));
close
(
so
->
fd
);
return
false
;
}
info
.
play
.
sample_rate
=
audio_format
->
sample_rate
;
info
.
play
.
channels
=
audio_format
->
channels
;
info
.
play
.
precision
=
audio_format
->
bits
;
info
.
play
.
encoding
=
AUDIO_ENCODING_LINEAR
;
ret
=
ioctl
(
so
->
fd
,
AUDIO_SETINFO
,
&
info
);
if
(
ret
<
0
)
{
g_set_error
(
error
,
solaris_output_quark
(),
errno
,
"AUDIO_SETINFO failed: %s"
,
g_strerror
(
errno
));
close
(
so
->
fd
);
return
false
;
}
return
true
;
}
static
void
solaris_output_close
(
void
*
data
)
{
struct
solaris_output
*
so
=
data
;
close
(
so
->
fd
);
}
static
size_t
solaris_output_play
(
void
*
data
,
const
void
*
chunk
,
size_t
size
,
GError
**
error
)
{
struct
solaris_output
*
so
=
data
;
ssize_t
nbytes
;
nbytes
=
write
(
so
->
fd
,
chunk
,
size
);
if
(
nbytes
<=
0
)
{
g_set_error
(
error
,
solaris_output_quark
(),
errno
,
"Write failed: %s"
,
g_strerror
(
errno
));
return
0
;
}
return
nbytes
;
}
static
void
solaris_output_cancel
(
void
*
data
)
{
struct
solaris_output
*
so
=
data
;
ioctl
(
so
->
fd
,
I_FLUSH
);
}
const
struct
audio_output_plugin
solaris_output_plugin
=
{
.
name
=
"solaris"
,
.
test_default_device
=
solaris_output_test_default_device
,
.
init
=
solaris_output_init
,
.
finish
=
solaris_output_finish
,
.
open
=
solaris_output_open
,
.
close
=
solaris_output_close
,
.
play
=
solaris_output_play
,
.
cancel
=
solaris_output_cancel
,
};
src/output_list.c
View file @
bba127a3
...
@@ -29,6 +29,7 @@ extern const struct audio_output_plugin alsaPlugin;
...
@@ -29,6 +29,7 @@ extern const struct audio_output_plugin alsaPlugin;
extern
const
struct
audio_output_plugin
ao_output_plugin
;
extern
const
struct
audio_output_plugin
ao_output_plugin
;
extern
const
struct
audio_output_plugin
oss_output_plugin
;
extern
const
struct
audio_output_plugin
oss_output_plugin
;
extern
const
struct
audio_output_plugin
osxPlugin
;
extern
const
struct
audio_output_plugin
osxPlugin
;
extern
const
struct
audio_output_plugin
solaris_output_plugin
;
extern
const
struct
audio_output_plugin
pulse_plugin
;
extern
const
struct
audio_output_plugin
pulse_plugin
;
extern
const
struct
audio_output_plugin
mvp_output_plugin
;
extern
const
struct
audio_output_plugin
mvp_output_plugin
;
extern
const
struct
audio_output_plugin
jackPlugin
;
extern
const
struct
audio_output_plugin
jackPlugin
;
...
@@ -57,6 +58,9 @@ const struct audio_output_plugin *audio_output_plugins[] = {
...
@@ -57,6 +58,9 @@ const struct audio_output_plugin *audio_output_plugins[] = {
#ifdef HAVE_OSX
#ifdef HAVE_OSX
&
osxPlugin
,
&
osxPlugin
,
#endif
#endif
#ifdef ENABLE_SOLARIS_OUTPUT
&
solaris_output_plugin
,
#endif
#ifdef HAVE_PULSE
#ifdef HAVE_PULSE
&
pulse_plugin
,
&
pulse_plugin
,
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment