[xiph-cvs] cvs commit: snatch INSTALL README Snatch libsnatch.c

Monty xiphmont at xiph.org
Fri May 10 13:05:19 PDT 2002



xiphmont    02/05/10 13:05:19

  Modified:    .        INSTALL README Snatch libsnatch.c
  Log:
  Numerous bugfixes
  
  bugfix on write error closing a file: was triggering a robot retry, altered
          status message to prevent robot trigger (should be handled internal
          to the lib)
  
  bugfix properly resorting wildcarded list entries
  
  removed per-timer output file selection; too confusing
  
  more timer end/timer start fixes
  
  added windowmanager hint to INSTALL doc

Revision  Changes    Path
1.3       +22 -0     snatch/INSTALL

Index: INSTALL
===================================================================
RCS file: /usr/local/cvsroot/snatch/INSTALL,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- INSTALL	2002/02/26 06:01:14	1.2
+++ INSTALL	2002/05/10 20:05:17	1.3
@@ -65,3 +65,25 @@
 cd snatch-20020225
 make install
 
+******************** IMPORTANT WINDOWMANAGER TIP ******************
+
+If RealPlayer crashes at some point (and we all know this Just Doesn't
+Happen! :-), the Snatch robot will helpfully try to throw a new
+RealPlayer process.  This is especially useful during timed recording,
+and Snatch will try to pick up time recording when the new RealPlayer
+pops.
+
+However, the windowmanager, by default, throws a monkeywrench into
+this; it will generally ask the user to place the new RealPlayer
+window.  When unattended, this naturally screws recording from that
+point on as it will wait forever for the user.
+
+It's strongly recommended to either add an X resources entry (to
+.Xresources) along the lines of:
+
+RealPlayer*geometry:		+0+0
+
+...or an explicit Windowmanager configuration directive (this depends
+entirely on the WM in use) to force placement of the RealPlayer
+window.  This way, a crash during unattended recording will only
+momentarily interrupt the recording process.

<p><p>1.9       +1 -1      snatch/README

Index: README
===================================================================
RCS file: /usr/local/cvsroot/snatch/README,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- README	2002/02/19 02:05:20	1.8
+++ README	2002/05/10 20:05:17	1.9
@@ -1,4 +1,4 @@
-Snatch 20011112
+Snatch 20020510
 
 "The only intuitive interface is the nipple. After that, it's all 
  learned."

<p><p>1.10      +47 -34    snatch/Snatch

Index: Snatch
===================================================================
RCS file: /usr/local/cvsroot/snatch/Snatch,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Snatch	2002/04/13 00:53:32	1.9
+++ Snatch	2002/05/10 20:05:17	1.10
@@ -15,7 +15,7 @@
     exit 1;
 }
 
-$version="Snatch 20020412";
+$version="Snatch 20020510";
 $configdir=$HOME."/.snatch";
 $configfile=$configdir."/config.txt";
 $historyfile=$configdir."/history.txt";
@@ -372,8 +372,9 @@
     $ENV{"SNATCH_DEBUG"}=1;
     $ENV{"LD_PRELOAD"}=$glob;
     $ENV{"SNATCH_COMM_SOCKET"}=$backchannel_socket;
-
+    
     $glob=trim_glob("$CONFIG{'REALPLAYER'}");
