source: eviacam/trunk/fuentes/creavision/crvcamera_enum.cpp @ 567

Last change on this file since 567 was 567, checked in by mabarracus, 4 years ago

updated sources to version 2.0.3

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1/////////////////////////////////////////////////////////////////////////////
2// Name:        crvcamera_enum.cpp
3// Purpose:     Detect, enumerate and create camera object
4// Author:      Cesar Mauri Loba (cesar at crea-si dot com)
5// Modified by:
6// Created:     1/10/2010
7// Copyright:   (C) 2008 Cesar Mauri Loba - CREA Software Systems
8//
9//  This program is free software: you can redistribute it and/or modify
10//  it under the terms of the GNU General Public License as published by
11//  the Free Software Foundation, either version 3 of the License, or
12//  (at your option) any later version.
13//
14//  This program is distributed in the hope that it will be useful,
15//  but WITHOUT ANY WARRANTY; without even the implied warranty of
16//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17//  GNU General Public License for more details.
18//
19//  You should have received a copy of the GNU General Public License
20//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21/////////////////////////////////////////////////////////////////////////////
22
23#ifdef WIN32
24        #include "crvcamera_wdm.h"
25
26        #define CAMCLASS CCameraWDM
27#else
28        #include <string.h>
29        #include "webcam.h"
30        #include "crvcamera_cv.h"
31        #include "crvcamera_v4l2.h"
32
33        #define CAMCLASS CCameraV4L2
34#endif
35#include "crvcamera_enum.h"
36#include "simplelog.h"
37
38//
39// Static member functions
40//
41int CCameraEnum::GetNumDevices()
42{
43        return CAMCLASS::GetNumDevices();
44}
45
46const char* CCameraEnum::GetDeviceName (unsigned int id)
47{
48        return CAMCLASS::GetDeviceName((int) id);
49}
50
51#define _unused(x) ((void)x)
52
53CCamera* CCameraEnum::GetCamera (unsigned int id, unsigned int width,
54                unsigned int height, float frameRate)
55{
56        if ((int) id>= GetNumDevices()) return NULL;
57
58        try{
59                return new CAMCLASS(id, width, height, frameRate);             
60        } 
61        catch (camera_exception &e)     {
62                slog_write (SLOG_PRIO_ERR, "error initializing camera: %s\n", e.what());
63        }
64       
65        return NULL;
66}
Note: See TracBrowser for help on using the repository browser.