source: BAORadio/libindi/v1.0.1/libs/webcam/v4l1_base.h @ 614

Last change on this file since 614 was 490, checked in by campagne, 14 years ago

import libindi (JEC)

File size: 2.6 KB
Line 
1/*
2    Copyright (C) 2005 by Jasem Mutlaq
3
4    Some code based on qastrocam
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
20*/
21
22#ifndef V4L1_BASE_H
23#define V4L1_BASE_H
24
25#include <stdio.h>
26#include <stdlib.h>
27#include "videodev.h"
28#include "eventloop.h"
29
30class V4L1_Base
31{
32  public:
33   V4L1_Base();
34   virtual ~V4L1_Base();
35
36  /* Connection */
37  virtual int connectCam(const char * devpath, char *errmsg);
38  virtual void disconnectCam();
39  char * getDeviceName();
40
41  /* Image settings */
42  int  getBrightness();
43  int  getContrast();
44  int  getColor();
45  int  getHue();
46  int  getWhiteness();
47  void setContrast(int val);
48  void setBrightness(int val);
49  void setColor(int val);
50  void setHue(int val);
51  void setWhiteness(int val);
52
53  /* Updates */
54  static void updateFrame(int d, void * p);
55  void newFrame();
56  void setPictureSettings();
57  void getPictureSettings();
58
59  /* Image Size */
60  int getWidth();
61  int getHeight();
62  void checkSize(int & x, int & y);
63  virtual bool setSize(int x, int y);
64  virtual void getMaxMinSize(int & xmax, int & ymax, int & xmin, int & ymin);
65
66  /* Frame rate */
67  void setFPS(int fps);
68  int  getFPS();
69
70  void init(int preferedPalette);
71  void allocBuffers();
72  int  mmapInit();
73  void mmapCapture();
74  void mmapSync();
75
76  unsigned char * mmapFrame();
77  unsigned char * getY();
78  unsigned char * getU();
79  unsigned char * getV();
80  unsigned char * getColorBuffer();
81
82  int start_capturing(char *errmsg);
83  int stop_capturing(char *errmsg);
84  void registerCallback(WPF *fp, void *ud);
85
86  protected:
87
88  int fd;
89  WPF *callback;
90  void *uptr;
91  unsigned long options;
92
93  struct video_capability capability;
94  struct video_window window;
95  struct video_picture picture_format;
96  struct video_mbuf mmap_buffer;
97
98  unsigned char * buffer_start;
99 
100  long mmap_sync_buffer;
101  long mmap_capture_buffer; 
102 
103  int frameRate;
104  bool streamActive;
105  int  selectCallBackID;
106  unsigned char * YBuf,*UBuf,*VBuf, *colorBuffer;
107
108};
109   
110#endif
Note: See TracBrowser for help on using the repository browser.