00001 /* 00002 * video.h 00003 * 00004 * Video interface class. 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (c) 1993-1998 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Portions are Copyright (C) 1993 Free Software Foundation, Inc. 00025 * All Rights Reserved. 00026 * 00027 * Contributor(s): Derek Smithies (derek@indranet.co.nz) 00028 * 00029 * $Log: video.h,v $ 00030 * Revision 1.17 2003/11/19 04:28:21 csoutheren 00031 * Changed to support video output plugins 00032 * 00033 * Revision 1.16 2003/09/17 05:41:59 csoutheren 00034 * Removed recursive includes 00035 * 00036 * Revision 1.15 2003/09/17 01:18:02 csoutheren 00037 * Removed recursive include file system and removed all references 00038 * to deprecated coooperative threading support 00039 * 00040 * Revision 1.14 2003/04/15 21:10:29 dereks 00041 * Patches for Firewire video. Thanks Georgi Georgiev. 00042 * 00043 * Revision 1.13 2003/03/17 07:45:14 robertj 00044 * Removed redundant "render now" function. 00045 * 00046 * Revision 1.12 2003/02/18 03:55:59 dereks 00047 * Add 1394AVC pathces from Georgi Georgiev. Thanks! 00048 * 00049 * Revision 1.11 2003/01/11 05:30:13 robertj 00050 * Added support for IEEE 1394 AV/C cameras, thanks Georgi Georgiev 00051 * 00052 * Revision 1.10 2002/09/16 01:08:59 robertj 00053 * Added #define so can select if #pragma interface/implementation is used on 00054 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00055 * 00056 * Revision 1.9 2002/02/20 02:37:26 dereks 00057 * Initial release of Firewire camera support for linux. 00058 * Many thanks to Ryutaroh Matsumoto <ryutaroh@rmatsumoto.org>. 00059 * 00060 * Revision 1.8 2002/01/04 04:11:45 dereks 00061 * Add video flip code from Walter Whitlock, which flips code at the grabber. 00062 * 00063 * Revision 1.7 2001/12/03 03:44:52 dereks 00064 * Add method to retrive pointer to the attached video display class. 00065 * 00066 * Revision 1.6 2001/11/28 00:07:32 dereks 00067 * Locking added to PVideoChannel, allowing reader/writer to be changed mid call 00068 * Enabled adjustment of the video frame rate 00069 * New fictitous image, a blank grey area 00070 * 00071 * Revision 1.5 2001/10/23 02:11:00 dereks 00072 * Extend video channel so it can display raw data, using attached video devices. 00073 * 00074 * Revision 1.4 2001/05/22 12:49:32 robertj 00075 * Did some seriously wierd rewrite of platform headers to eliminate the 00076 * stupid GNU compiler warning about braces not matching. 00077 * 00078 * Revision 1.3 2001/03/07 01:42:59 dereks 00079 * miscellaneous video fixes. Works on linux now. Add debug statements 00080 * (at PTRACE level of 1) 00081 * 00082 * Revision 1.2 2000/12/19 22:20:26 dereks 00083 * Add video channel classes to connect to the PwLib PVideoInputDevice class. 00084 * Add PFakeVideoInput class to generate test images for video. 00085 * 00086 * Revision 1.1 2000/11/09 00:43:04 dereks 00087 * Initial release. 00088 * 00089 * 00090 * 00091 */ 00092 00093 #ifndef _PVIDEO 00094 #define _PVIDEO 00095 00096 #ifdef P_USE_PRAGMA 00097 #pragma interface 00098 #endif 00099 00100 #include <ptlib/videoio.h> 00101 00108 class PVideoChannel : public PChannel 00109 { 00110 PCLASSINFO(PVideoChannel, PChannel); 00111 00112 public: 00115 enum Directions { 00116 Recorder, 00117 Player 00118 }; 00119 00121 PVideoChannel(); 00122 00126 PVideoChannel( 00127 const PString & device, 00128 Directions dir 00129 ); 00130 // 00131 00132 ~PVideoChannel(); 00133 // Destroy and close the video driver 00135 00144 BOOL Open( 00145 const PString & device, 00146 Directions dir 00147 ); 00148 00153 BOOL IsOpen() const; 00154 00163 static PStringList GetDeviceNames( 00164 Directions dir // Video I/O direction 00165 ) ; 00166 00175 static PString GetDefaultDevice( 00176 Directions dir // Video I/O direction 00177 ); 00179 00180 00183 virtual PINDEX GetGrabWidth(); 00184 00187 virtual PINDEX GetGrabHeight(); 00188 00189 virtual BOOL Read(void * buf, PINDEX len); 00190 // Low level read from the video channel. This function will block until the 00191 // requested number of characters were read. 00192 00193 00197 BOOL Write(const void * buf, //Pointer to the image data to be rendered 00198 PINDEX len); 00199 00203 virtual BOOL Redraw(const void * frame); 00204 00207 PINDEX GetRenderWidth(); 00208 00211 PINDEX GetRenderHeight(); 00212 00216 virtual void SetRenderFrameSize(int _width, int _height); 00217 00221 virtual void SetGrabberFrameSize(int _width, int _height); 00222 00231 virtual void AttachVideoPlayer(PVideoOutputDevice * device, BOOL keepCurrent = TRUE); 00232 00241 virtual void AttachVideoReader(PVideoInputDevice * device, BOOL keepCurrent = TRUE); 00242 00245 virtual PVideoInputDevice *GetVideoReader(); 00246 00249 virtual PVideoOutputDevice *GetVideoPlayer(); 00250 00253 virtual BOOL IsGrabberOpen(); 00254 00257 virtual BOOL IsRenderOpen(); 00258 00262 BOOL DisplayRawData(void *videoBuffer); 00263 00266 virtual void CloseVideoReader(); 00267 00270 virtual void CloseVideoPlayer(); 00271 00274 void RestrictAccess(); 00275 00278 void EnableAccess(); 00279 00282 BOOL ToggleVFlipInput(); 00283 00284 protected: 00285 00286 Directions direction; 00287 00288 PString deviceName; 00289 PVideoInputDevice *mpInput; 00290 PVideoOutputDevice *mpOutput; 00291 00292 PMutex accessMutex; // Ensure that only task is accesing 00293 // members in this video channel. 00294 private: 00295 void Construct(); 00296 00297 00298 // Include platform dependent part of class 00299 #ifdef _WIN32 00300 #include "msos/ptlib/video.h" 00301 #else 00302 #include "unix/ptlib/video.h" 00303 #endif 00304 }; 00305 00306 #endif 00307 00308 00309 // End Of File ///////////////////////////////////////////////////////////////