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.18  2005/11/30 12:47:38  csoutheren
00031  * Removed tabs, reformatted some code, and changed tags for Doxygen
00032  *
00033  * Revision 1.17  2003/11/19 04:28:21  csoutheren
00034  * Changed to support video output plugins
00035  *
00036  * Revision 1.16  2003/09/17 05:41:59  csoutheren
00037  * Removed recursive includes
00038  *
00039  * Revision 1.15  2003/09/17 01:18:02  csoutheren
00040  * Removed recursive include file system and removed all references
00041  * to deprecated coooperative threading support
00042  *
00043  * Revision 1.14  2003/04/15 21:10:29  dereks
00044  * Patches for Firewire video. Thanks Georgi Georgiev.
00045  *
00046  * Revision 1.13  2003/03/17 07:45:14  robertj
00047  * Removed redundant "render now" function.
00048  *
00049  * Revision 1.12  2003/02/18 03:55:59  dereks
00050  * Add 1394AVC pathces from  Georgi Georgiev. Thanks!
00051  *
00052  * Revision 1.11  2003/01/11 05:30:13  robertj
00053  * Added support for IEEE 1394 AV/C cameras, thanks Georgi Georgiev
00054  *
00055  * Revision 1.10  2002/09/16 01:08:59  robertj
00056  * Added #define so can select if #pragma interface/implementation is used on
00057  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00058  *
00059  * Revision 1.9  2002/02/20 02:37:26  dereks
00060  * Initial release of Firewire camera support for linux.
00061  * Many thanks to Ryutaroh Matsumoto <ryutaroh@rmatsumoto.org>.
00062  *
00063  * Revision 1.8  2002/01/04 04:11:45  dereks
00064  * Add video flip code from Walter Whitlock, which flips code at the grabber.
00065  *
00066  * Revision 1.7  2001/12/03 03:44:52  dereks
00067  * Add method to retrive pointer to the attached video display class.
00068  *
00069  * Revision 1.6  2001/11/28 00:07:32  dereks
00070  * Locking added to PVideoChannel, allowing reader/writer to be changed mid call
00071  * Enabled adjustment of the video frame rate
00072  * New fictitous image, a blank grey area
00073  *
00074  * Revision 1.5  2001/10/23 02:11:00  dereks
00075  * Extend video channel so it can display raw data, using attached video devices.
00076  *
00077  * Revision 1.4  2001/05/22 12:49:32  robertj
00078  * Did some seriously wierd rewrite of platform headers to eliminate the
00079  *   stupid GNU compiler warning about braces not matching.
00080  *
00081  * Revision 1.3  2001/03/07 01:42:59  dereks
00082  * miscellaneous video fixes. Works on linux now. Add debug statements
00083  * (at PTRACE level of 1)
00084  *
00085  * Revision 1.2  2000/12/19 22:20:26  dereks
00086  * Add video channel classes to connect to the PwLib PVideoInputDevice class.
00087  * Add PFakeVideoInput class to generate test images for video.
00088  *
00089  * Revision 1.1  2000/11/09 00:43:04  dereks
00090  * Initial release.
00091  *
00092  * 
00093  *
00094  */
00095 
00096 #ifndef _PVIDEO
00097 #define _PVIDEO
00098 
00099 #ifdef P_USE_PRAGMA
00100 #pragma interface
00101 #endif
00102 
00103 #include <ptlib/videoio.h>
00104 
00111 class PVideoChannel : public PChannel
00112 {
00113   PCLASSINFO(PVideoChannel, PChannel);
00114 
00115   public:
00118     enum Directions {
00119       Recorder,
00120       Player
00121     };
00122 
00124     PVideoChannel();
00125 
00129     PVideoChannel(
00130       const PString & device,       
00131       Directions dir               
00132     );
00133     // 
00134 
00135     ~PVideoChannel();
00136     // Destroy and close the video driver
00138 
00147     BOOL Open(
00148       const PString & device,       
00149       Directions dir               
00150     );
00151 
00156      BOOL IsOpen() const;
00157     
00166     static PStringList GetDeviceNames(
00167       Directions dir    // Video I/O direction
00168     )  ;
00169 
00178     static PString GetDefaultDevice(
00179       Directions dir    // Video I/O direction
00180     );
00182 
00183     
00186     virtual PINDEX  GetGrabWidth(); 
00187 
00190     virtual PINDEX  GetGrabHeight();
00191 
00192     virtual BOOL Read(void * buf, PINDEX  len);
00193       // Low level read from the video channel. This function will block until the
00194       // requested number of characters were read.
00195   
00196   
00200     BOOL Write(const void * buf,  //Pointer to the image data to be rendered
00201                PINDEX      len);
00202     
00206     virtual BOOL Redraw(const void * frame); 
00207 
00210     PINDEX  GetRenderWidth();
00211 
00214     PINDEX  GetRenderHeight();
00215 
00219     virtual void SetRenderFrameSize(int _width, int _height); 
00220 
00224     virtual void SetGrabberFrameSize(int _width, int _height); 
00225 
00234     virtual void AttachVideoPlayer(PVideoOutputDevice * device, BOOL keepCurrent = TRUE);
00235 
00244     virtual void AttachVideoReader(PVideoInputDevice * device, BOOL keepCurrent = TRUE);
00245 
00248     virtual PVideoInputDevice *GetVideoReader();
00249 
00252     virtual PVideoOutputDevice *GetVideoPlayer();
00253 
00256     virtual BOOL IsGrabberOpen();
00257     
00260     virtual BOOL IsRenderOpen();
00261 
00265     BOOL DisplayRawData(void *videoBuffer);
00266 
00269     virtual void CloseVideoReader();
00270 
00273     virtual void CloseVideoPlayer();
00274 
00277     void RestrictAccess();
00278     
00281     void EnableAccess();
00282 
00285     BOOL ToggleVFlipInput();
00286 
00287  protected:
00288 
00289     Directions       direction;
00290 
00291     PString          deviceName;     
00292     PVideoInputDevice  *mpInput;    
00293     PVideoOutputDevice *mpOutput;   
00294 
00295     PMutex           accessMutex;   // Ensure that only task is accesing 
00296                                     // members in this video channel.
00297   private:
00298     void Construct();
00299 
00300 
00301 // Include platform dependent part of class
00302 #ifdef _WIN32
00303 #include "msos/ptlib/video.h"
00304 #else
00305 #include "unix/ptlib/video.h"
00306 #endif
00307 };
00308 
00309 #endif
00310 
00311 
00312 // End Of File ///////////////////////////////////////////////////////////////

Generated on Fri Sep 21 14:40:11 2007 for PWLib by  doxygen 1.5.3