~ubuntu-branches/ubuntu/lucid/alsa-lib/lucid

« back to all changes in this revision

Viewing changes to debian/patches/Backport-git-head-fixes.patch

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-11-04 19:04:11 UTC
  • mfrom: (1.1.12 upstream) (2.2.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091104190411-igse8f4bzca8dq5x
Tags: 1.0.21a-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/rules:
    + Don't bail when removing include/alsa
  - debian/control: Add Vcs-Bzr URI
  - Add configuration files for bluetooth/bluez-alsa and pulseaudio
  - debian/libasound2.install: Ship smixer plugins for native and bi-arch
    packages
  - drop libcxxtools-dev build dependency, its in universe
  - debian/patches/Fix-fpe-snd_pcm_mmap_begin.patch: Handle attempts to
    divide by zero

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: alsa-lib-1.0.20/src/pcm/pcm_ioplug.c
2
 
===================================================================
3
 
--- alsa-lib-1.0.20.orig/src/pcm/pcm_ioplug.c   2009-09-06 10:14:02.000000000 -0400
4
 
+++ alsa-lib-1.0.20/src/pcm/pcm_ioplug.c        2009-09-06 10:31:01.000000000 -0400
5
 
@@ -442,7 +442,7 @@
6
 
        int err;
7
 
        
8
 
        if (io->data->state != SND_PCM_STATE_PREPARED)
9
 
-               return -EBUSY;
10
 
+               return -EBADFD;
11
 
 
12
 
        err = io->data->callback->start(io->data);
13
 
        if (err < 0)
14
 
Index: alsa-lib-1.0.20/src/pcm/pcm_meter.c
15
 
===================================================================
16
 
--- alsa-lib-1.0.20.orig/src/pcm/pcm_meter.c    2009-09-06 10:14:02.000000000 -0400
17
 
+++ alsa-lib-1.0.20/src/pcm/pcm_meter.c 2009-09-06 10:31:01.000000000 -0400
18
 
@@ -46,7 +46,7 @@
19
 
 struct _snd_pcm_scope {
20
 
        int enabled;
21
 
        char *name;
22
 
-       snd_pcm_scope_ops_t *ops;
23
 
+       const snd_pcm_scope_ops_t *ops;
24
 
        void *private_data;
25
 
        struct list_head list;
26
 
 };
27
 
@@ -960,7 +960,7 @@
28
 
  * \param scope PCM meter scope
29
 
  * \param val callbacks
30
 
  */
31
 
-void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, snd_pcm_scope_ops_t *val)
32
 
+void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, const snd_pcm_scope_ops_t *val)
33
 
 {
34
 
        scope->ops = val;
35
 
 }
36
 
Index: alsa-lib-1.0.20/src/pcm/pcm_mmap_emul.c
37
 
===================================================================
38
 
--- alsa-lib-1.0.20.orig/src/pcm/pcm_mmap_emul.c        2009-09-06 10:14:02.000000000 -0400
39
 
+++ alsa-lib-1.0.20/src/pcm/pcm_mmap_emul.c     2009-09-06 10:31:01.000000000 -0400
40
 
@@ -43,6 +43,7 @@
41
 
        unsigned int mmap_emul :1;
42
 
        snd_pcm_uframes_t hw_ptr;
43
 
        snd_pcm_uframes_t appl_ptr;
44
 
+       snd_pcm_uframes_t start_threshold;
45
 
 } mmap_emul_t;
46
 
 
47
 
 /*
48
 
@@ -203,6 +204,24 @@
49
 
        return err;
50
 
 }
51
 
 
52
 
+static int snd_pcm_mmap_emul_sw_params(snd_pcm_t *pcm,
53
 
+                                      snd_pcm_sw_params_t *params)
54
 
+{
55
 
+       mmap_emul_t *map = pcm->private_data;
56
 
+       int err;
57
 
+
58
 
+       map->start_threshold = params->start_threshold;
59
 
+
60
 
+       /* HACK: don't auto-start in the slave PCM */
61
 
+       params->start_threshold = pcm->boundary;
62
 
+       err = snd_pcm_generic_sw_params(pcm, params);
63
 
