All of lore.kernel.org
 help / color / mirror / Atom feed
From: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
To: alsa-devel@alsa-project.org, Vinod Koul <vinod.koul@intel.com>
Cc: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>,
	Jassi Brar <jaswinder.singh@linaro.org>,
	Takashi Iwai <tiwai@suse.com>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>
Subject: [PATCH v2 3/3] cplay: support IEC61937 format
Date: Fri,  2 Feb 2018 13:32:46 +0900	[thread overview]
Message-ID: <20180202043246.10481-3-suzuki.katsuhiro@socionext.com> (raw)
In-Reply-To: <20180202043246.10481-1-suzuki.katsuhiro@socionext.com>

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);
-- 
2.15.0

  parent reply	other threads:[~2018-02-02  4:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02  4:32 [PATCH v2 1/3] cplay: add option to specify codec ID Katsuhiro Suzuki
2018-02-02  4:32 ` [PATCH v2 2/3] cplay: move around MP3 header parsing method Katsuhiro Suzuki
2018-02-02  4:32 ` Katsuhiro Suzuki [this message]
2018-02-02 17:36 ` [PATCH v2 1/3] cplay: add option to specify codec ID Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180202043246.10481-3-suzuki.katsuhiro@socionext.com \
    --to=suzuki.katsuhiro@socionext.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=jaswinder.singh@linaro.org \
    --cc=masami.hiramatsu@linaro.org \
    --cc=tiwai@suse.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.