1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

Set AES Parameter for SPDIF

This commit is contained in:
jojo61 2023-04-22 09:57:00 +02:00
parent 9219f06c5a
commit 0621ed064d
2 changed files with 38 additions and 21 deletions

47
audio.c
View File

@ -927,6 +927,7 @@ static snd_pcm_t *AlsaOpenPCM(int passthrough) {
const char *device;
snd_pcm_t *handle;
int err;
char tmp[80];
// &&|| hell
if (!(passthrough && ((device = AudioPassthroughDevice) || (device = getenv("ALSA_PASSTHROUGH_DEVICE")))) &&
@ -936,31 +937,47 @@ static snd_pcm_t *AlsaOpenPCM(int passthrough) {
if (!AudioDoingInit) { // reduce blabla during init
Info(_("audio/alsa: using %sdevice '%s'\n"), passthrough ? "pass-through " : "", device);
}
//printf("audio/alsa: using %sdevice '%s'\n", passthrough ? "pass-through " : "", device);
//
// for AC3 pass-through try to set the non-audio bit, use AES0=6
//
if (passthrough && AudioAppendAES) {
#if 0
// FIXME: not yet finished
char *buf;
const char *s;
int n;
if (passthrough) { //) && AudioAppendAES) {
n = strlen(device);
buf = alloca(n + sizeof(":AES0=6") + 1);
strcpy(buf, device);
if (!(s = strchr(buf, ':'))) {
// no alsa parameters
strcpy(buf + n, ":AES=6");
#if 1
if (!(strchr(device, ':'))) {
sprintf(tmp,
//"AES0=%d,AES1=%d,AES2=0,AES3=%d",
"%s:AES0=%d,AES1=%d,AES2=0",
device,
IEC958_AES0_NONAUDIO | IEC958_AES0_PRO_EMPHASIS_NONE,
IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER);
//map_iec958_srate(ao->samplerate));
}
Debug(3, "audio/alsa: try '%s'\n", buf);
else {
sprintf(tmp,
//"AES0=%d,AES1=%d,AES2=0,AES3=%d",
"%s,AES0=%d,AES1=%d,AES2=0",
device,
IEC958_AES0_NONAUDIO | IEC958_AES0_PRO_EMPHASIS_NONE,
IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER);
//map_iec958_srate(ao->samplerate));
}
//printf( "opening device '%s' => '%s'\n", device, tmp);
if ((err = snd_pcm_open(&handle, tmp, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0 ) {
Error(_("audio/alsa: playback open '%s' error: %s\n"), device, snd_strerror(err));
return NULL;
}
;
#endif
}
} else {
// open none blocking; if device is already used, we don't want wait
if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) {
Error(_("audio/alsa: playback open '%s' error: %s\n"), device, snd_strerror(err));
return NULL;
}
}
if ((err = snd_pcm_nonblock(handle, 0)) < 0) {
Error(_("audio/alsa: can't set block mode: %s\n"), snd_strerror(err));
@ -1951,7 +1968,7 @@ void AudioSetVolume(int volume) {
}
AudioAmplifier = volume;
if (!AudioSoftVolume) {
AudioUsedModule->SetVolume(volume); // set Volume
AudioUsedModule->SetVolume(volume);
}
}

View File

@ -61,7 +61,7 @@ extern void ToggleLUT();
/// vdr-plugin version number.
/// Makefile extracts the version number for generating the file name
/// for the distribution archive.
static const char *const VERSION = "3.9"
static const char *const VERSION = "3.10"
#ifdef GIT_REV
"-GIT" GIT_REV
#endif