[Mplayer-cvslog] CVS: main/libmpeg2 decode.c,1.4,1.5

GEREOFFY arpi_esp at users.sourceforge.net
Fri Mar 16 00:21:42 CET 2001


Update of /cvsroot/mplayer/main/libmpeg2
In directory usw-pr-cvs1:/tmp/cvs-serv18781/libmpeg2

Modified Files:
	decode.c 
Log Message:
using setjmp/longjmp to handle sig11 in libmpeg2

Index: decode.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpeg2/decode.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** decode.c	2001/03/11 01:28:31	1.4
--- decode.c	2001/03/15 23:21:40	1.5
***************
*** 12,15 ****
--- 12,19 ----
  #include <errno.h>
  
+ #include <signal.h>
+ #include <setjmp.h>
+ 
+ 
  #include "config.h"
  
***************
*** 276,280 ****
--- 280,289 ----
  }
  
+ static jmp_buf mpeg2_jmp_buf;
  
+ static void mpeg2_sighandler(int sig){
+     longjmp(mpeg2_jmp_buf,1);
+ }
+ 
  int mpeg2_decode_data (vo_functions_t *output, uint8_t *current, uint8_t *end)
  {
***************
*** 287,291 ****
--- 296,308 ----
    uint8_t *start=current;
    int ret = 0;
+   void* old_sigh;
  
+   if(setjmp(mpeg2_jmp_buf)!=0){
+       printf("@@@ FATAL!!!??? libmpeg2 returned from sig11 before the actual decoding! @@@\n");
+       return 0;
+   }
+ 
+   old_sigh=signal(SIGSEGV,mpeg2_sighandler);
+ 
  //  printf("RCVD %d bytes\n",end-current);
  
***************
*** 306,314 ****
      //if((code&0x100)!=0x100) printf("libmpeg2: FATAL! code=%X\n",code);
      //printf("pos=%d  chunk %3X  size=%d  next-code=%X\n",pos-start,code,current-pos,head|c);
!     ret+=parse_chunk(output, code&0xFF, pos);
    }
    //--------------------
    pos=current;code=head|c;
  }
  
    if(code==0x1FF) ret+=parse_chunk(output, 0xFF, NULL); // send 'end of frame'
--- 323,337 ----
      //if((code&0x100)!=0x100) printf("libmpeg2: FATAL! code=%X\n",code);
      //printf("pos=%d  chunk %3X  size=%d  next-code=%X\n",pos-start,code,current-pos,head|c);
!     if(setjmp(mpeg2_jmp_buf)==0){
!       ret+=parse_chunk(output, code&0xFF, pos);
!     } else {
!       printf("@@@ libmpeg2 returned from sig11... @@@\n");
!     }
    }
    //--------------------
    pos=current;code=head|c;
  }
+ 
+   signal(SIGSEGV,old_sigh); // restore sighandler
  
    if(code==0x1FF) ret+=parse_chunk(output, 0xFF, NULL); // send 'end of frame'


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list