diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-10-18 04:04:10 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2002-10-18 04:04:10 +0000 |
commit | 703f9417096c5e7122dbe56721273ae0f79a46ad (patch) | |
tree | b1950714a3d254be4ebcb37310478f1673f7c742 /src/xine-engine/audio_decoder.c | |
parent | 78851150d869e0595cee3f7404e353eaf89f57f3 (diff) | |
download | xine-lib-703f9417096c5e7122dbe56721273ae0f79a46ad.tar.gz xine-lib-703f9417096c5e7122dbe56721273ae0f79a46ad.tar.bz2 |
my very first try at the new streams api. some fixes to it (uninitialized
stuff and plugins being instatiated several times).
actually i got it to play something (have not tried sound though).
CVS patchset: 2845
CVS date: 2002/10/18 04:04:10
Diffstat (limited to 'src/xine-engine/audio_decoder.c')
-rw-r--r-- | src/xine-engine/audio_decoder.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 892fdbf8d..32fb031e0 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.85 2002/10/14 15:47:23 guenter Exp $ + * $Id: audio_decoder.c,v 1.86 2002/10/18 04:04:10 miguelfreitas Exp $ * * * functions that implement audio decoding @@ -45,7 +45,6 @@ void *audio_decoder_loop (void *stream_gen) { buf_element_t *buf; xine_stream_t *stream = (xine_stream_t *) stream_gen; int running = 1; - audio_decoder_t *decoder; static int prof_audio_decode = -1; static uint32_t buftype_unknown = 0; @@ -237,23 +236,25 @@ void *audio_decoder_loop (void *stream_gen) { if (buf->type == audio_type) { int streamtype = (buf->type>>16) & 0xFF; - - decoder = get_audio_decoder (stream, streamtype); - + /* close old decoder of audio type has changed */ + + if( stream->audio_decoder_streamtype != streamtype || + !stream->audio_decoder_plugin ) { + + if (stream->audio_decoder_plugin) { + free_audio_decoder (stream, stream->audio_decoder_plugin); + } + + stream->audio_decoder_streamtype = streamtype; + stream->audio_decoder_plugin = get_audio_decoder (stream, streamtype); + } if (audio_type != stream->audio_type) { if (stream->audio_decoder_plugin) { - free_audio_decoder (stream, stream->audio_decoder_plugin); - stream->audio_decoder_plugin = NULL; - } - - if (decoder) { xine_event_t event; - stream->audio_decoder_plugin = decoder; - stream->audio_type = audio_type; event.type = XINE_EVENT_UI_CHANNELS_CHANGED; @@ -264,8 +265,8 @@ void *audio_decoder_loop (void *stream_gen) { /* finally - decode data */ - if (decoder) - decoder->decode_data (decoder, buf); + if (stream->audio_decoder_plugin) + stream->audio_decoder_plugin->decode_data (stream->audio_decoder_plugin, buf); else if( buf->type != buftype_unknown ) { xine_log (stream->xine, XINE_LOG_MSG, "audio_decoder: no plugin available to handle '%s'\n", |