blob: 373f0b8007f7a0ac42022021584ce67b0d2c2045 [file] [log] [blame]
agsantosd09cc6d2020-11-06 17:34:46 -05001/**
Sébastien Blincb783e32021-02-12 11:34:10 -05002 * Copyright (C) 2020-2021 Savoir-faire Linux Inc.
agsantosd09cc6d2020-11-06 17:34:46 -05003 *
4 * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#pragma once
22
agsantosd09cc6d2020-11-06 17:34:46 -050023extern "C" {
24#include <libavutil/frame.h>
25}
26#include <observer.h>
agsantosd09cc6d2020-11-06 17:34:46 -050027#include <opencv2/core.hpp>
28
29namespace jami {
30
31class CoinCircleVideoSubscriber : public jami::Observer<AVFrame*>
32{
33public:
34 CoinCircleVideoSubscriber(const std::string& dataPath);
35 ~CoinCircleVideoSubscriber();
36
37 virtual void update(jami::Observable<AVFrame*>*, AVFrame* const&) override;
38 virtual void attached(jami::Observable<AVFrame*>*) override;
39 virtual void detached(jami::Observable<AVFrame*>*) override;
40
41 void detach();
42
43 void setColor(const std::string& color);
44
45private:
46 // Observer pattern
agsantosb3c90842020-12-10 14:19:41 -050047 Observable<AVFrame*>* observable_{};
agsantosd09cc6d2020-11-06 17:34:46 -050048
49 // Data
50 std::string path_;
agsantosd09cc6d2020-11-06 17:34:46 -050051
52 // Status variables of the processing
53 bool firstRun {true};
54
55 // define custom variables
56 void copyByLine(const int lineSize);
57 void drawCoinCircle(const int angle);
58 void rotateFrame(const int angle, cv::Mat& frame);
59
60 cv::Point circlePos;
61 cv::Mat processingFrame;
62 cv::Mat resultFrame;
63 int radius;
64 cv::Scalar baseColor;
65};
66} // namespace jami