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  * $Revision: 20385 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-06-04 10:40:38 +0000 (Wed, 04 Jun 2008) $
00032  */
00033 
00034 #ifndef _PVIDEO
00035 #define _PVIDEO
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     // Destroy and close the video driver
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    // Video I/O direction
00110     )  ;
00111 
00120     static PString GetDefaultDevice(
00121       Directions dir    // Video I/O direction
00122     );
00124 
00125     
00128     virtual PINDEX  GetGrabWidth(); 
00129 
00132     virtual PINDEX  GetGrabHeight();
00133 
00134     virtual PBoolean Read(void * buf, PINDEX  len);
00135       // Low level read from the video channel. This function will block until the
00136       // requested number of characters were read.
00137   
00138   
00142     PBoolean Write(const void * buf,  //Pointer to the image data to be rendered
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;   // Ensure that only task is accesing 
00238                                     // members in this video channel.
00239   private:
00240     void Construct();
00241 
00242 
00243 // Include platform dependent part of class
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 // _PVIDEO
00254 
00255 
00256 // End Of File ///////////////////////////////////////////////////////////////

Generated on Mon Feb 23 01:57:54 2009 for PTLib by  doxygen 1.5.1