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
00147 virtual PBoolean Write(
00148 const void * buf,
00149 PINDEX len,
00150 void * mark
00151 );
00152
00156 virtual PBoolean Redraw(const void * frame);
00157
00160 PINDEX GetRenderWidth();
00161
00164 PINDEX GetRenderHeight();
00165
00169 virtual void SetRenderFrameSize(int width, int height);
00170
00174 virtual void SetRenderFrameSize(int width, int height,int sarwidth, int sarheight);
00175
00179 virtual void SetGrabberFrameSize(int width, int height);
00180
00189 virtual void AttachVideoPlayer(PVideoOutputDevice * device, PBoolean keepCurrent = true);
00190
00199 virtual void AttachVideoReader(PVideoInputDevice * device, PBoolean keepCurrent = true);
00200
00203 virtual PVideoInputDevice *GetVideoReader();
00204
00207 virtual PVideoOutputDevice *GetVideoPlayer();
00208
00211 virtual PBoolean IsGrabberOpen();
00212
00215 virtual PBoolean IsRenderOpen();
00216
00222 virtual PBoolean DisableDecode();
00223
00227 PBoolean DisplayRawData(void *videoBuffer);
00228
00231 virtual void CloseVideoReader();
00232
00235 virtual void CloseVideoPlayer();
00236
00239 void RestrictAccess();
00240
00243 void EnableAccess();
00244
00247 PBoolean ToggleVFlipInput();
00248
00252 virtual bool FlowControl(const void * flowData);
00253
00254 protected:
00255
00256 Directions direction;
00257
00258 PString deviceName;
00259 PVideoInputDevice *mpInput;
00260 PVideoOutputDevice *mpOutput;
00261
00262 PMutex accessMutex;
00263
00264 private:
00265 void Construct();
00266
00267
00268
00269 #ifdef _WIN32
00270 #include "msos/ptlib/video.h"
00271 #else
00272 #include "unix/ptlib/video.h"
00273 #endif
00274 };
00275
00276 #endif // P_VIDEO
00277
00278 #endif // PTLIB_VIDEO_H
00279
00280
00281