* @brief Builds a channel-to-source mapping for multi-source MDF4 playback. */
| 1064 | * @brief Builds a channel-to-source mapping for multi-source MDF4 playback. |
| 1065 | */ |
| 1066 | void MDF4::Player::buildReplayLayout() |
| 1067 | { |
| 1068 | m_sourceChannelsByIndex.clear(); |
| 1069 | |
| 1070 | struct ChMeta { |
| 1071 | int uid; |
| 1072 | int sourceId; |
| 1073 | }; |
| 1074 | |
| 1075 | QVector<ChMeta> chs; |
| 1076 | for (const auto& g : DataModel::ProjectModel::instance().groups()) { |
| 1077 | if (g.widget == QLatin1String("image")) |
| 1078 | continue; |
| 1079 | |
| 1080 | for (const auto& d : g.datasets) |
| 1081 | chs.append({d.uniqueId, g.sourceId}); |
| 1082 | } |
| 1083 | |
| 1084 | std::unordered_map<int, int> localCounter; |
| 1085 | for (const auto& m : chs) |
| 1086 | localCounter[m.sourceId]; |
| 1087 | |
| 1088 | m_multiSource = localCounter.size() > 1; |
| 1089 | |
| 1090 | std::unordered_map<int, std::unordered_map<int, int>> replay; |
| 1091 | |
| 1092 | if (!m_multiSource) { |
| 1093 | for (int ch = 0; ch < chs.size(); ++ch) |
| 1094 | replay[0][chs[ch].uid] = ch; |
| 1095 | } |
| 1096 | |
| 1097 | else { |
| 1098 | for (auto& kv : localCounter) |
| 1099 | kv.second = 0; |
| 1100 | |
| 1101 | for (int ch = 0; ch < chs.size(); ++ch) { |
| 1102 | m_sourceChannelsByIndex[chs[ch].sourceId].append(ch); |
| 1103 | replay[chs[ch].sourceId][chs[ch].uid] = localCounter[chs[ch].sourceId]++; |
| 1104 | } |
| 1105 | } |
| 1106 | |
| 1107 | DataModel::FrameBuilder::instance().setReplayColumnMap(std::move(replay)); |
| 1108 | } |
| 1109 | |
| 1110 | /** |
| 1111 | * @brief Injects an MDF4 frame through the appropriate pipeline path. |
nothing calls this directly
no test coverage detected