]> git.alsa-project.org Git - tinycompress.git/commitdiff
cplay: support IEC61937 format
authorKatsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Fri, 2 Feb 2018 04:32:46 +0000 (13:32 +0900)
committerVinod Koul <vinod.koul@intel.com>
Fri, 2 Feb 2018 17:30:37 +0000 (23:00 +0530)
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>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
src/utils/cplay.c

index beec45f1c949866221877d9ed743e70084703c62..f15c72876fb02b20bfd7cb5d030ea09ad0dc6a57 100644 (file)
@@ -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);