mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Add ac3 pass-through device to OSS module.
This commit is contained in:
parent
5f43803236
commit
217545542d
@ -88,6 +88,8 @@ Setup: environment
|
|||||||
only if oss is configured
|
only if oss is configured
|
||||||
OSS_AUDIODEV=/dev/dsp
|
OSS_AUDIODEV=/dev/dsp
|
||||||
oss dsp device name
|
oss dsp device name
|
||||||
|
OSS_AC3_AUDIODEV=
|
||||||
|
oss AC3/pass-though device name
|
||||||
OSS_MIXERDEV=/dev/mixer
|
OSS_MIXERDEV=/dev/mixer
|
||||||
oss mixer device name
|
oss mixer device name
|
||||||
OSS_MIXER_CHANNEL=pcm
|
OSS_MIXER_CHANNEL=pcm
|
||||||
|
55
audio.c
55
audio.c
@ -1441,6 +1441,32 @@ static void OssThreadFlushBuffers(void)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
** Open OSS pcm device.
|
||||||
|
**
|
||||||
|
** @param use_ac3 use ac3/pass-through device
|
||||||
|
*/
|
||||||
|
static int OssOpenPCM(int use_ac3)
|
||||||
|
{
|
||||||
|
const char *device;
|
||||||
|
int fildes;
|
||||||
|
|
||||||
|
// &&|| hell
|
||||||
|
if (!(use_ac3 && ((device = AudioAC3Device)
|
||||||
|
|| (device = getenv("OSS_AC3_AUDIODEV"))))
|
||||||
|
&& !(device = AudioPCMDevice) && !(device = getenv("OSS_AUDIODEV"))) {
|
||||||
|
device = "/dev/dsp";
|
||||||
|
}
|
||||||
|
Debug(3, "audio/oss: &&|| hell '%s'\n", device);
|
||||||
|
|
||||||
|
if ((fildes = open(device, O_WRONLY)) < 0) {
|
||||||
|
Error(_("audio/oss: can't open dsp device '%s': %s\n"), device,
|
||||||
|
strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return fildes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Initialize OSS pcm device.
|
** Initialize OSS pcm device.
|
||||||
**
|
**
|
||||||
@ -1448,19 +1474,9 @@ static void OssThreadFlushBuffers(void)
|
|||||||
*/
|
*/
|
||||||
static void OssInitPCM(void)
|
static void OssInitPCM(void)
|
||||||
{
|
{
|
||||||
const char *device;
|
|
||||||
int fildes;
|
int fildes;
|
||||||
|
|
||||||
if (!(device = AudioPCMDevice)) {
|
fildes = OssOpenPCM(0);
|
||||||
if (!(device = getenv("OSS_AUDIODEV"))) {
|
|
||||||
device = "/dev/dsp";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((fildes = open(device, O_WRONLY)) < 0) {
|
|
||||||
Error(_("audio/oss: can't open dsp device '%s': %s\n"), device,
|
|
||||||
strerror(errno));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
OssPcmFildes = fildes;
|
OssPcmFildes = fildes;
|
||||||
}
|
}
|
||||||
@ -1601,8 +1617,7 @@ static uint64_t OssGetDelay(void)
|
|||||||
**
|
**
|
||||||
** @todo audio changes must be queued and done when the buffer is empty
|
** @todo audio changes must be queued and done when the buffer is empty
|
||||||
*/
|
*/
|
||||||
static int OssSetup(int *freq, int *channels, __attribute__ ((unused))
|
static int OssSetup(int *freq, int *channels, int use_ac3)
|
||||||
int use_ac3)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int tmp;
|
int tmp;
|
||||||
@ -1613,6 +1628,18 @@ static int OssSetup(int *freq, int *channels, __attribute__ ((unused))
|
|||||||
// flush any buffered data
|
// flush any buffered data
|
||||||
AudioFlushBuffers();
|
AudioFlushBuffers();
|
||||||
|
|
||||||
|
if (1) { // close+open for pcm / ac3
|
||||||
|
int fildes;
|
||||||
|
|
||||||
|
fildes = OssPcmFildes;
|
||||||
|
OssPcmFildes = -1;
|
||||||
|
close(fildes);
|
||||||
|
if (!(fildes = OssOpenPCM(use_ac3))) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
OssPcmFildes = fildes;
|
||||||
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
tmp = AFMT_S16_NE; // native 16 bits
|
tmp = AFMT_S16_NE; // native 16 bits
|
||||||
@ -1701,8 +1728,6 @@ static int OssSetup(int *freq, int *channels, __attribute__ ((unused))
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
** Initialize OSS audio output module.
|
** Initialize OSS audio output module.
|
||||||
**
|
|
||||||
** @param use_ac3 use ac3/pass-through device
|
|
||||||
*/
|
*/
|
||||||
static void OssInit(void)
|
static void OssInit(void)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user