diff options
author | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2001-07-13 23:43:12 +0000 |
---|---|---|
committer | James Courtier-Dutton <jcdutton@users.sourceforge.net> | 2001-07-13 23:43:12 +0000 |
commit | 85eb608c7a602f971f779106c812b48f6c2cd030 (patch) | |
tree | f4fac8838c46fea222fb760ba9bfc0c199ab42b9 | |
parent | 6f8f8cd72c2be8bf0b2404b8a0e9034b25f7e882 (diff) | |
download | xine-lib-85eb608c7a602f971f779106c812b48f6c2cd030.tar.gz xine-lib-85eb608c7a602f971f779106c812b48f6c2cd030.tar.bz2 |
Make SPU decode use Video decoder thread instead of it's own thread.
CVS patchset: 274
CVS date: 2001/07/13 23:43:12
-rw-r--r-- | src/demuxers/demux_mpeg_block.c | 16 | ||||
-rw-r--r-- | src/xine-engine/buffer.h | 6 | ||||
-rw-r--r-- | src/xine-engine/spu_decoder.c | 8 | ||||
-rw-r--r-- | src/xine-engine/video_decoder.c | 51 |
4 files changed, 65 insertions, 16 deletions
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 2aa9e2a48..5120c4683 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.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: demux_mpeg_block.c,v 1.24 2001/07/04 17:10:24 uid32519 Exp $ + * $Id: demux_mpeg_block.c,v 1.25 2001/07/13 23:43:12 jcdutton Exp $ * * demultiplexer for mpeg 1/2 program streams * @@ -240,7 +240,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m buf->DTS = nDTS ; buf->input_pos = this->input->get_current_pos(this->input); - this->spu_fifo->put (this->spu_fifo, buf); + this->video_fifo->put (this->video_fifo, buf); return; } @@ -372,10 +372,10 @@ static void *demux_mpeg_block_loop (void *this_gen) { this->audio_fifo->put (this->audio_fifo, buf); } - buf = this->spu_fifo->buffer_pool_alloc (this->spu_fifo); +/* buf = this->spu_fifo->buffer_pool_alloc (this->spu_fifo); */ buf->type = BUF_CONTROL_END; buf->decoder_info[0] = 0; /* stream finished */ - this->spu_fifo->put (this->spu_fifo, buf); +/* this->spu_fifo->put (this->spu_fifo, buf); */ } pthread_exit(NULL); @@ -416,11 +416,11 @@ static void demux_mpeg_block_stop (demux_plugin_t *this_gen) { this->audio_fifo->put (this->audio_fifo, buf); } - buf = this->spu_fifo->buffer_pool_alloc (this->spu_fifo); +/* buf = this->spu_fifo->buffer_pool_alloc (this->spu_fifo); */ buf->type = BUF_CONTROL_END; buf->decoder_info[0] = 1; /* forced */ - this->spu_fifo->put (this->spu_fifo, buf); +/* this->spu_fifo->put (this->spu_fifo, buf); */ } @@ -465,9 +465,9 @@ static void demux_mpeg_block_start (demux_plugin_t *this_gen, this->audio_fifo->put (this->audio_fifo, buf); } - buf = this->spu_fifo->buffer_pool_alloc (this->spu_fifo); +/* buf = this->spu_fifo->buffer_pool_alloc (this->spu_fifo); */ buf->type = BUF_CONTROL_START; - this->spu_fifo->put (this->spu_fifo, buf); +/* this->spu_fifo->put (this->spu_fifo, buf); */ if((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) { diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index 55b705c47..8c972562e 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -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: buffer.h,v 1.3 2001/06/07 20:23:54 guenter Exp $ + * $Id: buffer.h,v 1.4 2001/07/13 23:43:13 jcdutton Exp $ * * * contents: @@ -58,8 +58,8 @@ #define BUF_CONTROL_BASE 0x01000000 #define BUF_CONTROL_START 0x01000000 -#define BUF_CONTROL_END 0x01000001 -#define BUF_CONTROL_QUIT 0x01000002 +#define BUF_CONTROL_END 0x01010000 +#define BUF_CONTROL_QUIT 0x01020000 /* video buffer types: */ diff --git a/src/xine-engine/spu_decoder.c b/src/xine-engine/spu_decoder.c index c4246e622..68036e6f8 100644 --- a/src/xine-engine/spu_decoder.c +++ b/src/xine-engine/spu_decoder.c @@ -19,7 +19,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: spu_decoder.c,v 1.5 2001/07/08 18:15:54 guenter Exp $ + * $Id: spu_decoder.c,v 1.6 2001/07/13 23:43:13 jcdutton Exp $ * * functions that implement spu decoding @@ -127,6 +127,8 @@ void *spu_decoder_loop (void *this_gen) { void spu_decoder_init (xine_t *this) { +/* FIXME: Tempory disable to test SPU in VIDEO Thread */ + return; this->spu_fifo = fifo_buffer_new (1500, 4096); printf ("spu_decoder_init: thread starting %p\n",this->video_out); @@ -139,7 +141,9 @@ void spu_decoder_shutdown (xine_t *this) { void *p; /* this->spu_fifo->clear(this->spu_fifo); */ - +/* FIXME: Tempory disable to test SPU in VIDEO Thread */ + return; + buf = this->spu_fifo->buffer_pool_alloc (this->spu_fifo); buf->type = BUF_CONTROL_QUIT; this->spu_fifo->put (this->spu_fifo, buf); diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index d17defff0..a6332a5d8 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_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: video_decoder.c,v 1.29 2001/07/11 22:42:47 guenter Exp $ + * $Id: video_decoder.c,v 1.30 2001/07/13 23:43:13 jcdutton Exp $ * */ @@ -32,6 +32,7 @@ void *video_decoder_loop (void *this_gen) { buf_element_t *buf; xine_t *this = (xine_t *) this_gen; int running = 1; + int i; int streamtype; video_decoder_t *decoder; @@ -45,7 +46,7 @@ void *video_decoder_loop (void *this_gen) { /* printf ("video_decoder: got buffer %d\n", buf->type); */ - switch (buf->type) { + switch (buf->type & 0xffff0000) { case BUF_CONTROL_START: if (this->cur_video_decoder_plugin) { @@ -53,14 +54,49 @@ void *video_decoder_loop (void *this_gen) { this->cur_video_decoder_plugin = NULL; } + if (this->cur_spu_decoder_plugin) { + this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin); + this->cur_spu_decoder_plugin = NULL; + } + pthread_mutex_lock (&this->xine_lock); this->video_finished = 0; + this->spu_finished = 0; +/* FIXME: I don't think we need spu_track_map. */ + for (i=0 ; i<50; i++) + this->spu_track_map[0] = 0; + + this->spu_track_map_entries = 0; + pthread_mutex_unlock (&this->xine_lock); this->metronom->video_stream_start (this->metronom); break; + case BUF_SPU_PACKAGE: + /* now, decode this buffer if it's the right track */ + + if ( (buf->type & 0xFFFF)== this->spu_channel) { + + int streamtype = (buf->type>>16) & 0xFF; + decoder = this->spu_decoder_plugins [streamtype]; + if (decoder) { + if (this->cur_spu_decoder_plugin != decoder) { + + if (this->cur_spu_decoder_plugin) + this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin); + + this->cur_spu_decoder_plugin = decoder; + + this->cur_spu_decoder_plugin->init (this->cur_spu_decoder_plugin, this->video_out); + } + + decoder->decode_data (decoder, buf); + } + } + + case BUF_VIDEO_MPEG: case BUF_VIDEO_AVI: @@ -98,7 +134,11 @@ void *video_decoder_loop (void *this_gen) { this->cur_video_decoder_plugin->close (this->cur_video_decoder_plugin); this->cur_video_decoder_plugin = NULL; } - + if (this->cur_spu_decoder_plugin) { + this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin); + this->cur_spu_decoder_plugin = NULL; + } + this->spu_finished = 1; pthread_mutex_lock (&this->xine_lock); if (!this->video_finished && (buf->decoder_info[0]==0)) { @@ -120,6 +160,11 @@ void *video_decoder_loop (void *this_gen) { this->cur_video_decoder_plugin->close (this->cur_video_decoder_plugin); this->cur_video_decoder_plugin = NULL; } + if (this->cur_spu_decoder_plugin) { + this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin); + this->cur_spu_decoder_plugin = NULL; + } + running = 0; break; |