This patch adds very simple supports for IEC61937 S/PDIF format.
The cplay just specifies the format ID and sends audio data to ALSA. There is no check the audio data is valid or invalid as IEC61937 specifications.
Signed-off-by: Katsuhiro Suzuki suzuki.katsuhiro@socionext.com --- src/utils/cplay.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/src/utils/cplay.c b/src/utils/cplay.c index beec45f..f15c728 100644 --- a/src/utils/cplay.c +++ b/src/utils/cplay.c @@ -304,6 +304,22 @@ void get_codec_mp3(FILE *file, struct compr_config *config, codec->format = 0; }
+int get_codec_iec(FILE *file, struct compr_config *config, + struct snd_codec *codec) +{ + codec->id = SND_AUDIOCODEC_IEC61937; + /* FIXME: cannot get accurate ch_in, any channels may be accepted */ + codec->ch_in = 2; + codec->ch_out = 2; + codec->sample_rate = 0; + codec->bit_rate = 0; + codec->rate_control = 0; + codec->profile = SND_AUDIOPROFILE_IEC61937_SPDIF; + codec->level = 0; + codec->ch_mode = 0; + codec->format = 0; +} + void play_samples(char *name, unsigned int card, unsigned int device, unsigned long buffer_size, unsigned int frag, unsigned long codec_id) @@ -327,6 +343,9 @@ void play_samples(char *name, unsigned int card, unsigned int device, case SND_AUDIOCODEC_MP3: get_codec_mp3(file, &config, &codec); break; + case SND_AUDIOCODEC_IEC61937: + get_codec_iec(file, &config, &codec); + break; default: fprintf(stderr, "codec ID %d is not supported\n", codec_id); exit(EXIT_FAILURE);