summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/audio_out.c28
-rw-r--r--src/xine-engine/input_cache.c3
-rw-r--r--src/xine-engine/input_rip.c3
-rw-r--r--src/xine-engine/load_plugins.c32
-rw-r--r--src/xine-engine/metronom.c7
-rw-r--r--src/xine-engine/scratch.c1
-rw-r--r--src/xine-engine/xine_internal.h2
7 files changed, 62 insertions, 14 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");
diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c
index 75c4beb43..7537c4d16 100644
--- a/src/xine-engine/input_cache.c
+++ b/src/xine-engine/input_cache.c
@@ -62,8 +62,9 @@ typedef struct {
/*
* read data from input plugin and write it into file
*/
-static off_t cache_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) {
+static off_t cache_plugin_read(input_plugin_t *this_gen, void *buf_gen, off_t len) {
cache_input_plugin_t *this = (cache_input_plugin_t *)this_gen;
+ char *buf = (char *)buf_gen;
off_t read_len = 0;
off_t main_read;
diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c
index 56850ba2d..774ef82c5 100644
--- a/src/xine-engine/input_rip.c
+++ b/src/xine-engine/input_rip.c
@@ -100,8 +100,9 @@ static off_t min_off(off_t a, off_t b) {
/*
* read data from input plugin and write it into file
*/
-static off_t rip_plugin_read(input_plugin_t *this_gen, char *buf, off_t len) {
+static off_t rip_plugin_read(input_plugin_t *this_gen, void *buf_gen, off_t len) {
rip_input_plugin_t *this = (rip_input_plugin_t *)this_gen;
+ char *buf = (char *)buf_gen;
off_t retlen, npreview, nread, nwrite, nread_orig, nread_file;
lprintf("reading %"PRId64" bytes (curpos = %"PRId64", savepos = %"PRId64")\n", len, this->curpos, this->savepos);
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index ca1f87c7a..750ec21e7 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.c
@@ -1721,6 +1721,38 @@ static ao_driver_t *_load_audio_driver (xine_t *this, plugin_node_t *node,
return driver;
}
+ao_driver_t *_x_load_audio_output_plugin (xine_t *this, const char *id)
+{
+ plugin_node_t *node;
+ ao_driver_t *driver = NULL;
+ ao_info_t *ao_info;
+ plugin_catalog_t *catalog = this->plugin_catalog;
+ int list_id, list_size;
+
+ pthread_mutex_lock (&catalog->lock);
+
+ list_size = xine_sarray_size (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1]);
+ for (list_id = 0; list_id < list_size; list_id++) {
+
+ node = xine_sarray_get (this->plugin_catalog->plugin_lists[PLUGIN_AUDIO_OUT - 1], list_id);
+
+ ao_info = (ao_info_t *)node->info->special_info;
+
+ if (!strcasecmp(node->info->id, id)) {
+ driver = _load_audio_driver (this, node, NULL);
+ break;
+ }
+ }
+
+ pthread_mutex_unlock (&catalog->lock);
+
+ if (!driver) {
+ xprintf (this, XINE_VERBOSITY_LOG,
+ _("load_plugins: failed to load audio output plugin <%s>\n"), id);
+ }
+ return driver;
+}
+
xine_audio_port_t *xine_open_audio_driver (xine_t *this, const char *id,
void *data) {
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index fa33da9e1..50720e157 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.c
@@ -851,7 +851,8 @@ static void metronom_unregister_scr (metronom_clock_t *this, scr_plugin_t *scr)
this->scr_master = get_master_scr(this);
}
-static int metronom_sync_loop (metronom_clock_t *this) {
+static void *metronom_sync_loop (void *const this_gen) {
+ metronom_clock_t *const this = (metronom_clock_t *const)this_gen;
struct timeval tv;
struct timespec ts;
@@ -874,7 +875,7 @@ static int metronom_sync_loop (metronom_clock_t *this) {
pthread_mutex_unlock (&this->lock);
}
- return 0;
+ return NULL;
}
static void metronom_exit (metronom_t *this) {
@@ -990,7 +991,7 @@ metronom_clock_t *_x_metronom_clock_init(xine_t *xine)
this->thread_running = 1;
if ((err = pthread_create(&this->sync_thread, NULL,
- (void*(*)(void*)) metronom_sync_loop, this)) != 0)
+ metronom_sync_loop, this)) != 0)
xprintf(this->xine, XINE_VERBOSITY_NONE, "cannot create sync thread (%s)\n",
strerror(err));
diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c
index 4b694699f..ddca0cfaf 100644
--- a/src/xine-engine/scratch.c
+++ b/src/xine-engine/scratch.c
@@ -108,7 +108,6 @@ static void scratch_dispose (scratch_buffer_t *this) {
scratch_buffer_t *_x_new_scratch_buffer (int num_lines) {
scratch_buffer_t *this;
- int i;
this = xine_xmalloc (sizeof (scratch_buffer_t));
diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h
index 208ef7647..fc142d44b 100644
--- a/src/xine-engine/xine_internal.h
+++ b/src/xine-engine/xine_internal.h
@@ -500,7 +500,7 @@ vo_driver_t *_x_load_video_output_plugin(xine_t *this,
* load a specific audio output plugin
*/
-ao_driver_t *_x_load_audio_output_plugin (xine_t *self, char *id) XINE_PROTECTED;
+ao_driver_t *_x_load_audio_output_plugin (xine_t *self, const char *id) XINE_PROTECTED;
void _x_set_speed (xine_stream_t *stream, int speed) XINE_PROTECTED;