forked from pool/alevt
360 lines
10 KiB
Diff
360 lines
10 KiB
Diff
diff -u alevt-1.6.1-orig/alevt-cap.c alevt-1.6.1/alevt-cap.c
|
|
--- alevt-1.6.1-orig/alevt-cap.c 2005-04-15 22:43:29.179452648 +0200
|
|
+++ alevt-1.6.1/alevt-cap.c 2005-04-15 20:52:57.000000000 +0200
|
|
@@ -216,6 +216,7 @@
|
|
struct dl_head reqs[2]; // simple linear lists of requests & captures
|
|
char *progname = NULL;
|
|
int txtpid = -1;
|
|
+ char *outfile = NULL;
|
|
|
|
setprgname(argv[0]);
|
|
|
|
@@ -301,7 +302,7 @@
|
|
fatal("no pages requested");
|
|
|
|
// setup device
|
|
- if (not(vbi = vbi_open(vbi_name, 0, fine_tune, newbttv, progname, txtpid)))
|
|
+ if (not(vbi = vbi_open(vbi_name, 0, fine_tune, newbttv, progname, txtpid, outfile)))
|
|
fatal("cannot open %s", vbi_name);
|
|
vbi_add_handler(vbi, event, reqs); // register event handler
|
|
|
|
diff -u alevt-1.6.1-orig/alevt-date.c alevt-1.6.1/alevt-date.c
|
|
--- alevt-1.6.1-orig/alevt-date.c 2005-04-15 22:43:29.170454016 +0200
|
|
+++ alevt-1.6.1/alevt-date.c 2005-04-15 20:52:57.000000000 +0200
|
|
@@ -4,7 +4,6 @@
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <signal.h>
|
|
-#include <time.h>
|
|
|
|
#include "os.h"
|
|
#include "vt.h"
|
|
@@ -149,10 +148,12 @@
|
|
if (streq(*arg, opts[i].nam) || streq(*arg, opts[i].altnam))
|
|
{
|
|
if (opts[i].arg)
|
|
+ {
|
|
if (*ind < argc)
|
|
*arg = argv[(*ind)++];
|
|
else
|
|
fatal("option %s requires an argument", *arg);
|
|
+ }
|
|
return i+1;
|
|
}
|
|
|
|
@@ -176,11 +177,12 @@
|
|
char *arg;
|
|
char *progname = NULL;
|
|
int txtpid = -1;
|
|
+ char *outfile = NULL;
|
|
|
|
setprgname(argv[0]);
|
|
|
|
ind = 1;
|
|
- while (opt = option(argc, argv, &ind, &arg))
|
|
+ while ((opt = option(argc, argv, &ind, &arg)))
|
|
switch (opt)
|
|
{
|
|
case 1: // -set
|
|
@@ -239,7 +241,7 @@
|
|
alarm(timeout);
|
|
}
|
|
|
|
- vbi = vbi_open(vbi_name, 0, 1, big_buf, progname, txtpid); // open device
|
|
+ vbi = vbi_open(vbi_name, 0, 1, big_buf, progname, txtpid, outfile); // open device
|
|
if (not vbi)
|
|
fatal_ioerror(vbi_name);
|
|
|
|
diff -u alevt-1.6.1-orig/alevt.1x.in alevt-1.6.1/alevt.1x.in
|
|
--- alevt-1.6.1-orig/alevt.1x.in 2000-10-11 20:03:29.000000000 +0200
|
|
+++ alevt-1.6.1/alevt.1x.in 2005-04-15 22:56:12.175459624 +0200
|
|
@@ -67,6 +67,15 @@
|
|
in the selected set are replaced by similar looking symbols.
|
|
(default: latin-1)
|
|
.TP
|
|
+.B \-progname (dvb only)
|
|
+Selects the station name to display.
|
|
+.TP
|
|
+.B \-pid (dvb only)
|
|
+Selects the station pid to display.
|
|
+.TP
|
|
+.B \-outfile (dvb only)
|
|
+Specifies a file where the available stations are written.
|
|
+.TP
|
|
.B \-\-help
|
|
Show summary of options.
|
|
.TP
|
|
@@ -89,6 +98,10 @@
|
|
options requires a parent window. So, it must be preceeded by a parent
|
|
or another child window.
|
|
.PP
|
|
+To access the DVB interface, use:
|
|
+.IP
|
|
+.I alevt -vbi /dev/dvb/adapter0/demux0
|
|
+.PP
|
|
When saving pages
|
|
.B alevt
|
|
asks for a format string. Look at
|
|
diff -u alevt-1.6.1-orig/lang.h alevt-1.6.1/lang.h
|
|
--- alevt-1.6.1-orig/lang.h 1999-06-28 23:08:08.000000000 +0200
|
|
+++ alevt-1.6.1/lang.h 2005-04-15 20:54:11.000000000 +0200
|
|
@@ -19,4 +19,4 @@
|
|
void add_enhance(struct enhance *eh, int dcode, u32 *data);
|
|
void enhance(struct enhance *eh, struct vt_page *vtp);
|
|
|
|
-#endif LANG_H
|
|
+#endif
|
|
diff -u alevt-1.6.1-orig/main.c alevt-1.6.1/main.c
|
|
--- alevt-1.6.1-orig/main.c 2005-04-15 22:43:29.173453560 +0200
|
|
+++ alevt-1.6.1/main.c 2005-04-15 23:03:45.590530056 +0200
|
|
@@ -23,6 +23,7 @@
|
|
static int newbttv = -1;
|
|
static char *progname;
|
|
static int txtpid = -1;
|
|
+static char *outfile;
|
|
|
|
static void
|
|
usage(FILE *fp, int exitval)
|
|
@@ -43,8 +44,9 @@
|
|
" -[no]erc\t\t\tenabled\n"
|
|
" -[no]bell\t\t\tenabled\n"
|
|
" -charset latin-1/2\t\tlatin-1\n"
|
|
- " -progname name\n"
|
|
- " -pid pid\n"
|
|
+ " -progname <name>\n"
|
|
+ " -pid <pid>\n"
|
|
+ " -outfile <path>\n"
|
|
"\n"
|
|
" Order is important! Each page number\n"
|
|
" opens a new window with the previously\n"
|
|
@@ -65,6 +67,8 @@
|
|
" The -progname or -pid option specify\n"
|
|
" the program or teletext PID if using\n"
|
|
" the DVB interface.\n"
|
|
+ " The -outfile option specifies a file\n"
|
|
+ " where the available stations are written\n"
|
|
);
|
|
exit(exitval);
|
|
}
|
|
@@ -95,7 +99,7 @@
|
|
start(int argc, char **argv, struct vtwin *parent, int pgno, int subno)
|
|
{
|
|
if (vbi == 0)
|
|
- vbi = vbi_open(vbi_name, cache_open(), fine_tune, newbttv, progname, txtpid);
|
|
+ vbi = vbi_open(vbi_name, cache_open(), fine_tune, newbttv, progname, txtpid, outfile);
|
|
if (vbi == 0)
|
|
fatal("cannot open %s", vbi_name);
|
|
if (vbi->cache)
|
|
@@ -137,6 +141,7 @@
|
|
{ "-charset", "-latin", 1 },
|
|
{ "-progname", "-pn", 1 },
|
|
{ "-pid", "--pid", 1 },
|
|
+ { "-outfile", "-of", 1 },
|
|
};
|
|
int i;
|
|
|
|
@@ -261,6 +266,9 @@
|
|
parent = start(argc, argv, 0, pgno, subno);
|
|
geometry = 0;
|
|
break;
|
|
+ case 21:
|
|
+ outfile = arg;
|
|
+ break;
|
|
}
|
|
|
|
if (parent == 0)
|
|
diff -u alevt-1.6.1-orig/main.c.orig alevt-1.6.1/main.c.orig
|
|
--- alevt-1.6.1-orig/main.c.orig 2002-08-20 05:07:04.000000000 +0200
|
|
+++ alevt-1.6.1/main.c.orig 2005-04-15 20:54:11.000000000 +0200
|
|
@@ -21,7 +21,9 @@
|
|
static int fine_tune = 1; // auto = 999;
|
|
static int erc = 1;
|
|
static int newbttv = -1;
|
|
-
|
|
+static char *progname;
|
|
+static int txtpid = -1;
|
|
+static char *outfile;
|
|
|
|
static void
|
|
usage(FILE *fp, int exitval)
|
|
@@ -42,6 +44,9 @@
|
|
" -[no]erc\t\t\tenabled\n"
|
|
" -[no]bell\t\t\tenabled\n"
|
|
" -charset latin-1/2\t\tlatin-1\n"
|
|
+ " -progname name\n"
|
|
+ " -pid pid\n"
|
|
+ " -outfile path\n"
|
|
"\n"
|
|
" Order is important! Each page number\n"
|
|
" opens a new window with the previously\n"
|
|
@@ -55,6 +60,15 @@
|
|
" The -child option requires a parent\n"
|
|
" window. So, it must be preceeded by\n"
|
|
" a parent or another child window.\n"
|
|
+ "\n"
|
|
+ " To use the DVB interface, use\n"
|
|
+ " -vbi /dev/dvb/adapter0/demux0\n"
|
|
+ "\n"
|
|
+ " The -progname or -pid option specify\n"
|
|
+ " the program or teletext PID if using\n"
|
|
+ " the DVB interface.\n"
|
|
+ " The -outfile option specifies a file\n"
|
|
+ " where the available stations are written \n"
|
|
);
|
|
exit(exitval);
|
|
}
|
|
@@ -85,7 +99,7 @@
|
|
start(int argc, char **argv, struct vtwin *parent, int pgno, int subno)
|
|
{
|
|
if (vbi == 0)
|
|
- vbi = vbi_open(vbi_name, cache_open(), fine_tune, newbttv);
|
|
+ vbi = vbi_open(vbi_name, cache_open(), fine_tune, newbttv, progname, txtpid, outfile);
|
|
if (vbi == 0)
|
|
fatal("cannot open %s", vbi_name);
|
|
if (vbi->cache)
|
|
@@ -125,6 +139,9 @@
|
|
{ "-bell", "-b", 0 },
|
|
{ "-nobell", "-nb", 0 },
|
|
{ "-charset", "-latin", 1 },
|
|
+ { "-progname", "-pn", 1 },
|
|
+ { "-pid", "--pid", 1 },
|
|
+ { "-outfile", "-of", 1 },
|
|
};
|
|
int i;
|
|
|
|
@@ -237,12 +254,21 @@
|
|
case 12: // debug
|
|
debug++;
|
|
break;
|
|
+ case 19: // progname
|
|
+ progname = arg;
|
|
+ break;
|
|
+ case 20: // pid
|
|
+ txtpid = strtoul(arg, NULL, 0);
|
|
+ break;
|
|
case 6: // parent
|
|
case -1: // non-option arg
|
|
pgno = arg_pgno(arg, &subno);
|
|
parent = start(argc, argv, 0, pgno, subno);
|
|
geometry = 0;
|
|
break;
|
|
+ case 21:
|
|
+ outfile = arg;
|
|
+ break;
|
|
}
|
|
|
|
if (parent == 0)
|
|
diff -u alevt-1.6.1-orig/vbi.c alevt-1.6.1/vbi.c
|
|
--- alevt-1.6.1-orig/vbi.c 2005-04-15 22:43:29.176453104 +0200
|
|
+++ alevt-1.6.1/vbi.c 2005-04-15 20:54:11.000000000 +0200
|
|
@@ -16,7 +16,7 @@
|
|
#include "lang.h"
|
|
|
|
|
|
-static int vbi_dvb_open(struct vbi *vbi, const char *vbi_name, const char *progname, int txtpid);
|
|
+static int vbi_dvb_open(struct vbi *vbi, const char *vbi_name, const char *progname, int txtpid, const char *outfile);
|
|
static void dvb_handler(struct vbi *vbi, int fd);
|
|
|
|
#define FAC (1<<16) // factor for fix-point arithmetic
|
|
@@ -586,7 +586,7 @@
|
|
|
|
|
|
struct vbi *
|
|
-vbi_open(char *vbi_name, struct cache *ca, int fine_tune, int big_buf, const char *progname, int txtpid)
|
|
+vbi_open(char *vbi_name, struct cache *ca, int fine_tune, int big_buf, const char *progname, int txtpid, const char *outfile)
|
|
{
|
|
static int inited = 0;
|
|
struct vbi *vbi;
|
|
@@ -601,7 +601,7 @@
|
|
goto fail1;
|
|
}
|
|
|
|
- if (!vbi_dvb_open(vbi, vbi_name, progname, txtpid)) {
|
|
+ if (!vbi_dvb_open(vbi, vbi_name, progname, txtpid, outfile)) {
|
|
vbi->cache = ca;
|
|
|
|
dl_init(vbi->clients);
|
|
@@ -627,6 +627,18 @@
|
|
|
|
vbi->cache = ca;
|
|
|
|
+ if (outfile) {
|
|
+ FILE * outstr;
|
|
+ outstr = fopen (outfile,"w");
|
|
+ if (outstr!=NULL)
|
|
+ {
|
|
+ fputs ("This works only with dvb",outstr);
|
|
+ fclose (outstr);
|
|
+ }
|
|
+ }
|
|
+
|
|
+
|
|
+
|
|
dl_init(vbi->clients);
|
|
vbi->seq = 0;
|
|
out_of_sync(vbi);
|
|
@@ -852,7 +864,7 @@
|
|
memmove(rawbuf, rawbuf + len, rawptr);
|
|
}
|
|
|
|
-static int vbi_dvb_open(struct vbi *vbi, const char *vbi_name, const char *progname, int txtpid)
|
|
+static int vbi_dvb_open(struct vbi *vbi, const char *vbi_name, const char *progname, int txtpid, const char *outfile)
|
|
{
|
|
struct {
|
|
u_int16_t pmtpid;
|
|
@@ -904,7 +916,7 @@
|
|
for (i = 0; i < (unsigned)r; i += 4) {
|
|
if (progcnt >= sizeof(progtbl)/sizeof(progtbl[0])) {
|
|
error("Program table overflow");
|
|
- goto outerr;
|
|
+ break;
|
|
}
|
|
progtbl[progcnt].service_id = (tbl[8 + i] << 8) | tbl[9 + i];
|
|
if (!progtbl[progcnt].service_id) /* this is the NIT pointer */
|
|
@@ -1011,6 +1023,21 @@
|
|
progtbl[i].txttype, progtbl[i].txtmagazine, progtbl[i].txtpage);
|
|
}
|
|
|
|
+
|
|
+ if (outfile) {
|
|
+ FILE * outstr;
|
|
+ outstr = fopen(outfile,"wt");
|
|
+ for (i = 0; i < progcnt; i++) {
|
|
+ if (progtbl[i].txtpid != 0x1fff) {
|
|
+ fprintf (outstr,"Provider: %s ", progtbl[i].service_provider_name);
|
|
+ fprintf (outstr,"Sender: \t%s ", progtbl[i].service_name);
|
|
+ fprintf (outstr,"PID: 0x%04x", progtbl[i].txtpid);
|
|
+ fputs ("\n",outstr);
|
|
+ }
|
|
+ }
|
|
+ fclose(outstr);
|
|
+ }
|
|
+
|
|
progp = NULL;
|
|
if (progname) {
|
|
j = strlen(progname);
|
|
diff -u alevt-1.6.1-orig/vbi.h alevt-1.6.1/vbi.h
|
|
--- alevt-1.6.1-orig/vbi.h 2005-04-15 22:43:29.177452952 +0200
|
|
+++ alevt-1.6.1/vbi.h 2005-04-15 20:54:11.000000000 +0200
|
|
@@ -51,7 +51,7 @@
|
|
};
|
|
|
|
struct vbi *vbi_open(char *vbi_dev_name, struct cache *ca, int fine_tune,
|
|
- int big_buf, const char *progname, int txtpid);
|
|
+ int big_buf, const char *progname, int txtpid, const char *outfile);
|
|
void vbi_close(struct vbi *vbi);
|
|
void vbi_reset(struct vbi *vbi);
|
|
int vbi_add_handler(struct vbi *vbi, void *handler, void *data);
|
|
diff -u alevt-1.6.1-orig/xio.c alevt-1.6.1/xio.c
|
|
--- alevt-1.6.1-orig/xio.c 2002-08-20 05:09:38.000000000 +0200
|
|
+++ alevt-1.6.1/xio.c 2005-04-15 20:54:11.000000000 +0200
|
|
@@ -379,7 +379,7 @@
|
|
return;
|
|
|
|
strcpy(xw->title, title);
|
|
- sprintf(buf, "AleVT " VERSION " %s", xw->title);
|
|
+ sprintf(buf, "AleVT-dvb " VERSION " %s", xw->title);
|
|
XStoreName(xw->xio->dpy, xw->win, buf);
|
|
XSetIconName(xw->xio->dpy, xw->win, xw->title);
|
|
}
|