1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
<html>
<head>
<title>Camstream: CamStream API documentation</title>
<link rel="stylesheet" href="../../tech.css" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.3.7 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div>
<h1>VideoDevice.h</h1><a href="_video_device_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* CVideoDevice: video capture base class</span>
00002 <span class="comment"> part of CamStream: a collection of GUI webcam tools</span>
00003 <span class="comment"> Copyright (C) 2002 Nemosoft Unv.</span>
00004 <span class="comment"></span>
00005 <span class="comment"> This program is free software; you can redistribute it and/or modify</span>
00006 <span class="comment"> it under the terms of the GNU General Public License as published by</span>
00007 <span class="comment"> the Free Software Foundation; either version 2 of the License, or</span>
00008 <span class="comment"> (at your option) any later version.</span>
00009 <span class="comment"></span>
00010 <span class="comment"> This program is distributed in the hope that it will be useful,</span>
00011 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
00012 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
00013 <span class="comment"> GNU General Public License for more details.</span>
00014 <span class="comment"></span>
00015 <span class="comment"> You should have received a copy of the GNU General Public License</span>
00016 <span class="comment"> along with this program; if not, write to the Free Software</span>
00017 <span class="comment"> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
00018 <span class="comment"></span>
00019 <span class="comment"> For questions, remarks, patches, etc. for this program, the author can be</span>
00020 <span class="comment"> reached at camstream@smcc.demon.nl.</span>
00021 <span class="comment">*/</span>
00022
00023 <span class="preprocessor">#ifndef VIDEO_DEVICE_HPP</span>
00024 <span class="preprocessor"></span><span class="preprocessor">#define VIDEO_DEVICE_HPP</span>
00025 <span class="preprocessor"></span>
00026 <span class="preprocessor">#ifdef HAVE_CONFIG_H</span>
00027 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="config_8h.html">config.h</a>"</span>
00028 <span class="preprocessor">#endif</span>
00029 <span class="preprocessor"></span>
00030 <span class="preprocessor">#include <qglobal.h></span>
00031
00032 <span class="preprocessor">#if (QT_VERSION >= 0x030000)</span>
00033 <span class="preprocessor"></span><span class="preprocessor">#include <qmutex.h></span>
00034 <span class="preprocessor">#endif</span>
00035 <span class="preprocessor"></span>
00036 <span class="preprocessor">#include <qarray.h></span>
00037 <span class="preprocessor">#include <qcolor.h></span>
00038 <span class="preprocessor">#include <qdom.h></span>
00039 <span class="preprocessor">#include <qimage.h></span>
00040 <span class="preprocessor">#include <qlist.h></span>
00041 <span class="preprocessor">#include <qobject.h></span>
00042 <span class="preprocessor">#include <qsocketnotifier.h></span>
00043 <span class="preprocessor">#include <qtimer.h></span>
00044 <span class="preprocessor">#include <qthread.h></span>
00045 <span class="preprocessor">#include <qvector.h></span>
00046
00047 <span class="preprocessor">#include "<a class="code" href="_video_frame_8h.html">VideoFrame.h</a>"</span>
00048
00049 <span class="preprocessor">#include "<a class="code" href="_t_v_channel_8h.html">TVChannel.h</a>"</span>
00050
00051 <span class="keyword">class </span><a class="code" href="class_c_channel_editor_dlg.html">CChannelEditorDlg</a>;
00052
<a name="l00053"></a><a class="code" href="class_c_video_device.html">00053</a> <span class="keyword">class </span><a class="code" href="class_c_video_device.html">CVideoDevice</a>: <span class="keyword">public</span> QObject, <span class="keyword">protected</span> QThread
00054 {
00055 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_c_video_collector.html">CVideoCollector</a>;
00056 Q_OBJECT
00057 <span class="keyword">public</span>:
<a name="l00058"></a><a class="code" href="class_c_video_device.html#w3">00058</a> <span class="keyword">enum</span> <a class="code" href="class_c_video_device.html#w3">Signals</a> {
00059 <a class="code" href="class_c_video_device.html#w3w0">frame_ready</a> = 1,
00060 };
00061
00062 <span class="keyword">private</span>:
00063 <span class="keyword">enum</span> Palettes {
00064 RGB,
00065 YUV,
00066 };
00067
00068 QList<CVideoFrame> m_VideoFrames;
00069 QList<CVideoFrame> m_EmptyFrames, m_FullFrames;
00070 <a class="code" href="class_c_video_frame.html">CVideoFrame</a> *m_pFillFrame;
00071 QMutex m_BufMutex;
00072
00073 QWaitCondition m_WaitFromFrame;
00074 <a class="code" href="class_c_channel_editor_dlg.html">CChannelEditorDlg</a> *m_pTunerDlg;
00075
00076 <span class="keywordtype">int</span> m_CaptureCount;
00077
00078 <span class="keywordtype">void</span> IncrementPalette(Palettes);
00079 <span class="keywordtype">void</span> DecrementPalette(Palettes);
00080
00081 <span class="keywordtype">void</span> ParseTVChannels(<span class="keyword">const</span> QDomNode &);
00082 <span class="keywordtype">void</span> GetTVChannels(QDomNode &) const;
00083
00084 private slots:
00085 virtual <span class="keywordtype">void</span> NewFrequency(<span class="keywordtype">float</span>) = 0;
00086 <span class="keywordtype">void</span> NewCurrentChannel();
00087
00088 protected:
<a name="l00089"></a><a class="code" href="class_c_video_device.html#p0">00089</a> QList<<a class="code" href="class_t_v_channel.html">TVChannel</a>> m_TVChannels;
00090
<a name="l00091"></a><a class="code" href="class_c_video_device.html#p1">00091</a> <span class="keywordtype">bool</span> m_Validated;
<a name="l00092"></a><a class="code" href="class_c_video_device.html#p4">00092</a> QString m_NodeName, m_IntfName, m_SerialNumber;
<a name="l00093"></a><a class="code" href="class_c_video_device.html#p8">00093</a> <span class="keywordtype">bool</span> m_HasDisplayDialog, m_HasFormatDialog, m_HasSourceDialog, m_HasTunerDialog;
<a name="l00094"></a><a class="code" href="class_c_video_device.html#p9">00094</a> <span class="keywordtype">bool</span> m_Mutable;
00095
<a name="l00096"></a><a class="code" href="class_c_video_device.html#p10">00096</a> <span class="keywordtype">int</span> m_OpenCount;
00097
<a name="l00098"></a><a class="code" href="class_c_video_device.html#p11">00098</a> <span class="keywordtype">int</span> m_PalRGB;
<a name="l00099"></a><a class="code" href="class_c_video_device.html#p12">00099</a> <span class="keywordtype">int</span> m_PalYUV;
<a name="l00100"></a><a class="code" href="class_c_video_device.html#p13">00100</a> uint m_RequestedBuffers, m_Buffers;
<a name="l00101"></a><a class="code" href="class_c_video_device.html#p15">00101</a> <span class="keywordtype">int</span> m_FrameCount;
<a name="l00102"></a><a class="code" href="class_c_video_device.html#p16">00102</a> <span class="keywordtype">int</span> m_FrameDropped;
00103
<a name="l00104"></a><a class="code" href="class_c_video_device.html#p17">00104</a> QSize m_ImageSize;
<a name="l00105"></a><a class="code" href="class_c_video_device.html#p18">00105</a> QVector<QImage> m_RGB;
<a name="l00106"></a><a class="code" href="class_c_video_device.html#p19">00106</a> QVector<QImage> m_Y, m_U, m_V;
<a name="l00107"></a><a class="code" href="class_c_video_device.html#p22">00107</a> QImage *m_pNullImage;
<a name="l00108"></a><a class="code" href="class_c_video_device.html#p23">00108</a> QRgb m_GrayScale[256];
00109
00110 <span class="keywordtype">int</span> GetCaptureCount() const;
00111
00112 virtual <span class="keywordtype">bool</span> Init() = 0;
00113 virtual <span class="keywordtype">void</span> Exit() = 0;
00114
00115 virtual <span class="keywordtype">void</span> CreateImagesRGB() = 0;
00116 virtual <span class="keywordtype">void</span> DeleteImagesRGB() = 0;
00117 virtual <span class="keywordtype">void</span> CreateImagesYUV() = 0;
00118 virtual <span class="keywordtype">void</span> DeleteImagesYUV() = 0;
00119
00120 <span class="keywordtype">void</span> CreateVideoFrames();
00121 <span class="keywordtype">void</span> DeleteVideoFrames();
00122 <a class="code" href="class_c_video_frame.html">CVideoFrame</a> *GetFillFrame();
00123 <span class="keywordtype">void</span> ReturnFillFrame(<span class="keywordtype">bool</span> filled = true);
00124
00125 virtual <span class="keywordtype">bool</span> StartCapture() = 0;
00126 virtual <span class="keywordtype">void</span> StopCapture() = 0;
00127
00128 <span class="keywordtype">void</span> SendSignal(Signals s);
00129
00130 public:
<a name="l00131"></a><a class="code" href="class_c_video_device.html#w4">00131</a> enum ErrorCodes {
00132 <a class="code" href="class_c_video_device.html#w4w1">NoError</a>,
00133 <a class="code" href="class_c_video_device.html#w4w2">SizeChangeFailed</a>,
00134 };
00135
00136 <a class="code" href="class_c_video_device.html#a0">CVideoDevice</a>();
00137 <span class="keyword">virtual</span> <a class="code" href="class_c_video_device.html#a1">~CVideoDevice</a>();
00138
00139 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> event(QEvent *);
00140
00141 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetConfiguration(<span class="keyword">const</span> QDomNode &);
00142 <span class="keyword">virtual</span> <span class="keywordtype">void</span> GetConfiguration(QDomNode &) const;
00143
00144 <span class="keywordtype">bool</span> IsValid() const;
00145 <span class="keywordtype">bool</span> Open(uint buffers = 0);
00146 <span class="keywordtype">void</span> Close();
00147 <span class="keywordtype">bool</span> IsOpen() const;
00148
00149 virtual <span class="keywordtype">int</span> GetNumberOfInputs() const = 0;
00150
00162 virtual <span class="keywordtype">void</span> SetInput(<span class="keywordtype">int</span> input) = 0;
00172 virtual <span class="keywordtype">int</span> GetInput() const = 0;
00185 virtual <span class="keywordtype">int</span> GetNumberOfTuners() const = 0;
00196 virtual <span class="keywordtype">void</span> SetTuner(<span class="keywordtype">int</span> tuner) = 0;
00197 virtual <span class="keywordtype">int</span> GetTuner() const = 0;
00198
00199 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetNumberOfTVChannels() const;
00200 <a class="code" href="class_t_v_channel.html">TVChannel</a> QueryTVChannel(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> preset);
00201 <a class="code" href="class_t_v_channel.html">TVChannel</a> GetCurrentTVChannel() const;
00202 <a class="code" href="class_t_v_channel.html">TVChannel</a> SelectTVChannel(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> preset);
00203 <a class="code" href="class_t_v_channel.html">TVChannel</a> SelectNextTVChannel(<span class="keywordtype">bool</span> wrap = true);
00204 <a class="code" href="class_t_v_channel.html">TVChannel</a> SelectPrevTVChannel(<span class="keywordtype">bool</span> wrap = true);
00205
00213 virtual <span class="keywordtype">long</span> GetDescriptor() const = 0;
00214
00215 QString GetNodeName() const;
00216 QString GetIntfName() const;
00217 QString GetSerialNumber() const;
00218
00219 <span class="keywordtype">int</span> GetBuffers() const;
00220
00221 <a class="code" href="class_c_video_frame.html">CVideoFrame</a> *GetLatestVideoFrame(<span class="keywordtype">int</span> backlog = 0);
00222
00223 <span class="keywordtype">bool</span> HasDisplayDialog() const;
00224 <span class="keywordtype">bool</span> HasFormatDialog() const;
00225 <span class="keywordtype">bool</span> HasSourceDialog() const;
00226 <span class="keywordtype">bool</span> HasTunerDialog() const;
00227
00228 virtual QSize GetSize() const;
00229
00230 <span class="comment">// Do we need these?</span>
00231 <span class="keywordtype">bool</span> IsMutable() const;
00232 virtual <span class="keywordtype">void</span> Mute(<span class="keywordtype">bool</span> on) const = 0;
00233
00234 public slots:
00235 virtual <span class="keywordtype">void</span> ShowDisplayDialog() = 0;
00236 virtual <span class="keywordtype">void</span> ShowFormatDialog() = 0;
00237 virtual <span class="keywordtype">void</span> ShowSourceDialog() = 0;
00238 virtual <span class="keywordtype">void</span> ShowTunerDialog();
00239
00240 <span class="keywordtype">void</span> EnableRGB();
00241 <span class="keywordtype">void</span> DisableRGB();
00242 <span class="keywordtype">void</span> EnableYUV();
00243 <span class="keywordtype">void</span> DisableYUV();
00244
00245 signals:
00247 <span class="keywordtype">void</span> Opened();
00249 <span class="keywordtype">void</span> Closed();
00251 <span class="keywordtype">void</span> SizeChanged(const QSize &);
00253 <span class="keywordtype">void</span> FramerateChanged(<span class="keywordtype">int</span> rate);
00255 <span class="keywordtype">void</span> Error(<span class="keywordtype">int</span> err_num);
00257 <span class="keywordtype">void</span> FrameReady();
00259 <span class="keywordtype">void</span> TVChannelChanged();
00260 };
00261
00262 #endif
</div></pre><hr size="1"><address style="align: right;"><small>Generated on Wed Dec 13 23:38:46 2006 for CamStream by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address>
</body>
</html>
|