| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | |||
| 2 | #pragma once | ||
| 3 | /* | ||
| 4 | * This file is part of the Falcon Player (FPP) and is Copyright (C) | ||
| 5 | * 2013-2022 by the Falcon Player Developers. | ||
| 6 | * | ||
| 7 | * The Falcon Player (FPP) is free software, and is covered under | ||
| 8 | * multiple Open Source licenses. Please see the included 'LICENSES' | ||
| 9 | * file for descriptions of what files are covered by each license. | ||
| 10 | * | ||
| 11 | * This source file is covered under the LGPL v2.1 as described in the | ||
| 12 | * included LICENSE.LGPL file. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <cstdint> | ||
| 16 | #include <string> | ||
| 17 | #include <vector> | ||
| 18 | |||
| 19 | class PanelInterleaveHandler { | ||
| 20 | public: | ||
| 21 | 30 | virtual ~PanelInterleaveHandler() {} | |
| 22 | |||
| 23 | 15140 | void map(int& x, int& y) { | |
| 24 | 15140 | int idx = (y * m_panelWidth + x); | |
| 25 |
3/6✓ Branch 0 taken 15140 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15140 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 15140 times.
|
15140 | if (idx < 0 || idx >= static_cast<int>(m_map.size())) { |
| 26 | ✗ | return; // Out of bounds | |
| 27 | } | ||
| 28 | 15140 | auto& pair = m_map[idx]; | |
| 29 | 15140 | x = pair.first; | |
| 30 | 15140 | y = pair.second; | |
| 31 | } | ||
| 32 | |||
| 33 | // Returns nullptr if no handler can map the panel onto the caller's frame | ||
| 34 | // buffer; callers must check and disable the output rather than proceed. | ||
| 35 | static PanelInterleaveHandler* createHandler(const std::string& type, int panelWidth, int panelHeight, int panelScan); | ||
| 36 | |||
| 37 | // true if every mapped pixel lands inside the frame the callers allocate | ||
| 38 | // for this geometry | ||
| 39 | bool mapFitsFrame() const; | ||
| 40 | |||
| 41 | protected: | ||
| 42 | PanelInterleaveHandler(int pw, int ph, int ps, int pi); | ||
| 43 | |||
| 44 | const int m_panelWidth; | ||
| 45 | const int m_panelHeight; | ||
| 46 | const int m_panelScan; | ||
| 47 | const int m_interleave; | ||
| 48 | |||
| 49 | std::vector<std::pair<uint16_t, uint16_t>> m_map; | ||
| 50 | }; | ||
| 51 |