summaryrefslogtreecommitdiff
path: root/src/xine-engine/audio_decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine/audio_decoder.c')
-rw-r--r--src/xine-engine/audio_decoder.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index 188a69466..6965e3715 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_decoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_decoder.c,v 1.104 2003/03/07 15:29:30 miguelfreitas Exp $
+ * $Id: audio_decoder.c,v 1.105 2003/03/25 12:52:32 mroi Exp $
*
*
* functions that implement audio decoding
@@ -68,6 +68,24 @@ void *audio_decoder_loop (void *stream_gen) {
extra_info_merge( stream->audio_decoder_extra_info, buf->extra_info );
stream->audio_decoder_extra_info->seek_count = stream->video_seek_count;
+ /* check for a new port to use */
+ if (stream->next_audio_port) {
+ uint32_t bits, rate;
+ int mode;
+
+ /* noone is allowed to modify the next port from now on */
+ pthread_mutex_lock(&stream->next_audio_port_lock);
+ if (stream->audio_out->status(stream->audio_out, stream, &bits, &rate, &mode)) {
+ /* register our stream at the new output port */
+ stream->next_audio_port->open(stream->next_audio_port, stream, bits, rate, mode);
+ stream->audio_out->close(stream->audio_out, stream);
+ }
+ stream->audio_out = stream->next_audio_port;
+ stream->next_audio_port = NULL;
+ pthread_mutex_unlock(&stream->next_audio_port_lock);
+ pthread_cond_broadcast(&stream->next_audio_port_wired);
+ }
+
switch (buf->type) {
case BUF_CONTROL_HEADERS_DONE:
@@ -387,12 +405,13 @@ void audio_decoder_shutdown (xine_stream_t *stream) {
stream->audio_fifo->put (stream->audio_fifo, buf);
pthread_join (stream->audio_thread, &p);
- }
-
- if (stream->audio_fifo) {
+
stream->audio_fifo->dispose (stream->audio_fifo);
stream->audio_fifo = NULL;
}
+
+ /* wakeup any rewire operations */
+ pthread_cond_broadcast(&stream->next_audio_port_wired);
}
int xine_get_audio_channel (xine_stream_t *stream) {