[MPlayer-dev-eng] [PATCH] signal handling in gmplayer, immediate mode in tvi_v4l, wrong warning for tv:// MRLs

Michael Joosten joost at c-lab.de
Sat Apr 19 06:12:23 CEST 2003


Next set of patches, mostly of concern for gmplayer:

1: mp_msg() in gmplayer uses GTK message boxes, and this is REALLY a
stupid idea inside a signal handler! This makes gmplayer 'almost
unkillable', as some threads are simply stuck. This still happens
sometimes, but much less than originally.

2: Seeking in a video stream did hang (g)mplayer, so I just disabled
this behaviour if tv_param_on was set. In the mean time, the CVS version
has some handlicng for this, but this just emits some warning messages.
If you don't want this, cut the last segment of the patch for mplayer.c

3: tvi_v4l.c also has code for tv_param_immediate, so cfg-common.h
should provide it also for HAVE_TV_V4L

4: While mplayer/mencoder now work with tv:// URLs or MRLs, there is
still an error message which comes up as annoying GTK message box in
gmplayer. Again, I'm not sure how to fix this in a proper way in this
code jungle, but checking for tv:// and taking the short path exit in
libmpdemux/open.c seems to be the right way.


-- 
Michael Joosten, SBS C-LAB, joost at c-lab.de
Fuerstenallee 11, 33094 Paderborn, Germany
Phone: +49 5251 606127, Fax: +49 5251 606065
C-LAB is a cooperation of University Paderborn & SIEMENS
-------------- next part --------------
diff -ru ../mplayer-pur/main/cfg-common.h main/cfg-common.h
--- ../mplayer-pur/main/cfg-common.h	2003-04-09 20:04:03.000000000 +0200
+++ main/cfg-common.h	2003-04-11 22:24:12.000000000 +0200
@@ -278,7 +278,7 @@
 #ifdef USE_TV
 struct config tvopts_conf[]={
 	{"on", "-tv on is deprecated, use tv:// instead\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
-#ifdef HAVE_TV_BSDBT848
+#if defined(HAVE_TV_V4L) || defined(HAVE_TV_BSDBT848)
 	{"immediatemode", &tv_param_immediate, CONF_TYPE_FLAG, 0, 0, 0, NULL},
 #endif
 	{"noaudio", &tv_param_noaudio, CONF_TYPE_FLAG, 0, 0, 1, NULL},
diff -ru ../mplayer-pur/main/libmpdemux/open.c main/libmpdemux/open.c
--- ../mplayer-pur/main/libmpdemux/open.c	2003-04-10 12:59:12.000000000 +0200
+++ main/libmpdemux/open.c	2003-04-12 04:18:10.000000000 +0200
@@ -529,7 +529,11 @@
 	    mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_SMBNotCompiled,filename);
 	    return NULL;
 #endif
+	} else if (strcmp(url->protocol, "tv")==0){
+	    /* open_stream_full handles the channel number */
+	    return open_stream_full(filename,STREAM_READ,options,file_format);
 	}
+
         stream=new_stream(f,STREAMTYPE_STREAM);
 	if( streaming_start( stream, file_format, url )<0){
           mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_UnableOpenURL, filename);
diff -ru ../mplayer-pur/main/mplayer.c main/mplayer.c
--- ../mplayer-pur/main/mplayer.c	2003-04-07 22:55:32.000000000 +0200
+++ main/mplayer.c	2003-04-11 22:29:39.000000000 +0200
@@ -479,9 +479,11 @@
     kill(getpid(),SIGKILL);
 #endif
   }
-  mp_msg(MSGT_CPLAYER,MSGL_FATAL,"\n" MSGTR_IntBySignal,x,
-      current_module?current_module:mp_gettext("unknown")
-  );
+  if (!use_gui) {
+    mp_msg(MSGT_CPLAYER,MSGL_FATAL,"\n" MSGTR_IntBySignal,x,
+          current_module?current_module:mp_gettext("unknown")
+    );
+  }
   if(sig_count==1)
   switch(x){
   case SIGINT:
@@ -490,16 +492,22 @@
   case SIGKILL:
       break;  // killed from keyboard (^C) or killed [-9]
   case SIGILL:
+      if (!use_gui) {
 #ifdef RUNTIME_CPUDETECT
-      mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGILL_RTCpuSel);
+        mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGILL_RTCpuSel);
 #else
-      mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGILL);
+        mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGILL);
 #endif
+      }
   case SIGFPE:
   case SIGSEGV:
-      mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGSEGV_SIGFPE);
+      if (!use_gui) {
+        mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGSEGV_SIGFPE);
+      }
   default:
-      mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGCRASH);
+      if (!use_gui) {
+        mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGCRASH);
+      }
   }
   exit_player(NULL);
 }
@@ -3126,7 +3134,8 @@
     loop_seek = 1;
   }
 
-if(rel_seek_secs || abs_seek_pos){
+/* do NOT use seeks in a life video stream from a TV tuner card ! */
+if(file_format != DEMUXER_TYPE_TV && (rel_seek_secs || abs_seek_pos)){
   current_module="seek";
   if(demux_seek(demuxer,rel_seek_secs,abs_seek_pos)){
       // success:


More information about the MPlayer-dev-eng mailing list