summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libspudec/spu.c33
-rw-r--r--src/libspudec/spu.h3
-rw-r--r--src/libspudec/xine_decoder.c25
3 files changed, 37 insertions, 24 deletions
diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c
index ed7c5fb30..c05e949c2 100644
--- a/src/libspudec/spu.c
+++ b/src/libspudec/spu.c
@@ -35,7 +35,7 @@
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: spu.c,v 1.56 2002/11/20 14:00:34 mroi Exp $
+ * $Id: spu.c,v 1.57 2002/11/26 16:05:00 mroi Exp $
*
*/
@@ -223,7 +223,7 @@ void spudec_reassembly (spudec_seq_t *seq, uint8_t *pkt_data, u_int pkt_len)
seq->cmd_offs = (((uint32_t)pkt_data[2])<<8) | pkt_data[3];
if (seq->cmd_offs >= seq->seq_len) {
printf("libspudec:faulty stream\n");
- abort();
+ seq->broken = 1;
}
if (seq->buf_len < seq->seq_len) {
seq->buf_len = seq->seq_len;
@@ -262,7 +262,7 @@ void spudec_reassembly (spudec_seq_t *seq, uint8_t *pkt_data, u_int pkt_len)
seq->ra_offs += pkt_len;
} else {
printf("libspudec:faulty stream\n");
- abort();
+ seq->broken = 1;
}
if (seq->ra_offs == seq->seq_len) {
@@ -303,12 +303,18 @@ void spudec_process (spudec_decoder_t *this, uint32_t stream_id) {
#endif
return;
}
- /* Get do commands to build the event. */
+ /* parse SPU command sequence, this will update forced_display, so it must come
+ * before the check for it */
spudec_do_commands(&this->state, cur_seq, &this->overlay);
/* FIXME: Check for Forced-display or subtitle stream
* For subtitles, open event.
* For menus, store it for later.
*/
+ if (cur_seq->broken) {
+ printf("libspudec: dropping broken SPU\n");
+ cur_seq->broken = 0;
+ return;
+ }
if ( (this->state.forced_display == 0) && (this->stream->spu_channel & 0x80) ) {
#ifdef LOG_DEBUG
printf ("spu: Dropping SPU channel %d. Only allow forced display SPUs\n", stream_id);
@@ -486,12 +492,6 @@ static void spudec_do_commands(spudec_state_t *state, spudec_seq_t* seq, vo_over
ovl->color[2] = state->clut[clut->entry1];
ovl->color[1] = state->clut[clut->entry2];
ovl->color[0] = state->clut[clut->entry3];
- if ( (clut->entry0 | clut->entry1 | clut->entry2 | clut->entry3) == 0) {
- ovl->color[3] = 0x108080;
- ovl->color[2] = 0x808080;
- ovl->color[1] = 0xb08080;
- ovl->color[0] = 0x108080;
- }
#ifdef LOG_DEBUG
printf ("spu: \tclut [%x %x %x %x]\n",
@@ -512,16 +512,6 @@ static void spudec_do_commands(spudec_state_t *state, spudec_seq_t* seq, vo_over
ovl->trans[1] = trans->entry2;
ovl->trans[0] = trans->entry3;
-/* FIXME: Force invisible SPUs to be visible. */
-/*
- if ( (trans->entry0 | trans->entry1 | trans->entry2 | trans->entry3) == 0) {
- ovl->trans[3] = 15;
- ovl->trans[2] = 15;
- ovl->trans[1] = 15;
- ovl->trans[0] = 8;
- }
-*/
-
#ifdef LOG_DEBUG
printf ("spu: \ttrans [%d %d %d %d]\n",
ovl->trans[0], ovl->trans[1], ovl->trans[2], ovl->trans[3]);
@@ -567,7 +557,7 @@ static void spudec_do_commands(spudec_state_t *state, spudec_seq_t* seq, vo_over
if ((state->field_offs[0] >= seq->seq_len) ||
(state->field_offs[1] >= seq->seq_len)) {
printf("libspudec:faulty stream\n");
- abort();
+ seq->broken = 1;
}
state->modified = 1;
buf += 5;
@@ -593,6 +583,7 @@ static void spudec_do_commands(spudec_state_t *state, spudec_seq_t* seq, vo_over
printf("libspudec: unknown seqence command (%02x)\n", buf[0]);
/* FIXME: SPU should be dropped, and buffers resynced */
buf = next_seq;
+ seq->broken = 1;
break;
}
}
diff --git a/src/libspudec/spu.h b/src/libspudec/spu.h
index 5fd959859..807048b2b 100644
--- a/src/libspudec/spu.h
+++ b/src/libspudec/spu.h
@@ -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.h,v 1.17 2002/11/20 11:57:44 mroi Exp $
+ * $Id: spu.h,v 1.18 2002/11/26 16:05:00 mroi Exp $
*
* This file was originally part of the OMS program.
*
@@ -63,6 +63,7 @@ typedef struct {
int64_t pts; /* Base PTS of this sequence */
int32_t finished; /* Has this control sequence been finished? */
uint32_t complete; /* Has this reassembly been finished? */
+ uint32_t broken; /* this SPU is broken and should be dropped */
} spudec_seq_t;
typedef struct {
diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c
index 756582dfc..1b863e13f 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.88 2002/11/20 11:57:45 mroi Exp $
+ * $Id: xine_decoder.c,v 1.89 2002/11/26 16:05:00 mroi Exp $
*
* stuff needed to turn libspu into a xine decoder plugin
*/
@@ -136,11 +136,32 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) {
buf->content,
buf->size);
if(this->spudec_stream_state[stream_id].ra_seq.complete == 1) {
- spudec_process(this,stream_id);
+ if(this->spudec_stream_state[stream_id].ra_seq.broken) {
+ printf("libspudec: dropping broken SPU\n");
+ this->spudec_stream_state[stream_id].ra_seq.broken = 0;
+ } else
+ spudec_process(this,stream_id);
}
}
static void spudec_reset (spu_decoder_t *this_gen) {
+ spudec_decoder_t *this = (spudec_decoder_t *) this_gen;
+ video_overlay_instance_t *ovl_instance = this->vo_out->get_overlay_instance (this->vo_out);
+ int i;
+
+ if( this->menu_handle >= 0 )
+ ovl_instance->free_handle(ovl_instance,
+ this->menu_handle);
+ this->menu_handle = -1;
+
+ for (i=0; i < MAX_STREAMS; i++) {
+ if( this->spudec_stream_state[i].overlay_handle >= 0 )
+ ovl_instance->free_handle(ovl_instance,
+ this->spudec_stream_state[i].overlay_handle);
+ this->spudec_stream_state[i].overlay_handle = -1;
+ this->spudec_stream_state[i].ra_seq.complete = 1;
+ this->spudec_stream_state[i].ra_seq.broken = 0;
+ }
}
static void spudec_discontinuity (spu_decoder_t *this_gen) {