+       if (err < 0)
64
 
+               return err;
65
 
+       /* restore the value for this PCM */
66
 
+       params->start_threshold = map->start_threshold;
67
 
+       return err;
68
 
+}
69
 
+
70
 
 static int snd_pcm_mmap_emul_prepare(snd_pcm_t *pcm)
71
 
 {
72
 
        mmap_emul_t *map = pcm->private_data;
73
 
@@ -254,13 +273,18 @@
74
 
        snd_pcm_uframes_t offset;
75
 
        snd_pcm_sframes_t size;
76
 
 
77
 
+       /* HACK: don't start stream automatically at commit in mmap mode */
78
 
+       pcm->start_threshold = pcm->boundary;
79
 
+
80
 
        size = map->appl_ptr - *slave->appl.ptr;
81
 
        if (size < 0)
82
 
                size += pcm->boundary;
83
 
-       if (!size)
84
 
-               return 0;
85
 
-       offset = *slave->appl.ptr % pcm->buffer_size;
86
 
-       return snd_pcm_write_mmap(pcm, offset, size);
87
 
+       if (size) {
88
 
+               offset = *slave->appl.ptr % pcm->buffer_size;
89
 
+               size = snd_pcm_write_mmap(pcm, offset, size);
90
 
+       }
91
 
+       pcm->start_threshold = map->start_threshold; /* restore */
92
 
+       return size;
93
 
 }
94
 
 
95
 
 /* read the available chunk on the slave PCM to mmap buffer */
96
 
@@ -335,7 +359,7 @@
97
 
        .hw_refine = snd_pcm_mmap_emul_hw_refine,
98
 
        .hw_params = snd_pcm_mmap_emul_hw_params,
99
 
        .hw_free = snd_pcm_generic_hw_free,
100
 
-       .sw_params = snd_pcm_generic_sw_params,
101
 
+       .sw_params = snd_pcm_mmap_emul_sw_params,
102
 
        .channel_info = snd_pcm_generic_channel_info,
103
 
        .dump = snd_pcm_mmap_emul_dump,
104
 
        .nonblock = snd_pcm_generic_nonblock,
105
 
Index: alsa-lib-1.0.20/src/pcm/pcm_dmix_i386.h
106
 
===================================================================
107
 
--- alsa-lib-1.0.20.orig/src/pcm/pcm_dmix_i386.h        2009-09-06 10:14:02.000000000 -0400
108
 
+++ alsa-lib-1.0.20/src/pcm/pcm_dmix_i386.h     2009-09-06 10:31:01.000000000 -0400
109
 
@@ -400,8 +400,8 @@
110
 
                "\tmovzwl (%%esi), %%ecx\n"
111
 
                "\tmovl (%%ebx), %%edx\n"
112
 
                "\tsall $16, %%eax\n"
113
 
+               "\torl %%eax, %%ecx\n"
114
 
                "\t" LOCK_PREFIX "btsw $0, (%%edi)\n"
115
 
-               "\tleal (%%ecx,%%eax,1), %%ecx\n"
116
 
                "\tjc 2f\n"
117
 
                "\t" XSUB " %%edx, %%ecx\n"
118
 
                "2:"
119
 
Index: alsa-lib-1.0.20/src/pcm/pcm_dmix_x86_64.h
120
 
===================================================================
121
 
--- alsa-lib-1.0.20.orig/src/pcm/pcm_dmix_x86_64.h      2009-09-06 10:14:02.000000000 -0400
122
 
+++ alsa-lib-1.0.20/src/pcm/pcm_dmix_x86_64.h   2009-09-06 10:31:01.000000000 -0400
123
 
@@ -284,11 +284,11 @@
124
 
                 *   *sum += sample;
125
 
                 */
126
 
                "\tmovsbl 2(%%rsi), %%eax\n"
127
 
-               "\tmovswl (%%rsi), %%ecx\n"
128
 
+               "\tmovzwl (%%rsi), %%ecx\n"
129
 
                "\tmovl (%%rbx), %%edx\n"
130
 
                "\tsall $16, %%eax\n"
131
 
+               "\torl %%eax, %%ecx\n"
132
 
                "\t" LOCK_PREFIX "btsw $0, (%%rdi)\n"
