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
pvfiledev.h
Go to the documentation of this file.
1 /*
2 * pvfiledev.cxx
3 *
4 * Video file declaration
5 *
6 * Portable Windows Library
7 *
8 * Copyright (C) 2004 Post Increment
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
23 * Craig Southeren <craigs@postincrement.com>
24 *
25 * All Rights Reserved.
26 *
27 * Contributor(s): ______________________________________.
28 *
29 * $Revision: 30763 $
30 * $Author: rjongbloed $
31 * $Date: 2013-10-21 12:13:48 +1100 (Mon, 21 Oct 2013) $
32 */
33
34 #ifndef PTLIB_PVFILEDEV_H
35 #define PTLIB_PVFILEDEV_H
36
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40
41 #include <ptlib.h>
42
43 #if P_VIDEO
44 #if P_VIDFILE
45
46 #include <ptlib.h>
47 #include <ptlib/video.h>
48 #include <ptlib/vconvert.h>
49 #include <ptclib/pvidfile.h>
50 #include <ptclib/delaychan.h>
51
52
54 //
55 // This class defines a video capture (input) device that reads video from a raw YUV file
56 //
57
58 class PVideoInputDevice_YUVFile : public PVideoInputDevice
59 {
60 PCLASSINFO(PVideoInputDevice_YUVFile, PVideoInputDevice);
61 public:
62 enum {
63 Channel_PlayAndClose = 0,
64 Channel_PlayAndRepeat = 1,
65 Channel_PlayAndKeepLast = 2,
66 Channel_PlayAndShowBlack = 3,
67 ChannelCount = 4
68 };
69
72 PVideoInputDevice_YUVFile();
73
76 virtual ~PVideoInputDevice_YUVFile();
77
78
81 PBoolean Open(
82 const PString & deviceName,
83 PBoolean startImmediate = true
84 );
85
88 PBoolean IsOpen() ;
89
92 PBoolean Close();
93
96 PBoolean Start();
97
100 PBoolean Stop();
101
104 PBoolean IsCapturing();
105
108 static PStringArray GetInputDeviceNames();
109
110 virtual PStringArray GetDeviceNames() const
111 { return GetInputDeviceNames(); }
112
115 static bool GetDeviceCapabilities(
116 const PString & /*deviceName*/,
117 Capabilities * /*caps*/
118 ) { return false; }
119
125 virtual PINDEX GetMaxFrameBytes();
126
131 virtual PBoolean GetFrameData(
132 BYTE * buffer,
133 PINDEX * bytesReturned = NULL
134 );
135
140 virtual PBoolean GetFrameDataNoDelay(
141 BYTE * buffer,
142 PINDEX * bytesReturned = NULL
143 );
144
145
151 virtual PBoolean SetVideoFormat(
152 VideoFormat videoFormat
153 );
154
163 virtual int GetNumChannels();
164
167 virtual PStringArray GetChannelNames();
168
174 virtual PBoolean SetColourFormat(
175 const PString & colourFormat // New colour format for device.
176 );
177
183 virtual PBoolean SetFrameRate(
184 unsigned rate
185 );
186
192 virtual PBoolean GetFrameSizeLimits(
193 unsigned & minWidth,
194 unsigned & minHeight,
195 unsigned & maxWidth,
196 unsigned & maxHeight
197 ) ;
198
204 virtual PBoolean SetFrameSize(
205 unsigned width,
206 unsigned height
207 );
208
209
210 protected:
211 PVideoFile * m_file;
212 PAdaptiveDelay m_pacing;
213 unsigned m_frameRateAdjust;
214 bool m_opened;
215 };
216
217
219 //
220 // This class defines a video display (output) device that writes video to a raw YUV file
221 //
222
223 class PVideoOutputDevice_YUVFile : public PVideoOutputDevice
224 {
225 PCLASSINFO(PVideoOutputDevice_YUVFile, PVideoOutputDevice);
226
227 public:
230 PVideoOutputDevice_YUVFile();
231
234 virtual ~PVideoOutputDevice_YUVFile();
235
238 static PStringArray GetOutputDeviceNames();
239
240 virtual PStringArray GetDeviceNames() const
241 { return GetOutputDeviceNames(); }
242
245 virtual PBoolean Open(
246 const PString & deviceName,
247 PBoolean startImmediate = true
248 );
249
252 PBoolean Start();
253
256 PBoolean Stop();
257
260 virtual PBoolean Close();
261
264 virtual PBoolean IsOpen();
265
271 virtual PBoolean SetColourFormat(
272 const PString & colourFormat // New colour format for device.
273 );
274
280 virtual PINDEX GetMaxFrameBytes();
281
284 virtual PBoolean SetFrameData(
285 unsigned x,
286 unsigned y,
287 unsigned width,
288 unsigned height,
289 const BYTE * data,
290 PBoolean endFrame = true
291 );
292
293 protected:
294 PVideoFile * m_file;
295 bool m_opened;
296 };
297
298
299 #endif // P_VIDFILE
300 #endif
301
302 #endif // PTLIB_PVFILEDEV_H
303
304
305 // End Of File ///////////////////////////////////////////////////////////////