qa_fwcam.cpp

00001 
00002 /***************************************************************************
00003  *  qa_fvcam.cpp - QA for Firewire camera
00004  *
00005  *  Created: Tue Apr 08 16:40:30 2008
00006  *  Copyright  2005-2008  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 /// @cond QA
00025 
00026 #include <cams/firewire.h>
00027 #include <cams/factory.h>
00028 
00029 #include <cstdio>
00030 
00031 int
00032 main(int argc, char **argv)
00033 {
00034   Camera *cam;
00035   if ( argc > 1 ) {
00036     printf("Opening from camera argument string '%s'\n", argv[1]);
00037     cam = CameraFactory::instance(argv[1]);
00038   } else {
00039     printf("Opening plain Firewire camera\n");
00040     cam = new FirewireCamera();
00041   }
00042   cam->open();
00043   cam->start();
00044   cam->print_info();
00045 
00046   for (unsigned int i = 0; i < 100; ++i) {
00047     printf("Capturing\n");
00048     cam->capture();
00049     cam->dispose_buffer();
00050   }
00051 
00052   printf("Closing\n");
00053   cam->close();
00054   delete cam;
00055 
00056   return 0;
00057 }
00058 
00059 /// @endcond