public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sbc: Add sbc_reinit_msbc
@ 2020-11-23  0:01 Pali Rohár
  2020-12-03 13:26 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Pali Rohár @ 2020-11-23  0:01 UTC (permalink / raw)
  To: linux-bluetooth

This adds a new API function sbc_reinit_msbc. Like sbc_reinit or
sbc_reinit_a2dp but for msbc.
---
 Makefile.am |  6 +++---
 sbc/sbc.c   | 18 ++++++++++++++++++
 sbc/sbc.h   |  1 +
 sbc/sbc.sym |  5 +++++
 4 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7ff0c7d..8a58b59 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,9 +6,9 @@ AM_MAKEFLAGS = --no-print-directory
 # Interfaces added:		CURRENT++ REVISION=0 AGE++
 # Interfaces removed:		CURRENT++ REVISION=0 AGE=0
 
-SBC_CURRENT = 3
-SBC_REVISION = 2
-SBC_AGE = 2
+SBC_CURRENT = 4
+SBC_REVISION = 0
+SBC_AGE = 3
 
 sbc_headers = sbc/sbc.h
 
diff --git a/sbc/sbc.c b/sbc/sbc.c
index edbe332..d059906 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -1087,6 +1087,24 @@ SBC_EXPORT int sbc_init_msbc(sbc_t *sbc, unsigned long flags)
 	return 0;
 }
 
+SBC_EXPORT int sbc_reinit_msbc(sbc_t *sbc, unsigned long flags)
+{
+	int err;
+
+	err = sbc_reinit(sbc, flags);
+	if (err < 0)
+		return err;
+
+	sbc->frequency = SBC_FREQ_16000;
+	sbc->blocks = MSBC_BLOCKS;
+	sbc->subbands = SBC_SB_8;
+	sbc->mode = SBC_MODE_MONO;
+	sbc->allocation = SBC_AM_LOUDNESS;
+	sbc->bitpool = 26;
+
+	return 0;
+}
+
 static int sbc_set_a2dp(sbc_t *sbc, unsigned long flags,
 					const void *conf, size_t conf_len)
 {
diff --git a/sbc/sbc.h b/sbc/sbc.h
index 835460a..65d5ef3 100644
--- a/sbc/sbc.h
+++ b/sbc/sbc.h
@@ -85,6 +85,7 @@ typedef struct sbc_struct sbc_t;
 int sbc_init(sbc_t *sbc, unsigned long flags);
 int sbc_reinit(sbc_t *sbc, unsigned long flags);
 int sbc_init_msbc(sbc_t *sbc, unsigned long flags);
+int sbc_reinit_msbc(sbc_t *sbc, unsigned long flags);
 int sbc_init_a2dp(sbc_t *sbc, unsigned long flags,
 					const void *conf, size_t conf_len);
 int sbc_reinit_a2dp(sbc_t *sbc, unsigned long flags,
diff --git a/sbc/sbc.sym b/sbc/sbc.sym
index c1f6919..938301a 100644
--- a/sbc/sbc.sym
+++ b/sbc/sbc.sym
@@ -26,3 +26,8 @@ global:
 	sbc_init_a2dp;
 	sbc_reinit_a2dp;
 } SBC_1.1;
+
+SBC_1.3 {
+global:
+	sbc_reinit_msbc;
+} SBC_1.2;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sbc: Add sbc_reinit_msbc
  2020-11-23  0:01 [PATCH] sbc: Add sbc_reinit_msbc Pali Rohár
@ 2020-12-03 13:26 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2020-12-03 13:26 UTC (permalink / raw)
  To: Pali Rohár; +Cc: linux-bluetooth

Hi Pali,

> This adds a new API function sbc_reinit_msbc. Like sbc_reinit or
> sbc_reinit_a2dp but for msbc.
> ---
> Makefile.am |  6 +++---
> sbc/sbc.c   | 18 ++++++++++++++++++
> sbc/sbc.h   |  1 +
> sbc/sbc.sym |  5 +++++
> 4 files changed, 27 insertions(+), 3 deletions(-)

patch has been applied.

Regards

Marcel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-03 13:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-23  0:01 [PATCH] sbc: Add sbc_reinit_msbc Pali Rohár
2020-12-03 13:26 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox