| 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 "../common.h" | ||
| 18 | #include "../log.h" | ||
| 19 | |||
| 20 | #include "OutputTester.h" | ||
| 21 | #include "channeloutput/ChannelOutputSetup.h" | ||
| 22 | |||
| 23 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | OutputTester::OutputTester() { |
| 24 | 31 | } | |
| 25 | 120 | OutputTester::~OutputTester() { | |
| 26 | 120 | } | |
| 27 | 31 | int OutputTester::Init(Json::Value config) { | |
| 28 | // a test (re)started counts its cycles from 0: the string testers and the | ||
| 29 | // outputs key their start off cycle 0 | ||
| 30 | 31 | cycleCount = 0; | |
| 31 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | startMS = GetMonotonicTimeMS(); |
| 32 | 31 | outputTypes.clear(); | |
| 33 |
2/4✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
|
62 | testType = JsonInt(config, "type"); |
| 34 |
3/6✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 31 times.
✗ Branch 5 not taken.
|
93 | std::string s = JsonString(config, "outputs"); |
| 35 |
3/10✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 31 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 31 times.
|
31 | if (s != "--ALL--" && s != "") { |
| 36 | ✗ | outputTypes.insert(s); | |
| 37 | } | ||
| 38 |
3/4✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 30 times.
|
31 | if (config.isMember("config")) { |
| 39 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | extraConfig = config["config"]; |
| 40 | } | ||
| 41 |
2/4✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
|
62 | return TestPatternBase::Init(config); |
| 42 | 31 | } | |
| 43 | ✗ | int OutputTester::SetupTest(void) { | |
| 44 | ✗ | return TestPatternBase::SetupTest(); | |
| 45 | } | ||
| 46 | ✗ | void OutputTester::CycleData(void) { | |
| 47 | // cycled in OverlayTestData(): TestPatternBase only cycles a pattern with | ||
| 48 | // channels of its own to copy, and this one has none -- each output draws | ||
| 49 | // its own test | ||
| 50 | ✗ | } | |
| 51 | 3651 | int OutputTester::OverlayTestData(char* channelData) { | |
| 52 |
2/2✓ Branch 0 taken 3561 times.
✓ Branch 1 taken 90 times.
|
3651 | if (m_testEnabled) { |
| 53 | 3561 | uint64_t now = GetMonotonicTimeMS(); // the same clock as startMS, which never steps | |
| 54 |
3/4✓ Branch 0 taken 3561 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2991 times.
✓ Branch 3 taken 570 times.
|
3561 | if (m_cycleMS > 0 && now >= startMS + m_cycleMS) { |
| 55 | 2991 | cycleCount++; | |
| 56 | 2991 | startMS = now; | |
| 57 | } | ||
| 58 | 3561 | int offset = now - startMS; | |
| 59 | 3561 | float pct = offset; | |
| 60 | 3561 | pct /= m_cycleMS; | |
| 61 |
2/4✓ Branch 0 taken 3561 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3561 times.
✗ Branch 3 not taken.
|
3561 | OverlayOutputTestData(outputTypes, (unsigned char*)channelData, cycleCount, pct, testType, extraConfig); |
| 62 | } else { | ||
| 63 |
2/4✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90 times.
✗ Branch 3 not taken.
|
90 | OverlayOutputTestData(outputTypes, (unsigned char*)channelData, 0, 0, 0, extraConfig); |
| 64 | } | ||
| 65 | 3651 | return TestPatternBase::OverlayTestData(channelData); | |
| 66 | } | ||
| 67 | 31 | void OutputTester::DumpConfig(void) { | |
| 68 | 31 | LogDebug(VB_CHANNELOUT, "OutputTester::DumpConfig\n"); | |
| 69 | 31 | LogDebug(VB_CHANNELOUT, " testType : %d\n", testType); | |
| 70 | 31 | TestPatternBase::DumpConfig(); | |
| 71 | 31 | } | |
| 72 |