sphere_mixed.h
1/*
2 * Player - One Hell of a Robot Server
3 * Copyright (C) 2000 Brian Gerkey et al.
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#include <stdint.h>
23
24#include <libplayercore/playercore.h>
25
26#include "v4lcapture.h"
27
28#define PLAYER_CAMERA_FORMAT_RGB 6
29#define PLAYER_CAMERA_FORMAT_YUV420P 7
30
32// The class for the driver
34{
35 public:
36
37 // Constructor; need that
38 SphereDriver(ConfigFile* cf, int section);
39
40 // Must implement the following methods.
41 int MainSetup();
42 void MainQuit();
43 // Main function for device thread.
44 virtual void Main();
45
46 // This method will be invoked on each incoming message
47 virtual int ProcessMessage(QueuePointer & resp_queue,
48 player_msghdr * hdr,
49 void * data);
50 //void ProcessConfig();
51 void ProcessCommand(player_msghdr_t* hdr, player_ptz_cmd_t &data);
52 void RefreshData();
53
54 private:
55
56 void YUV422toRGB(uint8_t* argInputData, uint8_t* argOutputData);
57
58 inline double LimitPan(double argP)
59 {return (argP < mPanMin) ? mPanMin : ((argP > mPanMax) ? mPanMax : argP);};
60 inline double LimitTilt(double argT)
61 {return (argT < mTiltMin) ? mTiltMin : ((argT > mTiltMax) ? mTiltMax : argT);};
62
63 // Camera interface
64 player_devaddr_t mCameraAddr;
65 player_camera_data_t mCameraData;
66 // PTZ interface
67 player_devaddr_t mPtzAddr;
68 player_ptz_data_t mPtzData;
69 player_ptz_cmd_t mPtzCmd;
70
71 int32_t mSleep;
72 int32_t mFrameRate;
73 int32_t mShutterSpeed;
74 int32_t mCompressionPreference;
75 int32_t mAutomaticGain;
76 int32_t mSharpness;
77 int32_t mBacklight;
78 int32_t mFlicker;
79 int32_t mNoiseReduction;
80 int32_t mDumpSettings;
81 int32_t mDebug;
82 const char *mAutomaticWb;
83
84 double mPanMin;
85 double mPanMax;
86 double mTiltMin;
87 double mTiltMax;
88
89 // Video device
90 const char *mDevice;
91 // Input source
92 int32_t mSource;
93
94 // Camera palette
95 const char *mPalette;
96 // Frame grabber interface
97 FRAMEGRABBER* mFg;
98
99 // The current image (local copy)
100 FRAME* mFrame;
101 FRAME* mRGBFrame;
102 int32_t mFrameNumber;
103
104 // Image dimensions
105 int32_t mWidth, mHeight;
106 // Pixel depth
107 int32_t mDepth;
108
109 // Write frames to disk?
110 int32_t mSave;
111
112};
Class for loading configuration file information.
Definition configfile.h:197
An autopointer for the message queue.
Definition message.h:74
Definition sphere_mixed.h:34
int MainSetup()
Sets up the resources needed by the driver thread.
Definition sphere_mixed.cc:276
virtual void Main()
Main method for driver thread.
Definition sphere_mixed.cc:382
void YUV422toRGB(uint8_t *argInputData, uint8_t *argOutputData)
Conversion of YUV422 pixel data into RGB ( CCIR 601 )
Definition sphere_mixed.cc:671
void MainQuit()
Cleanup method for driver thread (called when main exits)
Definition sphere_mixed.cc:362
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
Definition sphere_mixed.cc:405
SphereDriver(ConfigFile *cf, int section)
Definition sphere_mixed.cc:200
Base class for drivers which oeprate with a thread.
Definition driver.h:553
Definition v4lcapture.h:100
Definition v4lframe.h:64
A device address.
Definition player.h:146
Generic message header.
Definition player.h:162