Skip to contentSkip to conversation

tinycompress: update compress headers for sample rate field

PATCH New Vinod Koul 1 participant 2 messages Jun 19, 2014 Sound

lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

PATCH 1/2 tinycompress: update compress headers for sample rate field

commit "929559b: ALSA: compress: add num_sample_rates in snd_codec_desc" adds array for passing sample rate instead of bit map. Update the local header as well

---
 include/sound/compress_params.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/sound/compress_params.h +3 -1
index deda425..378417a 100644
@@ -23,6 +23,7 @@
 #define MAX_NUM_CODECS 32
 #define MAX_NUM_CODEC_DESCRIPTORS 32
 #define MAX_NUM_BITRATES 32
+#define MAX_NUM_SAMPLE_RATES 32
 
 #define SND_AUDIOCODEC_PCM ((__u32) 0x00000001)
 #define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002)
@@ -209,7 +210,8 @@ union snd_codec_options {
 
 struct snd_codec_desc {
  __u32 max_ch;
- __u32 sample_rates;
+ __u32 sample_rates[MAX_NUM_SAMPLE_RATES];
+ __u32 num_sample_rates;
  __u32 bit_rate[MAX_NUM_BITRATES];
  __u32 num_bitrates;
  __u32 rate_control;
Signature · 1 line
1.7.0.4
author
#1 lore raw

PATCH 2/2 tinycompress: update headers for packed, aligned

commit "6b24a8dd: ALSA: compress: fix the struct alignment to 4 bytes" updated compress struct to force packed and aligned to 4 bytes. Update here a s well

---
 include/sound/compress_offload.h |   15 ++++++++-------
 include/sound/compress_params.h  |   14 +++++++-------
 2 files changed, 15 insertions(+), 14 deletions(-)
include/sound/compress_offload.h +8 -7
index 6a8e97f..980f69f 100644
@@ -22,16 +22,17 @@
 #include <sound/asound.h>
 #include <sound/compress_params.h>
 #define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2)
+
 struct snd_compressed_buffer {
  __u32 fragment_size;
  __u32 fragments;
-};
+}__attribute__((packed, aligned(4)));
 
 struct snd_compr_params {
  struct snd_compressed_buffer buffer;
  struct snd_codec codec;
  __u8 no_wake_mode;
-};
+}__attribute__((packed, aligned(4)));
 
 struct snd_compr_tstamp {
  __u32 byte_offset;
@@ -39,12 +40,12 @@ struct snd_compr_tstamp {
  __u32 pcm_frames;
  __u32 pcm_io_frames;
  __u32 sampling_rate;
-};
+}__attribute__((packed, aligned(4)));
 
 struct snd_compr_avail {
  __u64 avail;
  struct snd_compr_tstamp tstamp;
-};
+}__attribute__((packed, aligned(4)));
 
 enum snd_compr_direction {
  SND_COMPRESS_PLAYBACK = 0,
@@ -60,13 +61,13 @@ struct snd_compr_caps {
  __u32 max_fragments;
  __u32 codecs[MAX_NUM_CODECS];
  __u32 reserved[11];
-};
+}__attribute__((packed, aligned(4)));
 
 struct snd_compr_codec_caps {
  __u32 codec;
  __u32 num_descriptors;
  struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
-};
+}__attribute__((packed, aligned(4)));
 
 enum {
 	SNDRV_COMPRESS_ENCODER_PADDING = 1,
@@ -76,7 +77,7 @@ enum {
 struct snd_compr_metadata {
 	 __u32 key;
 	 __u32 value[8];
-};
+}__attribute__((packed, aligned(4)));
 
 #define SNDRV_COMPRESS_IOCTL_VERSION _IOR('C', 0x00, int)
 #define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x10, struct snd_compr_caps)
include/sound/compress_params.h +7 -7
index 378417a..9802292 100644
@@ -182,23 +182,23 @@ struct snd_enc_vorbis {
  __u32 max_bit_rate;
  __u32 min_bit_rate;
  __u32 downmix;
-};
+}__attribute__((packed, aligned(4)));
 
 struct snd_enc_real {
  __u32 quant_bits;
  __u32 start_region;
  __u32 num_regions;
-};
+}__attribute__((packed, aligned(4)));
 
 struct snd_enc_flac {
  __u32 num;
  __u32 gain;
-};
+}__attribute__((packed, aligned(4)));
 
 struct snd_enc_generic {
  __u32 bw;
  __s32 reserved[15];
-};
+}__attribute__((packed, aligned(4)));
 
 union snd_codec_options {
  struct snd_enc_wma wma;
@@ -206,7 +206,7 @@ union snd_codec_options {
  struct snd_enc_real real;
  struct snd_enc_flac flac;
  struct snd_enc_generic generic;
-};
+}__attribute__((packed, aligned(4)));
 
 struct snd_codec_desc {
  __u32 max_ch;
@@ -220,7 +220,7 @@ struct snd_codec_desc {
  __u32 formats;
  __u32 min_buffer;
  __u32 reserved[15];
-};
+}__attribute__((packed, aligned(4)));
 
 struct snd_codec {
  __u32 id;
@@ -236,6 +236,6 @@ struct snd_codec {
  __u32 align;
  union snd_codec_options options;
  __u32 reserved[3];
-};
+}__attribute__((packed, aligned(4)));
 
 #endif
Signature · 1 line
1.7.0.4