summaryrefslogtreecommitdiff
path: root/src/xine-engine/audio_out.c
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-06-09 18:21:04 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-06-09 18:21:04 +0200
commitf36b9d822626dbbaf585e70cfa7ea60aa6d194af (patch)
tree220b7a7d185f262dc793c14c92a77ea615950d86 /src/xine-engine/audio_out.c
parentb6055c5fe61d918259d1c253aa32fa97dd3e5163 (diff)
parentd5d3776bf7e2733d382c5811b317bcdb7c2c9e88 (diff)
downloadxine-lib-f36b9d822626dbbaf585e70cfa7ea60aa6d194af.tar.gz
xine-lib-f36b9d822626dbbaf585e70cfa7ea60aa6d194af.tar.bz2
Merge with 1.2 branch.
Diffstat (limited to 'src/xine-engine/audio_out.c')
-rw-r--r--src/xine-engine/audio_out.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 66e28d80d..75cef4ce6 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -1211,13 +1211,27 @@ static void *ao_loop (void *this_gen) {
}
if( result < 0 ) {
- /* FIXME: USB device unplugged.
- * We should get the card into a closed state here, that involves closing
- * the PCM as well as the MIXER.
- * Maybe we should pause the stream until the USB device is plugged in again.
- * Return values 0 happen even if usb not unplugged, so needs further investigation.
- */
- xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Was a USB device unplugged ?\n"));
+ /* device unplugged. */
+ xprintf(this->xine, XINE_VERBOSITY_LOG, _("write to sound card failed. Assuming the device was unplugged.\n"));
+ _x_message (in_buf->stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL);
+
+ pthread_mutex_lock( &this->driver_lock );
+ if(this->driver_open) {
+ this->driver->close(this->driver);
+ this->driver_open = 0;
+ this->driver->exit(this->driver);
+ this->driver = _x_load_audio_output_plugin (this->xine, "none");
+ if (this->driver && !in_buf->stream->emergency_brake &&
+ ao_change_settings(this,
+ in_buf->format.bits,
+ in_buf->format.rate,
+ in_buf->format.mode) == 0) {
+ in_buf->stream->emergency_brake = 1;
+ _x_message (in_buf->stream, XINE_MSG_AUDIO_OUT_UNAVAILABLE, NULL);
+ }
+ }
+ pthread_mutex_unlock( &this->driver_lock );
+ /* closing the driver will result in XINE_MSG_AUDIO_OUT_UNAVAILABLE to be emitted */
}
lprintf ("loop: next buf from fifo\n");