diff options
-rw-r--r-- | src/demuxers/demux_mpeg_block.c | 18 | ||||
-rw-r--r-- | src/libspudec/spu.c | 8 | ||||
-rw-r--r-- | src/libspudec/xine_decoder.c | 22 | ||||
-rw-r--r-- | src/xine-engine/video_decoder.c | 51 |
4 files changed, 71 insertions, 28 deletions
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 54ac3d6fe..adffae3fa 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.27 2001/07/14 13:28:31 guenter Exp $ + * $Id: demux_mpeg_block.c,v 1.28 2001/08/05 00:59:50 ehasenle Exp $ * * demultiplexer for mpeg 1/2 program streams * @@ -504,6 +504,22 @@ static void demux_mpeg_block_start (demux_plugin_t *this_gen, } /* + * query CLUT from the input plugin + */ + + buf = this->video_fifo->buffer_pool_alloc (this->video_fifo); + + if(this->input->get_optional_data(this->input, buf->mem, + INPUT_OPTIONAL_DATA_CLUT) == INPUT_OPTIONAL_SUCCESS) { + buf->type = BUF_SPU_CLUT; + buf->content = buf->mem; + + this->video_fifo->put(this->video_fifo, buf); + } else { + buf->free_buffer(buf); + } + + /* * now start demuxing */ diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index b17cddc00..f28e74884 100644 --- a/src/libspudec/spu.c +++ b/src/libspudec/spu.c @@ -257,10 +257,10 @@ int spuParseHdr (vo_overlay_t *spu, uint8_t *pkt_data, u_int pkt_len) case CMD_SPU_SET_PALETTE: { /* CLUT */ spu_clut_t *clut = (spu_clut_t *) &buf[i+1]; - spu->clut[0] = clut->entry0; - spu->clut[1] = clut->entry1; - spu->clut[2] = clut->entry2; - spu->clut[3] = clut->entry3; + spu->clut[3] = clut->entry0; + spu->clut[2] = clut->entry1; + spu->clut[1] = clut->entry2; + spu->clut[0] = clut->entry3; LOG (LOG_DEBUG, "\tclut [%d %d %d %d]", spu->clut[0], spu->clut[1], spu->clut[2], spu->clut[3]); i += 3; diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index b041d184c..dc87e77cb 100644 --- a/src/libspudec/xine_decoder.c +++ b/src/libspudec/xine_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: xine_decoder.c,v 1.5 2001/08/01 20:01:48 jcdutton Exp $ + * $Id: xine_decoder.c,v 1.6 2001/08/05 00:59:51 ehasenle Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -56,6 +56,7 @@ typedef struct spudec_decoder_s { vo_instance_t *vo_out; vo_overlay_t *spu; + uint32_t *clut; int spu_caps; int bypass_mode; int max_num_channels; @@ -66,7 +67,8 @@ typedef struct spudec_decoder_s { } spudec_decoder_t; int spudec_can_handle (spu_decoder_t *this_gen, int buf_type) { - return ((buf_type & 0xFFFF0000) == BUF_SPU_PACKAGE) ; + int type = buf_type & 0xFFFF0000; + return (type == BUF_SPU_PACKAGE || type == BUF_SPU_CLUT) ; } @@ -125,6 +127,14 @@ void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { uint8_t *current = buf->content; + if (buf->type == BUF_SPU_CLUT) { + if (this->clut == NULL) + this->clut = malloc(sizeof(clut_t)*16); + + memcpy(this->clut, buf->content, sizeof(clut_t)*16); + return; + } + if (!this->spu) { this->spu = this->vo_out->get_overlay (this->vo_out); } @@ -134,6 +144,9 @@ void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { return; this->spu->PTS = buf->PTS; + if (this->clut) + this->spu->clut_tbl = this->clut; + if (!spuParseHdr (this->spu, current, buf->size)) { spuParseData (this->spu); /* overlay_txt(this->spu,1.0); Just for test purposes */ @@ -147,8 +160,11 @@ void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { } void spudec_close (spu_decoder_t *this_gen) { + spudec_decoder_t *this = (spudec_decoder_t *) this_gen; + + if (this->clut) + free(this->clut); - /* spudec_decoder_t *this = (spudec_decoder_t *) this_gen; */ /* FIXME not implemented */ // if (this->output_open) // this->spu_out->close (this->spu_out); diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index c71b4a51f..5b44e2758 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.33 2001/08/02 20:38:42 jcdutton Exp $ + * $Id: video_decoder.c,v 1.34 2001/08/05 00:59:51 ehasenle Exp $ * */ @@ -27,6 +27,23 @@ #include "xine_internal.h" +static spu_decoder_t* update_spu_decoder(xine_t *this, int type) { + int streamtype = (type>>16) & 0xFF; + spu_decoder_t *spu_decoder = this->spu_decoder_plugins [streamtype]; + + if (spu_decoder && this->cur_spu_decoder_plugin != spu_decoder) { + + if (this->cur_spu_decoder_plugin) + this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin); + + this->cur_spu_decoder_plugin = spu_decoder; + + this->cur_spu_decoder_plugin->init (this->cur_spu_decoder_plugin, + this->video_out); + } + return spu_decoder; +} + void *video_decoder_loop (void *this_gen) { buf_element_t *buf; @@ -75,28 +92,22 @@ void *video_decoder_loop (void *this_gen) { 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; - spu_decoder = this->spu_decoder_plugins [streamtype]; - if (spu_decoder) { - if (this->cur_spu_decoder_plugin != spu_decoder) { - - if (this->cur_spu_decoder_plugin) - this->cur_spu_decoder_plugin->close (this->cur_spu_decoder_plugin); - - this->cur_spu_decoder_plugin = spu_decoder; + case BUF_SPU_CLUT: + spu_decoder = update_spu_decoder(this, buf->type); - this->cur_spu_decoder_plugin->init (this->cur_spu_decoder_plugin, this->video_out); - } + if (spu_decoder) + spu_decoder->decode_data (spu_decoder, buf); + break; - spu_decoder->decode_data (spu_decoder, buf); - } - } + case BUF_SPU_PACKAGE: + /* now, decode this buffer if it's the right track */ + if ( (buf->type & 0xFFFF)== this->spu_channel) { + spu_decoder = update_spu_decoder (this, buf->type); + if (spu_decoder) + spu_decoder->decode_data (spu_decoder, buf); + } + break; case BUF_VIDEO_MPEG: case BUF_VIDEO_AVI: |