summaryrefslogtreecommitdiff
path: root/src/xine-engine/audio_out.c
diff options
context:
space:
mode:
authorMatthias Kretz <kretz@kde.org>2007-06-04 23:30:47 +0200
committerMatthias Kretz <kretz@kde.org>2007-06-04 23:30:47 +0200
commitd121d898bd4a4061cb95162ecb886bd4d8d2e79b (patch)
treee4e947f5642409a4cb9ffdd6d59152662ad98f05 /src/xine-engine/audio_out.c
parent7fc8916e6231e4cd7ed55c0fc7423f1ff705e497 (diff)
downloadxine-lib-d121d898bd4a4061cb95162ecb886bd4d8d2e79b.tar.gz
xine-lib-d121d898bd4a4061cb95162ecb886bd4d8d2e79b.tar.bz2
fallback to none output when the device is unplugged
Diffstat (limited to 'src/xine-engine/audio_out.c')
-rw-r--r--src/xine-engine/audio_out.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index fddae2dfe..6f5351986 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -1213,11 +1213,23 @@ static void *ao_loop (void *this_gen) {
if( result < 0 ) {
/* 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;
+ 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 */
}