Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

tutorial_2.cpp

Go to the documentation of this file.
00001 /****************************************************************
00002 **
00003 ** L1394 tutorial 2
00004 **
00005 ** This program searches a camera and start it.
00006 **
00007 **
00008 **  begin                : Thu Nov 30 2000
00009 **  copyright            : (C) 2000-2004 by Michael Repplinger
00010 **  email                : repplinger@cs.uni-sb.de
00011 *******************************************************************/
00012 
00013 /***************************************************************************
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
00019  *                                                                         *
00020  ***************************************************************************/
00021 
00022 
00023 #include <iostream>
00024 #include <l1394_session.h>
00025 
00026 using namespace L1394;
00027 using namespace std;
00028 
00029 int exit() {
00030   return 0;
00031 }
00032 
00033 int main()
00034 {
00035   Session* session = SSession::getInstance();
00036   if (!session) {
00037     cerr << "Could not get Session object" << endl;
00038     return 0;
00039   }
00040 
00041 
00042   Camera* camera = session->findCamera();
00043 
00044   if (camera == NULL)  {
00045     cout << "No camera found. " <<endl;
00046     return exit();
00047   }
00048   Videomode video_mode = DEVICE_160x120_YUV_444;
00049 
00050   for (int i = DEVICE_160x120_YUV_444; i <= static_cast<int>(DEVICE_1600x1200_MONO); ++i) {
00051     if (camera->hasFramerate(static_cast<L1394::Videomode>(i), DEVICE_FRAMES_30)) { //find the best supported resolution with 30FPS
00052       video_mode = static_cast<L1394::Videomode>(i);
00053     }
00054   }
00055   camera->setParameter(4, FREE_ISO_CHANNEL, DEVICE_ISO_RUN, video_mode,DEVICE_FRAMES_30);
00056   camera->init();
00057   camera->start();
00058   char q = 'a';
00059   while (q != 'q') {
00060       cout << " press 'q' to stop the camera" << endl;
00061       cin >> q;
00062   }
00063 
00064   camera->stop();
00065   return exit();
00066 }

Generated on Wed Aug 24 00:36:41 2005 for L1394 by doxygen 1.4.2
L1394 library (NMM) grahics.cs.uni-sb.de/~repplix/l1394_home/