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

57
audio.c
View File

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

View File

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