Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Tzap and exit after tuning



Hello

When tzapping to channel, tzap does not exit when tuning is done. Szap seems 
to have option "-x" to exit when tuning is done.

I'd like to have the same feature in tzap. I copied the -x code from szap to 
tzap (see attached patch) , is this the correct way to do it and if yes, 
could this be applied to CVS?

Regards
Kimmo Koivisto
Index: tzap.c
===================================================================
RCS file: /cvs/linuxtv/dvb-apps/util/szap/tzap.c,v
retrieving revision 1.7
diff -u -r1.7 tzap.c
--- tzap.c	23 Aug 2004 16:47:16 -0000	1.7
+++ tzap.c	21 Nov 2004 16:57:12 -0000
@@ -40,6 +40,7 @@
 static char DVR_DEV [80];
 static int timeout_flag=0;
 static int silent=0,timeout=0;
+static int exit_after_tuning;
 
 #define CHANNEL_FILE "channels.conf"
 
@@ -435,11 +436,15 @@
 static
 int check_frontend (int fe_fd)
 {
+fe_status_t status;
 	do
 	{
+	        ioctl(fe_fd, FE_READ_STATUS, &status);
 		if(silent==0)
 			print_frontend_stats (fe_fd);
 		usleep(1000000);
+		if (exit_after_tuning && (status & FE_HAS_LOCK)) 
+	   	   	break;
 	}
 	while (timeout_flag==0);
 	if(silent<2)
@@ -474,7 +479,7 @@
 }
 
 static const char *usage = "\nusage: %s [-a adapter_num] [-f frontend_id] [-d demux_id] \\\n"
-	"\t[-c conf_file] [-t timeout_secs] [-r] [-o mpeg_file] [-s] [-S] <channel name>\n\n";
+	"\t[-c conf_file] [-t timeout_secs] [-r] [-o mpeg_file] [-x] [-s] [-S] <channel name>\n\n";
 
 
 int main(int argc, char **argv)
@@ -490,7 +495,7 @@
 	int record=0;
 	char *filename = NULL;
 
-	while ((opt = getopt(argc, argv, "hrRsSn:a:f:d:c:t:o:")) != -1) {
+	while ((opt = getopt(argc, argv, "hrxRsSn:a:f:d:c:t:o:")) != -1) {
 		switch (opt) {
 		case 'a':
 			adapter = strtoul(optarg, NULL, 0);
@@ -511,6 +516,9 @@
 		case 'r':
 			dvr = 1;
 			break;
+		case 'x':
+            		exit_after_tuning = 1;
+            		break;
 		case 'c':
 			confname = optarg;
 			break;

Home | Main Index | Thread Index