📄 vdisplay.h
字号:
//// 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: vdisplay.h,v $ * Revision 1.3 2003/05/09 03:08:24 dereksmithies * Fix Microtelco handling, and message display * * 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:03 dereksmithies * Initial release. * * * * */#ifndef VDISPLAY_H#define VDISPLAY_H#include <ptlib.h>#include <ptlib/vconvert.h>#ifndef QT_H#include "qwidget.h"#endif#include <qframe.h>#include <qimage.h>#include <qthread.h>#include <qlabel.h>#define SWAP_BLANK 1#define SWAP_BUFFER 2#define SWAP_INCOMING 3//This class takes YUV420P data, scales and displays it. class VideoDisplay : public QFrame //VideoDisplay class{ public: VideoDisplay( QWidget *parent=0, const char *name=0, WFlags f=0); ~VideoDisplay(); void drawContents(QPainter *p); void SetDisplayBuffer(const void *videoFrame, unsigned _width, unsigned _height, BOOL doFlip); void RemoveVideoImage(); void InitiateRepaint(BOOL doErase); private: void CreateColourConverter(); void ResizeImage(uchar *dest_data, unsigned dest_width, unsigned dest_height, uchar *source_data, unsigned source_width, unsigned source_height); void SwapImages(int swapNeeded); int width; int height; PColourConverter *converter; PMutex bufferMutex; QImage *blankImage; QImage *incomingImage; QImage *displayImage; QImage *bufferImage; QImage *scaledImage; BOOL displayFlipped; BOOL newImageData;};//This class is provided so any thread can safely send text to this label,//and have it displayed without thread violations.class LabelDisplay : public QLabel{ public: LabelDisplay(QWidget *parent=0, const char *name=0, WFlags f=0); void customEvent(QCustomEvent *e); void prepareDisplayText(QString s); private: QString displayText; PMutex displayMutex;};//This class is used to generate a RGB32 image of size (X,Y) with//text displayed on it.class Rgb32Image : public QObject{ Q_OBJECT public: Rgb32Image(int x, int y, QString newMessage); ~Rgb32Image(); QString GetTextMessage() const { return textMessage; } unsigned Width() const { return frameWidth ; } unsigned Height() const { return frameHeight; } void RestrictAccess() { access.lock(); } void EnableAccess() { access.unlock(); } BYTE * GetDataPointer() const; void CopyData(u_char *dest); bool event(QEvent *e); void MakeImage(); private: unsigned frameWidth, frameHeight; QImage *image; QString textMessage; QMutex access;}; #endif // VDISPLAY_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -