blob: 3265883d52d3e49b0806b634997d29845cb2a450 [file] [log] [blame]
Edric Milaret627500d2015-03-27 16:41:40 -04001/***************************************************************************
Edric Milaretbab169d2016-01-07 15:13:33 -05002 * Copyright (C) 2015-2016 by Savoir-faire Linux *
Edric Milaret627500d2015-03-27 16:41:40 -04003 * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 **************************************************************************/
18
Edric Milaret5f316da2015-09-28 11:57:42 -040019#pragma once
Edric Milaret627500d2015-03-27 16:41:40 -040020
21#include <QWidget>
22#include <QPainter>
Edric Milaret1eca0292015-06-29 12:03:36 -040023
24#include <memory>
Edric Milaret7153eed2015-06-03 15:29:03 -040025
26#include "video/renderer.h"
27#include "video/previewmanager.h"
Edric Milaret7153eed2015-06-03 15:29:03 -040028#include "callmodel.h"
Edric Milaret627500d2015-03-27 16:41:40 -040029
30class VideoWidget : public QWidget
31{
32 Q_OBJECT
33public:
Edric Milaret80e0b212015-10-16 10:07:43 -040034 explicit VideoWidget(QWidget* parent = 0);
Edric Milaret627500d2015-03-27 16:41:40 -040035 ~VideoWidget();
36 void paintEvent(QPaintEvent* evt);
Edric Milaret80e0b212015-10-16 10:07:43 -040037 void setPreviewDisplay(bool display);
38 void setDistantRenderer(Video::Renderer* renderer);
Edric Milaret627500d2015-03-27 16:41:40 -040039
40public slots:
41 void previewStarted(Video::Renderer* renderer);
Edric Milaret72c406d2015-04-28 13:23:54 -040042 void previewStopped();
Edric Milaret627500d2015-03-27 16:41:40 -040043 void frameFromPreview();
Edric Milaret627500d2015-03-27 16:41:40 -040044 void frameFromDistant();
45 void renderingStopped();
46
47private:
48 Video::Renderer* previewRenderer_;
49 Video::Renderer* renderer_;
Edric Milaret37157b32015-10-13 18:00:03 -040050 Video::Frame currentPreviewFrame_;
51 Video::Frame currentDistantFrame_;
52 QMutex mutex_;
53 std::unique_ptr<QImage> distantImage_;
54 std::unique_ptr<QImage> previewImage_;
55 std::vector<uint8_t> frameDistant_;
56 std::vector<uint8_t> framePreview_;
Edric Milaret80e0b212015-10-16 10:07:43 -040057 bool isPreviewDisplayed_;
Edric Milaret37157b32015-10-13 18:00:03 -040058
Edric Milareta9f937f2015-06-01 17:10:34 -040059 constexpr static int previewMargin_ = 15;
Edric Milaret627500d2015-03-27 16:41:40 -040060};
61