KVIrc 5.2.4
Developer APIs
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 <QAudioInput>
48#include <QCamera>
49#include <QMediaCaptureSession>
50#include <QMediaDevices>
51#include <QMediaMetaData>
52#include <QScopedPointer>
53class QVideoWidget;
54
55#ifdef COMPILE_CRYPT_SUPPORT
56class KviCryptSessionInfo;
57#endif
58
59class QSlider;
60class DccMarshal;
61
62#ifndef _DCC_VIDEO_CPP_
63extern bool kvi_dcc_video_is_valid_codec(const char * codecName);
64#endif
65
66#define KVI_DCC_VIDEO_THREAD_ACTION_START_RECORDING 0
67#define KVI_DCC_VIDEO_THREAD_ACTION_STOP_RECORDING 1
68#define KVI_DCC_VIDEO_THREAD_ACTION_START_PLAYING 2
69#define KVI_DCC_VIDEO_THREAD_ACTION_STOP_PLAYING 3
70#define KVI_DCC_VIDEO_THREAD_ACTION_GRAB_FRAME 4
71
77
79{
80 friend class DccVideoWindow;
81
82public:
85
86protected:
96
97protected:
98 QImage m_inImage;
99 QImage m_outImage;
100
101protected:
102 bool readWriteStep();
103 bool videoStep();
104 bool textStep();
105 void startRecording();
106 void restartRecording(int iDevice, int iInput, int iStandard);
107 void stopRecording();
108 void startPlaying();
109 void stopPlaying();
110 bool isPlaying() const { return m_bPlaying; }
111 void run() override;
112 bool handleIncomingData(KviDccThreadIncomingData * data, bool bCritical);
113};
114
116{
117 Q_OBJECT
118 friend class DccVideoThread;
119
120public:
121 DccVideoWindow(DccDescriptor * dcc, const char * name);
123
124protected:
127 QComboBox * m_pCDevices;
128 QGridLayout * m_pLayout;
129 QTimer m_Timer;
131 QString m_szTarget;
135
136 //camera
137 QVideoWidget * m_pLocalCamera;
138 QVideoWidget * m_pRemoteCamera;
139 QMediaDevices m_devices;
140 QMediaCaptureSession m_captureSession;
141 QScopedPointer<QCamera> m_camera;
142 QScopedPointer<QAudioInput> m_audioInput;
143protected:
144 void triggerCreationEvents() override;
145 void triggerDestructionEvents() override;
146 const QString & target() override;
147 void fillCaptionBuffers() override;
148 QPixmap * myIconPtr() override;
149 bool event(QEvent * e) override;
150 void getBaseLogFileName(QString & buffer) override;
151 void startTalking();
152 void stopTalking();
153 void startConnection();
154 const QString & localNick() override;
155 void ownMessage(const QString & text, bool bUserFeedback = true) override;
156 void ownAction(const QString & text) override;
157 void resizeEvent(QResizeEvent *) override;
158 QSize sizeHint() const override;
159protected slots:
161 void connected();
162 void startOrStopTalking(bool bStart);
164 void slotUpdateImage();
166
167 //camera
169
170 void setCamera(const QCameraDevice &cameraDevice);
171
172 void startCamera();
173 void stopCamera();
174
175 void setMuted(bool);
176
177 void displayCameraError();
178
179 void updateCameraDevice(int idx);
180 void updateCameraActive(bool active);
181 void updateCameras();
182};
183
184#endif //_VIDEO_H_
bool kvi_dcc_video_is_valid_codec(const char *codecName)
Definition DccVideoWindow.cpp:68
Error List.
Class for horizontal box.
Contains the KviWindow class.
Definition DccDescriptor.h:34
Definition DccMarshal.h:57
Definition DccThread.h:56
Definition DccVoiceCodec.h:66
Definition DccVideoWindow.h:79
void stopRecording()
Definition DccVideoWindow.cpp:316
bool textStep()
Definition DccVideoWindow.cpp:193
bool handleIncomingData(KviDccThreadIncomingData *data, bool bCritical)
Definition DccVideoWindow.cpp:227
QImage m_inImage
Definition DccVideoWindow.h:98
QImage m_outImage
Definition DccVideoWindow.h:99
KviDataBuffer m_videoOutSignalBuffer
Definition DccVideoWindow.h:92
KviDccVideoThreadOptions * m_pOpt
Definition DccVideoWindow.h:87
bool m_bRecording
Definition DccVideoWindow.h:95
void restartRecording(int iDevice, int iInput, int iStandard)
Definition DccVideoWindow.cpp:296
bool isPlaying() const
Definition DccVideoWindow.h:110
KviDataBuffer m_videoInSignalBuffer
Definition DccVideoWindow.h:90
KviDataBuffer m_outFrameBuffer
Definition DccVideoWindow.h:88
void startRecording()
Definition DccVideoWindow.cpp:302
KviDataBuffer m_inFrameBuffer
Definition DccVideoWindow.h:89
void startPlaying()
Definition DccVideoWindow.cpp:329
KviDataBuffer m_textOutSignalBuffer
Definition DccVideoWindow.h:93
void stopPlaying()
Definition DccVideoWindow.cpp:341
bool videoStep()
Definition DccVideoWindow.cpp:156
bool m_bPlaying
Definition DccVideoWindow.h:94
KviDataBuffer m_textInSignalBuffer
Definition DccVideoWindow.h:91
bool readWriteStep()
Definition DccVideoWindow.cpp:107
void run() override
Definition DccVideoWindow.cpp:353
~DccVideoThread()
Definition DccVideoWindow.cpp:99
Definition DccVideoWindow.h:116
QByteArray m_tmpTextDataOut
Definition DccVideoWindow.h:133
QWidget * m_pContainerWidget
Definition DccVideoWindow.h:126
void startCamera()
Definition DccVideoWindow.cpp:991
void updateCameraDevice(int idx)
Definition DccVideoWindow.cpp:1014
QPixmap * myIconPtr() override
Definition DccVideoWindow.cpp:623
QSize sizeHint() const override
Definition DccVideoWindow.cpp:525
void slotUpdateImage()
Definition DccVideoWindow.cpp:947
void resizeEvent(QResizeEvent *) override
Definition DccVideoWindow.cpp:516
void triggerDestructionEvents() override
Definition DccVideoWindow.cpp:542
DccVideoThread * m_pSlaveThread
Definition DccVideoWindow.h:132
QString m_szTarget
Definition DccVideoWindow.h:131
QScopedPointer< QCamera > m_camera
Definition DccVideoWindow.h:141
QLabel * m_pVideoLabel
Definition DccVideoWindow.h:130
bool event(QEvent *e) override
Definition DccVideoWindow.cpp:747
void updateCameras()
Definition DccVideoWindow.cpp:1020
void connected()
Definition DccVideoWindow.cpp:900
QString m_szLocalNick
Definition DccVideoWindow.h:134
KviThemedLabel * m_pLabel
Definition DccVideoWindow.h:125
void setCamera(const QCameraDevice &cameraDevice)
Definition DccVideoWindow.cpp:972
void fillCaptionBuffers() override
Definition DccVideoWindow.cpp:614
void stopTalking()
Definition DccVideoWindow.cpp:925
QMediaCaptureSession m_captureSession
Definition DccVideoWindow.h:140
QMediaDevices m_devices
Definition DccVideoWindow.h:139
QTimer m_Timer
Definition DccVideoWindow.h:129
QComboBox * m_pCDevices
Definition DccVideoWindow.h:127
void ownMessage(const QString &text, bool bUserFeedback=true) override
Definition DccVideoWindow.cpp:628
QGridLayout * m_pLayout
Definition DccVideoWindow.h:128
QVideoWidget * m_pLocalCamera
Definition DccVideoWindow.h:137
QScopedPointer< QAudioInput > m_audioInput
Definition DccVideoWindow.h:142
void handleMarshalError(KviError::Code eError)
Definition DccVideoWindow.cpp:894
void ownAction(const QString &text) override
Definition DccVideoWindow.cpp:718
void startTalking()
Definition DccVideoWindow.cpp:932
void displayCameraError()
Definition DccVideoWindow.cpp:1008
void startConnection()
Definition DccVideoWindow.cpp:547
void connectionInProgress()
Definition DccVideoWindow.cpp:567
void textViewRightClicked()
Definition DccVideoWindow.cpp:532
~DccVideoWindow()
Definition DccVideoWindow.cpp:476
const QString & localNick() override
Definition DccVideoWindow.cpp:711
void startOrStopTalking(bool bStart)
Definition DccVideoWindow.cpp:939
void setMuted(bool)
Definition DccVideoWindow.cpp:986
void getBaseLogFileName(QString &buffer) override
Definition DccVideoWindow.cpp:609
void updateCameraActive(bool active)
Definition DccVideoWindow.cpp:1001
void initializeLocalCamera()
Definition DccVideoWindow.cpp:960
const QString & target() override
Definition DccVideoWindow.cpp:602
void stopCamera()
Definition DccVideoWindow.cpp:996
QVideoWidget * m_pRemoteCamera
Definition DccVideoWindow.h:138
void triggerCreationEvents() override
Definition DccVideoWindow.cpp:537
Definition DccWindow.h:35
Definition KviDataBuffer.h:31
Definition KviThemedLabel.h:34
Base class for all windows in KVIrc.
Definition KviWindow.h:75
#define e
Definition detector.cpp:70
int kvi_socket_t
Definition kvi_sockettype.h:40
Code
Contains all error codes.
Definition KviError.h:48
Definition DccThread.h:50
Definition DccVideoWindow.h:73
DccVideoCodec * pCodec
Definition DccVideoWindow.h:75
QString szVideoDevice
Definition DccVideoWindow.h:74