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
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #ifndef _PVFILEDEV
00077 #define _PVFILEDEV
00078
00079 #ifdef P_USE_PRAGMA
00080 #pragma interface
00081 #endif
00082
00083 #include <ptlib.h>
00084
00085 #if P_VIDEO
00086 #if P_VIDFILE
00087
00088 #include <ptlib.h>
00089 #include <ptlib/video.h>
00090 #include <ptlib/vconvert.h>
00091 #include <ptclib/pvidfile.h>
00092 #include <ptclib/delaychan.h>
00093
00094
00096
00097
00098
00099
00100 class PVideoInputDevice_YUVFile : public PVideoInputDevice
00101 {
00102 PCLASSINFO(PVideoInputDevice_YUVFile, PVideoInputDevice);
00103 public:
00104 enum {
00105 Channel_PlayAndClose = 0,
00106 Channel_PlayAndRepeat = 1,
00107 Channel_PlayAndKeepLast = 2,
00108 Channel_PlayAndShowBlack = 3,
00109 ChannelCount = 4
00110 };
00111
00114 PVideoInputDevice_YUVFile();
00115
00118 ~PVideoInputDevice_YUVFile();
00119
00120
00123 BOOL Open(
00124 const PString & deviceName,
00125 BOOL startImmediate = TRUE
00126 );
00127
00130 BOOL IsOpen() ;
00131
00134 BOOL Close();
00135
00138 BOOL Start();
00139
00142 BOOL Stop();
00143
00146 BOOL IsCapturing();
00147
00150 static PStringList GetInputDeviceNames();
00151
00152 virtual PStringList GetDeviceNames() const
00153 { return GetInputDeviceNames(); }
00154
00160 virtual PINDEX GetMaxFrameBytes();
00161
00166 virtual BOOL GetFrameData(
00167 BYTE * buffer,
00168 PINDEX * bytesReturned = NULL
00169 );
00170
00175 virtual BOOL GetFrameDataNoDelay(
00176 BYTE * buffer,
00177 PINDEX * bytesReturned = NULL
00178 );
00179
00180
00183 void GrabBlankImage(BYTE *resFrame);
00184
00190 virtual BOOL SetVideoFormat(
00191 VideoFormat videoFormat
00192 );
00193
00198 virtual int GetNumChannels() ;
00199
00209 virtual BOOL SetChannel(
00210 int channelNumber
00211 );
00212
00218 virtual BOOL SetColourFormat(
00219 const PString & colourFormat
00220 );
00221
00227 virtual BOOL SetFrameRate(
00228 unsigned rate
00229 );
00230
00236 virtual BOOL GetFrameSizeLimits(
00237 unsigned & minWidth,
00238 unsigned & minHeight,
00239 unsigned & maxWidth,
00240 unsigned & maxHeight
00241 ) ;
00242
00248 virtual BOOL SetFrameSize(
00249 unsigned width,
00250 unsigned height
00251 );
00252
00253 void ClearMapping() { return ; }
00254
00257 virtual BOOL TestAllFormats()
00258 { return TRUE; }
00259
00260 void FillRect(BYTE * frame,int xPos, int initialYPos,int rectWidth, int rectHeight,int r, int g, int b);
00261
00262 protected:
00263 unsigned grabCount;
00264 PINDEX videoFrameSize;
00265 PVideoFile * file;
00266 PAdaptiveDelay pacing;
00267 };
00268
00269
00271
00272
00273
00274
00275 class PVideoOutputDevice_YUVFile : public PVideoOutputDevice
00276 {
00277 PCLASSINFO(PVideoOutputDevice_YUVFile, PVideoOutputDevice);
00278
00279 public:
00282 PVideoOutputDevice_YUVFile();
00283
00286 ~PVideoOutputDevice_YUVFile();
00287
00290 static PStringList GetOutputDeviceNames();
00291
00292 virtual PStringList GetDeviceNames() const
00293 { return GetOutputDeviceNames(); }
00294
00297 virtual BOOL Open(
00298 const PString & deviceName,
00299 BOOL startImmediate = TRUE
00300 );
00301
00304 BOOL Start();
00305
00308 BOOL Stop();
00309
00312 virtual BOOL Close();
00313
00316 virtual BOOL IsOpen();
00317
00323 virtual BOOL SetColourFormat(
00324 const PString & colourFormat
00325 );
00326
00332 virtual PINDEX GetMaxFrameBytes();
00333
00336 virtual BOOL SetFrameData(
00337 unsigned x,
00338 unsigned y,
00339 unsigned width,
00340 unsigned height,
00341 const BYTE * data,
00342 BOOL endFrame = TRUE
00343 );
00344
00345 protected:
00346 PVideoFile * file;
00347 };
00348
00349
00350 #endif // P_VIDFILE
00351 #endif
00352
00353 #endif // _PVFILEDEV
00354