Changeset 664
- Timestamp:
- 12/16/09 16:33:32 (2 years ago)
- Files:
-
- sweep/trunk/src/driver_pulseaudio.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sweep/trunk/src/driver_pulseaudio.c
r586 r664 122 122 pulse_read (sw_handle * handle, sw_audio_t * buf, size_t count) 123 123 { 124 struct pa_simple * pa ; 124 125 int error; 125 126 size_t byte_count; 126 127 128 if ((pa = (struct pa_simple *)handle->custom_data) == NULL) 129 return 0; 130 127 131 byte_count = count * sizeof (sw_audio_t); 128 132 129 if (pa_simple_read( (struct pa_simple *)handle->custom_data, buf, byte_count, &error) < 0) {133 if (pa_simple_read(pa, buf, byte_count, &error) < 0) { 130 134 fprintf(stderr, __FILE__": pa_simple_read() failed: %s\n", pa_strerror(error)); 131 135 return 0; … … 138 142 sw_framecount_t offset) 139 143 { 144 struct pa_simple * pa ; 140 145 int error; 141 146 size_t byte_count; 142 147 148 if ((pa = (struct pa_simple *)handle->custom_data) == NULL) 149 return 0; 150 143 151 byte_count = count * sizeof (sw_audio_t); 144 152 145 if (pa_simple_write( (struct pa_simple *)handle->custom_data, buf, byte_count, &error) < 0) {153 if (pa_simple_write(pa, buf, byte_count, &error) < 0) { 146 154 fprintf(stderr, __FILE__": pa_simple_write() failed: %s\n", pa_strerror(error)); 147 155 return 0; … … 165 173 pulse_flush (sw_handle * handle) 166 174 { 167 int error; 168 169 if (pa_simple_flush((struct pa_simple *)handle->custom_data, &error) < 0) { 175 struct pa_simple * pa ; 176 int error; 177 178 if ((pa = (struct pa_simple *)handle->custom_data) == NULL) 179 return; 180 181 if (pa_simple_flush(pa, &error) < 0) { 170 182 fprintf(stderr, __FILE__": pa_simple_flush() failed: %s\n", pa_strerror(error)); 171 183 } … … 175 187 pulse_drain (sw_handle * handle) 176 188 { 177 int error; 178 179 if (pa_simple_drain((struct pa_simple *)handle->custom_data, &error) < 0) { 189 struct pa_simple * pa ; 190 int error; 191 192 if ((pa = (struct pa_simple *)handle->custom_data) == NULL) 193 return; 194 195 if (pa_simple_drain(pa, &error) < 0) { 180 196 fprintf(stderr, __FILE__": pa_simple_drain() failed: %s\n", pa_strerror(error)); 181 197 } … … 185 201 pulse_close (sw_handle * handle) 186 202 { 203 struct pa_simple * pa ; 204 187 205 pulse_drain(handle); 188 pa_simple_free((struct pa_simple *)handle->custom_data); 206 207 if ((pa = (struct pa_simple *)handle->custom_data) == NULL) 208 return; 209 210 pa_simple_free(pa); 189 211 handle->custom_data = NULL; 190 212 }
