summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Courtier-Dutton <jcdutton@users.sourceforge.net>2001-10-26 11:21:08 +0000
committerJames Courtier-Dutton <jcdutton@users.sourceforge.net>2001-10-26 11:21:08 +0000
commit981503834690528cfb40a63ef0b6947fc782a378 (patch)
treef6d0125ecd6c8bf28954c74d42f6a463fe829a94
parent9898c2e6653622da929bea54a718cd848bcaae05 (diff)
downloadxine-lib-981503834690528cfb40a63ef0b6947fc782a378.tar.gz
xine-lib-981503834690528cfb40a63ef0b6947fc782a378.tar.bz2
Added some debug commands, trying to track malloc segfaults.
CVS patchset: 886 CVS date: 2001/10/26 11:21:08
-rw-r--r--src/libspudec/spu.c16
-rw-r--r--src/libspudec/xine_decoder.c53
2 files changed, 60 insertions, 9 deletions
diff --git a/src/libspudec/spu.c b/src/libspudec/spu.c
index 658880f46..ca2f9667d 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.19 2001/10/23 21:51:11 jcdutton Exp $
+ * $Id: spu.c,v 1.20 2001/10/26 11:21:08 jcdutton Exp $
*
*/
@@ -85,11 +85,17 @@ int spu_reassembly (spu_seq_t *seq, int start, uint8_t *pkt_data, u_int pkt_len)
seq->cmd_offs = (((u_int)pkt_data[2])<<8) | pkt_data[3];
if (seq->buf_len < seq->seq_len) {
- if (seq->buf)
+ if (seq->buf) {
+ xprintf (VERBOSE|SPU, "FREE1: seq->buf %p\n", seq->buf);
free(seq->buf);
+ seq->buf = NULL;
+ xprintf (VERBOSE|SPU, "FREE2: seq->buf %p\n", seq->buf);
+ }
seq->buf_len = seq->seq_len;
seq->buf = malloc(seq->buf_len);
+ xprintf (VERBOSE|SPU, "MALLOC: seq->buf %p, len=%d\n", seq->buf,seq->buf_len);
+
}
seq->ra_offs = 0;
@@ -307,7 +313,6 @@ static int spu_next_line (vo_overlay_t *spu)
void spu_draw_picture (spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl)
{
rle_elem_t *rle;
-
field = 0;
bit_ptr[0] = seq->buf + state->field_offs[0];
bit_ptr[1] = seq->buf + state->field_offs[1];
@@ -334,10 +339,12 @@ void spu_draw_picture (spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl)
// free(ovl->rle);
ovl->data_size = seq->cmd_offs * 2 * sizeof(rle_elem_t);
ovl->rle = malloc(ovl->data_size);
+ xprintf (VERBOSE|SPU, "MALLOC: ovl->rle %p, len=%d\n", ovl->rle,ovl->data_size);
// }
state->modified = 0; /* mark as already processed */
rle = ovl->rle;
+ xprintf (VERBOSE|SPU, "Draw RLE=%p\n",rle);
while (bit_ptr[1] < seq->buf + seq->cmd_offs) {
u_int len;
@@ -373,6 +380,9 @@ void spu_draw_picture (spu_state_t *state, spu_seq_t* seq, vo_overlay_t *ovl)
ovl->num_rle = rle - ovl->rle;
ovl->rgb_clut = 0;
+ xprintf (VERBOSE|SPU, "Num RLE=%d\n",ovl->num_rle);
+ xprintf (VERBOSE|SPU, "Date size=%d\n",ovl->data_size);
+ xprintf (VERBOSE|SPU, "sizeof RLE=%d\n",sizeof(rle_elem_t));
}
/* Heuristic to discover the colors used by the subtitles
diff --git a/src/libspudec/xine_decoder.c b/src/libspudec/xine_decoder.c
index f85d9be6c..4308706cd 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.26 2001/10/25 10:05:43 f1rmb Exp $
+ * $Id: xine_decoder.c,v 1.27 2001/10/26 11:21:08 jcdutton Exp $
*
* stuff needed to turn libspu into a xine decoder plugin
*/
@@ -190,6 +190,10 @@ static void spudec_reset (spudec_decoder_t *this) {
for (i=0; i < MAX_EVENTS; i++) {
if (this->spu_events[i].event == NULL) {
this->spu_events[i].event = malloc (sizeof(spu_overlay_event_t));
+ xprintf (VERBOSE|SPU, "MALLOC: this->spu_events[%d].event %p, len=%d\n",
+ i,
+ this->spu_events[i].event,
+ sizeof(spu_overlay_event_t));
this->spu_events[i].event->event_type = 0; /* Empty slot */
}
}
@@ -200,8 +204,12 @@ static void spudec_reset (spudec_decoder_t *this) {
this->spu_objects[1].handle=1;
this->spu_objects[1].object_type=1;
this->spu_objects[1].pts=0;
- this->spu_objects[1].overlay = malloc (sizeof(vo_overlay_t));
- memset(this->spu_objects[1].overlay,0,sizeof(vo_overlay_t));
+ this->spu_objects[1].overlay = xmalloc (sizeof(vo_overlay_t));
+ xprintf (VERBOSE|SPU, "MALLOC: this->spu_objects[1].overlay %p, len=%d\n",
+ this->spu_objects[1].overlay, sizeof(vo_overlay_t));
+/* xmalloc does memset */
+/* memset(this->spu_objects[1].overlay,0,sizeof(vo_overlay_t));
+ */
pthread_mutex_init (&this->spu_events_mutex,NULL);
pthread_mutex_init (&this->spu_objects_mutex,NULL);
@@ -307,6 +315,10 @@ int32_t spu_add_event(spudec_decoder_t *this, spu_overlay_event_t *event) {
this->spu_events[new_event].event->vpts=event->vpts;
this->spu_events[new_event].event->object.handle=event->object.handle;
this->spu_events[new_event].event->object.overlay = malloc (sizeof(vo_overlay_t));
+ xprintf (VERBOSE|SPU, "MALLOC: this->spu_events[%d].overlay %p, len=%d\n",
+ new_event,
+ this->spu_events[new_event].event->object.overlay,
+ sizeof(vo_overlay_t));
memcpy(this->spu_events[new_event].event->object.overlay,
event->object.overlay, sizeof(vo_overlay_t));
// print_overlay( event->object.overlay );
@@ -528,10 +540,25 @@ void spu_process_event( spudec_decoder_t *this, int vpts ) {
xprintf (VERBOSE|SPU, "HIDE SPU NOW\n");
this->spu_showing[1].handle = -1;
if(this->spu_objects[handle].overlay->rle) {
+ xprintf (VERBOSE|SPU, "FREE1: this->spu_objects[%d].overlay->rle %p\n",
+ handle,
+ this->spu_objects[handle].overlay->rle);
free(this->spu_objects[handle].overlay->rle);
+ this->spu_objects[handle].overlay->rle = NULL;
+ xprintf (VERBOSE|SPU, "FREE2: this->spu_objects[%d].overlay->rle %p\n",
+ handle,
+ this->spu_objects[handle].overlay->rle);
}
+ xprintf (VERBOSE|SPU, "RLE clear=%08X\n",(uint32_t)this->spu_objects[handle].overlay->rle);
if (this->spu_objects[handle].overlay) {
+ xprintf (VERBOSE|SPU, "FREE1: this->spu_objects[%d].overlay %p\n",
+ handle,
+ this->spu_objects[handle].overlay);
free(this->spu_objects[handle].overlay);
+ this->spu_objects[handle].overlay = NULL;
+ xprintf (VERBOSE|SPU, "FREE2: this->spu_objects[%d].overlay %p\n",
+ handle,
+ this->spu_objects[handle].overlay);
}
spu_free_handle( this, handle );
break;
@@ -554,7 +581,14 @@ void spu_process_event( spudec_decoder_t *this, int vpts ) {
this->spu_objects[handle].handle = handle; /* This should not change for menus */
/* If rle is not empty, free it first */
- if(overlay && overlay->rle) free (overlay->rle);
+ if(overlay && overlay->rle) {
+ xprintf (VERBOSE|SPU, "FREE1: overlay->rle %p\n",
+ overlay->rle);
+ free (overlay->rle);
+ overlay->rle = NULL;
+ xprintf (VERBOSE|SPU, "FREE2: overlay->rle %p\n",
+ overlay->rle);
+ }
overlay->rle = event_overlay->rle;
overlay->data_size = event_overlay->data_size;
overlay->num_rle = event_overlay->num_rle;
@@ -687,7 +721,13 @@ static void spudec_event_listener(void *this_gen, xine_event_t *event_gen) {
vo_overlay_t *overlay;
spu_button_t *but = event->data;
overlay_event = malloc (sizeof(spu_overlay_event_t));
+ xprintf (VERBOSE|SPU, "MALLOC: overlay_event %p, len=%d\n",
+ overlay_event,
+ sizeof(spu_overlay_event_t));
overlay = malloc (sizeof(vo_overlay_t));
+ xprintf (VERBOSE|SPU, "MALLOC: overlay %p, len=%d\n",
+ overlay,
+ sizeof(vo_overlay_t));
overlay_event->object.overlay=overlay;
xprintf (VERBOSE|SPU, "BUTTON\n");
@@ -770,8 +810,9 @@ spu_decoder_t *init_spu_decoder_plugin (int iface_version, xine_t *xine) {
return NULL;
}
- this = (spudec_decoder_t *) malloc (sizeof (spudec_decoder_t));
- memset (this, 0, sizeof(*this));
+ this = (spudec_decoder_t *) xmalloc (sizeof (spudec_decoder_t));
+/* xmalloc does memset */
+/* memset (this, 0, sizeof(*this)); */
this->spu_decoder.interface_version = 4;
this->spu_decoder.can_handle = spudec_can_handle;