| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | /* | ||
| 3 | * This file is part of the Falcon Player (FPP) and is Copyright (C) | ||
| 4 | * 2013-2022 by the Falcon Player Developers. | ||
| 5 | * | ||
| 6 | * The Falcon Player (FPP) is free software, and is covered under | ||
| 7 | * multiple Open Source licenses. Please see the included 'LICENSES' | ||
| 8 | * file for descriptions of what files are covered by each license. | ||
| 9 | * | ||
| 10 | * This source file is covered under the LGPL v2.1 as described in the | ||
| 11 | * included LICENSE.LGPL file. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include "../../Sequence.h" | ||
| 15 | #include "fpp-json-fwd.h" | ||
| 16 | #include <functional> | ||
| 17 | |||
| 18 | class OutputProcessor { | ||
| 19 | public: | ||
| 20 | OutputProcessor(); | ||
| 21 | virtual ~OutputProcessor(); | ||
| 22 | |||
| 23 | virtual void ProcessData(unsigned char* channelData) const = 0; | ||
| 24 | |||
| 25 | 1485 | bool isActive() { return active; } | |
| 26 | |||
| 27 | enum OutputProcessorType { | ||
| 28 | UNKNOWN, | ||
| 29 | REMAP, | ||
| 30 | SETVALUE, | ||
| 31 | BRIGHTNESS, | ||
| 32 | COLORORDER, | ||
| 33 | HOLDVALUE, | ||
| 34 | THREETOFOUR, | ||
| 35 | OVERRIDEZERO, | ||
| 36 | FOLD, | ||
| 37 | CLAMPVALUE, | ||
| 38 | SCALE | ||
| 39 | }; | ||
| 40 | |||
| 41 | ✗ | virtual OutputProcessorType getType() const { return UNKNOWN; } | |
| 42 | |||
| 43 | virtual void GetRequiredChannelRanges(const std::function<void(int, int)>& addRange) = 0; | ||
| 44 | |||
| 45 | ✗ | virtual void GetRequiredChannelRange(int& min, int& max) final { | |
| 46 | ✗ | min = 0; | |
| 47 | ✗ | max = FPPD_MAX_CHANNELS; | |
| 48 | ✗ | } | |
| 49 | |||
| 50 | protected: | ||
| 51 | std::string description; | ||
| 52 | bool active; | ||
| 53 | }; | ||
| 54 | |||
| 55 | class OutputProcessors { | ||
| 56 | public: | ||
| 57 | OutputProcessors(); | ||
| 58 | ~OutputProcessors(); | ||
| 59 | |||
| 60 | void ProcessData(unsigned char* channelData) const; | ||
| 61 | |||
| 62 | // The chain owns its processors. addProcessor() takes ownership and | ||
| 63 | // deletes one it rejects; removeProcessor() deletes the processor it | ||
| 64 | // removes (a JSON-loaded one included), and does nothing to one that is | ||
| 65 | // no longer in the chain (a config reload may already have replaced it). | ||
| 66 | void addProcessor(OutputProcessor* p); | ||
| 67 | void removeProcessor(OutputProcessor* p); | ||
| 68 | |||
| 69 | OutputProcessor* find(std::function<bool(OutputProcessor*)> f) const; | ||
| 70 | |||
| 71 | void loadFromJSON(const Json::Value& config); | ||
| 72 | |||
| 73 | void GetRequiredChannelRanges(const std::function<void(int, int)>& addRange); | ||
| 74 | |||
| 75 | protected: | ||
| 76 | void removeAll(); | ||
| 77 | OutputProcessor* create(const Json::Value& config); | ||
| 78 | bool rangeIsValid(OutputProcessor* p); | ||
| 79 | |||
| 80 | mutable std::mutex processorsLock; | ||
| 81 | std::list<OutputProcessor*> processors; | ||
| 82 | std::list<OutputProcessor*> fromJsonProcessors; | ||
| 83 | |||
| 84 | // warnings for processors addProcessor() refused; retracted on the next | ||
| 85 | // loadFromJSON(), which is when a corrected config arrives | ||
| 86 | std::list<std::string> rejectedWarnings; | ||
| 87 | }; | ||
| 88 | |||
| 89 | void ProcessModelConfig(const Json::Value& config, std::string& model, int& start, int& count); | ||
| 90 |