133
 
-               "\t.byte 0x67, 0x8d, 0x0c, 0x01\n"
134
 
                "\tjc 2f\n"
135
 
                "\t" XSUB " %%edx, %%ecx\n"
136
 
                "2:"
137
 
Index: alsa-lib-1.0.20/src/pcm/pcm_hooks.c
138
 
===================================================================
139
 
--- alsa-lib-1.0.20.orig/src/pcm/pcm_hooks.c    2009-09-06 10:14:02.000000000 -0400
140
 
+++ alsa-lib-1.0.20/src/pcm/pcm_hooks.c 2009-09-06 10:31:01.000000000 -0400
141
 
@@ -43,12 +43,39 @@
142
 
        struct list_head list;
143
 
 };
144
 
 
145
 
+struct snd_pcm_hook_dllist {
146
 
+       void *dlobj;
147
 
+       struct list_head list;
148
 
+};
149
 
+
150
 
 typedef struct {
151
 
        snd_pcm_generic_t gen;
152
 
        struct list_head hooks[SND_PCM_HOOK_TYPE_LAST + 1];
153
 
+       struct list_head dllist;
154
 
 } snd_pcm_hooks_t;
155
 
 #endif
156
 
 
157
 
+static int hook_add_dlobj(snd_pcm_t *pcm, void *dlobj)
158
 
+{
159
 
+       snd_pcm_hooks_t *h = pcm->private_data;
160
 
+       struct snd_pcm_hook_dllist *dl;
161
 
+
162
 
+       dl = malloc(sizeof(*dl));
163
 
+       if (!dl)
164
 
+               return -ENOMEM;
165
 
+
166
 
+       dl->dlobj = dlobj;
167
 
+       list_add_tail(&dl->list, &h->dllist);
168
 
+       return 0;
169
 
+}
170
 
+
171
 
+static void hook_remove_dlobj(struct snd_pcm_hook_dllist *dl)
172
 
+{
173
 
+       list_del(&dl->list);
174
 
+       snd_dlclose(dl->dlobj);
175
 
+       free(dl);
176
 
+}
177
 
+
178
 
 static int snd_pcm_hooks_close(snd_pcm_t *pcm)
179
 
 {
180
 
        snd_pcm_hooks_t *h = pcm->private_data;
181
 
@@ -71,6 +98,10 @@
182
 
                        snd_pcm_hook_remove(hook);
183
 
                }
184
 
        }
185
 
+       while (!list_empty(&h->dllist)) {
186
 
+               pos = h->dllist.next;
187
 
+               hook_remove_dlobj(list_entry(pos, struct snd_pcm_hook_dllist, list));
188
 
+       }
189
 
        err = snd_pcm_generic_close(pcm);
190
 
        if (err < 0)
191
 
                res = err;
192
 
@@ -193,6 +224,7 @@
193
 
        for (k = 0; k <= SND_PCM_HOOK_TYPE_LAST; ++k) {
194
 
                INIT_LIST_HEAD(&h->hooks[k]);
195
 
        }
196
 
+       INIT_LIST_HEAD(&h->dllist);
197
 
        err = snd_pcm_new(&pcm, SND_PCM_TYPE_HOOKS, name, slave->stream, slave->mode);
