From 33b8605efcbe77123210b0f6ce2906a7135c107a Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 24 Sep 2014 19:20:35 +0200 Subject: Add original v4l-util copyright notice. Remove unused code. --- src/v4l.cc | 128 ++++++++----------------------------------------------------- 1 file changed, 17 insertions(+), 111 deletions(-) diff --git a/src/v4l.cc b/src/v4l.cc index 339194b..8e8d5ad 100644 --- a/src/v4l.cc +++ b/src/v4l.cc @@ -24,6 +24,23 @@ * along with SimpleRTP; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ + +/* + * This file is mostly taken from the v4l recording example in the v4l-util + * package: + * v4l-utils /v4l-utils-0.8.8/contrib/test/capture-example.c + * Below is the original copyright notice: + */ + +/* + * V4L2 video capture example + * + * This program can be used and distributed without restrictions. + * + * This program is provided with the V4L2 API + * see http://linuxtv.org/docs.php for more information + */ + #include "v4l.h" #include @@ -680,111 +697,6 @@ static void open_device(void) } } -#if 0 -static void usage(FILE *fp, int argc, char **argv) -{ - fprintf(fp, - "Usage: %s [options]\n\n" - "Version 1.3\n" - "Options:\n" - "-d | --device name Video device name [%s]\n" - "-h | --help Print this message\n" - "-m | --mmap Use memory mapped buffers [default]\n" - "-r | --read Use read() calls\n" - "-u | --userp Use application allocated buffers\n" - "-o | --output Outputs stream to stdout\n" - "-f | --format Force format to 640x480 YUYV\n" - "-c | --count Number of frames to grab [%i]\n" - "", - argv[0], dev_name, frame_count); -} - -static const char short_options[] = "d:hmruofc:"; - -static const struct option -long_options[] = { - { "device", required_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - { "mmap", no_argument, NULL, 'm' }, - { "read", no_argument, NULL, 'r' }, - { "userp", no_argument, NULL, 'u' }, - { "output", no_argument, NULL, 'o' }, - { "format", no_argument, NULL, 'f' }, - { "count", required_argument, NULL, 'c' }, - { 0, 0, 0, 0 } -}; - -int main(int argc, char **argv) -{ - dev_name = "/dev/video0"; - - for (;;) { - int idx; - int c; - - c = getopt_long(argc, argv, - short_options, long_options, &idx); - - if (-1 == c) - break; - - switch (c) { - case 0: /* getopt_long() flag */ - break; - - case 'd': - dev_name = optarg; - break; - - case 'h': - usage(stdout, argc, argv); - exit(EXIT_SUCCESS); - - case 'm': - io = IO_METHOD_MMAP; - break; - - case 'r': - io = IO_METHOD_READ; - break; - - case 'u': - io = IO_METHOD_USERPTR; - break; - - case 'o': - out_buf++; - break; - - case 'f': - force_format++; - break; - - case 'c': - errno = 0; - frame_count = strtol(optarg, NULL, 0); - if (errno) - errno_exit(optarg); - break; - - default: - usage(stderr, argc, argv); - exit(EXIT_FAILURE); - } - } - - open_device(); - init_device(); - start_capturing(); - mainloop(); - stop_capturing(); - uninit_device(); - close_device(); - fprintf(stderr, "\n"); - return 0; -} -#endif/*0*/ - V4L::V4L(QString device) { qRegisterMetaType("Frame"); @@ -825,12 +737,6 @@ void V4L::run() void V4L::processImage(const void *p, int size) { - /* - QImage img; - bool res = img.loadFromData((const uchar *)p, size, "JPG"); - //printf("processImage() => %s\n", res?"true":"false"); - if(res) emit newImage(img); - */ Frame frame((const char *)p, size); emit newImage(frame); } -- cgit v1.2.3