00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <l1394_session.h>
00022 #include <l1394_XShmImg.h>
00023
00024 using namespace L1394;
00025 using namespace L1394_MM;
00026
00027 int exit()
00028 {
00029 cout << "delete Session ok" << endl;
00030 return 0;
00031 }
00032
00033
00034 int main(int argc, char* argv[])
00035 {
00036
00037
00038 Session* session = SSession::getInstance();
00039
00040 list<Camera*> camera_list = session->getAllCameras();
00041
00042 if (camera_list.size() == 0)
00043 {
00044 cout << "No camera found " << endl;
00045 return exit();
00046 }
00047
00048 for (list<Camera*>::iterator it = camera_list.begin(); it != camera_list.end(); it++)
00049 {
00050 if ( (*it)->hasFramerate( DEVICE_640x480_YUV_422, DEVICE_FRAMES_30) )
00051 {
00052 if ( (*it)->setParameter(5, FREE_ISO_CHANNEL, DEVICE_ISO_RUN, DEVICE_640x480_YUV_422 ,DEVICE_FRAMES_7_5) != L1394_SUCCESS)
00053 {
00054 cout << "could not set Parameter " << endl;
00055 }
00056 else
00057 cout << "init cam with 30fps" << endl;
00058 }
00059 else
00060 {
00061 if ( (*it)->hasFramerate( DEVICE_320x240_YUV_422, DEVICE_FRAMES_30) )
00062 {
00063 if ( (*it)->setParameter(5, FREE_ISO_CHANNEL, DEVICE_ISO_RUN, DEVICE_320x240_YUV_422 ,DEVICE_FRAMES_30) != L1394_SUCCESS)
00064 {
00065 cout << "could not set Parameter " << endl;
00066 }
00067 else
00068 cout << "init cam with 15fps" << endl;
00069 }
00070 else
00071 cout << "Dumm gelaaf" << endl;
00072 }
00073
00074 if ( (*it)->init() != L1394_SUCCESS)
00075 {
00076 cout << "could not init the camera" << endl;
00077 }
00078
00079 }
00080
00081 list<Camera*>::iterator it = camera_list.begin();
00082
00083 XShmImg** window_array = new XShmImg*[camera_list.size()];
00084 for (unsigned int i = 0; i< camera_list.size(); i++)
00085 {
00086 window_array[i] = new XShmImg( "CameraWindow" , L1394_MM::Converter::UYVYtoBGRA32);
00087 window_array[i]->connect(*it);
00088 it++;
00089 }
00090
00091 it = camera_list.begin();
00092
00093 for (unsigned int i = 0; i< camera_list.size(); i++)
00094 {
00095 if ( (*it)->start() == L1394_FAILED)
00096 cout << "Could not start the camera " << endl;
00097 else
00098 window_array[i]->start();
00099 it++;
00100 }
00101
00102 char q = 'a';
00103 bool quit = false;
00104 while(!quit)
00105 {
00106 cout << "press (s) to start, (p) for pause, (q) for quit" << endl;
00107 cin >> q;
00108 switch (q)
00109 {
00110
00111
00112 case 'q' : quit = true; break;
00113 default: break;
00114 }
00115 }
00116
00117
00118 it = camera_list.begin();
00119
00120 for (unsigned int i = 0; i< camera_list.size(); i++)
00121 {
00122 window_array[i]->stop();
00123 if ( (*it)->stop() == L1394_FAILED)
00124 cout << "Could not stop the camera " << endl;
00125 it++;
00126 }
00127 return exit();
00128 }
00129