aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeeja KP <jeeja.kp@intel.com>2013-02-14 06:22:51 -0500
committerTakashi Iwai <tiwai@suse.de>2013-02-14 06:30:22 -0500
commit9727b490e543de956b8ba356e2d5499097d0b7a2 (patch)
tree81c41ee5b9987fdcb32c474484c39f45210507c0 /include
parent8be69efacdc73fc110624f847bdf04b83decfc70 (diff)
ALSA: compress: add support for gapless playback
this add new API for sound compress to support gapless playback. As noted in Documentation change, we add API to send metadata of encoder and padding delay to DSP. Also add API for indicating EOF and switching to subsequent track Also bump the compress API version Signed-off-by: Jeeja KP <jeeja.kp@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/sound/compress_driver.h8
-rw-r--r--include/uapi/sound/compress_offload.h31
2 files changed, 38 insertions, 1 deletions
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index f2912abacdf3..ff6c74153fa1 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -71,6 +71,8 @@ struct snd_compr_runtime {
71 * @runtime: pointer to runtime structure 71 * @runtime: pointer to runtime structure
72 * @device: device pointer 72 * @device: device pointer
73 * @direction: stream direction, playback/recording 73 * @direction: stream direction, playback/recording
74 * @metadata_set: metadata set flag, true when set
75 * @next_track: has userspace signall next track transistion, true when set
74 * @private_data: pointer to DSP private data 76 * @private_data: pointer to DSP private data
75 */ 77 */
76struct snd_compr_stream { 78struct snd_compr_stream {
@@ -79,6 +81,8 @@ struct snd_compr_stream {
79 struct snd_compr_runtime *runtime; 81 struct snd_compr_runtime *runtime;
80 struct snd_compr *device; 82 struct snd_compr *device;
81 enum snd_compr_direction direction; 83 enum snd_compr_direction direction;
84 bool metadata_set;
85 bool next_track;
82 void *private_data; 86 void *private_data;
83}; 87};
84 88
@@ -110,6 +114,10 @@ struct snd_compr_ops {
110 struct snd_compr_params *params); 114 struct snd_compr_params *params);
111 int (*get_params)(struct snd_compr_stream *stream, 115 int (*get_params)(struct snd_compr_stream *stream,
112 struct snd_codec *params); 116 struct snd_codec *params);
117 int (*set_metadata)(struct snd_compr_stream *stream,
118 struct snd_compr_metadata *metadata);
119 int (*get_metadata)(struct snd_compr_stream *stream,
120 struct snd_compr_metadata *metadata);
113 int (*trigger)(struct snd_compr_stream *stream, int cmd); 121 int (*trigger)(struct snd_compr_stream *stream, int cmd);
114 int (*pointer)(struct snd_compr_stream *stream, 122 int (*pointer)(struct snd_compr_stream *stream,
115 struct snd_compr_tstamp *tstamp); 123 struct snd_compr_tstamp *tstamp);
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h
index 05341a43fedf..d630163b9a2e 100644
--- a/include/uapi/sound/compress_offload.h
+++ b/include/uapi/sound/compress_offload.h
@@ -30,7 +30,7 @@
30#include <sound/compress_params.h> 30#include <sound/compress_params.h>
31 31
32 32
33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 0) 33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 1)
34/** 34/**
35 * struct snd_compressed_buffer: compressed buffer 35 * struct snd_compressed_buffer: compressed buffer
36 * @fragment_size: size of buffer fragment in bytes 36 * @fragment_size: size of buffer fragment in bytes
@@ -122,6 +122,27 @@ struct snd_compr_codec_caps {
122}; 122};
123 123
124/** 124/**
125 * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the
126 * end of the track
127 * @SNDRV_COMPRESS_ENCODER_DELAY: no of samples inserted by the encoder at the
128 * beginning of the track
129 */
130enum {
131 SNDRV_COMPRESS_ENCODER_PADDING = 1,
132 SNDRV_COMPRESS_ENCODER_DELAY = 2,
133};
134
135/**
136 * struct snd_compr_metadata: compressed stream metadata
137 * @key: key id
138 * @value: key value
139 */
140struct snd_compr_metadata {
141 __u32 key;
142 __u32 value[8];
143};
144
145/**
125 * compress path ioctl definitions 146 * compress path ioctl definitions
126 * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP 147 * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP
127 * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec 148 * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec
@@ -145,6 +166,10 @@ struct snd_compr_codec_caps {
145 struct snd_compr_codec_caps) 166 struct snd_compr_codec_caps)
146#define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params) 167#define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params)
147#define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec) 168#define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec)
169#define SNDRV_COMPRESS_SET_METADATA _IOW('C', 0x14,\
170 struct snd_compr_metadata)
171#define SNDRV_COMPRESS_GET_METADATA _IOWR('C', 0x15,\
172 struct snd_compr_metadata)
148#define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp) 173#define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp)
149#define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail) 174#define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail)
150#define SNDRV_COMPRESS_PAUSE _IO('C', 0x30) 175#define SNDRV_COMPRESS_PAUSE _IO('C', 0x30)
@@ -152,10 +177,14 @@ struct snd_compr_codec_caps {
152#define SNDRV_COMPRESS_START _IO('C', 0x32) 177#define SNDRV_COMPRESS_START _IO('C', 0x32)
153#define SNDRV_COMPRESS_STOP _IO('C', 0x33) 178#define SNDRV_COMPRESS_STOP _IO('C', 0x33)
154#define SNDRV_COMPRESS_DRAIN _IO('C', 0x34) 179#define SNDRV_COMPRESS_DRAIN _IO('C', 0x34)
180#define SNDRV_COMPRESS_NEXT_TRACK _IO('C', 0x35)
181#define SNDRV_COMPRESS_PARTIAL_DRAIN _IO('C', 0x36)
155/* 182/*
156 * TODO 183 * TODO
157 * 1. add mmap support 184 * 1. add mmap support
158 * 185 *
159 */ 186 */
160#define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */ 187#define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */
188#define SND_COMPR_TRIGGER_NEXT_TRACK 8
189#define SND_COMPR_TRIGGER_PARTIAL_DRAIN 9
161#endif 190#endif