198
 
        if (err < 0) {
199
 
                free(h);
200
 
@@ -312,6 +344,7 @@
201
 
        snd_config_iterator_t i, next;
202
 
        int (*install_func)(snd_pcm_t *pcm, snd_config_t *args) = NULL;
203
 
        void *h = NULL;
204
 
+
205
 
        if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
206
 
                SNDERR("Invalid hook definition");
207
 
                return -EINVAL;
208
 
@@ -402,20 +435,26 @@
209
 
        _err:
210
 
        if (type)
211
 
                snd_config_delete(type);
212
 
-       if (err >= 0) {
213
 
-               if (args && snd_config_get_string(args, &str) >= 0) {
214
 
-                       err = snd_config_search_definition(root, "hook_args", str, &args);
215
 
-                       if (err < 0)
216
 
-                               SNDERR("unknown hook_args %s", str);
217
 
-                       else
218
 
-                               err = install_func(pcm, args);
219
 
-                       snd_config_delete(args);
220
 
-               } else
221
 
+       if (err < 0)
222
 
+               return err;
223
 
+
224
 
+       if (args && snd_config_get_string(args, &str) >= 0) {
225
 
+               err = snd_config_search_definition(root, "hook_args", str, &args);
226
 
+               if (err < 0)
227
 
+                       SNDERR("unknown hook_args %s", str);
228
 
+               else
229
 
                        err = install_func(pcm, args);
230
 
+               snd_config_delete(args);
231
 
+       } else
232
 
+               err = install_func(pcm, args);
233
 
+
234
 
+       if (err >= 0)
235
 
+               err = hook_add_dlobj(pcm, h);
236
 
+
237
 
+       if (err < 0) {
238
 
                snd_dlclose(h);
239
 
-       }
240
 
-       if (err < 0)
241
 
                return err;
242
 
+       }
243
 
        return 0;
244
 
 }
245
 
 
246
 
Index: alsa-lib-1.0.20/src/conf/cards/USB-Audio.conf
247
 
===================================================================
248
 
--- alsa-lib-1.0.20.orig/src/conf/cards/USB-Audio.conf  2009-09-06 10:14:02.000000000 -0400
249
 
+++ alsa-lib-1.0.20/src/conf/cards/USB-Audio.conf       2009-09-06 10:31:01.000000000 -0400
250
 
@@ -40,11 +40,48 @@
251
 
 # If a device requires non-standard definitions for front, surround40,
252
 
 # surround51, surround71 or iec958, they can be defined here.
253
 
 
254
 
-# USB-Audio."NoiseBlaster 3000".pcm.surround51 {
255
 
-#      @args [ CARD ]
256
 
-#      @args.CARD { type string }
257
 
-#      ...
258
 
-# }
259
 
+# M-Audio AudioPhile USB:
260
 
+# device 0: analog output, digital input
261
 
+# device 1: digital output, analog input
262
 
+USB-Audio."AudioPhile".pcm.default {
263
 
+       @args [ CARD ]
264
 
+       @args.CARD { type string }
265
 
+       type asym
266
 
+       playback.pcm {
267
 
+               type plug
268
 
+               slave.pcm {
269
 
+                       type hw
270
 
+                       card $CARD
271
 
+                       device 0
272
 
+               }
273
 
+       }
274
 
+       capture.pcm {
275
 
+               type plug
276
 
+               slave.pcm {
277
 
+                       @func concat
278
 
+                       strings [ "dsnoop:DEVICE=1,CARD=" $CARD ]
279
 
+               }
280
 
+       }
281
 
+}
282
 
+USB-Audio."AudioPhile".pcm.iec958 {
283
 
+       @args [ CARD AES0 AES1 AES2 AES3 ]
284
 
+       @args.CARD { type string }
285
 
+       @args.AES0 { type integer }
286
 
+       @args.AES1 { type integer }
287
 
+       @args.AES2 { type integer }
288
 
+       @args.AES3 { type integer }
289
 
+       type asym
290
 
+       playback.pcm {
291
 
+               type hw
292
 
+               card $CARD
293
 
+               device 1
294
 
+       }
295
 
+       capture.pcm {
296
 
+               type hw
297
 
+               card $CARD
298
 
+               device 0
299
 
+       }
300
 
+}
301
 
 
302
 
 
303
 
 ################################################################################
304
 
Index: alsa-lib-1.0.20/include/pcm.h
305
 
===================================================================
306
 
--- alsa-lib-1.0.20.orig/include/pcm.h  2009-09-06 10:34:28.000000000 -0400
307
 
+++ alsa-lib-1.0.20/include/pcm.h       2009-09-06 10:37:14.000000000 -0400
308
 
@@ -1022,7 +1022,8 @@
309
 
 int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope);
310
 
 snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name);
311
 
 int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr);
312
 
-void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, snd_pcm_scope_ops_t *val);
313
 
+void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope,
314
 
+                          const snd_pcm_scope_ops_t *val);
315
 
 void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val);
316
 
 const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope);
317
 
 void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope);