changeset 1631:09284c9c2b49

exit() -> return NULL
author arpi
date Wed, 22 Aug 2001 19:40:46 +0000
parents 919d085c3205
children 77cf72182c7f
files asfheader.c dec_video.c demux_avi.c demuxer.c dll_init.c network.c url.c
diffstat 7 files changed, 12 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/asfheader.c	Wed Aug 22 19:36:06 2001 +0000
+++ b/asfheader.c	Wed Aug 22 19:40:46 2001 +0000
@@ -160,7 +160,7 @@
       if(streamh.type_size>1024 || streamh.stream_size>1024){
           mp_msg(MSGT_HEADER,MSGL_FATAL,"FATAL: header size bigger than 1024 bytes!\n"
               "Please contact mplayer authors, and upload/send this file.\n");
-          exit(1);
+          return 0;
       }
       // type-specific data:
       stream_read(demuxer->stream,(char*) buffer,streamh.type_size);
--- a/dec_video.c	Wed Aug 22 19:36:06 2001 +0000
+++ b/dec_video.c	Wed Aug 22 19:40:46 2001 +0000
@@ -150,7 +150,6 @@
  case VFM_VFW: {
    if(!init_video_codec(sh_video,0)) {
 //     GUI_MSG( mplUnknowError )
-//     exit(1);
       return 0;
    }  
    mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n");
@@ -159,7 +158,6 @@
  case VFM_VFWEX: {
    if(!init_video_codec(sh_video,1)) {
 //     GUI_MSG( mplUnknowError )
-//     exit(1);
       return 0;
    }  
    mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32Ex video codec init OK!\n");
@@ -170,7 +168,6 @@
    mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT directshow support!\n");
    return 0;
 //   GUI_MSG( mplCompileWithoutDSSupport )
-//   exit(1);
 #else
    int bpp;
    if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, &sh_video->our_out_buffer)){
@@ -188,7 +185,6 @@
 //           usec_sleep( 10000 );
 //          }
 //        #endif
-//        exit(1);
    }
    
    switch(out_fmt){
@@ -247,7 +243,7 @@
  case VFM_DIVX4: {  // DivX4Linux
 #ifndef NEW_DECORE
    mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT DivX4Linux (libdivxdecore.so) support!\n");
-   return 0; //exit(1);
+   return 0;
 #else
    mp_msg(MSGT_DECVIDEO,MSGL_V,"DivX4Linux video codec\n");
    { DEC_PARAM dec_param;
@@ -282,7 +278,7 @@
  case VFM_FFMPEG: {  // FFmpeg's libavcodec
 #ifndef USE_LIBAVCODEC
    mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT libavcodec support!\n");
-   return 0; //exit(1);
+   return 0;
 #else
    mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n");
     avcodec_init();
@@ -290,7 +286,7 @@
     lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll);
     if(!lavc_codec){
 	mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Can't find codec '%s' in libavcodec...\n",sh_video->codec->dll);
-	return 0; //exit(1);
+	return 0;
     }
     memset(&lavc_context, 0, sizeof(lavc_context));
 //    sh_video->disp_h/=2; // !!
@@ -300,7 +296,7 @@
     /* open it */
     if (avcodec_open(&lavc_context, lavc_codec) < 0) {
         mp_msg(MSGT_DECVIDEO,MSGL_ERR, "could not open codec\n");
-        return 0; //exit(1);
+        return 0;
     }
    
    mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n");
@@ -580,7 +576,6 @@
         mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPEG: FATAL: EOF while searching for sequence header\n");
 	return 0;
 //        GUI_MSG( mplMPEGErrorSeqHeaderSearch )
-//        exit(1);
       }
    }
    mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n");
@@ -592,20 +587,17 @@
      mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Cannot allocate shared memory\n");
      return 0;
 //     GUI_MSG( mplErrorShMemAlloc )
-//     exit(0);
    }
    videobuf_len=0;
    if(!read_video_packet(d_video)){ 
      mp_msg(MSGT_DECVIDEO,MSGL_ERR,"FATAL: Cannot read sequence header!\n");
      return 0;
 //     GUI_MSG( mplMPEGErrorCannotReadSeqHeader )
-//     exit(1);
    }
    if(header_process_sequence_header (picture, &videobuffer[4])) {
      mp_msg(MSGT_DECVIDEO,MSGL_ERR,"bad sequence header!\n"); 
      return 0;
 //     GUI_MSG( mplMPEGErrorBadSeqHeader )
-//     exit(1);
    }
    if(sync_video_packet(d_video)==0x1B5){ // next packet is seq. ext.
 //    videobuf_len=0;
@@ -614,13 +606,11 @@
       mp_msg(MSGT_DECVIDEO,MSGL_ERR,"FATAL: Cannot read sequence header extension!\n");
       return 0;
 //      GUI_MSG( mplMPEGErrorCannotReadSeqHeaderExt )
-//      exit(1);
     }
     if(header_process_extension (picture, &videobuffer[pos+4])) {
       mp_msg(MSGT_DECVIDEO,MSGL_ERR,"bad sequence header extension!\n");  
       return 0;
 //      GUI_MSG( mplMPEGErrorBadSeqHeaderExt )
-//      exit(1);
     }
    }
    // display info:
