2009-03-13 18:43:16 +01:00
|
|
|
/*
|
2013-01-29 14:32:32 +01:00
|
|
|
* Copyright (C) 2003-2013 The Music Player Daemon Project
|
2009-03-13 18:43:16 +01:00
|
|
|
* http://www.musicpd.org
|
2004-10-29 05:30:23 +02: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-10-29 05:30:23 +02:00
|
|
|
*/
|
|
|
|
|
2009-11-12 09:12:38 +01:00
|
|
|
#include "config.h"
|
2013-01-29 14:32:32 +01:00
|
|
|
#include "OssOutputPlugin.hxx"
|
2013-07-30 08:34:10 +02:00
|
|
|
#include "OutputAPI.hxx"
|
2013-02-22 20:51:23 +01:00
|
|
|
#include "MixerList.hxx"
|
2013-08-07 10:31:31 +02:00
|
|
|
#include "system/fd_util.h"
|
2004-10-29 05:30:23 +02:00
|
|
|
|
2008-11-25 17:43:28 +01:00
|
|
|
#include <glib.h>
|
2009-01-01 18:08:29 +01:00
|
|
|
|
2008-10-08 10:49:29 +02:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <fcntl.h>
|
2008-11-25 17:43:28 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
2010-05-13 14:42:09 +02:00
|
|
|
#include <assert.h>
|
2008-11-25 17:43:28 +01:00
|
|
|
|
|
|
|
#undef G_LOG_DOMAIN
|
|
|
|
#define G_LOG_DOMAIN "oss"
|
2008-10-08 10:49:29 +02:00
|
|
|
|
2004-10-29 05:30:23 +02:00
|
|
|
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
|
|
|
# include <soundcard.h>
|
2006-07-20 20:53:56 +02:00
|
|
|
#else /* !(defined(__OpenBSD__) || defined(__NetBSD__) */
|
2004-10-29 05:30:23 +02:00
|
|
|
# include <sys/soundcard.h>
|
2006-07-20 20:53:56 +02:00
|
|
|
#endif /* !(defined(__OpenBSD__) || defined(__NetBSD__) */
|
2004-10-29 05:30:23 +02:00
|
|
|
|
2011-02-28 00:09:45 +01:00
|
|
|
/* We got bug reports from FreeBSD users who said that the two 24 bit
|
|
|
|
formats generate white noise on FreeBSD, but 32 bit works. This is
|
|
|
|
a workaround until we know what exactly is expected by the kernel
|
|
|
|
audio drivers. */
|
|
|
|
#ifndef __linux__
|
|
|
|
#undef AFMT_S24_PACKED
|
|
|
|
#undef AFMT_S24_NE
|
|
|
|
#endif
|
|
|
|
|
2012-03-21 19:19:40 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-04-09 01:24:32 +02:00
|
|
|
#include "pcm/PcmExport.hxx"
|
|
|
|
#include "util/Manual.hxx"
|
2012-03-21 19:19:40 +01:00
|
|
|
#endif
|
|
|
|
|
2013-04-17 01:21:33 +02:00
|
|
|
struct OssOutput {
|
2011-09-16 23:31:48 +02:00
|
|
|
struct audio_output base;
|
|
|
|
|
2012-03-21 19:19:40 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-04-09 01:24:32 +02:00
|
|
|
Manual<PcmExport> pcm_export;
|
2012-03-21 19:19:40 +01:00
|
|
|
#endif
|
|
|
|
|
2004-10-29 06:11:10 +02:00
|
|
|
int fd;
|
2006-08-01 14:39:10 +02:00
|
|
|
const char *device;
|
2008-10-14 17:21:53 +02:00
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
/**
|
|
|
|
* The current input audio format. This is needed to reopen
|
|
|
|
* the device after cancel().
|
|
|
|
*/
|
2013-08-03 21:00:50 +02:00
|
|
|
AudioFormat audio_format;
|
2012-03-21 23:47:29 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current OSS audio format. This is needed to reopen the
|
|
|
|
* device after cancel().
|
|
|
|
*/
|
|
|
|
int oss_format;
|
2013-04-17 01:21:33 +02:00
|
|
|
|
|
|
|
OssOutput():fd(-1), device(nullptr) {}
|
|
|
|
|
2013-08-04 12:25:08 +02:00
|
|
|
bool Initialize(const config_param ¶m, GError **error_r) {
|
2013-04-17 01:21:33 +02:00
|
|
|
return ao_base_init(&base, &oss_output_plugin, param,
|
|
|
|
error_r);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Deinitialize() {
|
|
|
|
ao_base_finish(&base);
|
|
|
|
}
|
2008-10-14 17:21:53 +02:00
|
|
|
};
|
|
|
|
|
2009-02-26 22:04:59 +01:00
|
|
|
/**
|
|
|
|
* The quark used for GError.domain.
|
|
|
|
*/
|
|
|
|
static inline GQuark
|
|
|
|
oss_output_quark(void)
|
|
|
|
{
|
|
|
|
return g_quark_from_static_string("oss_output");
|
|
|
|
}
|
|
|
|
|
2009-02-26 19:18:13 +01:00
|
|
|
enum oss_stat {
|
|
|
|
OSS_STAT_NO_ERROR = 0,
|
|
|
|
OSS_STAT_NOT_CHAR_DEV = -1,
|
|
|
|
OSS_STAT_NO_PERMS = -2,
|
|
|
|
OSS_STAT_DOESN_T_EXIST = -3,
|
|
|
|
OSS_STAT_OTHER = -4,
|
|
|
|
};
|
2005-03-05 04:36:24 +01:00
|
|
|
|
2009-02-26 19:18:13 +01:00
|
|
|
static enum oss_stat
|
2009-02-26 19:16:33 +01:00
|
|
|
oss_stat_device(const char *device, int *errno_r)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2005-03-05 04:36:24 +01:00
|
|
|
struct stat st;
|
2006-07-20 18:02:40 +02:00
|
|
|
|
|
|
|
if (0 == stat(device, &st)) {
|
|
|
|
if (!S_ISCHR(st.st_mode)) {
|
2005-03-05 04:36:24 +01:00
|
|
|
return OSS_STAT_NOT_CHAR_DEV;
|
|
|
|
}
|
2006-07-20 18:02:40 +02:00
|
|
|
} else {
|
2009-02-26 19:16:33 +01:00
|
|
|
*errno_r = errno;
|
2005-03-05 04:36:24 +01:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
switch (errno) {
|
2005-03-05 04:36:24 +01:00
|
|
|
case ENOENT:
|
|
|
|
case ENOTDIR:
|
|
|
|
return OSS_STAT_DOESN_T_EXIST;
|
|
|
|
case EACCES:
|
|
|
|
return OSS_STAT_NO_PERMS;
|
|
|
|
default:
|
|
|
|
return OSS_STAT_OTHER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-26 19:18:13 +01:00
|
|
|
return OSS_STAT_NO_ERROR;
|
2005-03-05 04:36:24 +01:00
|
|
|
}
|
|
|
|
|
2006-08-01 14:39:10 +02:00
|
|
|
static const char *default_devices[] = { "/dev/sound/dsp", "/dev/dsp" };
|
|
|
|
|
2009-02-26 19:16:33 +01:00
|
|
|
static bool
|
|
|
|
oss_output_test_default_device(void)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2006-08-01 14:39:10 +02:00
|
|
|
int fd, i;
|
2005-03-12 04:10:09 +01:00
|
|
|
|
2008-11-25 17:43:28 +01:00
|
|
|
for (i = G_N_ELEMENTS(default_devices); --i >= 0; ) {
|
2009-11-10 16:53:24 +01:00
|
|
|
fd = open_cloexec(default_devices[i], O_WRONLY, 0);
|
2009-11-07 18:55:16 +01:00
|
|
|
|
|
|
|
if (fd >= 0) {
|
2008-11-25 17:43:28 +01:00
|
|
|
close(fd);
|
2008-10-29 20:40:27 +01:00
|
|
|
return true;
|
2006-08-01 14:39:10 +02:00
|
|
|
}
|
2008-11-25 17:43:28 +01:00
|
|
|
g_warning("Error opening OSS device \"%s\": %s\n",
|
2012-03-06 22:06:08 +01:00
|
|
|
default_devices[i], g_strerror(errno));
|
2005-03-12 04:10:09 +01:00
|
|
|
}
|
|
|
|
|
2008-10-29 20:40:27 +01:00
|
|
|
return false;
|
2006-08-01 14:39:10 +02:00
|
|
|
}
|
2005-03-12 04:10:09 +01:00
|
|
|
|
2011-09-16 23:31:48 +02:00
|
|
|
static struct audio_output *
|
2009-02-26 22:04:59 +01:00
|
|
|
oss_open_default(GError **error)
|
2006-08-01 14:39:10 +02:00
|
|
|
{
|
2008-11-25 17:43:28 +01:00
|
|
|
int err[G_N_ELEMENTS(default_devices)];
|
2009-02-26 19:18:13 +01:00
|
|
|
enum oss_stat ret[G_N_ELEMENTS(default_devices)];
|
2005-03-12 04:10:09 +01:00
|
|
|
|
2013-08-04 12:25:08 +02:00
|
|
|
const config_param empty;
|
2013-01-29 14:32:32 +01:00
|
|
|
for (int i = G_N_ELEMENTS(default_devices); --i >= 0; ) {
|
2009-02-26 19:16:33 +01:00
|
|
|
ret[i] = oss_stat_device(default_devices[i], &err[i]);
|
2009-02-26 19:18:13 +01:00
|
|
|
if (ret[i] == OSS_STAT_NO_ERROR) {
|
2013-04-17 01:21:33 +02:00
|
|
|
OssOutput *od = new OssOutput();
|
2013-08-04 12:25:08 +02:00
|
|
|
if (!od->Initialize(empty, error)) {
|
2013-04-17 01:21:33 +02:00
|
|
|
delete od;
|
2011-09-16 23:31:48 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-08-01 14:39:10 +02:00
|
|
|
od->device = default_devices[i];
|
2011-09-16 23:31:48 +02:00
|
|
|
return &od->base;
|
2006-08-01 14:39:10 +02:00
|
|
|
}
|
2005-03-12 04:10:09 +01:00
|
|
|
}
|
|
|
|
|
2013-01-29 14:32:32 +01:00
|
|
|
for (int i = G_N_ELEMENTS(default_devices); --i >= 0; ) {
|
2006-08-01 14:39:10 +02:00
|
|
|
const char *dev = default_devices[i];
|
|
|
|
switch(ret[i]) {
|
2009-02-26 19:18:13 +01:00
|
|
|
case OSS_STAT_NO_ERROR:
|
|
|
|
/* never reached */
|
|
|
|
break;
|
2006-08-01 14:39:10 +02:00
|
|
|
case OSS_STAT_DOESN_T_EXIST:
|
2008-11-25 17:43:28 +01:00
|
|
|
g_warning("%s not found\n", dev);
|
2006-08-01 14:39:10 +02:00
|
|
|
break;
|
|
|
|
case OSS_STAT_NOT_CHAR_DEV:
|
2008-11-25 17:43:28 +01:00
|
|
|
g_warning("%s is not a character device\n", dev);
|
2006-08-01 14:39:10 +02:00
|
|
|
break;
|
|
|
|
case OSS_STAT_NO_PERMS:
|
2008-11-25 17:43:28 +01:00
|
|
|
g_warning("%s: permission denied\n", dev);
|
2006-08-01 14:39:10 +02:00
|
|
|
break;
|
2009-02-26 19:18:13 +01:00
|
|
|
case OSS_STAT_OTHER:
|
2008-11-25 17:43:28 +01:00
|
|
|
g_warning("Error accessing %s: %s\n",
|
2012-03-06 22:06:08 +01:00
|
|
|
dev, g_strerror(err[i]));
|
2006-08-01 14:39:10 +02:00
|
|
|
}
|
|
|
|
}
|
2009-02-26 22:04:59 +01:00
|
|
|
|
|
|
|
g_set_error(error, oss_output_quark(), 0,
|
|
|
|
"error trying to open default OSS device");
|
|
|
|
return NULL;
|
2005-03-12 04:10:09 +01:00
|
|
|
}
|
|
|
|
|
2011-09-16 23:31:48 +02:00
|
|
|
static struct audio_output *
|
2013-08-04 12:25:08 +02:00
|
|
|
oss_output_init(const config_param ¶m, GError **error_r)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-08-04 12:25:08 +02:00
|
|
|
const char *device = param.GetBlockValue("device");
|
2009-01-25 16:04:03 +01:00
|
|
|
if (device != NULL) {
|
2013-04-17 01:21:33 +02:00
|
|
|
OssOutput *od = new OssOutput();
|
|
|
|
if (!od->Initialize(param, error_r)) {
|
|
|
|
delete od;
|
2011-09-16 23:31:48 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-01-25 16:04:03 +01:00
|
|
|
od->device = device;
|
2011-09-16 23:31:48 +02:00
|
|
|
return &od->base;
|
2006-08-01 14:39:10 +02:00
|
|
|
}
|
2009-01-25 16:04:03 +01:00
|
|
|
|
2013-04-17 01:21:33 +02:00
|
|
|
return oss_open_default(error_r);
|
2004-10-29 05:30:23 +02:00
|
|
|
}
|
|
|
|
|
2009-02-26 19:16:33 +01:00
|
|
|
static void
|
2011-09-16 23:31:48 +02:00
|
|
|
oss_output_finish(struct audio_output *ao)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-04-17 01:21:33 +02:00
|
|
|
OssOutput *od = (OssOutput *)ao;
|
2004-10-29 05:30:23 +02:00
|
|
|
|
2011-09-16 23:31:48 +02:00
|
|
|
ao_base_finish(&od->base);
|
2013-04-17 01:21:33 +02:00
|
|
|
delete od;
|
2004-10-29 05:30:23 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 19:19:40 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
|
|
|
|
|
|
|
static bool
|
2013-08-04 23:48:01 +02:00
|
|
|
oss_output_enable(struct audio_output *ao, gcc_unused GError **error_r)
|
2012-03-21 19:19:40 +01:00
|
|
|
{
|
2013-04-17 01:21:33 +02:00
|
|
|
OssOutput *od = (OssOutput *)ao;
|
2012-03-21 19:19:40 +01:00
|
|
|
|
2013-04-09 01:24:32 +02:00
|
|
|
od->pcm_export.Construct();
|
2012-03-21 19:19:40 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
oss_output_disable(struct audio_output *ao)
|
|
|
|
{
|
2013-04-17 01:21:33 +02:00
|
|
|
OssOutput *od = (OssOutput *)ao;
|
2012-03-21 19:19:40 +01:00
|
|
|
|
2013-04-09 01:24:32 +02:00
|
|
|
od->pcm_export.Destruct();
|
2012-03-21 19:19:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2009-02-26 19:16:33 +01:00
|
|
|
static void
|
2013-04-17 01:21:33 +02:00
|
|
|
oss_close(OssOutput *od)
|
2006-07-16 18:53:04 +02:00
|
|
|
{
|
2006-07-20 18:02:40 +02:00
|
|
|
if (od->fd >= 0)
|
2010-07-25 11:09:13 +02:00
|
|
|
close(od->fd);
|
2006-07-16 18:53:04 +02:00
|
|
|
od->fd = -1;
|
|
|
|
}
|
|
|
|
|
2009-02-26 19:18:16 +01:00
|
|
|
/**
|
2010-05-13 14:42:09 +02:00
|
|
|
* A tri-state type for oss_try_ioctl().
|
2009-02-26 19:18:16 +01:00
|
|
|
*/
|
2010-05-13 14:42:09 +02:00
|
|
|
enum oss_setup_result {
|
|
|
|
SUCCESS,
|
|
|
|
ERROR,
|
|
|
|
UNSUPPORTED,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoke an ioctl on the OSS file descriptor. On success, SUCCESS is
|
|
|
|
* returned. If the parameter is not supported, UNSUPPORTED is
|
|
|
|
* returned. Any other failure returns ERROR and allocates a GError.
|
|
|
|
*/
|
|
|
|
static enum oss_setup_result
|
|
|
|
oss_try_ioctl_r(int fd, unsigned long request, int *value_r,
|
|
|
|
const char *msg, GError **error_r)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2010-05-13 14:42:09 +02:00
|
|
|
assert(fd >= 0);
|
|
|
|
assert(value_r != NULL);
|
|
|
|
assert(msg != NULL);
|
|
|
|
assert(error_r == NULL || *error_r == NULL);
|
2005-03-05 04:36:24 +01:00
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
int ret = ioctl(fd, request, value_r);
|
|
|
|
if (ret >= 0)
|
|
|
|
return SUCCESS;
|
|
|
|
|
|
|
|
if (errno == EINVAL)
|
|
|
|
return UNSUPPORTED;
|
|
|
|
|
|
|
|
g_set_error(error_r, oss_output_quark(), errno,
|
|
|
|
"%s: %s", msg, g_strerror(errno));
|
|
|
|
return ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoke an ioctl on the OSS file descriptor. On success, SUCCESS is
|
|
|
|
* returned. If the parameter is not supported, UNSUPPORTED is
|
|
|
|
* returned. Any other failure returns ERROR and allocates a GError.
|
|
|
|
*/
|
|
|
|
static enum oss_setup_result
|
|
|
|
oss_try_ioctl(int fd, unsigned long request, int value,
|
|
|
|
const char *msg, GError **error_r)
|
|
|
|
{
|
|
|
|
return oss_try_ioctl_r(fd, request, &value, msg, error_r);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set up the channel number, and attempts to find alternatives if the
|
|
|
|
* specified number is not supported.
|
|
|
|
*/
|
|
|
|
static bool
|
2013-08-03 21:00:50 +02:00
|
|
|
oss_setup_channels(int fd, AudioFormat &audio_format, GError **error_r)
|
2010-05-13 14:42:09 +02:00
|
|
|
{
|
|
|
|
const char *const msg = "Failed to set channel count";
|
2013-08-03 21:00:50 +02:00
|
|
|
int channels = audio_format.channels;
|
2010-05-13 14:42:09 +02:00
|
|
|
enum oss_setup_result result =
|
|
|
|
oss_try_ioctl_r(fd, SNDCTL_DSP_CHANNELS, &channels, msg, error_r);
|
|
|
|
switch (result) {
|
|
|
|
case SUCCESS:
|
|
|
|
if (!audio_valid_channel_count(channels))
|
|
|
|
break;
|
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
audio_format.channels = channels;
|
2010-05-13 14:42:09 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case ERROR:
|
2009-02-26 19:18:16 +01:00
|
|
|
return false;
|
2010-05-13 14:42:09 +02:00
|
|
|
|
|
|
|
case UNSUPPORTED:
|
|
|
|
break;
|
2005-03-05 15:01:13 +01:00
|
|
|
}
|
2005-03-05 04:36:24 +01:00
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
for (unsigned i = 1; i < 2; ++i) {
|
2013-08-03 21:00:50 +02:00
|
|
|
if (i == audio_format.channels)
|
2010-05-13 14:42:09 +02:00
|
|
|
/* don't try that again */
|
|
|
|
continue;
|
|
|
|
|
|
|
|
channels = i;
|
|
|
|
result = oss_try_ioctl_r(fd, SNDCTL_DSP_CHANNELS, &channels,
|
|
|
|
msg, error_r);
|
|
|
|
switch (result) {
|
|
|
|
case SUCCESS:
|
|
|
|
if (!audio_valid_channel_count(channels))
|
|
|
|
break;
|
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
audio_format.channels = channels;
|
2010-05-13 14:42:09 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case ERROR:
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case UNSUPPORTED:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_set_error(error_r, oss_output_quark(), EINVAL, "%s", msg);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set up the sample rate, and attempts to find alternatives if the
|
|
|
|
* specified sample rate is not supported.
|
|
|
|
*/
|
|
|
|
static bool
|
2013-08-03 21:00:50 +02:00
|
|
|
oss_setup_sample_rate(int fd, AudioFormat &audio_format,
|
2010-05-13 14:42:09 +02:00
|
|
|
GError **error_r)
|
|
|
|
{
|
|
|
|
const char *const msg = "Failed to set sample rate";
|
2013-08-03 21:00:50 +02:00
|
|
|
int sample_rate = audio_format.sample_rate;
|
2010-05-13 14:42:09 +02:00
|
|
|
enum oss_setup_result result =
|
|
|
|
oss_try_ioctl_r(fd, SNDCTL_DSP_SPEED, &sample_rate,
|
|
|
|
msg, error_r);
|
|
|
|
switch (result) {
|
|
|
|
case SUCCESS:
|
|
|
|
if (!audio_valid_sample_rate(sample_rate))
|
|
|
|
break;
|
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
audio_format.sample_rate = sample_rate;
|
2010-05-13 14:42:09 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case ERROR:
|
2009-02-26 19:18:16 +01:00
|
|
|
return false;
|
2010-05-13 14:42:09 +02:00
|
|
|
|
|
|
|
case UNSUPPORTED:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const int sample_rates[] = { 48000, 44100, 0 };
|
|
|
|
for (unsigned i = 0; sample_rates[i] != 0; ++i) {
|
|
|
|
sample_rate = sample_rates[i];
|
2013-08-03 21:00:50 +02:00
|
|
|
if (sample_rate == (int)audio_format.sample_rate)
|
2010-05-13 14:42:09 +02:00
|
|
|
continue;
|
|
|
|
|
|
|
|
result = oss_try_ioctl_r(fd, SNDCTL_DSP_SPEED, &sample_rate,
|
|
|
|
msg, error_r);
|
|
|
|
switch (result) {
|
|
|
|
case SUCCESS:
|
|
|
|
if (!audio_valid_sample_rate(sample_rate))
|
|
|
|
break;
|
2011-02-04 10:39:21 +01:00
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
audio_format.sample_rate = sample_rate;
|
2010-05-13 14:42:09 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case ERROR:
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case UNSUPPORTED:
|
|
|
|
break;
|
|
|
|
}
|
2005-03-05 15:01:13 +01:00
|
|
|
}
|
2005-03-05 04:36:24 +01:00
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
g_set_error(error_r, oss_output_quark(), EINVAL, "%s", msg);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a MPD sample format to its OSS counterpart. Returns
|
|
|
|
* AFMT_QUERY if there is no direct counterpart.
|
|
|
|
*/
|
|
|
|
static int
|
2013-08-03 21:00:50 +02:00
|
|
|
sample_format_to_oss(SampleFormat format)
|
2010-05-13 14:42:09 +02:00
|
|
|
{
|
|
|
|
switch (format) {
|
2013-08-03 21:00:50 +02:00
|
|
|
case SampleFormat::UNDEFINED:
|
|
|
|
case SampleFormat::FLOAT:
|
|
|
|
case SampleFormat::DSD:
|
2010-05-13 14:42:09 +02:00
|
|
|
return AFMT_QUERY;
|
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
case SampleFormat::S8:
|
2010-05-13 14:42:09 +02:00
|
|
|
return AFMT_S8;
|
2009-11-10 17:11:34 +01:00
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
case SampleFormat::S16:
|
2010-05-13 14:42:09 +02:00
|
|
|
return AFMT_S16_NE;
|
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
case SampleFormat::S24_P32:
|
2010-05-13 15:42:20 +02:00
|
|
|
#ifdef AFMT_S24_NE
|
|
|
|
return AFMT_S24_NE;
|
|
|
|
#else
|
|
|
|
return AFMT_QUERY;
|
|
|
|
#endif
|
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
case SampleFormat::S32:
|
2010-05-13 15:42:20 +02:00
|
|
|
#ifdef AFMT_S32_NE
|
|
|
|
return AFMT_S32_NE;
|
|
|
|
#else
|
2010-05-13 14:42:09 +02:00
|
|
|
return AFMT_QUERY;
|
2010-05-13 15:42:20 +02:00
|
|
|
#endif
|
2010-05-13 14:42:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return AFMT_QUERY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert an OSS sample format to its MPD counterpart. Returns
|
2013-08-03 21:00:50 +02:00
|
|
|
* SampleFormat::UNDEFINED if there is no direct counterpart.
|
2010-05-13 14:42:09 +02:00
|
|
|
*/
|
2013-08-03 21:00:50 +02:00
|
|
|
static SampleFormat
|
2010-05-13 14:42:09 +02:00
|
|
|
sample_format_from_oss(int format)
|
|
|
|
{
|
|
|
|
switch (format) {
|
|
|
|
case AFMT_S8:
|
2013-08-03 21:00:50 +02:00
|
|
|
return SampleFormat::S8;
|
2010-05-13 14:42:09 +02:00
|
|
|
|
|
|
|
case AFMT_S16_NE:
|
2013-08-03 21:00:50 +02:00
|
|
|
return SampleFormat::S16;
|
2008-10-29 18:35:03 +01:00
|
|
|
|
2010-05-13 15:42:20 +02:00
|
|
|
#ifdef AFMT_S24_PACKED
|
|
|
|
case AFMT_S24_PACKED:
|
2013-08-03 21:00:50 +02:00
|
|
|
return SampleFormat::S24_P32;
|
2010-05-13 15:42:20 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef AFMT_S24_NE
|
|
|
|
case AFMT_S24_NE:
|
2013-08-03 21:00:50 +02:00
|
|
|
return SampleFormat::S24_P32;
|
2010-05-13 15:42:20 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef AFMT_S32_NE
|
|
|
|
case AFMT_S32_NE:
|
2013-08-03 21:00:50 +02:00
|
|
|
return SampleFormat::S32;
|
2010-05-13 15:42:20 +02:00
|
|
|
#endif
|
|
|
|
|
2008-10-29 18:35:03 +01:00
|
|
|
default:
|
2013-08-03 21:00:50 +02:00
|
|
|
return SampleFormat::UNDEFINED;
|
2006-03-25 06:33:14 +01:00
|
|
|
}
|
2010-05-13 14:42:09 +02:00
|
|
|
}
|
2006-03-25 06:33:14 +01:00
|
|
|
|
2012-03-21 22:28:18 +01:00
|
|
|
/**
|
|
|
|
* Probe one sample format.
|
|
|
|
*
|
2013-08-03 21:00:50 +02:00
|
|
|
* @return the selected sample format or SampleFormat::UNDEFINED on
|
2012-03-21 22:28:18 +01:00
|
|
|
* error
|
|
|
|
*/
|
|
|
|
static enum oss_setup_result
|
2013-08-03 21:00:50 +02:00
|
|
|
oss_probe_sample_format(int fd, SampleFormat sample_format,
|
|
|
|
SampleFormat *sample_format_r,
|
2012-03-21 23:47:29 +01:00
|
|
|
int *oss_format_r,
|
2012-03-21 22:28:18 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-04-09 01:24:32 +02:00
|
|
|
PcmExport &pcm_export,
|
2012-03-21 22:28:18 +01:00
|
|
|
#endif
|
|
|
|
GError **error_r)
|
|
|
|
{
|
|
|
|
int oss_format = sample_format_to_oss(sample_format);
|
|
|
|
if (oss_format == AFMT_QUERY)
|
|
|
|
return UNSUPPORTED;
|
|
|
|
|
|
|
|
enum oss_setup_result result =
|
|
|
|
oss_try_ioctl_r(fd, SNDCTL_DSP_SAMPLESIZE,
|
|
|
|
&oss_format,
|
|
|
|
"Failed to set sample format", error_r);
|
2012-03-21 22:15:45 +01:00
|
|
|
|
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-08-03 21:00:50 +02:00
|
|
|
if (result == UNSUPPORTED && sample_format == SampleFormat::S24_P32) {
|
2012-03-21 22:15:45 +01:00
|
|
|
/* if the driver doesn't support padded 24 bit, try
|
|
|
|
packed 24 bit */
|
|
|
|
oss_format = AFMT_S24_PACKED;
|
|
|
|
result = oss_try_ioctl_r(fd, SNDCTL_DSP_SAMPLESIZE,
|
|
|
|
&oss_format,
|
|
|
|
"Failed to set sample format", error_r);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-03-21 22:28:18 +01:00
|
|
|
if (result != SUCCESS)
|
|
|
|
return result;
|
|
|
|
|
|
|
|
sample_format = sample_format_from_oss(oss_format);
|
2013-08-03 21:00:50 +02:00
|
|
|
if (sample_format == SampleFormat::UNDEFINED)
|
2012-03-21 22:28:18 +01:00
|
|
|
return UNSUPPORTED;
|
|
|
|
|
|
|
|
*sample_format_r = sample_format;
|
2012-03-21 23:47:29 +01:00
|
|
|
*oss_format_r = oss_format;
|
2012-03-21 22:28:18 +01:00
|
|
|
|
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-04-09 01:24:32 +02:00
|
|
|
pcm_export.Open(sample_format, 0, false, false,
|
2012-03-21 22:15:45 +01:00
|
|
|
oss_format == AFMT_S24_PACKED,
|
2012-03-21 22:28:18 +01:00
|
|
|
oss_format == AFMT_S24_PACKED &&
|
|
|
|
G_BYTE_ORDER != G_LITTLE_ENDIAN);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
/**
|
|
|
|
* Set up the sample format, and attempts to find alternatives if the
|
|
|
|
* specified format is not supported.
|
|
|
|
*/
|
|
|
|
static bool
|
2013-08-03 21:00:50 +02:00
|
|
|
oss_setup_sample_format(int fd, AudioFormat &audio_format,
|
2012-03-21 23:47:29 +01:00
|
|
|
int *oss_format_r,
|
2012-03-21 19:19:40 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-04-09 01:24:32 +02:00
|
|
|
PcmExport &pcm_export,
|
2012-03-21 19:19:40 +01:00
|
|
|
#endif
|
2010-05-13 14:42:09 +02:00
|
|
|
GError **error_r)
|
|
|
|
{
|
2013-08-03 21:00:50 +02:00
|
|
|
SampleFormat mpd_format;
|
2012-03-21 22:28:18 +01:00
|
|
|
enum oss_setup_result result =
|
2013-08-03 21:00:50 +02:00
|
|
|
oss_probe_sample_format(fd, audio_format.format,
|
2012-03-21 23:47:29 +01:00
|
|
|
&mpd_format, oss_format_r,
|
2012-03-21 22:28:18 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-01-29 14:32:32 +01:00
|
|
|
pcm_export,
|
2012-03-21 22:28:18 +01:00
|
|
|
#endif
|
|
|
|
error_r);
|
2010-05-13 14:42:09 +02:00
|
|
|
switch (result) {
|
|
|
|
case SUCCESS:
|
2013-08-03 21:00:50 +02:00
|
|
|
audio_format.format = mpd_format;
|
2010-05-13 14:42:09 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case ERROR:
|
2009-02-26 19:18:16 +01:00
|
|
|
return false;
|
2010-05-13 14:42:09 +02:00
|
|
|
|
|
|
|
case UNSUPPORTED:
|
|
|
|
break;
|
2005-03-05 15:01:13 +01:00
|
|
|
}
|
2004-10-30 06:19:11 +02:00
|
|
|
|
2012-03-21 22:28:18 +01:00
|
|
|
if (result != UNSUPPORTED)
|
|
|
|
return result == SUCCESS;
|
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
/* the requested sample format is not available - probe for
|
|
|
|
other formats supported by MPD */
|
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
static const SampleFormat sample_formats[] = {
|
|
|
|
SampleFormat::S24_P32,
|
|
|
|
SampleFormat::S32,
|
|
|
|
SampleFormat::S16,
|
|
|
|
SampleFormat::S8,
|
|
|
|
SampleFormat::UNDEFINED /* sentinel */
|
2010-05-13 14:42:09 +02:00
|
|
|
};
|
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
for (unsigned i = 0; sample_formats[i] != SampleFormat::UNDEFINED; ++i) {
|
2010-05-13 14:42:09 +02:00
|
|
|
mpd_format = sample_formats[i];
|
2013-08-03 21:00:50 +02:00
|
|
|
if (mpd_format == audio_format.format)
|
2010-05-13 14:42:09 +02:00
|
|
|
/* don't try that again */
|
|
|
|
continue;
|
|
|
|
|
2012-03-21 22:28:18 +01:00
|
|
|
result = oss_probe_sample_format(fd, mpd_format,
|
2012-03-21 23:47:29 +01:00
|
|
|
&mpd_format, oss_format_r,
|
2012-03-21 22:28:18 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-01-29 14:32:32 +01:00
|
|
|
pcm_export,
|
2012-03-21 22:28:18 +01:00
|
|
|
#endif
|
|
|
|
error_r);
|
2010-05-13 14:42:09 +02:00
|
|
|
switch (result) {
|
|
|
|
case SUCCESS:
|
2013-08-03 21:00:50 +02:00
|
|
|
audio_format.format = mpd_format;
|
2010-05-13 14:42:09 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case ERROR:
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case UNSUPPORTED:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-21 22:28:18 +01:00
|
|
|
g_set_error_literal(error_r, oss_output_quark(), EINVAL,
|
|
|
|
"Failed to set sample format");
|
2010-05-13 14:42:09 +02:00
|
|
|
return false;
|
2009-02-26 19:18:16 +01:00
|
|
|
}
|
2004-10-30 06:19:11 +02:00
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
/**
|
|
|
|
* Sets up the OSS device which was opened before.
|
|
|
|
*/
|
2009-02-26 19:18:16 +01:00
|
|
|
static bool
|
2013-08-03 21:00:50 +02:00
|
|
|
oss_setup(OssOutput *od, AudioFormat &audio_format,
|
2010-05-13 14:42:09 +02:00
|
|
|
GError **error_r)
|
2009-02-26 19:18:16 +01:00
|
|
|
{
|
2010-05-13 14:42:09 +02:00
|
|
|
return oss_setup_channels(od->fd, audio_format, error_r) &&
|
|
|
|
oss_setup_sample_rate(od->fd, audio_format, error_r) &&
|
2012-03-21 23:47:29 +01:00
|
|
|
oss_setup_sample_format(od->fd, audio_format, &od->oss_format,
|
2012-03-21 19:19:40 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-04-09 01:24:32 +02:00
|
|
|
od->pcm_export,
|
2012-03-21 19:19:40 +01:00
|
|
|
#endif
|
|
|
|
error_r);
|
2010-05-13 14:42:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reopen the device with the saved audio_format, without any probing.
|
|
|
|
*/
|
|
|
|
static bool
|
2013-04-17 01:21:33 +02:00
|
|
|
oss_reopen(OssOutput *od, GError **error_r)
|
2010-05-13 14:42:09 +02:00
|
|
|
{
|
|
|
|
assert(od->fd < 0);
|
2009-02-26 19:18:16 +01:00
|
|
|
|
2009-11-10 16:53:24 +01:00
|
|
|
od->fd = open_cloexec(od->device, O_WRONLY, 0);
|
2009-11-07 18:55:16 +01:00
|
|
|
if (od->fd < 0) {
|
2010-05-13 14:42:09 +02:00
|
|
|
g_set_error(error_r, oss_output_quark(), errno,
|
2009-02-26 22:04:59 +01:00
|
|
|
"Error opening OSS device \"%s\": %s",
|
2012-03-06 22:06:08 +01:00
|
|
|
od->device, g_strerror(errno));
|
2009-02-26 19:18:16 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
enum oss_setup_result result;
|
|
|
|
|
|
|
|
const char *const msg1 = "Failed to set channel count";
|
|
|
|
result = oss_try_ioctl(od->fd, SNDCTL_DSP_CHANNELS,
|
|
|
|
od->audio_format.channels, msg1, error_r);
|
|
|
|
if (result != SUCCESS) {
|
|
|
|
oss_close(od);
|
|
|
|
if (result == UNSUPPORTED)
|
|
|
|
g_set_error(error_r, oss_output_quark(), EINVAL,
|
|
|
|
"%s", msg1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *const msg2 = "Failed to set sample rate";
|
|
|
|
result = oss_try_ioctl(od->fd, SNDCTL_DSP_SPEED,
|
|
|
|
od->audio_format.sample_rate, msg2, error_r);
|
|
|
|
if (result != SUCCESS) {
|
|
|
|
oss_close(od);
|
|
|
|
if (result == UNSUPPORTED)
|
|
|
|
g_set_error(error_r, oss_output_quark(), EINVAL,
|
|
|
|
"%s", msg2);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *const msg3 = "Failed to set sample format";
|
|
|
|
result = oss_try_ioctl(od->fd, SNDCTL_DSP_SAMPLESIZE,
|
2012-03-21 23:47:29 +01:00
|
|
|
od->oss_format,
|
2010-05-13 14:42:09 +02:00
|
|
|
msg3, error_r);
|
|
|
|
if (result != SUCCESS) {
|
2009-02-26 19:18:16 +01:00
|
|
|
oss_close(od);
|
2010-05-13 14:42:09 +02:00
|
|
|
if (result == UNSUPPORTED)
|
|
|
|
g_set_error(error_r, oss_output_quark(), EINVAL,
|
|
|
|
"%s", msg3);
|
2009-02-26 19:18:16 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2004-10-30 06:19:11 +02:00
|
|
|
}
|
|
|
|
|
2008-10-29 20:40:27 +01:00
|
|
|
static bool
|
2013-08-03 21:00:50 +02:00
|
|
|
oss_output_open(struct audio_output *ao, AudioFormat &audio_format,
|
2011-09-16 23:31:48 +02:00
|
|
|
GError **error)
|
2005-03-05 15:01:13 +01:00
|
|
|
{
|
2013-04-17 01:21:33 +02:00
|
|
|
OssOutput *od = (OssOutput *)ao;
|
2006-03-25 06:33:14 +01:00
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
od->fd = open_cloexec(od->device, O_WRONLY, 0);
|
|
|
|
if (od->fd < 0) {
|
|
|
|
g_set_error(error, oss_output_quark(), errno,
|
|
|
|
"Error opening OSS device \"%s\": %s",
|
2012-03-06 22:06:08 +01:00
|
|
|
od->device, g_strerror(errno));
|
2008-10-29 20:40:27 +01:00
|
|
|
return false;
|
2010-05-13 14:42:09 +02:00
|
|
|
}
|
2005-03-10 03:47:18 +01:00
|
|
|
|
2010-05-13 14:42:09 +02:00
|
|
|
if (!oss_setup(od, audio_format, error)) {
|
|
|
|
oss_close(od);
|
|
|
|
return false;
|
|
|
|
}
|
2005-03-10 03:47:18 +01:00
|
|
|
|
2013-08-03 21:00:50 +02:00
|
|
|
od->audio_format = audio_format;
|
2010-05-13 14:42:09 +02:00
|
|
|
return true;
|
2005-03-05 15:01:13 +01:00
|
|
|
}
|
|
|
|
|
2009-02-26 19:16:33 +01:00
|
|
|
static void
|
2011-09-16 23:31:48 +02:00
|
|
|
oss_output_close(struct audio_output *ao)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-04-17 01:21:33 +02:00
|
|
|
OssOutput *od = (OssOutput *)ao;
|
2004-10-30 06:19:11 +02:00
|
|
|
|
2005-04-07 00:52:42 +02:00
|
|
|
oss_close(od);
|
2004-10-29 05:30:23 +02:00
|
|
|
}
|
|
|
|
|
2009-02-26 19:16:33 +01:00
|
|
|
static void
|
2011-09-16 23:31:48 +02:00
|
|
|
oss_output_cancel(struct audio_output *ao)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-04-17 01:21:33 +02:00
|
|
|
OssOutput *od = (OssOutput *)ao;
|
2005-03-05 15:01:13 +01:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
if (od->fd >= 0) {
|
2005-03-05 15:01:13 +01:00
|
|
|
ioctl(od->fd, SNDCTL_DSP_RESET, 0);
|
2005-04-07 00:52:42 +02:00
|
|
|
oss_close(od);
|
2005-03-05 15:01:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-23 09:29:56 +01:00
|
|
|
static size_t
|
2011-09-16 23:31:48 +02:00
|
|
|
oss_output_play(struct audio_output *ao, const void *chunk, size_t size,
|
|
|
|
GError **error)
|
2004-10-29 05:30:23 +02:00
|
|
|
{
|
2013-04-17 01:21:33 +02:00
|
|
|
OssOutput *od = (OssOutput *)ao;
|
2008-04-12 06:15:52 +02:00
|
|
|
ssize_t ret;
|
2004-10-29 05:30:23 +02:00
|
|
|
|
2005-04-07 00:52:42 +02:00
|
|
|
/* reopen the device since it was closed by dropBufferedAudio */
|
2010-05-13 14:42:09 +02:00
|
|
|
if (od->fd < 0 && !oss_reopen(od, error))
|
2009-02-26 22:04:59 +01:00
|
|
|
return 0;
|
2005-04-07 00:52:42 +02:00
|
|
|
|
2012-03-21 19:19:40 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-04-09 01:24:32 +02:00
|
|
|
chunk = od->pcm_export->Export(chunk, size, size);
|
2012-03-21 19:19:40 +01:00
|
|
|
#endif
|
|
|
|
|
2009-02-23 09:29:56 +01:00
|
|
|
while (true) {
|
2009-02-23 09:34:26 +01:00
|
|
|
ret = write(od->fd, chunk, size);
|
2012-03-27 00:03:44 +02:00
|
|
|
if (ret > 0) {
|
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-04-09 01:24:32 +02:00
|
|
|
ret = od->pcm_export->CalcSourceSize(ret);
|
2012-03-27 00:03:44 +02:00
|
|
|
#endif
|
|
|
|
return ret;
|
|
|
|
}
|
2009-02-23 09:29:56 +01:00
|
|
|
|
|
|
|
if (ret < 0 && errno != EINTR) {
|
2009-02-26 22:04:59 +01:00
|
|
|
g_set_error(error, oss_output_quark(), errno,
|
|
|
|
"Write error on %s: %s",
|
2012-03-06 22:06:08 +01:00
|
|
|
od->device, g_strerror(errno));
|
2009-02-23 09:29:56 +01:00
|
|
|
return 0;
|
2004-10-29 05:30:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-26 19:16:33 +01:00
|
|
|
const struct audio_output_plugin oss_output_plugin = {
|
2013-01-29 14:32:32 +01:00
|
|
|
"oss",
|
|
|
|
oss_output_test_default_device,
|
|
|
|
oss_output_init,
|
|
|
|
oss_output_finish,
|
2012-03-21 19:19:40 +01:00
|
|
|
#ifdef AFMT_S24_PACKED
|
2013-01-29 14:32:32 +01:00
|
|
|
oss_output_enable,
|
|
|
|
oss_output_disable,
|
|
|
|
#else
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2012-03-21 19:19:40 +01:00
|
|
|
#endif
|
2013-01-29 14:32:32 +01:00
|
|
|
oss_output_open,
|
|
|
|
oss_output_close,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
oss_output_play,
|
|
|
|
nullptr,
|
|
|
|
oss_output_cancel,
|
|
|
|
nullptr,
|
|
|
|
|
|
|
|
&oss_mixer_plugin,
|
2004-10-29 05:30:23 +02:00
|
|
|
};
|