KVIrc  4.9.2
DeveloperAPIs
DccVideoWindow.h
Go to the documentation of this file.
1 #ifndef _VIDEO_H_
2 #define _VIDEO_H_
3 //=============================================================================
4 //
5 // File : DccVideoWindow.h
6 // Creation date : Tue Nov 10 18:08:09 2009 GMT by Fabio Bas
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2009 Szymon Stefanek (pragma at kvirc dot net)
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "DccVoiceCodec.h"
28 #include "DccDescriptor.h"
29 #include "DccThread.h"
30 #include "DccWindow.h"
31 
32 #include "KviWindow.h"
33 #include "KviDataBuffer.h"
34 #include "kvi_sockettype.h"
35 #include "KviTalHBox.h"
36 #include "KviThemedLabel.h"
37 #include "KviError.h"
38 
39 #include <QLabel>
40 #include <QToolButton>
41 #include <QTimer>
42 #include <QImage>
43 #include <QPixmap>
44 #include <QComboBox>
45 #include <QGridLayout>
46 
47 #include <QCamera>
48 #include <QCameraViewfinder>
49 
50 #ifdef COMPILE_CRYPT_SUPPORT
51 class KviCryptSessionInfo;
52 #endif
53 
54 class QSlider;
55 class DccMarshal;
56 
57 #ifndef _DCC_VIDEO_CPP_
58 extern bool kvi_dcc_video_is_valid_codec(const char * codecName);
59 #endif
60 
61 #define KVI_DCC_VIDEO_THREAD_ACTION_START_RECORDING 0
62 #define KVI_DCC_VIDEO_THREAD_ACTION_STOP_RECORDING 1
63 #define KVI_DCC_VIDEO_THREAD_ACTION_START_PLAYING 2
64 #define KVI_DCC_VIDEO_THREAD_ACTION_STOP_PLAYING 3
65 #define KVI_DCC_VIDEO_THREAD_ACTION_GRAB_FRAME 4
66 
68 {
69  QString szVideoDevice;
72 
73 class DccVideoThread : public DccThread
74 {
75  friend class DccVideoWindow;
76 
77 public:
80 
81 protected:
89  bool m_bPlaying;
91 
92 protected:
93  QImage m_inImage;
94  QImage m_outImage;
95 
96 protected:
97  bool readWriteStep();
98  bool videoStep();
99  bool textStep();
100  void startRecording();
101  void restartRecording(int iDevice, int iInput, int iStandard);
102  void stopRecording();
103  void startPlaying();
104  void stopPlaying();
105  inline bool isPlaying() { return m_bPlaying; };
106  virtual void run();
107  virtual bool handleIncomingData(KviDccThreadIncomingData * data, bool bCritical);
108 };
109 
110 class DccVideoWindow : public DccWindow
111 {
112  Q_OBJECT
113  friend class DccVideoThread;
114 
115 public:
116  DccVideoWindow(DccDescriptor * dcc, const char * name);
117  ~DccVideoWindow();
118 
119 protected:
122  QImage * m_pCameraImage;
123  QCameraViewfinder * m_pCameraView;
124  QCamera * m_pCamera;
125  QLabel * m_pInVideoLabel;
126  QComboBox * m_pCDevices;
127  QComboBox * m_pCInputs;
128  QComboBox * m_pCStandards;
129  QGridLayout * m_pLayout;
130  QTimer m_Timer;
131  QLabel * m_pVideoLabel[3];
132  QString * m_pszTarget;
134  QByteArray m_tmpTextDataOut;
135  QString m_szLocalNick;
136 
137 protected:
138  virtual void triggerCreationEvents();
139  virtual void triggerDestructionEvents();
140  virtual const QString & target();
141  virtual void fillCaptionBuffers();
142  virtual QPixmap * myIconPtr();
143  virtual bool event(QEvent * e);
144  virtual void getBaseLogFileName(QString & buffer);
145  void startTalking();
146  void stopTalking();
147  void startConnection();
148  virtual const QString & localNick();
149  virtual void ownMessage(const QString & text, bool bUserFeedback = true);
150  virtual void ownAction(const QString & text);
151  virtual void resizeEvent(QResizeEvent *);
152  virtual QSize sizeHint() const;
153 protected slots:
154  void handleMarshalError(KviError::Code eError);
155  void connected();
156  void startOrStopTalking(bool bStart);
157  void connectionInProgress();
158  void slotUpdateImage();
159  void textViewRightClicked();
160  void videoInputChanged(int);
161 };
162 
163 #endif //_VIDEO_H_
KviDataBuffer m_textOutSignalBuffer
Definition: DccVideoWindow.h:88
int kvi_socket_t
Definition: kvi_sockettype.h:40
void textViewRightClicked()
Definition: DccVideoWindow.cpp:585
void connectionInProgress()
Definition: DccVideoWindow.cpp:620
QImage m_outImage
Definition: DccVideoWindow.h:94
KviDataBuffer m_videoInSignalBuffer
Definition: DccVideoWindow.h:85
QString szVideoDevice
Definition: DccVideoWindow.h:69
QString m_szLocalNick
Definition: DccVideoWindow.h:135
Class for horizontal box.
struct _KviDccVideoThreadOptions KviDccVideoThreadOptions
Definition: DccThread.h:49
KviDataBuffer m_inFrameBuffer
Definition: DccVideoWindow.h:84
virtual const QString & target()
Definition: DccVideoWindow.cpp:655
Definition: DccWindow.h:34
QWidget * m_pContainerWidget
Definition: DccVideoWindow.h:121
void slotUpdateImage()
Definition: DccVideoWindow.cpp:1004
bool videoStep()
Definition: DccVideoWindow.cpp:153
virtual void ownAction(const QString &text)
Definition: DccVideoWindow.cpp:774
bool kvi_dcc_video_is_valid_codec(const char *codecName)
Definition: DccVideoWindow.cpp:64
bool readWriteStep()
Definition: DccVideoWindow.cpp:104
virtual void ownMessage(const QString &text, bool bUserFeedback=true)
Definition: DccVideoWindow.cpp:684
QLabel * m_pVideoLabel[3]
Definition: DccVideoWindow.h:131
virtual bool event(QEvent *e)
Definition: DccVideoWindow.cpp:803
Definition: KviDataBuffer.h:30
void stopRecording()
Definition: DccVideoWindow.cpp:311
DccVideoWindow(DccDescriptor *dcc, const char *name)
Definition: DccVideoWindow.cpp:395
QImage m_inImage
Definition: DccVideoWindow.h:93
#define e
Definition: detector.cpp:69
QByteArray m_tmpTextDataOut
Definition: DccVideoWindow.h:134
KviThemedLabel * m_pLabel
Definition: DccVideoWindow.h:120
DccVideoCodec * pCodec
Definition: DccVideoWindow.h:70
virtual QSize sizeHint() const
Definition: DccVideoWindow.cpp:578
void startRecording()
Definition: DccVideoWindow.cpp:297
Definition: DccMarshal.h:56
Definition: DccDescriptor.h:33
Definition: DccThread.h:55
QCamera * m_pCamera
Definition: DccVideoWindow.h:124
void stopPlaying()
Definition: DccVideoWindow.cpp:336
Code
Contains all error codes.
Definition: KviError.h:47
bool isPlaying()
Definition: DccVideoWindow.h:105
DccVideoThread(KviWindow *wnd, kvi_socket_t fd, KviDccVideoThreadOptions *opt)
Definition: DccVideoWindow.cpp:85
bool textStep()
Definition: DccVideoWindow.cpp:188
void startPlaying()
Definition: DccVideoWindow.cpp:324
KviDataBuffer m_outFrameBuffer
Definition: DccVideoWindow.h:83
virtual const QString & localNick()
Definition: DccVideoWindow.cpp:767
virtual void resizeEvent(QResizeEvent *)
Definition: DccVideoWindow.cpp:569
KviDccVideoThreadOptions * m_pOpt
Definition: DccVideoWindow.h:82
void stopTalking()
Definition: DccVideoWindow.cpp:982
void startConnection()
Definition: DccVideoWindow.cpp:600
bool m_bRecording
Definition: DccVideoWindow.h:90
Definition: DccVideoWindow.h:73
QComboBox * m_pCInputs
Definition: DccVideoWindow.h:127
KviDataBuffer m_videoOutSignalBuffer
Definition: DccVideoWindow.h:87
DccVideoThread * m_pSlaveThread
Definition: DccVideoWindow.h:133
virtual void triggerCreationEvents()
Definition: DccVideoWindow.cpp:590
~DccVideoThread()
Definition: DccVideoWindow.cpp:96
QCameraViewfinder * m_pCameraView
Definition: DccVideoWindow.h:123
QImage * m_pCameraImage
Definition: DccVideoWindow.h:122
Definition: DccVoiceCodec.h:65
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
QComboBox * m_pCDevices
Definition: DccVideoWindow.h:126
virtual void fillCaptionBuffers()
Definition: DccVideoWindow.cpp:670
QLabel * m_pInVideoLabel
Definition: DccVideoWindow.h:125
virtual void getBaseLogFileName(QString &buffer)
Definition: DccVideoWindow.cpp:665
QTimer m_Timer
Definition: DccVideoWindow.h:130
Definition: DccVideoWindow.h:110
Definition: KviThemedLabel.h:33
void restartRecording(int iDevice, int iInput, int iStandard)
Definition: DccVideoWindow.cpp:291
Error List.
QString name()
Definition: KviRuntimeInfo.cpp:655
QString * m_pszTarget
Definition: DccVideoWindow.h:132
bool m_bPlaying
Definition: DccVideoWindow.h:89
Contains the KviWindow class.
void startOrStopTalking(bool bStart)
Definition: DccVideoWindow.cpp:996
QComboBox * m_pCStandards
Definition: DccVideoWindow.h:128
virtual QPixmap * myIconPtr()
Definition: DccVideoWindow.cpp:679
~DccVideoWindow()
Definition: DccVideoWindow.cpp:499
void handleMarshalError(KviError::Code eError)
Definition: DccVideoWindow.cpp:951
virtual void run()
Definition: DccVideoWindow.cpp:348
virtual void triggerDestructionEvents()
Definition: DccVideoWindow.cpp:595
QGridLayout * m_pLayout
Definition: DccVideoWindow.h:129
void startTalking()
Definition: DccVideoWindow.cpp:989
void connected()
Definition: DccVideoWindow.cpp:957
virtual bool handleIncomingData(KviDccThreadIncomingData *data, bool bCritical)
Definition: DccVideoWindow.cpp:222
Definition: DccVideoWindow.h:67
void videoInputChanged(int)
Definition: DccVideoWindow.cpp:1012
KviDataBuffer m_textInSignalBuffer
Definition: DccVideoWindow.h:86