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 #ifndef PTLIB_VIDEO_H
00035 #define PTLIB_VIDEO_H
00036
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040
00041 #include <ptbuildopts.h>
00042
00043 #if P_VIDEO
00044
00045 #include <ptlib/videoio.h>
00046
00053 class PVideoChannel : public PChannel
00054 {
00055 PCLASSINFO(PVideoChannel, PChannel);
00056
00057 public:
00060 enum Directions {
00061 Recorder,
00062 Player
00063 };
00064
00066 PVideoChannel();
00067
00071 PVideoChannel(
00072 const PString & device,
00073 Directions dir
00074 );
00075
00076
00077 ~PVideoChannel();
00078
00080
00089 PBoolean Open(
00090 const PString & device,
00091 Directions dir
00092 );
00093
00098 PBoolean IsOpen() const;
00099
00108 static PStringArray GetDeviceNames(
00109 Directions dir
00110 ) ;
00111
00120 static PString GetDefaultDevice(
00121 Directions dir
00122 );
00124
00125
00128 virtual PINDEX GetGrabWidth();
00129
00132 virtual PINDEX GetGrabHeight();
00133
00134 virtual PBoolean Read(void * buf, PINDEX len);
00135
00136
00137
00138
00142 PBoolean Write(const void * buf,
00143 PINDEX len);
00144
00148 virtual PBoolean Redraw(const void * frame);
00149
00152 PINDEX GetRenderWidth();
00153
00156 PINDEX GetRenderHeight();
00157
00161 virtual void SetRenderFrameSize(int width, int height);
00162
00166 virtual void SetGrabberFrameSize(int width, int height);
00167
00176 virtual void AttachVideoPlayer(PVideoOutputDevice * device, PBoolean keepCurrent = PTrue);
00177
00186 virtual void AttachVideoReader(PVideoInputDevice * device, PBoolean keepCurrent = PTrue);
00187
00190 virtual PVideoInputDevice *GetVideoReader();
00191
00194 virtual PVideoOutputDevice *GetVideoPlayer();
00195
00198 virtual PBoolean IsGrabberOpen();
00199
00202 virtual PBoolean IsRenderOpen();
00203
00207 PBoolean DisplayRawData(void *videoBuffer);
00208
00211 virtual void CloseVideoReader();
00212
00215 virtual void CloseVideoPlayer();
00216
00219 void RestrictAccess();
00220
00223 void EnableAccess();
00224
00227 PBoolean ToggleVFlipInput();
00228
00229 protected:
00230
00231 Directions direction;
00232
00233 PString deviceName;
00234 PVideoInputDevice *mpInput;
00235 PVideoOutputDevice *mpOutput;
00236
00237 PMutex accessMutex;
00238
00239 private:
00240 void Construct();
00241
00242
00243
00244 #ifdef _WIN32
00245 #include "msos/ptlib/video.h"
00246 #else
00247 #include "unix/ptlib/video.h"
00248 #endif
00249 };
00250
00251 #endif // P_VIDEO
00252
00253 #endif // PTLIB_VIDEO_H
00254
00255
00256