pvfiledev.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #ifndef _PVFILEDEV
00054 #define _PVFILEDEV
00055
00056 #ifdef P_USE_PRAGMA
00057 #pragma interface
00058 #endif
00059
00060 #include <ptlib.h>
00061
00062 #if P_VIDFILE
00063
00064
00065 #include <ptlib.h>
00066 #include <ptlib/video.h>
00067 #include <ptlib/vconvert.h>
00068 #include <ptclib/pvidfile.h>
00069
00071
00072
00073
00074
00075 class PVideoInputDevice_YUVFile : public PVideoInputDevice
00076 {
00077 PCLASSINFO(PVideoInputDevice_YUVFile, PVideoInputDevice);
00078 public:
00079 enum {
00080 Channel_PlayAndClose = 0,
00081 Channel_PlayAndRepeat = 1,
00082 Channel_PlayAndKeepLast = 2,
00083 Channel_PlayAndShowBlack = 3,
00084 ChannelCount = 4
00085 };
00086
00089 PVideoInputDevice_YUVFile();
00090
00091
00094 BOOL Open(
00095 const PString & deviceName,
00096 BOOL startImmediate = TRUE
00097 );
00098
00101 BOOL IsOpen() ;
00102
00105 BOOL Close();
00106
00109 BOOL Start();
00110
00113 BOOL Stop();
00114
00117 BOOL IsCapturing();
00118
00121 static PStringList GetInputDeviceNames();
00122
00123 virtual PStringList GetDeviceNames() const
00124 { return GetInputDeviceNames(); }
00125
00131 virtual PINDEX GetMaxFrameBytes();
00132
00137 virtual BOOL GetFrameData(
00138 BYTE * buffer,
00139 PINDEX * bytesReturned = NULL
00140 );
00141
00146 virtual BOOL GetFrameDataNoDelay(
00147 BYTE * buffer,
00148 PINDEX * bytesReturned = NULL
00149 );
00150
00151
00154 void GrabBlankImage(BYTE *resFrame);
00155
00161 virtual BOOL SetVideoFormat(
00162 VideoFormat videoFormat
00163 );
00164
00169 virtual int GetNumChannels() ;
00170
00180 virtual BOOL SetChannel(
00181 int channelNumber
00182 );
00183
00189 virtual BOOL SetColourFormat(
00190 const PString & colourFormat
00191 );
00192
00198 virtual BOOL SetFrameRate(
00199 unsigned rate
00200 );
00201
00207 virtual BOOL GetFrameSizeLimits(
00208 unsigned & minWidth,
00209 unsigned & minHeight,
00210 unsigned & maxWidth,
00211 unsigned & maxHeight
00212 ) ;
00213
00219 virtual BOOL SetFrameSize(
00220 unsigned width,
00221 unsigned height
00222 );
00223
00224 BOOL SetFrameSizeConverter(
00225 unsigned width,
00226 unsigned height,
00227 BOOL bScaleNotCrop
00228 );
00229
00230 void ClearMapping() { return ; }
00231
00234 virtual BOOL TestAllFormats()
00235 { return TRUE; }
00236
00237 void FillRect(BYTE * frame,int xPos, int initialYPos,int rectWidth, int rectHeight,int r, int g, int b);
00238
00239 protected:
00240 unsigned grabCount;
00241 PINDEX videoFrameSize;
00242 PINDEX scanLineWidth;
00243 PYUVFile file;
00244 PBYTEArray frameStore;
00245 };
00246
00247 PLOAD_FACTORY_DECLARE(PVideoInputDevice,YUVFile)
00248
00249
00250
00251
00252
00253
00254 class PVideoOutputDevice_YUVFile : public PVideoOutputDevice
00255 {
00256 PCLASSINFO(PVideoOutputDevice_YUVFile, PVideoOutputDevice);
00257
00258 public:
00261 PVideoOutputDevice_YUVFile();
00262
00265 static PStringList GetOutputDeviceNames();
00266
00267 virtual PStringList GetDeviceNames() const
00268 { return GetOutputDeviceNames(); }
00269
00272 virtual BOOL Open(
00273 const PString & deviceName,
00274 BOOL startImmediate = TRUE
00275 );
00276
00279 BOOL Start();
00280
00283 BOOL Stop();
00284
00287 virtual BOOL Close();
00288
00291 virtual BOOL IsOpen();
00292
00298 virtual PINDEX GetMaxFrameBytes();
00299
00302 virtual BOOL SetFrameData(
00303 unsigned x,
00304 unsigned y,
00305 unsigned width,
00306 unsigned height,
00307 const BYTE * data,
00308 BOOL endFrame = TRUE
00309 );
00310
00313 virtual BOOL EndFrame();
00314
00315 protected:
00316 PYUVFile file;
00317 };
00318
00319 PLOAD_FACTORY_DECLARE(PVideoOutputDevice,YUVFile)
00320
00321 #endif // P_VIDFILE
00322
00323 #endif // _PVFILEDEV
00324