blob: be1d466b7e472ab2062500bc4137796b66e92dcc [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>
agsantosc9181b42020-11-26 12:03:04 -050027#include <frameScaler.h>
agsantosd09cc6d2020-11-06 17:34:46 -050028#include <opencv2/core.hpp>
29
30namespace jami {
31
32class CoinCircleVideoSubscriber : public jami::Observer<AVFrame*>
33{
34public:
35 CoinCircleVideoSubscriber(const std::string& dataPath);
36 ~CoinCircleVideoSubscriber();
37
38 virtual void update(jami::Observable<AVFrame*>*, AVFrame* const&) override;
39 virtual void attached(jami::Observable<AVFrame*>*) override;
40 virtual void detached(jami::Observable<AVFrame*>*) override;
41
42 void detach();
43
44 void setColor(const std::string& color);
45
46private:
47 // Observer pattern
agsantosb3c90842020-12-10 14:19:41 -050048 Observable<AVFrame*>* observable_{};
agsantosd09cc6d2020-11-06 17:34:46 -050049
50 // Data
51 std::string path_;
52 FrameScaler scaler;
53
54 // Status variables of the processing
55 bool firstRun {true};
56
57 // define custom variables
58 void copyByLine(const int lineSize);
59 void drawCoinCircle(const int angle);
60 void rotateFrame(const int angle, cv::Mat& frame);
61
62 cv::Point circlePos;
63 cv::Mat processingFrame;
64 cv::Mat resultFrame;
65 int radius;
66 cv::Scalar baseColor;
67};
68} // namespace jami