2003-03-26 19:57:29 +08:00
|
|
|
//
|
|
|
|
// ZoneMinder Camera Class Interface, $Date$, $Revision$
|
2008-07-25 17:33:23 +08:00
|
|
|
// Copyright (C) 2001-2008 Philip Coombes
|
2003-03-26 19:57:29 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ZM_CAMERA_H
|
|
|
|
#define ZM_CAMERA_H
|
|
|
|
|
2003-04-13 00:17:17 +08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
2003-03-26 19:57:29 +08:00
|
|
|
#include "zm_image.h"
|
|
|
|
|
|
|
|
//
|
|
|
|
// Abstract base class for cameras. This is intended just to express
|
|
|
|
// common attributes
|
|
|
|
//
|
|
|
|
class Camera
|
|
|
|
{
|
|
|
|
protected:
|
2013-11-04 22:52:21 +08:00
|
|
|
typedef enum { LOCAL_SRC, REMOTE_SRC, FILE_SRC, FFMPEG_SRC, CURL_SRC } SourceType;
|
2003-03-26 19:57:29 +08:00
|
|
|
|
2008-07-16 16:35:59 +08:00
|
|
|
int id;
|
2003-03-26 19:57:29 +08:00
|
|
|
SourceType type;
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
unsigned int colours;
|
2011-04-29 22:26:50 +08:00
|
|
|
unsigned int subpixelorder;
|
2009-02-18 20:30:43 +08:00
|
|
|
unsigned int pixels;
|
2011-04-29 22:26:50 +08:00
|
|
|
unsigned int imagesize;
|
2004-09-26 02:26:09 +08:00
|
|
|
int brightness;
|
|
|
|
int hue;
|
|
|
|
int colour;
|
|
|
|
int contrast;
|
2008-07-21 23:20:52 +08:00
|
|
|
bool capture;
|
2003-03-26 19:57:29 +08:00
|
|
|
|
|
|
|
public:
|
2011-04-29 22:26:50 +08:00
|
|
|
Camera( int p_id, SourceType p_type, int p_width, int p_height, int p_colours, int p_subpixelorder, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
|
2003-04-07 18:43:12 +08:00
|
|
|
virtual ~Camera();
|
2003-03-26 19:57:29 +08:00
|
|
|
|
2008-07-16 16:35:59 +08:00
|
|
|
int getId() const { return( id ); }
|
2003-03-26 19:57:29 +08:00
|
|
|
SourceType Type() const { return( type ); }
|
2008-07-14 22:43:47 +08:00
|
|
|
bool IsLocal() const { return( type == LOCAL_SRC ); }
|
|
|
|
bool IsRemote() const { return( type == REMOTE_SRC ); }
|
|
|
|
bool IsFile() const { return( type == FILE_SRC ); }
|
2009-01-20 23:01:32 +08:00
|
|
|
bool IsFfmpeg() const { return( type == FFMPEG_SRC ); }
|
2003-03-26 19:57:29 +08:00
|
|
|
unsigned int Width() const { return( width ); }
|
|
|
|
unsigned int Height() const { return( height ); }
|
|
|
|
unsigned int Colours() const { return( colours ); }
|
2011-05-01 02:39:34 +08:00
|
|
|
unsigned int SubpixelOrder() const { return( subpixelorder ); }
|
2011-04-29 22:26:50 +08:00
|
|
|
unsigned int Pixels() const { return( pixels ); }
|
|
|
|
unsigned int ImageSize() const { return( imagesize ); }
|
2003-03-26 19:57:29 +08:00
|
|
|
|
2004-01-15 05:26:47 +08:00
|
|
|
virtual int Brightness( int/*p_brightness*/=-1 ) { return( -1 ); }
|
|
|
|
virtual int Hue( int/*p_hue*/=-1 ) { return( -1 ); }
|
|
|
|
virtual int Colour( int/*p_colour*/=-1 ) { return( -1 ); }
|
|
|
|
virtual int Contrast( int/*p_contrast*/=-1 ) { return( -1 ); }
|
2003-06-25 17:47:09 +08:00
|
|
|
|
2008-07-21 23:20:52 +08:00
|
|
|
bool CanCapture() const { return( capture ); }
|
|
|
|
|
2006-10-24 22:37:34 +08:00
|
|
|
virtual int PrimeCapture() { return( 0 ); }
|
2003-03-26 19:57:29 +08:00
|
|
|
virtual int PreCapture()=0;
|
2009-01-28 17:48:06 +08:00
|
|
|
virtual int Capture( Image &image )=0;
|
|
|
|
virtual int PostCapture()=0;
|
2003-03-26 19:57:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ZM_CAMERA_H
|