PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
video.h
Go to the documentation of this file.
1 /*
2 * video.h
3 *
4 * Video interface class.
5 *
6 * Portable Windows Library
7 *
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9 *
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
14 *
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * The Original Code is Portable Windows Library.
21 *
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23 *
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
26 *
27 * Contributor(s): Derek Smithies (derek@indranet.co.nz)
28 *
29 * $Revision: 24459 $
30 * $Author: shorne $
31 * $Date: 2010-06-06 23:59:59 +1000 (Sun, 06 Jun 2010) $
32 */
33
34 #ifndef PTLIB_VIDEO_H
35 #define PTLIB_VIDEO_H
36
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40
41 #include <ptbuildopts.h>
42
43 #if P_VIDEO
44
45 #include <ptlib/videoio.h>
46
53 class PVideoChannel : public PChannel
54 {
55 PCLASSINFO(PVideoChannel, PChannel);
56
57 public:
60 enum Directions {
61 Recorder,
62 Player
63 };
64
66 PVideoChannel();
67
71 PVideoChannel(
72 const PString & device,
73 Directions dir
74 );
75 //
76
77 ~PVideoChannel();
78 // Destroy and close the video driver
80
89 PBoolean Open(
90 const PString & device,
91 Directions dir
92 );
93
98 PBoolean IsOpen() const;
99
108 static PStringArray GetDeviceNames(
109 Directions dir
110 ) ;
111
120 static PString GetDefaultDevice(
121 Directions dir // Video I/O direction
122 );
124
125
128 virtual PINDEX GetGrabWidth();
129
132 virtual PINDEX GetGrabHeight();
133
134 virtual PBoolean Read(void * buf, PINDEX len);
135 // Low level read from the video channel. This function will block until the
136 // requested number of characters were read.
137
138
142 PBoolean Write(const void * buf, //Pointer to the image data to be rendered
143 PINDEX len);
144
147 virtual PBoolean Write(
148 const void * buf,
149 PINDEX len,
150 void * mark
151 );
152
156 virtual PBoolean Redraw(const void * frame);
157
160 PINDEX GetRenderWidth();
161
164 PINDEX GetRenderHeight();
165
169 virtual void SetRenderFrameSize(int width, int height);
170
174 virtual void SetRenderFrameSize(int width, int height,int sarwidth, int sarheight);
175
179 virtual void SetGrabberFrameSize(int width, int height);
180
189 virtual void AttachVideoPlayer(PVideoOutputDevice * device, PBoolean keepCurrent = true);
190
199 virtual void AttachVideoReader(PVideoInputDevice * device, PBoolean keepCurrent = true);
200
203 virtual PVideoInputDevice *GetVideoReader();
204
207 virtual PVideoOutputDevice *GetVideoPlayer();
208
211 virtual PBoolean IsGrabberOpen();
212
215 virtual PBoolean IsRenderOpen();
216
222 virtual PBoolean DisableDecode();
223
227 PBoolean DisplayRawData(void *videoBuffer);
228
231 virtual void CloseVideoReader();
232
235 virtual void CloseVideoPlayer();
236
239 void RestrictAccess();
240
243 void EnableAccess();
244
247 PBoolean ToggleVFlipInput();
248
252 virtual bool FlowControl(const void * flowData);
253
254 protected:
255
256 Directions direction;
257
258 PString deviceName;
259 PVideoInputDevice *mpInput;
260 PVideoOutputDevice *mpOutput;
261
262 PMutex accessMutex; // Ensure that only task is accesing
263 // members in this video channel.
264 private:
265 void Construct();
266
267
268 // Include platform dependent part of class
269 #ifdef _WIN32
270 #include "msos/ptlib/video.h"
271 #else
272 #include "unix/ptlib/video.h"
273 #endif
274 };
275
276 #endif // P_VIDEO
277
278 #endif // PTLIB_VIDEO_H
279
280
281 // End Of File ///////////////////////////////////////////////////////////////