printf(" -D,--device=NAME select PCM by NAME\n");
printf(" -4,--4ch four channels mode\n");
printf(" -6,--6ch six channels mode\n");
- printf(" -I,--iec958 raw IEC958 (S/PDIF) mode\n");
+ printf(" -C,--iec958c raw IEC958 (S/PDIF) consumer mode\n");
+ printf(" -P,--iec958p raw IEC958 (S/PDIF) professional mode\n");
printf(" -q,--quit quit mode\n");
}
{"device", 1, NULL, 'D'},
{"4ch", 0, NULL, '4'},
{"6ch", 0, NULL, '6'},
- {"iec958", 0, NULL, 'I'},
- {"spdif", 0, NULL, 'I'},
+ {"iec958c", 0, NULL, 'C'},
+ {"spdif", 0, NULL, 'C'},
+ {"iec958p", 0, NULL, 'P'},
{"quit", 0, NULL, 'q'},
{NULL, 0, NULL, 0},
};
ac3_config_t ac3_config;
output_t out_config;
int morehelp, loop = 0;
- char *pcm_name = NULL;
bzero(&ac3_config, sizeof(ac3_config));
ac3_config.fill_buffer_callback = fill_buffer;
out_config.bits = 16;
out_config.rate = 48000;
out_config.channels = 2;
- out_config.spdif = 0;
+ out_config.spdif = SPDIF_NONE;
morehelp = 0;
while (1) {
int c;
- if ((c = getopt_long(argc, argv, "hvD:46Iq", long_option, NULL)) < 0)
+ if ((c = getopt_long(argc, argv, "hvD:46CPq", long_option, NULL)) < 0)
break;
switch (c) {
case 'h':
printf("ac3dec version " VERSION "\n");
return 1;
case 'D':
- pcm_name = optarg;
+ out_config.pcm_name = optarg;
break;
case '4':
- if (!out_config.spdif)
+ if (out_config.spdif != SPDIF_NONE)
ac3_config.num_output_ch = 4;
break;
case '6':
- if (!out_config.spdif)
+ if (out_config.spdif != SPDIF_NONE)
ac3_config.num_output_ch = 6;
break;
- case 'I':
+ case 'C':
ac3_config.num_output_ch = 2;
- out_config.spdif = 1;
+ out_config.spdif = SPDIF_CON;
+ break;
+ case 'P':
+ ac3_config.num_output_ch = 2;
+ out_config.spdif = SPDIF_PRO;
break;
case 'q':
ac3_config.flags |= AC3_QUIET;
optind++;
loop++;
}
- if (!out_config.spdif) {
+ if (out_config.spdif == SPDIF_NONE) {
ac3_frame_t *ac3_frame;
ac3_init(&ac3_config);
ac3_frame = ac3_decode_frame();
goto __close;
}
- if (output->spdif) {
+ if (output->spdif != SPDIF_NONE) {
snd_pcm_info_t *info;
snd_ctl_elem_value_t *ctl;
snd_ctl_t *ctl_handle;
snd_aes_iec958_t spdif;
memset(&spdif, 0, sizeof(spdif));
- spdif.status[0] = IEC958_AES0_NONAUDIO |
- IEC958_AES0_CON_EMPHASIS_NONE;
- spdif.status[1] = IEC958_AES1_CON_ORIGINAL |
- IEC958_AES1_CON_PCM_CODER;
- spdif.status[2] = 0;
- spdif.status[3] = IEC958_AES3_CON_FS_48000;
+ if (output->spdif == SPDIF_PRO) {
+ spdif.status[0] = (IEC958_AES0_PROFESSIONAL |
+ IEC958_AES0_NONAUDIO |
+ IEC958_AES0_PRO_EMPHASIS_NONE |
+ IEC958_AES0_PRO_FS_48000);
+ spdif.status[1] = (IEC958_AES1_PRO_MODE_NOTID |
+ IEC958_AES1_PRO_USERBITS_NOTID);
+ spdif.status[2] = IEC958_AES2_PRO_WORDLEN_NOTID;
+ spdif.status[3] = 0;
+ } else {
+ spdif.status[0] = (IEC958_AES0_NONAUDIO |
+ IEC958_AES0_CON_EMPHASIS_NONE);
+ spdif.status[1] = (IEC958_AES1_CON_ORIGINAL |
+ IEC958_AES1_CON_PCM_CODER);
+ spdif.status[2] = 0;
+ spdif.status[3] = IEC958_AES3_CON_FS_48000;
+ }
snd_pcm_info_alloca(&info);
if ((err = snd_pcm_info(pcm, info)) < 0) {
fprintf(stderr, "pcm info error: %s", snd_strerror(err));