: tinycompress: header and rate fixes
cover : tinycompress: header and rate fixes
This patch series update the header file to verion 0.1.2. This brings the 64bit ABI compatiblity issue fix.
Users have complianed about use of SNDRV_RATE_xxx for passing the sample rates as it doesnt scale to what decoder user. So time to junk this and use raw rates as is.
Vinod Koul (3):
tinycompress: update the header to kernel API v0.1.2
tinycompress: cplay: use the numeric sample rate
tinycompress: remove usage of SNDRV_RATE_xxx
cplay.c | 2 +- include/sound/compress_offload.h | 23 ++++++++++++++--------- include/sound/compress_params.h | 9 +++++++++ include/tinycompress/tinycompress.h | 20 -------------------- utils.c | 34 ---------------------------------- 5 files changed, 24 insertions(+), 64 deletions(-)
--
~Vinod
PATCH 1/3 tinycompress: update the header to kernel API v0.1.2
Signed-off-by Vinod Koul <[email protected]>
--- include/sound/compress_offload.h | 23 ++++++++++++++--------- include/sound/compress_params.h | 9 +++++++++ 2 files changed, 23 insertions(+), 9 deletions(-)
include/sound/compress_offload.h +14 -9
@@ -7,17 +7,21 @@*** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** +*** To edit the content of this header, modify the corresponding +*** source file (e.g. under external/kernel-headers/original/) then +*** run bionic/libc/kernel/tools/update_all.py +*** +*** Any manual change here will be lost the next time this script will +*** be run. You've been warned! +*** **************************************************************************** ****************************************************************************/ #ifndef __COMPRESS_OFFLOAD_H #define __COMPRESS_OFFLOAD_H - #include <linux/types.h> #include <sound/asound.h> -//#include <sound/compress_params.h> - -#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 1) - +#include <sound/compress_params.h> +#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2) struct snd_compressed_buffer { __u32 fragment_size; __u32 fragments;
@@ -32,8 +36,8 @@ struct snd_compr_params {struct snd_compr_tstamp {__u32 byte_offset;__u32 copied_total; -snd_pcm_uframes_t pcm_frames; -snd_pcm_uframes_t pcm_io_frames; +__u32 pcm_frames; +__u32 pcm_io_frames;__u32 sampling_rate; };
@@ -90,6 +94,7 @@ struct snd_compr_metadata {#define SNDRV_COMPRESS_DRAIN _IO('C', 0x34)#define SNDRV_COMPRESS_NEXT_TRACK _IO('C', 0x35)#define SNDRV_COMPRESS_PARTIAL_DRAIN _IO('C', 0x36) -#define SND_COMPR_TRIGGER_DRAIN 7 -#define SND_COMPR_TRIGGER_PARTIAL_DRAIN 8 +#define SND_COMPR_TRIGGER_DRAIN 7 +#define SND_COMPR_TRIGGER_NEXT_TRACK 8 +#define SND_COMPR_TRIGGER_PARTIAL_DRAIN 9#endif
include/sound/compress_params.h +9 -0
@@ -7,11 +7,19 @@*** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** +*** To edit the content of this header, modify the corresponding +*** source file (e.g. under external/kernel-headers/original/) then +*** run bionic/libc/kernel/tools/update_all.py +*** +*** Any manual change here will be lost the next time this script will +*** be run. You've been warned! +*** **************************************************************************** ****************************************************************************/ #ifndef __SND_COMPRESS_PARAMS_H#define __SND_COMPRESS_PARAMS_H +#include <linux/types.h> #define MAX_NUM_CODECS 32#define MAX_NUM_CODEC_DESCRIPTORS 32#define MAX_NUM_BITRATES 32
@@ -30,6 +38,7 @@#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) +#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_G729#define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001)#define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001)
Signature · 1 line
1.7.0.4
PATCH 2/3 tinycompress: cplay: use the numeric sample rate
In reply to Vinod KoulSigned-off-by Vinod Koul <[email protected]>
--- cplay.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
cplay.c +1 -1
@@ -226,7 +226,7 @@ void play_samples(char *name, unsigned int card, unsigned int device, codec.id =SND_AUDIOCODEC_MP3 ; codec.ch_in = channels; codec.ch_out = channels; - codec.sample_rate =compress_get_alsa_rate (rate); + codec.sample_rate = rate;if (!codec.sample_rate) {fprintf (stderr,"invalid sample rate %d\n" , rate);fclose (file);
Signature · 1 line
1.7.0.4
PATCH 3/3 tinycompress: remove usage of SNDRV_RATE_xxx
In reply to Vinod Koulas now it is not to be used for passing the sampling rate
Signed-off-by Vinod Koul <[email protected]>
--- include/tinycompress/tinycompress.h | 20 -------------------- utils.c | 34 ---------------------------------- 2 files changed, 0 insertions(+), 54 deletions(-)
include/tinycompress/tinycompress.h +0 -20
@@ -269,25 +269,5 @@ int is_compress_ready(struct compress *compress);/* Returns a human readable reason for the last error */ const char *compress_get_error (struct compress *compress); -/* -* since the SNDRV_PCM_RATE_* is not availble anywhere in userspace -* and we have used these to define the sampling rate, we need to define -* then here -*/ -#define SNDRV_PCM_RATE_5512 (1<<0)/* 5512Hz */ -#define SNDRV_PCM_RATE_8000 (1<<1)/* 8000Hz */ -#define SNDRV_PCM_RATE_11025 (1<<2)/* 11025Hz */ -#define SNDRV_PCM_RATE_16000 (1<<3)/* 16000Hz */ -#define SNDRV_PCM_RATE_22050 (1<<4)/* 22050Hz */ -#define SNDRV_PCM_RATE_32000 (1<<5)/* 32000Hz */ -#define SNDRV_PCM_RATE_44100 (1<<6)/* 44100Hz */ -#define SNDRV_PCM_RATE_48000 (1<<7)/* 48000Hz */ -#define SNDRV_PCM_RATE_64000 (1<<8)/* 64000Hz */ -#define SNDRV_PCM_RATE_88200 (1<<9)/* 88200Hz */ -#define SNDRV_PCM_RATE_96000 (1<<10)/* 96000Hz */ -#define SNDRV_PCM_RATE_176400 (1<<11)/* 176400Hz */ -#define SNDRV_PCM_RATE_192000 (1<<12)/* 192000Hz */ -/* utility functions */ -unsigned int compress_get_alsa_rate (unsigned int rate);#endif
utils.c +0 -34
@@ -60,37 +60,3 @@#define __user#include "tinycompress/tinycompress.h" - -unsigned int compress_get_alsa_rate (unsigned int rate) -{ -switch (rate) { -case 5512 : -return SNDRV_PCM_RATE_5512 ; -case 8000 : -return SNDRV_PCM_RATE_8000 ; -case 11025 : -return SNDRV_PCM_RATE_11025 ; -case 16000 : -return SNDRV_PCM_RATE_16000 ; -case 22050 : -return SNDRV_PCM_RATE_22050 ; -case 32000 : -return SNDRV_PCM_RATE_32000 ; -case 44100 : -return SNDRV_PCM_RATE_44100 ; -case 48000 : -return SNDRV_PCM_RATE_48000 ; -case 64000 : -return SNDRV_PCM_RATE_64000 ; -case 88200 : -return SNDRV_PCM_RATE_88200 ; -case 96000 : -return SNDRV_PCM_RATE_96000 ; -case 176400 : -return SNDRV_PCM_RATE_176400 ; -case 192000 : -return SNDRV_PCM_RATE_192000 ; -default : -return 0 ; - } -}
Signature · 1 line
1.7.0.4