aboutsummaryrefslogtreecommitdiffstats
path: root/console
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:40 (GMT)
committerGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:40 (GMT)
commit82fbaff22e3e4b1bbdd1e2192cfeff061ce7285c (patch)
tree308704093028c293b650fcefab4a14ef6f6ca42b /console
parente99e58b6d385a8ae806a97b88ec4dbb26c898619 (diff)
v3.83
Diffstat (limited to 'console')
-rw-r--r--console/fbtools.c4
-rw-r--r--console/radio.c23
-rw-r--r--console/record.c12
-rw-r--r--console/streamer.c63
-rw-r--r--console/v4l-conf.c2
-rw-r--r--console/webcam.c3
6 files changed, 75 insertions, 32 deletions
diff --git a/console/fbtools.c b/console/fbtools.c
index b7473f0..228589f 100644
--- a/console/fbtools.c
+++ b/console/fbtools.c
@@ -262,7 +262,7 @@ fb_setvt(int vtno)
vtno &= 0xff;
sprintf(vtname, devices->ttynr, vtno);
chown(vtname, getuid(), getgid());
- if (-1 == access(vtname,R_OK | W_OK)) {
+ if (-1 == access(vtname, R_OK | W_OK)) {
fprintf(stderr,"access %s: %s\n",vtname,strerror(errno));
exit(1);
}
@@ -349,12 +349,12 @@ fb_init(char *device, char *mode, int vt)
struct stat st;
char fbdev[16];
+ dev_init();
tty = 0;
if (vt != 0)
fb_setvt(vt);
/* FIXME: where are MAJOR() / MINOR() ??? */
- dev_init();
fstat(tty,&st);
if (((st.st_rdev >> 8) & 0xff) != TTY_MAJOR) {
/* catch that here, give a more user friendly error message that just
diff --git a/console/radio.c b/console/radio.c
index 010b4a4..fb0e5a6 100644
--- a/console/radio.c
+++ b/console/radio.c
@@ -56,6 +56,17 @@ radio_setfreq(int fd, float freq)
return ioctl(fd, VIDIOCSFREQ, &ifreq);
}
+static int radio_getfreq(int fd, float *freq)
+{
+ int ioctl_status;
+ int ifreq;
+ ioctl_status = ioctl(fd,VIDIOCGFREQ, &ifreq);
+ if (ioctl_status == -1)
+ return ioctl_status;
+ *freq = (float) ifreq / get_freq_fact(fd);
+ return 0;
+}
+
static void
radio_unmute(int fd)
{
@@ -521,6 +532,12 @@ main(int argc, char *argv[])
if (!stset)
mvwprintw(wstations,1,1,"[none]");
wrefresh(wstations);
+
+ if (ifreq == 0) {
+ float ffreq;
+ radio_getfreq(fd,&ffreq);
+ ifreq = ffreq * 1000000;
+ }
radio_unmute(fd);
for (done = 0; done == 0;) {
@@ -569,7 +586,11 @@ main(int argc, char *argv[])
noecho();
curs_set(0);
wrefresh(wcommand);
- ifreq = newfreq * 1000000;
+ if ( (newfreq >= 87.5) && (newfreq <= 108) )
+ ifreq = newfreq * 1000000;
+ else
+ mvwprintw(wcommand, 1, 2,
+ "Frequency out of range (87.5-108 MHz)");
break;
case KEY_UP:
ifreq += 50000;
diff --git a/console/record.c b/console/record.c
index 5638fc6..b334a1e 100644
--- a/console/record.c
+++ b/console/record.c
@@ -535,6 +535,8 @@ usage(FILE *fp)
" until stopped by a signal (^C)\n"
" -s size set max file size [%s]. You have to give number\n"
" and unit without space inbetween, i.e. \"100mb\".\n"
+ " -n num limit amount of files recorded, quits when\n"
+ " reached.\n"
" -l signal level triggered recording.\n"
" -L level same as above + specify trigger level [%d]\n"
"\n",
@@ -552,6 +554,7 @@ main(int argc, char *argv[])
char *outfile;
fd_set s;
int sec,maxhour,maxmin,maxsec;
+ int maxfiles = 0;
off_t maxsize;
/* init some vars */
@@ -565,7 +568,7 @@ main(int argc, char *argv[])
/* parse options */
for (;;) {
- if (-1 == (c = getopt(argc, argv, "vhlci:o:d:m:r:t:s:L:p:")))
+ if (-1 == (c = getopt(argc, argv, "vhlci:o:d:m:r:t:s:L:p:n:")))
break;
switch (c) {
case 'v':
@@ -612,6 +615,9 @@ main(int argc, char *argv[])
case 's':
str_maxsize = optarg;
break;
+ case 'n':
+ maxfiles = atoi(optarg);
+ break;
case 'h':
usage(stdout);
exit(0);
@@ -649,7 +655,7 @@ main(int argc, char *argv[])
mvprintw(11,0,"'N' next file (same as space twice, but without break)");
mvprintw(12,0,"'Q' quit");
mvprintw(LINES-3,0,"--");
- mvprintw(LINES-2,0,"(c) 1999-2002 Gerd Knorr <kraxel@bytesex.org>");
+ mvprintw(LINES-2,0,"(c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>");
for (;!stop;) {
refresh();
@@ -766,6 +772,8 @@ main(int argc, char *argv[])
secr < level_trigger) {
record_stop(wav);
record=0;
+ if (maxfiles && nr == maxfiles)
+ break;
}
}
if (!record) {
diff --git a/console/streamer.c b/console/streamer.c
index a4e9399..50fd7c8 100644
--- a/console/streamer.c
+++ b/console/streamer.c
@@ -107,6 +107,7 @@ usage(FILE *out)
"general options:\n"
" -h print this help text\n"
" -q quiet operation\n"
+ " -d enable debug output\n"
" -p n use n compression threads [%d]\n"
" -w seconds wait before grabbing [%d]\n"
"\n"
@@ -203,71 +204,83 @@ find_formats(void)
for (w = 0; NULL != ng_writers[w]; w++) {
wr = ng_writers[w];
if (debug)
- fprintf(stderr,"checking writer %s... ",wr->name);
+ fprintf(stderr,"checking writer %s [%s] ...\n",wr->name,wr->desc);
if ((/*!wr->combined && */mext) || NULL != vfmt_name) {
if (NULL == wr->video) {
if (debug)
- fprintf(stderr,"no video\n");
+ fprintf(stderr," no video, skipping\n");
continue;
}
for (v = 0; NULL != wr->video[v].name; v++) {
- if (mext && 0 != strcasecmp(wr->video[v].ext,mext))
+ if (debug)
+ fprintf(stderr," video name=%s ext=%s: ",
+ wr->video[v].name,wr->video[v].ext);
+ if (mext && 0 != strcasecmp(wr->video[v].ext,mext)) {
+ if (debug)
+ fprintf(stderr,"ext mismatch [need %s]\n",mext);
continue;
- if (vfmt_name && 0 != strcasecmp(wr->video[v].name,vfmt_name))
+ }
+ if (vfmt_name && 0 != strcasecmp(wr->video[v].name,vfmt_name)) {
+ if (debug)
+ fprintf(stderr,"name mismatch [need %s]\n",vfmt_name);
continue;
+ }
+ if (debug)
+ fprintf(stderr,"OK\n");
break;
}
- if (NULL == wr->video[v].name) {
- if (debug)
- fprintf(stderr,"video fmt not found [ext=%s,name=%s]\n",
- mext,vfmt_name);
+ if (NULL == wr->video[v].name)
continue;
- }
}
if ((!wr->combined && aext) || NULL != afmt_name) {
if (NULL == wr->audio) {
if (debug)
- fprintf(stderr,"no audio\n");
+ fprintf(stderr," no audio, skipping\n");
continue;
}
for (a = 0; NULL != wr->audio[a].name; a++) {
+ if (debug)
+ fprintf(stderr," audio name=%s ext=%s: ",
+ wr->audio[a].name,wr->audio[a].ext);
if (!wr->combined &&
- aext && 0 != strcasecmp(wr->audio[a].ext,aext))
+ aext && 0 != strcasecmp(wr->audio[a].ext,aext)) {
+ if (debug)
+ fprintf(stderr,"ext mismatch [need %s]\n",aext);
continue;
+ }
if (wr->combined &&
- mext && 0 != strcasecmp(wr->audio[a].ext,mext))
+ mext && 0 != strcasecmp(wr->audio[a].ext,mext)) {
+ if (debug)
+ fprintf(stderr,"ext mismatch [need %s]\n",mext);
continue;
- if (afmt_name && 0 != strcasecmp(wr->audio[a].name,afmt_name))
+ }
+ if (afmt_name && 0 != strcasecmp(wr->audio[a].name,afmt_name)) {
+ if (debug)
+ fprintf(stderr,"name mismatch [need %s]\n",afmt_name);
continue;
+ }
+ if (debug)
+ fprintf(stderr,"OK\n");
break;
}
- if (NULL == wr->audio[a].name) {
- if (debug)
- fprintf(stderr,"audio fmt not found [ext=%s,name=%s]\n",
- wr->combined ? mext : aext, afmt_name);
+ if (NULL == wr->audio[a].name)
continue;
- }
}
- if (debug)
- fprintf(stderr,"ok:");
break;
}
if (NULL != ng_writers[w]) {
writer = wr;
if (-1 != v) {
- if (debug)
- fprintf(stderr," video=%s",wr->video[v].name);
video.fmtid = wr->video[v].fmtid;
video_priv = wr->video[v].priv;
}
if (-1 != a) {
- if (debug)
- fprintf(stderr," audio=%s",wr->audio[a].name);
audio.fmtid = wr->audio[a].fmtid;
audio_priv = wr->audio[a].priv;
}
+ } else {
if (debug)
- fprintf(stderr,"\n");
+ fprintf(stderr,"no match found\n");
}
}
diff --git a/console/v4l-conf.c b/console/v4l-conf.c
index 9d0139f..a17e416 100644
--- a/console/v4l-conf.c
+++ b/console/v4l-conf.c
@@ -339,7 +339,7 @@ displayinfo_v4l2(int fd, struct DISPLAYINFO *d)
/* set values */
fb.fmt.width = d->width;
fb.fmt.height = d->height;
- switch (d->depth) {
+ switch (d->bpp) {
case 8: fb.fmt.pixelformat = V4L2_PIX_FMT_HI240; break;
#if BYTE_ORDER == BIG_ENDIAN
case 15: fb.fmt.pixelformat = V4L2_PIX_FMT_RGB555X; break;
diff --git a/console/webcam.c b/console/webcam.c
index a4421a1..4baf12a 100644
--- a/console/webcam.c
+++ b/console/webcam.c
@@ -686,7 +686,8 @@ main(int argc, char *argv[])
if (-1 != (i = cfg_get_int("grab","trigger")))
grab_trigger = i;
if (-1 != (i = cfg_get_int("grab","once")))
- grab_times = 1;
+ if (i > 0)
+ grab_times = 1;
if (-1 != (i = cfg_get_int("grab","times")))
grab_times = i;
if (NULL != (val = cfg_get_str("grab","archive")))

Privacy Policy