| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file is part of the Falcon Player (FPP) and is Copyright (C) | ||
| 3 | * 2013-2022 by the Falcon Player Developers. | ||
| 4 | * | ||
| 5 | * The Falcon Player (FPP) is free software, and is covered under | ||
| 6 | * multiple Open Source licenses. Please see the included 'LICENSES' | ||
| 7 | * file for descriptions of what files are covered by each license. | ||
| 8 | * | ||
| 9 | * This source file is covered under the LGPL v2.1 as described in the | ||
| 10 | * included LICENSE.LGPL file. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include "fpp-pch.h" | ||
| 14 | |||
| 15 | #include "fpp-json.h" | ||
| 16 | |||
| 17 | #include "../../log.h" | ||
| 18 | |||
| 19 | #include "HoldValueOutputProcessor.h" | ||
| 20 | |||
| 21 | 2 | HoldValueOutputProcessor::HoldValueOutputProcessor(const Json::Value& config) { | |
| 22 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | description = config["description"].asString(); |
| 23 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | active = config["active"].asInt() ? true : false; |
| 24 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | start = config["start"].asInt(); |
| 25 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | count = config["count"].asInt(); |
| 26 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | ProcessModelConfig(config, model, start, count); |
| 27 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (count < 0) { |
| 28 | ✗ | count = 0; | |
| 29 | } | ||
| 30 | |||
| 31 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | LogInfo(VB_CHANNELOUT, "Hold Channel Values: %d-%d, Model: %s\n", |
| 32 | start + 1, start + count, model.c_str()); | ||
| 33 | |||
| 34 | // Zero means "hold", so an unset entry would substitute uninitialized memory | ||
| 35 | // for every channel that has not yet gone non-zero. | ||
| 36 |
4/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
32 | lastValues = new unsigned char[count](); |
| 37 | 2 | } | |
| 38 | |||
| 39 | ✗ | HoldValueOutputProcessor::~HoldValueOutputProcessor() { | |
| 40 | ✗ | delete[] lastValues; | |
| 41 | ✗ | } | |
| 42 | |||
| 43 | 78 | void HoldValueOutputProcessor::ProcessData(unsigned char* channelData) const { | |
| 44 |
2/2✓ Branch 0 taken 1170 times.
✓ Branch 1 taken 78 times.
|
1248 | for (int x = 0; x < count; x++) { |
| 45 |
2/2✓ Branch 0 taken 825 times.
✓ Branch 1 taken 345 times.
|
1170 | if (channelData[x + start] == 0) { |
| 46 | 825 | channelData[x + start] = lastValues[x]; | |
| 47 | } else { | ||
| 48 | 345 | lastValues[x] = channelData[x + start]; | |
| 49 | } | ||
| 50 | } | ||
| 51 | 78 | } | |
| 52 |