diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-07-08 18:15:54 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-07-08 18:15:54 +0000 |
commit | c980a592bd835f2c0826e4f0638cef3fabd70ee7 (patch) | |
tree | ecf5e9adcd28cabe0d59e0842780a1dbb3cc0633 /src/libspudec | |
parent | fbf6214d84dbed2b9e22da164748eca8c762cb82 (diff) | |
download | xine-lib-c980a592bd835f2c0826e4f0638cef3fabd70ee7.tar.gz xine-lib-c980a592bd835f2c0826e4f0638cef3fabd70ee7.tar.bz2 |
subtitle patches from james
CVS patchset: 259
CVS date: 2001/07/08 18:15:54
Diffstat (limited to 'src/libspudec')
-rw-r--r-- | src/libspudec/spu.c | 25 | ||||
-rw-r--r-- | src/libspudec/xine_decoder.c | 22 |
2 files changed, 13 insertions, 34 deletions
diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c index bb8717142..b17cddc00 100644 --- a/src/libspudec/spu.c +++ b/src/libspudec/spu.c @@ -173,12 +173,10 @@ static struct reassembly_s *_reassembly (uint8_t *pkt_data, u_int pkt_len) // the whole spu fits into the supplied packet if (pkt_len >= reassembly.buf_len) { - LOG (LOG_DEBUG, "0)"); reassembly.buf = pkt_data; reassembly_flag = REASSEMBLY_UNNEEDED; return &reassembly; } else { - LOG (LOG_DEBUG, "1)"); if (!(reassembly.buf = malloc (reassembly.buf_len + 1))) { LOG (LOG_DEBUG, "unable to alloc buffer"); return NULL; @@ -190,7 +188,6 @@ static struct reassembly_s *_reassembly (uint8_t *pkt_data, u_int pkt_len) reassembly_flag = REASSEMBLY_MID; } } else { - LOG (LOG_DEBUG, "2)"); if ((reassembly.buf_ptr+pkt_len) > (reassembly.buf+reassembly.buf_len)) pkt_len = reassembly.buf_len - (reassembly.buf_ptr - reassembly.buf); @@ -204,7 +201,6 @@ static struct reassembly_s *_reassembly (uint8_t *pkt_data, u_int pkt_len) } } - LOG (LOG_DEBUG, "3)"); return NULL; } @@ -238,8 +234,8 @@ int spuParseHdr (vo_overlay_t *spu, uint8_t *pkt_data, u_int pkt_len) while (DCSQ_offset != prev_DCSQ_offset) { /* Display Control Sequences */ u_int i = DCSQ_offset; - spu->duration = /* PTS + */ ((buf[i] << 8) + buf[i+1]) * TIME_UNIT; - LOG (LOG_DEBUG, "time = %d ms", spu->duration); + spu->duration = /* Frames + */ ((buf[i] << 8) + buf[i+1]) /* * TIME_UNIT */ ; + LOG (LOG_DEBUG, "duration = %d frames", spu->duration); i += 2; prev_DCSQ_offset = DCSQ_offset; @@ -271,17 +267,12 @@ int spuParseHdr (vo_overlay_t *spu, uint8_t *pkt_data, u_int pkt_len) break; } case CMD_SPU_SET_ALPHA: { /* transparency palette */ -#ifndef DENT_TEST spu_clut_t *trans = (spu_clut_t *) &buf[i+1]; spu->trans[3] = trans->entry0; spu->trans[2] = trans->entry1; spu->trans[1] = trans->entry2; spu->trans[0] = trans->entry3; -#else - spu->trans[0] = 0; - spu->trans[1] = spu->trans[2] = spu->trans[3] = 15; -#endif LOG (LOG_DEBUG, "\ttrans [%d %d %d %d]\n", spu->trans[0], spu->trans[1], spu->trans[2], spu->trans[3]); i += 3; @@ -299,7 +290,9 @@ int spuParseHdr (vo_overlay_t *spu, uint8_t *pkt_data, u_int pkt_len) spu->height = (((buf[i+5] & 0x0f) << 8) | buf[i+6]) - spu->y + 1; /* 1-576 */ - spu->data = (uint8_t *) malloc (spu->width * spu->height * sizeof (uint8_t)); + if (spu->data) spu->data = (uint8_t *) realloc (spu->data,spu->width * spu->height * sizeof (uint8_t)); + else spu->data = (uint8_t *) malloc (spu->width * spu->height * sizeof (uint8_t)); + /* Private stuff */ spu->_x = spu->_y = 0; LOG (LOG_DEBUG, "\tx = %d y = %d width = %d height = %d", @@ -320,14 +313,6 @@ int spuParseHdr (vo_overlay_t *spu, uint8_t *pkt_data, u_int pkt_len) * hardcoded menu clut, uncomment this and comment CMD_SPU_SET_PALETTE and * CMD_SPU_SET_ALPHA to see the menu buttons */ -#ifdef DENT_TEST - spu->clut[0] = 0; - spu->clut[1] = 9; - spu->clut[2] = 8; - spu->clut[3] = 12; - spu->trans[0] = 0; - spu->trans[1] = spu->trans[2] = spu->trans[3] = 15; -#endif i++; break; diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c index 8f9acdeb6..714ebe179 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.2 2001/07/04 20:32:29 uid32519 Exp $ + * $Id: xine_decoder.c,v 1.3 2001/07/08 18:15:54 guenter Exp $ * * stuff needed to turn libspu into a xine decoder plugin */ @@ -73,15 +73,12 @@ int spudec_can_handle (spu_decoder_t *this_gen, int buf_type) { void spudec_init (spu_decoder_t *this_gen, vo_instance_t *vo_out) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; - printf("spudec_init %p\n",&vo_out); this->vo_out = vo_out; this->spu_caps = vo_out->get_capabilities(vo_out); this->syncword = 0; this->sync_todo = 6; this->output_open = 0; -// spu_init (); - } /* overlay_txt is just for test purposes */ @@ -108,7 +105,7 @@ u_int *overlay_txt (vo_overlay_t *spu, float o1) //clr_ptr2 = (u_char *) &spu_clut[*spu_data_ptr&0x0f]; *clr_ptr2 = *spu_data_ptr&0x0f; tmp=*spu_data_ptr; - printf("%X%X",tmp&0x0f,((tmp>>4)&0x0f)); + //printf("%X%X",tmp&0x0f,((tmp>>4)&0x0f)); spu_data_ptr ++; // printf("%d ",(*clr_ptr2++)); @@ -127,9 +124,6 @@ void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { spudec_decoder_t *this = (spudec_decoder_t *) this_gen; uint8_t *current = buf->content; - /* uint8_t *end = buf->content + buf->size; */ - - printf ("spudec_decode_data\n"); if (!this->spu) { this->spu = this->vo_out->get_overlay (this->vo_out); @@ -139,23 +133,23 @@ void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if (!this->spu) return; + this->spu->PTS = buf->PTS; if (!spuParseHdr (this->spu, current, buf->size)) { spuParseData (this->spu); - printf("X=%d Y=%d w=%d h=%d\n", - this->spu->x,this->spu->y, - this->spu->width,this->spu->height); /* overlay_txt(this->spu,1.0); Just for test purposes */ - this->spu->PTS = buf->PTS; + this->vo_out->queue_overlay (this->vo_out, this->spu); + this->spu = NULL; + } else { + this->spu->data=NULL; this->vo_out->queue_overlay (this->vo_out, this->spu); this->spu = NULL; } - } void spudec_close (spu_decoder_t *this_gen) { /* spudec_decoder_t *this = (spudec_decoder_t *) this_gen; */ - +/* FIXME not implemented */ // if (this->output_open) // this->spu_out->close (this->spu_out); |