1 /*
2 * (c) 1999 Gerd Knorr <kraxel@goldbach.in-berlin.de>
3 *
4 */
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <unistd.h>
8 #include <string.h>
9 #include <ctype.h>
10 #include <errno.h>
11 #include <math.h>
12 #include <pthread.h>
13
14 #include "config.h"
15
16 #ifdef HAVE_LIBXV
17 # include <X11/Xlib.h>
18 # include <X11/extensions/Xv.h>
19 # include <X11/extensions/Xvlib.h>
20 # include "atoms.h"
21 # include "xv.h"
22 #endif
23
24 #include "grab-ng.h"
25 #include "channel.h"
26 #include "frequencies.h"
27 #include "commands.h"
28
29 int debug = 0;
30 int have_dga = 0;
31 #ifdef HAVE_LIBXV
32 Display *dpy;
33 #endif
34
35 /*--- main ---------------------------------------------------------------*/
36
37 static void
38 grabber_init(void)
39 {
40 drv = ng_vid_open(ng_dev.video,NULL,NULL,0,&h_drv);
41 if (NULL == drv) {
42 fprintf(stderr,"no grabber device available\n");
43 exit(1);
44 }
45 f_drv = drv->capabilities(h_drv);
46 add_attrs(drv->list_attrs(h_drv));
47 }
48
49 static void
50 usage(void)
51 {
52 fprintf(stderr,
53 "\n"
54 "usage: v4lctl [ options ] command\n"
55 "options:\n"
56 " -v, --debug=n debug level n, n = [0..2]\n"
57 " -c, --device=file use <file> as video4linux device\n"
58 " -h, --help print this text\n"
59 "\n");
60 }
61
62 int main(int argc, char *argv[])
63 {
64 int c;
65 int xvideo = 1;
66
67 ng_init();
68 for (;;) {
69 if (-1 == (c = getopt(argc, argv, "hv:c:")))
70 break;
71 switch (c) {
72 case 'v':
73 ng_debug = debug = atoi(optarg);
74 break;
75 case 'c':
76 ng_dev.video = optarg;
77 xvideo = 0;
78 break;
79 case 'h':
80 default:
81 usage();
82 exit(1);
83 }
84 }
85 if (optind == argc) {
86 usage();
87 exit(1);
88 }
89
90 #ifdef HAVE_LIBXV
91 if (NULL != getenv("DISPLAY"))
92 dpy = XOpenDisplay(NULL);
93 if (dpy) {
94 init_atoms(dpy);
95 if (xvideo)
96 xv_video_init(-1,0);
97 }
98 #endif
99 if (NULL == drv)
100 grabber_init();
101 freq_init();
102 read_config(NULL,NULL,NULL);
103
104 attr_init();
105 audio_init();
106 audio_init();
107
108 parse_config();
109
110 do_command(argc-optind,argv+optind);
111 drv->close(h_drv);
112 #ifdef HAVE_LIBXV
113 if (dpy)
114 XCloseDisplay(dpy);
115 #endif
116 return 0;
117 }
118
|
This page was automatically generated by the
LXR engine.
|