# 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: 24459 $
    00030  * $Author: shorne $
    00031  * $Date: 2010-06-06 08:59:59 -0500 (Sun, 06 Jun 2010) $
    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     // 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
    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
    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;   // Ensure that only task is accesing
    00263                                     // members in this video channel.
    00264   private:
    00265     void Construct();
    00266
    00267
    00268 // Include platform dependent part of class
    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 // End Of File ///////////////////////////////////////////////////////////////