+
     if(GLOB_ERROR || !defined($glob)){
         Status("Failed to find RealPlayer!");
         Alert("Failed to find RealPlayer!",
@@ -540,6 +541,7 @@
     
     syswrite COMM_SOCK,$stopcode;
 
+    $recording_pending=1;
     send_string("P",$password);
     send_string("U",$username);
     send_string("L",$loc);
@@ -555,6 +557,7 @@
     my $opencode=join "",("Ko",pack ("S",4));
 
     syswrite COMM_SOCK,$stopcode;
+    $recording_pending=1;
     send_string("O",$openfile);
     syswrite COMM_SOCK,$opencode;
 }
@@ -594,6 +597,7 @@
 
 sub Robot_Inactive{
     $next_timer_event=0;
+    $mode='inactive';
     if(defined($timer_callback)){
         $timer_callback->cancel();
         undef $timer_callback;
@@ -608,7 +612,6 @@
     Robot_Audio($CONFIG{"AUDIO_MUTE"});
     Robot_Video($CONFIG{"VIDEO_MUTE"});
     Status("Recording off");
-    $mode='inactive';
     ButtonPressConfig();
 }
 
@@ -631,10 +634,6 @@
     my($year,$month,$day,$dayofweek,$hour,$minute,$duration,$audio,$video,$username,
        $password,$outfile,$url)=SplitTimerEntry($line);
 
-    $recording_pending=1;
-    $next_timer_event=$start+$duration-1; # the -1 is important; makes sure contiguous
-                                          # but nonoverlapping events don't interfere
-
     syswrite COMM_SOCK,'A';    
     send_string("F",$outfile);
     Robot_Audio($audio);
@@ -649,7 +648,7 @@
 }
 
 sub SetupTimerDispatch{
-    TimerSort();
+    ListBoxUpdate();
     my$now=time();
     my at TIMETEMP=@TIMER_TIMES;
     my at ENDTIMETEMP=@TIMER_ENDTIMES;
@@ -661,6 +660,7 @@
 
         if($start<=$now && $end>$now){    
             Robot_Stop();
+	    $next_timer_event=$now;
             DoTimedEntry($start,$line);
             return;
         }else{
@@ -677,16 +677,25 @@
     if($mode=~/timer/){
         my$now=time();
 
-	if($TIMER_ENDTIMES[$TIMER_SORTED[$#TIMER]]<$now){
-	    Robot_Stop();
+	if($TIMER_ENDTIMES[$TIMER_SORTED[$#TIMER]]<=$now){
             Robot_Inactive();
+	    Robot_Stop();
+	    ListBoxUpdate();
             ButtonConfig();
         }else{
+	    
+	    my $next;
+	    if($recording_active){
+		$next=$TIMER_ENDTIMES[$TIMER_SORTED[0]];
+	    }else{
+		$next=$next_timer_event;
+	    }
             
-	    if($now>=$next_timer_event){
+	    if($now>=$next){
                 SetupTimerDispatch();
             }else{
-		my$waiting_seconds=$next_timer_event-$now;
+
+		my$waiting_seconds=$next-$now;
                 
                 my$waiting_minutes=int($waiting_seconds/60);
                 $waiting_seconds-=$waiting_minutes*60;
@@ -944,9 +953,9 @@
             }
         }
 
-	if($etry<$now){
+	if($etry<=$now){
             # current guess entirely preceeds now; prefer any guess in the future
-	    return ($start,$end) if($start>$try);
+	    return ($start,$end) if($start>=$try);
         }
 
         if($try>$now){
@@ -1458,6 +1467,21 @@
     $listbox;
 }
 
+sub ListBoxUpdate{
+    TimerSort();
+    ButtonConfig();
+    if(defined($timerw)){
+	BuildListBox();
+	
+	$timerw_add->configure(-state=>normal);
+	if(defined($timer_row)){
+	    $timerw_edit->configure(-state=>normal);
+	    $timerw_duplicate->configure(-state=>normal);
+	    $timerw_delete->configure(-state=>normal);
+	}
+    }
+}
+
 sub CheckTimerOverlap{
     my$rows=($#TIMER)+1;
 
@@ -1476,10 +1500,9 @@
                 if(($start1>=$start2 && $start1<$end2)||
                    ($start2>=$start1 && $start2<$end1)){
                     Alert("Some timer entries currently overlap!",
-			  "When multiple entries overlap, start and stop events are processed ".
-			  "in order; that is, if program B is scheduled to begin during program ".
-			  "A, program B will interrupt the recording of program A.  Should A ".
-			  "continue past the ending point of B, recording program A will resume.\n",
+			  "When multiple entries overlap, recording of one program will not be ".
+			  "interrupted to record the next; that is, if program B is scheduled to ".
+			  " begin during program A, recording B will wait until A ends.\n",
                           $timerw);
                     return;
                 }
@@ -1545,7 +1568,7 @@
     $nowmonth+=1;
     $nowyear+=1900;
     Timer_Entry(-1,"$nowyear $nowmonth $nowday * $nowhour:$nowmin 3600 yes yes 0: 0: ".
-	       length($CONFIG{OUTPUT_PATH}).":$CONFIG{OUTPUT_PATH} 0:");
+	       "0: 0:");
 }
 
 sub Timer_Edit{
@@ -1560,7 +1583,7 @@
     my$row=shift;
 
     my($year,$month,$day,$dayofweek,$hour,$minute,$duration,$audio,$video,$username,
-       $password,$outfile,$url)=SplitTimerEntry(shift);
+       $password,$dummy,$url)=SplitTimerEntry(shift);
 
     my$duration_hour=int($duration/3600);
     my$duration_minute=int(($duration-$duration_hour*3600+59)/60);
@@ -1606,11 +1629,11 @@
                   " far enough in the past it will never trigger anyway).  Please correct the".
                   ' date specification before proceeding, or file a bug report'.
                   " if the date is correct and the code is wrong.\n",$tentry);
-	}elsif(TestOutpath($outfile,$tentry)){
+	}else{
             $outfile=trim_glob($outfile);
             my$entry="$year $month $day $dayofweek $hour:$minute $duration $audio $video ".
                 length($username).":$username ".length($password).":$password ".
-		    length($outfile).":$outfile ".length($url).":$url";
+		    "0: ".length($url).":$url";
             
             if($row<0){
                 push @TIMER, $entry;
@@ -1803,15 +1826,7 @@
     nonmomentary(\$tentry_audio,\$audio);
     nonmomentary(\$tentry_video,\$video);
     nonmomentary(\$tentry_video,\$video);
-    $y+=$tentry_video->reqheight()+5;
-
-    $t=$tentry_outlabel=$tentry_shell->Label(-text=>"output path")->
-	place(-x=>5,-y=>$y,-bordermode=>outside);
-    my$tentry_out=$tentry_shell->Entry(-textvariable=>\$outfile,-width=>2048)->
-	place(-y=>$y,-x=>10+$t->reqwidth,-height=>$t->reqheight,-bordermode=>outside,
-	      -relwidth=>1.0,-width=>-20-$t->reqwidth());
-
-    $y+=$tentry_outlabel->reqheight()+10;
+    $y+=$tentry_video->reqheight()+10;
 
     $tentry_message=$tentry_shell->
         Message(-text=>"Any field in the date specification may be set to the wildcard * (asterisk); ".
@@ -1823,9 +1838,7 @@
                 "play audio ".
                 "or display video.  This is useful both to increase performance and eliminate ".
                 "the possibility timed record will fail due to audio device conflicts with other ".
-		"applications.\n\nOutput path may be a directory [Snatch create a new ".
-		"file for each record request], ".
-		"a filename [record will append to that file], or - (dash) indicating standard out.",
+		"applications.",
                 -width=>$reqwidth-30-$tentry_shell->cget(borderwidth)*2,
                 -anchor=>w,-class=>AlertDetail)->
                     place(-x=>5,-y=>$y,-relwidth=>1.0,-width=>-10,-bordermode=>outside);

<p><p>1.35      +14 -2     snatch/libsnatch.c

Index: libsnatch.c
===================================================================
RCS file: /usr/local/cvsroot/snatch/libsnatch.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- libsnatch.c	2002/02/26 06:01:14	1.34
+++ libsnatch.c	2002/05/10 20:05:18	1.35
@@ -91,7 +91,8 @@
 
 static int outfile_fd=-1;
 
-static void CloseOutputFile();
+static void TempCloseOutputFile();
+static void CloseOutputFile(int preserve);
 static void OpenOutputFile();
 
 static char *audio_fmts[]={"unknown format",
@@ -122,7 +123,7 @@
         else{
           fprintf(stderr,"**ERROR: Write error on capture file!\n"
                   "       : %s\n",strerror(errno));
-	  CloseOutputFile(1); /* if the error is the 2GB limit on Linux 2.2,
+	  TempCloseOutputFile(); /* if the error is the 2GB limit on Linux 2.2,
                                 this will result in a new file getting opened */
           return(ret);
         }
@@ -759,6 +760,17 @@
       output_audio_p=0;
       output_video_p=0;
     }
+  }
+  pthread_mutex_unlock(&output_mutex);
+}
+
+static void TempCloseOutputFile(void){
+  pthread_mutex_lock(&output_mutex);
+  if(outfile_fd>=0){
+    if(debug)fprintf(stderr,"    ...: Capture file closed; trying to continue...\n");
+    if(outfile_fd!=STDOUT_FILENO)
+      close(outfile_fd);
+    outfile_fd=-1;
   }
   pthread_mutex_unlock(&output_mutex);
 }

<p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list