S/PDIF related changes..

This commit is contained in:
Jaroslav Kysela 2000-12-21 21:53:07 +00:00
parent a3696de829
commit 84f294a3b9
2 changed files with 29 additions and 18 deletions

View file

@ -309,22 +309,30 @@ static int get_control(snd_ctl_t *handle, snd_control_id_t *id, snd_config_t *to
}
}
if (info.type == SND_CONTROL_TYPE_BYTES) {
char buf[info.values_count * 2 + 1];
char *p = buf;
char *hex = "0123456789abcdef";
for (idx = 0; idx < info.values_count; idx++) {
int v = ctl.value.bytes.data[idx];
*p++ = hex[v >> 4];
*p++ = hex[v & 0x0f];
}
*p = '\0';
err = snd_config_string_add(control, "value", buf);
if (err < 0) {
error("snd_config_string_add: %s", snd_strerror(err));
return err;
switch (info.type) {
case SND_CONTROL_TYPE_BYTES:
{
char buf[info.values_count * 2 + 1];
char *p = buf;
char *hex = "0123456789abcdef";
for (idx = 0; idx < info.values_count; idx++) {
int v = ctl.value.bytes.data[idx];
*p++ = hex[v >> 4];
*p++ = hex[v & 0x0f];
}
*p = '\0';
err = snd_config_string_add(control, "value", buf);
if (err < 0) {
error("snd_config_string_add: %s", snd_strerror(err));
return err;
}
return 0;
}
case SND_CONTROL_TYPE_IEC958:
error("An IEC958 control ignored");
return 0;
default:
break;
}
if (info.values_count == 1) {
@ -823,7 +831,7 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control)
error("bad control.%d.value.%d content", numid, idx);
return -EINVAL;
}
ctl.value.integer.value[idx] = val;
ctl.value.bytes.data[idx] = val;
break;
default:
break;

View file

@ -86,7 +86,6 @@ static int verbose = 0;
static int buffer_pos = 0;
static size_t bits_per_sample, bits_per_frame;
static size_t buffer_bytes;
int digital = SND_PCM_DIG_NONE;
static int count;
static int vocmajor, vocminor;
@ -404,10 +403,10 @@ int main(int argc, char *argv[])
interleaved = 0;
break;
case 'C':
digital = SND_PCM_DIG_AES_IEC958C;
// digital = SND_PCM_DIG_AES_IEC958C;
break;
case 'P':
digital = SND_PCM_DIG_AES_IEC958P;
// digital = SND_PCM_DIG_AES_IEC958P;
break;
default:
fprintf(stderr, "Try `%s --help' for more information.\n", command);
@ -421,6 +420,9 @@ int main(int argc, char *argv[])
return 1;
}
#if 1
#warning "The S/PDIF code needs to be recoded.."
#else
if (digital != SND_PCM_DIG_NONE) {
snd_pcm_dig_params_t dig;
memset(&dig, 0, sizeof(dig));
@ -443,6 +445,7 @@ int main(int argc, char *argv[])
return 1;
}
}
#endif
if (nonblock) {
err = snd_pcm_nonblock(handle, 1);