diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-03-25 12:52:32 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2003-03-25 12:52:32 +0000 |
commit | 02f1a32e5fb7f13b2f706f7d3efa125f2b100ead (patch) | |
tree | a3a4775ec1e4b452b8ded76bb27891672aa60de2 /src/xine-engine/audio_decoder.c | |
parent | 171e977d8334a4be15d77b5898e24217074bdc09 (diff) | |
download | xine-lib-02f1a32e5fb7f13b2f706f7d3efa125f2b100ead.tar.gz xine-lib-02f1a32e5fb7f13b2f706f7d3efa125f2b100ead.tar.bz2 |
- allow on-the-fly rewiring of streams output
- add missing destruction of some pthread structs
- do not init streams_lock twice
CVS patchset: 4479
CVS date: 2003/03/25 12:52:32
Diffstat (limited to 'src/xine-engine/audio_decoder.c')
-rw-r--r-- | src/xine-engine/audio_decoder.c | 27 |
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) { |