// // The contents of this file are subject to the Mozilla Public License // Version 1.0 (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // http://www.mozilla.org/MPL/ // // Software distributed under the License is distributed on an "AS IS" // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See // the License for the specific language governing rights and limitations // under the License. // // The Original Code is CPhone, a cross platform voip gui. // // The Initial Developer of the Original Code is Derek Smithies. // // Copyright (C) 2002 Indranet Technologies Ltd, // http://www.indranet-technologies.com // All Rights Reserved. // // Contributor(s): _______________ /* * * $Log: qtvid.h,v $ * Revision 1.3 2004/01/02 04:06:24 dereksmithies * Bring up to date with openh323 libraries. Get Plugins to work corectly. * * Revision 1.2 2003/04/04 04:37:49 dereksmithies * Major upgrade. * Ixj & microtelco support added. Fix threading issues. * * Revision 1.1.1.1 2002/05/12 22:55:01 dereksmithies * Initial release. * * * * */ #ifndef _CPhone_Qt_H #define _CPhone_Qt_H #include #include #include "vdisplay.h" #ifdef P_USE_PRAGMA //#pragma interface #endif /**Display data to the Qt screen. */ class QtVideoDevice : public PVideoOutputDevice { PCLASSINFO(QtVideoDevice, PVideoOutputDevice); public: /**Constructor. Does not make a window. Initializes all variables; */ QtVideoDevice(BOOL _isEncoding, VideoDisplay *_displayWidget, BOOL vertFlip); /**Destructor. Closes window if necessary, (which initializes all variables) */ ~QtVideoDevice(); /**Open the device given the device name. */ virtual BOOL Open( const PString & deviceName, /// Device name to open BOOL startImmediate = TRUE /// Immediately start device ) { return TRUE; } /**Synonymous with the destructor. */ BOOL Close(); /**Global test function to determine if this video rendering class is open.*/ BOOL IsOpen(); /**Take a YUV420P format image, render it on the existing window. If the window is not present, there is no rendering. */ BOOL Redraw (const void *videoFrame); virtual PString GetDeviceName() const { return "QtVideo"; } /**Get a list of all of the drivers available. */ virtual PStringList GetDeviceNames() const; /**Get the maximum frame size in bytes. Note a particular device may be able to provide variable length frames (eg motion JPEG) so will be the maximum size of all frames. */ virtual PINDEX GetMaxFrameBytes() { return 352 * 288 * 3 * 2; } /**Set size of the window. Closes existing window, opens new window. */ BOOL SetFrameSize (unsigned _width ,unsigned _height); /**Get the video conversion vertical flip state */ BOOL GetVFlipState(); /**Set the video conversion vertical flip state */ BOOL SetVFlipState(BOOL newVFlipState); /**Toggle the video conversion vertical flip state */ BOOL ToggleVFlipState(); void RemoveVideoImage(); unsigned GetFrameWidth() const { return width; } unsigned GetFrameHeight() const { return height; } BOOL SetFrameData( unsigned x, unsigned y, unsigned width, unsigned height, const BYTE * data, BOOL endFrame = TRUE ) ; /**Indicate frame may be displayed. */ BOOL EndFrame(); protected: BOOL WriteLineSegment(int x, int y, unsigned len, const BYTE * data); BOOL isEncoding; BOOL doVerticalFlip; private: VideoDisplay *displayWidget; unsigned width; unsigned height; }; #if 0 ////////////////////////////////////////////////////////////////////// /** Null Video Display device */ class NullVideoOutputDevice : public PVideoOutputDevice { PCLASSINFO(NullVideoOutputDevice, PVideoOutputDevice); public: NullVideoOutputDevice(); /**Open the device given the device name. */ virtual BOOL Open( const PString & deviceName, /// Device name to open BOOL startImmediate = TRUE /// Immediately start device ) { return TRUE; } /**Synonymous with the destructor. */ BOOL Close() { return TRUE; } /**Global test function to determine if this video rendering class is open.*/ BOOL IsOpen() { return TRUE; } /**Take a YUV420P format image, render it on the existing window. If the window is not present, there is no rendering. */ BOOL Redraw (const void *videoFrame) { return TRUE; } virtual PString GetDeviceName() const { return "NullVideoOutputDevice"; } /**Get a list of all of the drivers available. */ virtual PStringList GetDeviceNames() const { PStringList res; res += GetDeviceName(); return res; } /**Get the maximum frame size in bytes. Note a particular device may be able to provide variable length frames (eg motion JPEG) so will be the maximum size of all frames. */ virtual PINDEX GetMaxFrameBytes() { return 352 * 288 * 3 * 2; } /**Set size of the window. Closes existing window, opens new window. */ BOOL SetFrameSize (unsigned _width ,unsigned _height) { width = _width; height = _height; return TRUE; } /**Get the video conversion vertical flip state */ BOOL GetVFlipState() { return TRUE; } /**Set the video conversion vertical flip state */ BOOL SetVFlipState(BOOL newVFlipState) { return TRUE; } /**Toggle the video conversion vertical flip state */ BOOL ToggleVFlipState() { return TRUE; } void RemoveVideoImage() { } unsigned GetFrameWidth() const { return width; } unsigned GetFrameHeight() const { return height; } BOOL SetFrameData( unsigned x, unsigned y, unsigned width, unsigned height, const BYTE * data, BOOL endFrame = TRUE ) ; /**Indicate frame may be displayed. */ BOOL EndFrame() { return TRUE; } protected: BOOL WriteLineSegment(int x, int y, unsigned len, const BYTE * data) { return TRUE; } private: unsigned width; unsigned height; }; #endif ////////////////////////////////////////////////////////////////////// /** Generate a text message on a YUV420P image plane. */ class PTextVideoInputDevice : public PVideoInputDevice { PCLASSINFO(PTextVideoInputDevice, PVideoInputDevice); public: /**create a new video input device for generating text image on a qt system. */ PTextVideoInputDevice(); PTextVideoInputDevice(PString message); ~PTextVideoInputDevice(); BOOL Open(const PString & thisName, BOOL force = 1) { return TRUE; } BOOL IsOpen() { return TRUE;} BOOL Start() { return TRUE; } BOOL Stop() { return TRUE; } BOOL IsCapturing() { return TRUE; } PStringList GetDeviceNames() const; PINDEX GetMaxFrameBytes(); BOOL GetFrame(PBYTEArray & frame); BOOL GetFrameData(BYTE *buffer, PINDEX *bytesReturned = NULL); BOOL TestAllFormats() { return TRUE; } /**find how many channels are available for use */ int GetNumChannels(); /** Set the size of the output frame, and alter colour converter size. */ BOOL SetFrameSize(unsigned width, unsigned height); /** Fill the destination frame with the required data. */ BOOL GetFrameDataNoDelay(BYTE *destFrame, PINDEX * /*bytesReturned*/); void SetDisplayText(PString newText); /**Set the colour format to be used. Default behaviour sets the value of the colourFormat variable and then returns the IsOpen() status. */ virtual BOOL SetColourFormat(const PString & colourFormat); // New colour format for device. protected: PString text; Rgb32Image *rgbImage; PMutex bufferMutex; }; #endif // End of File ///////////////////////////////////////////////////////////////