video.h

Go to the documentation of this file.
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.19  2007/04/20 06:47:02  csoutheren
00031  * Really disable video code when video is turned off
00032  *
00033  * Revision 1.18  2005/11/30 12:47:38  csoutheren
00034  * Removed tabs, reformatted some code, and changed tags for Doxygen
00035  *
00036  * Revision 1.17  2003/11/19 04:28:21  csoutheren
00037  * Changed to support video output plugins
00038  *
00039  * Revision 1.16  2003/09/17 05:41:59  csoutheren
00040  * Removed recursive includes
00041  *
00042  * Revision 1.15  2003/09/17 01:18:02  csoutheren
00043  * Removed recursive include file system and removed all references
00044  * to deprecated coooperative threading support
00045  *
00046  * Revision 1.14  2003/04/15 21:10:29  dereks
00047  * Patches for Firewire video. Thanks Georgi Georgiev.
00048  *
00049  * Revision 1.13  2003/03/17 07:45:14  robertj
00050  * Removed redundant "render now" function.
00051  *
00052  * Revision 1.12  2003/02/18 03:55:59  dereks
00053  * Add 1394AVC pathces from  Georgi Georgiev. Thanks!
00054  *
00055  * Revision 1.11  2003/01/11 05:30:13  robertj
00056  * Added support for IEEE 1394 AV/C cameras, thanks Georgi Georgiev
00057  *
00058  * Revision 1.10  2002/09/16 01:08:59  robertj
00059  * Added #define so can select if #pragma interface/implementation is used on
00060  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00061  *
00062  * Revision 1.9  2002/02/20 02:37:26  dereks
00063  * Initial release of Firewire camera support for linux.
00064  * Many thanks to Ryutaroh Matsumoto <ryutaroh@rmatsumoto.org>.
00065  *
00066  * Revision 1.8  2002/01/04 04:11:45  dereks
00067  * Add video flip code from Walter Whitlock, which flips code at the grabber.
00068  *
00069  * Revision 1.7  2001/12/03 03:44:52  dereks
00070  * Add method to retrive pointer to the attached video display class.
00071  *
00072  * Revision 1.6  2001/11/28 00:07:32  dereks
00073  * Locking added to PVideoChannel, allowing reader/writer to be changed mid call
00074  * Enabled adjustment of the video frame rate
00075  * New fictitous image, a blank grey area
00076  *
00077  * Revision 1.5  2001/10/23 02:11:00  dereks
00078  * Extend video channel so it can display raw data, using attached video devices.
00079  *
00080  * Revision 1.4  2001/05/22 12:49:32  robertj
00081  * Did some seriously wierd rewrite of platform headers to eliminate the
00082  *   stupid GNU compiler warning about braces not matching.
00083  *
00084  * Revision 1.3  2001/03/07 01:42:59  dereks
00085  * miscellaneous video fixes. Works on linux now. Add debug statements
00086  * (at PTRACE level of 1)
00087  *
00088  * Revision 1.2  2000/12/19 22:20:26  dereks
00089  * Add video channel classes to connect to the PwLib PVideoInputDevice class.
00090  * Add PFakeVideoInput class to generate test images for video.
00091  *
00092  * Revision 1.1  2000/11/09 00:43:04  dereks
00093  * Initial release.
00094  *
00095  * 
00096  *
00097  */
00098 
00099 #ifndef _PVIDEO
00100 #define _PVIDEO
00101 
00102 #ifdef P_USE_PRAGMA
00103 #pragma interface
00104 #endif
00105 
00106 #include <ptbuildopts.h>
00107 
00108 #if P_VIDEO
00109 
00110 #include <ptlib/videoio.h>
00111 
00118 class PVideoChannel : public PChannel
00119 {
00120   PCLASSINFO(PVideoChannel, PChannel);
00121 
00122   public:
00125     enum Directions {
00126       Recorder,
00127       Player
00128     };
00129 
00131     PVideoChannel();
00132 
00136     PVideoChannel(
00137       const PString & device,       
00138       Directions dir               
00139     );
00140     // 
00141 
00142     ~PVideoChannel();
00143     // Destroy and close the video driver
00145 
00154     BOOL Open(
00155       const PString & device,       
00156       Directions dir               
00157     );
00158 
00163      BOOL IsOpen() const;
00164     
00173     static PStringList GetDeviceNames(
00174       Directions dir    // Video I/O direction
00175     )  ;
00176 
00185     static PString GetDefaultDevice(
00186       Directions dir    // Video I/O direction
00187     );
00189 
00190     
00193     virtual PINDEX  GetGrabWidth(); 
00194 
00197     virtual PINDEX  GetGrabHeight();
00198 
00199     virtual BOOL Read(void * buf, PINDEX  len);
00200       // Low level read from the video channel. This function will block until the
00201       // requested number of characters were read.
00202   
00203   
00207     BOOL Write(const void * buf,  //Pointer to the image data to be rendered
00208                PINDEX      len);
00209     
00213     virtual BOOL Redraw(const void * frame); 
00214 
00217     PINDEX  GetRenderWidth();
00218 
00221     PINDEX  GetRenderHeight();
00222 
00226     virtual void SetRenderFrameSize(int _width, int _height); 
00227 
00231     virtual void SetGrabberFrameSize(int _width, int _height); 
00232 
00241     virtual void AttachVideoPlayer(PVideoOutputDevice * device, BOOL keepCurrent = TRUE);
00242 
00251     virtual void AttachVideoReader(PVideoInputDevice * device, BOOL keepCurrent = TRUE);
00252 
00255     virtual PVideoInputDevice *GetVideoReader();
00256 
00259     virtual PVideoOutputDevice *GetVideoPlayer();
00260 
00263     virtual BOOL IsGrabberOpen();
00264     
00267     virtual BOOL IsRenderOpen();
00268 
00272     BOOL DisplayRawData(void *videoBuffer);
00273 
00276     virtual void CloseVideoReader();
00277 
00280     virtual void CloseVideoPlayer();
00281 
00284     void RestrictAccess();
00285     
00288     void EnableAccess();
00289 
00292     BOOL ToggleVFlipInput();
00293 
00294  protected:
00295 
00296     Directions       direction;
00297 
00298     PString          deviceName;     
00299     PVideoInputDevice  *mpInput;    
00300     PVideoOutputDevice *mpOutput;   
00301 
00302     PMutex           accessMutex;   // Ensure that only task is accesing 
00303                                     // members in this video channel.
00304   private:
00305     void Construct();
00306 
00307 
00308 // Include platform dependent part of class
00309 #ifdef _WIN32
00310 #include "msos/ptlib/video.h"
00311 #else
00312 #include "unix/ptlib/video.h"
00313 #endif
00314 };
00315 
00316 #endif // P_VIDEO
00317 
00318 #endif // _PVIDEO
00319 
00320 
00321 // End Of File ///////////////////////////////////////////////////////////////

Generated on Fri Mar 7 06:25:03 2008 for PTLib by  doxygen 1.5.1