agsantos | d09cc6d | 2020-11-06 17:34:46 -0500 | [diff] [blame] | 1 | /** |
Sébastien Blin | cb783e3 | 2021-02-12 11:34:10 -0500 | [diff] [blame] | 2 | * Copyright (C) 2020-2021 Savoir-faire Linux Inc. |
agsantos | d09cc6d | 2020-11-06 17:34:46 -0500 | [diff] [blame] | 3 | * |
| 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 | |
agsantos | d09cc6d | 2020-11-06 17:34:46 -0500 | [diff] [blame] | 23 | extern "C" { |
| 24 | #include <libavutil/frame.h> |
| 25 | } |
| 26 | #include <observer.h> |
agsantos | d09cc6d | 2020-11-06 17:34:46 -0500 | [diff] [blame] | 27 | #include <opencv2/core.hpp> |
| 28 | |
| 29 | namespace jami { |
| 30 | |
| 31 | class CoinCircleVideoSubscriber : public jami::Observer<AVFrame*> |
| 32 | { |
| 33 | public: |
| 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 | |
| 45 | private: |
| 46 | // Observer pattern |
agsantos | b3c9084 | 2020-12-10 14:19:41 -0500 | [diff] [blame] | 47 | Observable<AVFrame*>* observable_{}; |
agsantos | d09cc6d | 2020-11-06 17:34:46 -0500 | [diff] [blame] | 48 | |
| 49 | // Data |
| 50 | std::string path_; |
agsantos | d09cc6d | 2020-11-06 17:34:46 -0500 | [diff] [blame] | 51 | |
| 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 |