~ubuntu-branches/debian/squeeze/mplayer/squeeze

« back to all changes in this revision

Viewing changes to debian/patches/61_backport_ao_pulse.patch

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2010-05-25 20:18:08 UTC
  • Revision ID: james.westby@ubuntu.com-20100525201808-gnpnltfdki0q36he
Tags: 2:1.0~rc3+svn20100502-3
* Fix rtsp vulnerability. Patch applied by DSA. Closes: #581245
* Fix another integer overflow, Closes: #524805
* prepare new upload
* sync libao2/ao_pulse.c with svn r30062, Closes: #558196, #580113
* make configure use pkg-config for fribidi checks. Closes: #582784,
  LP: #556200
* document 23mplayer-debug-printf.patch
* avoid mentioning of GTK frontend in mplayer description
* improve package descriptions of mplayer-doc and mplayer-dbg
* medium urgency because of fixed security issue
* fix SVN_VERION regex in debian rules to unbreak get-orig-source
  target. Closes: #582369
* forcefully disable arts support. Closes: #581225

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: siretart@tauware.de
 
2
Subject: sync libao2/ao_pulse.c with svn r30062
 
3
 
 
4
 
 
5
diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c
 
6
index 30a2380..a07bf31 100644
 
7
--- a/libao2/ao_pulse.c
 
8
+++ b/libao2/ao_pulse.c
 
9
@@ -49,9 +49,6 @@ static struct pa_context *context;
 
10
 /** Main event loop object */
 
11
 static struct pa_threaded_mainloop *mainloop;
 
12
 
 
13
-/** A temporary variable to store the current volume */
 
14
-static pa_cvolume volume;
 
15
-
 
16
 static int broken_pause;
 
17
 
 
18
 LIBAO_EXTERN(pulse)
 
19
@@ -102,7 +99,10 @@ static void success_cb(pa_stream *s, int success, void *userdata) {
 
20
  */
 
21
 static int waitop(pa_operation *op) {
 
22
     pa_operation_state_t state;
 
23
-    if (!op) return 0;
 
24
+    if (!op) {
 
25
+        pa_threaded_mainloop_unlock(mainloop);
 
26
+        return 0;
 
27
+    }
 
28
     state = pa_operation_get_state(op);
 
29
     while (state == PA_OPERATION_RUNNING) {
 
30
         pa_threaded_mainloop_wait(mainloop);
 
31
@@ -140,7 +140,7 @@ static int init(int rate_hz, int channels, int format, int flags) {
 
32
     char *devarg = NULL;
 
33
     char *host = NULL;
 
34
     char *sink = NULL;
 
35
-    char *version = pa_get_library_version();
 
36
+    const char *version = pa_get_library_version();
 
37
 
 
38
     if (ao_subdevice) {
 
39
         devarg = strdup(ao_subdevice);
 
40
@@ -150,11 +150,11 @@ static int init(int rate_hz, int channels, int format, int flags) {
 
41
     }
 
42
 
 
43
     broken_pause = 0;
 
44
-    // not sure which versions are affected, assume 0.9.1*
 
45
+    // not sure which versions are affected, assume 0.9.11* to 0.9.14*
 
46
     // known bad: 0.9.14, 0.9.13
 
47
-    // known good: 0.9.9, 0.9.10
 
48
+    // known good: 0.9.9, 0.9.10, 0.9.15
 
49
     // to test: pause, wait ca. 5 seconds framestep and see if MPlayer hangs somewhen
 
50
-    if (strncmp(version, "0.9.1", 5) == 0 && strncmp(version, "0.9.10", 6) != 0) {
 
51
+    if (strncmp(version, "0.9.1", 5) == 0 && version[5] >= '1' && version[5] <= '4') {
 
52
         mp_msg(MSGT_AO, MSGL_WARN, "[pulse] working around probably broken pause functionality,\n"
 
53
                                    "        see http://www.pulseaudio.org/ticket/440\n");
 
54
         broken_pause = 1;
 
55
@@ -345,13 +345,14 @@ static float get_delay(void) {
 
56
  * pa_context_get_sink_input_info() operation completes. Saves the
 
57
  * volume field of the specified structure to the global variable volume. */
 
58
 static void info_func(struct pa_context *c, const struct pa_sink_input_info *i, int is_last, void *userdata) {
 
59
+    struct pa_cvolume *volume = userdata;
 
60
     if (is_last < 0) {
 
61
         GENERIC_ERR_MSG(context, "Failed to get sink input info");
 
62
         return;
 
63
     }
 
64
     if (!i)
 
65
         return;
 
66
-    volume = i->volume;
 
67
+    *volume = i->volume;
 
68
     pa_threaded_mainloop_signal(mainloop, 0);
 
69
 }
 
70
 
 
71
@@ -360,8 +361,9 @@ static int control(int cmd, void *arg) {
 
72
         case AOCONTROL_GET_VOLUME: {
 
73
             ao_control_vol_t *vol = arg;
 
74
             uint32_t devidx = pa_stream_get_index(stream);
 
75
+            struct pa_cvolume volume;
 
76
             pa_threaded_mainloop_lock(mainloop);
 
77
-            if (!waitop(pa_context_get_sink_input_info(context, devidx, info_func, NULL))) {
 
78
+            if (!waitop(pa_context_get_sink_input_info(context, devidx, info_func, &volume))) {
 
79
                 GENERIC_ERR_MSG(context, "pa_stream_get_sink_input_info() failed");
 
80
                 return CONTROL_ERROR;
 
81
             }
 
82
@@ -379,7 +381,9 @@ static int control(int cmd, void *arg) {
 
83
         case AOCONTROL_SET_VOLUME: {
 
84
             const ao_control_vol_t *vol = arg;
 
85
             pa_operation *o;
 
86
+            struct pa_cvolume volume;
 
87
 
 
88
+            pa_cvolume_reset(&volume, ao_data.channels);
 
89
             if (volume.channels != 2)
 
90
                 pa_cvolume_set(&volume, volume.channels, (pa_volume_t)vol->left*PA_VOLUME_NORM/100);
 
91
             else {
 
92
@@ -387,12 +391,16 @@ static int control(int cmd, void *arg) {
 
93
                 volume.values[1] = (pa_volume_t)vol->right*PA_VOLUME_NORM/100;
 
94
             }
 
95
 
 
96
-            if (!(o = pa_context_set_sink_input_volume(context, pa_stream_get_index(stream), &volume, NULL, NULL))) {
 
97
+            pa_threaded_mainloop_lock(mainloop);
 
98
+            o = pa_context_set_sink_input_volume(context, pa_stream_get_index(stream), &volume, NULL, NULL);
 
99
+            if (!o) {
 
100
+                pa_threaded_mainloop_unlock(mainloop);
 
101
                 GENERIC_ERR_MSG(context, "pa_context_set_sink_input_volume() failed");
 
102
                 return CONTROL_ERROR;
 
103
             }
 
104
             /* We don't wait for completion here */
 
105
             pa_operation_unref(o);
 
106
+            pa_threaded_mainloop_unlock(mainloop);
 
107
             return CONTROL_OK;
 
108
         }
 
109
 
 
110