@@ -629,7 +619,7 @@
    if(!sh_video->fps){
 //     if(!force_fps){
 //       fprintf(stderr,"FPS not specified (or invalid) in the header! Use the -fps option!\n");
-//       return 0; //exit(1);
+//       return 0;
 //     }
      sh_video->frametime=0;
    } else {
--- a/demux_avi.c	Wed Aug 22 19:36:06 2001 +0000
+++ b/demux_avi.c	Wed Aug 22 19:40:46 2001 +0000
@@ -412,7 +412,6 @@
         mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI_NI: missing video stream!? contact the author, it may be a bug :(\n");
 	return NULL;
 //        GUI_MSG( mplErrorAVINI )
-//        exit(1);
       }
       if(a_pos==-1){
         mp_msg(MSGT_DEMUX,MSGL_INFO,"AVI_NI: No audio stream found -> nosound\n");
@@ -439,7 +438,6 @@
     mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI: missing video stream!? contact the author, it may be a bug :(\n");
     return NULL;
 //    GUI_MSG( mplAVIErrorMissingVideoStream )
-//    exit(1);
   }
   sh_video=d_video->sh;sh_video->ds=d_video;
   if(d_audio->id!=-2){
--- a/demuxer.c	Wed Aug 22 19:36:06 2001 +0000
+++ b/demuxer.c	Wed Aug 22 19:40:46 2001 +0000
@@ -399,7 +399,6 @@
   mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized);
   return NULL;
 //  GUI_MSG( mplUnknowFileType )
-//  exit(1);
 }
 //====== File format recognized, set up these for compatibility: =========
 d_audio=demuxer->audio;
@@ -429,7 +428,6 @@
     sh_video=NULL;
     //printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
     //GUI_MSG( mplASFErrorMissingVideoStream )
-    //exit(1);
   } else {
     sh_video=d_video->sh;sh_video->ds=d_video;
     sh_video->fps=1000.0f; sh_video->frametime=0.001f; // 1ms
--- a/dll_init.c	Wed Aug 22 19:36:06 2001 +0000
+++ b/dll_init.c	Wed Aug 22 19:40:46 2001 +0000
@@ -34,9 +34,6 @@
 
     sh_audio->srcstream=NULL;
 
-//    if(in_fmt->nSamplesPerSec==0){  printf("Bad WAVE header!\n");exit(1);  }
-//    MSACM_RegisterAllDrivers();
-
     sh_audio->o_wf.nChannels=in_fmt->nChannels;
     sh_audio->o_wf.nSamplesPerSec=in_fmt->nSamplesPerSec;
     sh_audio->o_wf.nAvgBytesPerSec=2*sh_audio->o_wf.nSamplesPerSec*sh_audio->o_wf.nChannels;
--- a/network.c	Wed Aug 22 19:36:06 2001 +0000
+++ b/network.c	Wed Aug 22 19:40:46 2001 +0000
@@ -474,7 +474,7 @@
 		ret = select( streaming_ctrl->fd_net+1, &fd_net_in, NULL, NULL, NULL );
 		if( ret<0 ) {
 			perror("select");
-			exit(1);
+			return; //exit(1); // FIXME!
 		}
 		if( FD_ISSET( streaming_ctrl->fd_net, &fd_net_in ) ) {
 			ret = readFromServer( streaming_ctrl->fd_net, buffer, BUFFER_SIZE );
--- a/url.c	Wed Aug 22 19:36:06 2001 +0000
+++ b/url.c	Wed Aug 22 19:40:46 2001 +0000
@@ -23,7 +23,7 @@
 	Curl = (URL_t*)malloc(sizeof(URL_t));
 	if( Curl==NULL ) {
 		printf("Memory allocation failed!\n");
-		exit(1);
+		return NULL;
 	}
 	// Initialisation of the URL container members
 	memset( Curl, 0, sizeof(URL_t) );
@@ -32,7 +32,7 @@
 	Curl->url = (char*)malloc(strlen(url)+1);
 	if( Curl->url==NULL ) {
 		printf("Memory allocation failed!\n");
-		exit(1);
+		return NULL;
 	}
 	strcpy(Curl->url, url);
 
@@ -71,7 +71,7 @@
 	Curl->hostname = (char*)malloc(pos2-pos1-3+1);
 	if( Curl->hostname==NULL ) {
 		printf("Memory allocation failed!\n");
-		exit(1);
+		return NULL;
 	}
 	strncpy(Curl->hostname, ptr1+3, pos2-pos1-3);
 	Curl->hostname[pos2-pos1-3] = '\0';
@@ -86,7 +86,7 @@
 			Curl->file = (char*)malloc(strlen(ptr2)+1);
 			if( Curl->file==NULL ) {
 				printf("Memory allocation failed!\n");
-				exit(1);
+				return NULL;
 			}
 			strcpy(Curl->file, ptr2);
 		}
@@ -96,7 +96,7 @@
 		Curl->file = (char*)malloc(2);
 		if( Curl->file==NULL ) {
 			printf("Memory allocation failed!\n");
-			exit(1);
+			return NULL;
 		}
 		strcpy(Curl->file, "/");
 	}