Skip to content

Commit c2784ee

Browse files
committed
delta_board_type_is_dv changes
- delta_board_type_is_dv takes the VHD_BOARD_TYPE now - to acquire the type from board index, delta_get_board_type() is now externally linked - delta_board_type_is_dv: handle types with switch (compiler warns about unhandled enum values) - changed compat macros a bit (works at least for VHD 5.19, 6.{19,20,21,30,32})
1 parent 83a5a8e commit c2784ee

File tree

5 files changed

+39
-24
lines changed

5 files changed

+39
-24
lines changed

src/deltacast_common.cpp

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858

5959
#define MOD_NAME "[DELTACAST] "
6060

61-
static VHD_BOARDTYPE
62-
get_board_type(ULONG BoardIndex)
61+
VHD_BOARDTYPE
62+
delta_get_board_type(ULONG BoardIndex)
6363
{
6464
HANDLE BoardHandle = nullptr;
6565
ULONG BoardType = 0U;
@@ -87,7 +87,7 @@ delta_get_model_name(ULONG BoardIndex)
8787
thread_local char buf[128];
8888
#if !defined VHD_MIN_6_00
8989
#define VHD_GetBoardModel(BoardIndex) \
90-
delta_get_board_type_name(get_board_type(BoardIndex))
90+
delta_get_board_type_name(delta_get_board_type(BoardIndex))
9191
#endif
9292
snprintf_ch(buf, "%s #%" PRIu_ULONG,
9393
VHD_GetBoardModel(BoardIndex),
@@ -1039,18 +1039,30 @@ delta_print_slot_stats(HANDLE StreamHandle, ULONG *SlotsDroppedLast,
10391039
}
10401040

10411041
bool
1042-
delta_board_type_is_dv(ULONG BoardIndex, [[maybe_unused]] bool include_mixed)
1042+
delta_board_type_is_dv(VHD_BOARDTYPE BoardType,
1043+
[[maybe_unused]] bool include_mixed)
10431044
{
1044-
const ULONG BoardType = get_board_type(BoardIndex);
1045-
return BoardType == VHD_BOARDTYPE_DVI ||
1046-
BoardType == VHD_BOARDTYPE_HDMI ||
1045+
switch (BoardType) {
1046+
case VHD_BOARDTYPE_HD: return false;
1047+
case VHD_BOARDTYPE_HDKEY: return false;
1048+
case VHD_BOARDTYPE_SD: return false;
1049+
case VHD_BOARDTYPE_SDKEY: return false;
1050+
case VHD_BOARDTYPE_DVI: return true;
1051+
case VHD_BOARDTYPE_CODEC: return include_mixed; // _MIXEDINTERFACE
1052+
case VHD_BOARDTYPE_3G: return false;
1053+
case VHD_BOARDTYPE_3GKEY: return false;
1054+
case VHD_BOARDTYPE_HDMI: return true;
1055+
case VHD_BOARDTYPE_FLEX: return include_mixed;
1056+
case VHD_BOARDTYPE_ASI: return false;
10471057
#if defined VHD_MIN_6_00
1048-
BoardType == VHD_BOARDTYPE_HDMI20 ||
1049-
(include_mixed && BoardType == VHD_BOARDTYPE_FLEX_DP) ||
1050-
(include_mixed && BoardType == VHD_BOARDTYPE_FLEX_HMI) ||
1058+
case VHD_BOARDTYPE_IP: return false;
1059+
case VHD_BOARDTYPE_HDMI20: return true;
1060+
case VHD_BOARDTYPE_FLEX_DP: return include_mixed;
1061+
case VHD_BOARDTYPE_FLEX_SDI: return false;
1062+
case VHD_BOARDTYPE_12G: return false;
1063+
case VHD_BOARDTYPE_FLEX_HMI: return include_mixed;
10511064
#endif
1052-
#if defined VHD_MIN_6_21
1053-
(include_mixed && BoardType == VHD_BOARDTYPE_MIXEDINTERFACE) ||
1054-
#endif
1055-
false;
1065+
case NB_VHD_BOARDTYPES: return false;
1066+
}
1067+
return false;
10561068
}

src/deltacast_common.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@
157157
#define VHD_CHNTYPE_12GSDI_ASI VHD_CHNTYPE_DISABLE
158158
#endif // not defined VHD_MIN_6_20
159159

160-
#if !defined VHD_MIN_6_00
160+
#if defined VHD_MIN_6_00
161+
#define VHD_BOARDTYPE_FLEX VHD_BOARDTYPE_FLEX_DEPRECATED
162+
#else
161163
#define VHD_CHNTYPE_12GSDI VHD_CHNTYPE_DISABLE
162164
#endif
163165

@@ -205,8 +207,9 @@ const char *delta_get_board_type_name(ULONG BoardType);
205207
bool delta_chn_type_is_sdi(ULONG ChnType);
206208
void delta_print_slot_stats(HANDLE StreamHandle, ULONG *SlotsDroppedLast,
207209
const char *action);
208-
bool delta_board_type_is_dv(ULONG BoardIndex, bool include_mixed);
209-
const char *delta_get_model_name(ULONG BoardIndex);
210+
VHD_BOARDTYPE delta_get_board_type(ULONG BoardIndex);
211+
bool delta_board_type_is_dv(VHD_BOARDTYPE BoardType, bool include_mixed);
212+
const char *delta_get_model_name(ULONG BoardIndex);
210213

211214
#ifdef HAVE_VHD_STRING
212215
#define DELTA_PRINT_ERROR(error_code, error_message, ...) \

src/video_capture/deltacast.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ static void vidcap_deltacast_probe(device_info **available_cards, int *count, vo
150150
*available_cards =
151151
(struct device_info *) calloc(NbBoards, sizeof(struct device_info));
152152
for (ULONG i = 0; i < NbBoards; ++i) {
153-
if (delta_board_type_is_dv(i, false)) { // skip DVI/HDMI-only boards
154-
continue;
153+
if (delta_board_type_is_dv(delta_get_board_type(i), false)) {
154+
continue; // skip DVI/HDMI-only boards
155155
}
156156
auto &card = (*available_cards)[*count];
157157
snprintf_ch(card.dev, ":device=%" PRIu_ULONG, i);
@@ -516,7 +516,7 @@ vidcap_deltacast_init(struct vidcap_params *params, void **state)
516516
VHD_GetBoardProperty(s->BoardHandle, Property, &ChnType);
517517
if (!delta_chn_type_is_sdi(ChnType)) {
518518
MSG(ERROR, "ERROR : The selected channel is not a SDI one\n");
519-
if (delta_board_type_is_dv(BrdId, false)) {
519+
if (!delta_board_type_is_dv(delta_get_board_type(BrdId), false)) {
520520
MSG(NOTICE, "Use 'deltacast-dv' capture device\n");
521521
}
522522
HANDLE_ERROR

src/video_capture/deltacast_dvi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ static void vidcap_deltacast_dvi_probe(device_info **available_cards, int *count
243243

244244
*available_cards = (struct device_info *) calloc(NbBoards, sizeof(struct device_info));
245245
for (ULONG i = 0; i < NbBoards; ++i) {
246-
if (!delta_board_type_is_dv(i, true)) { // skip SDI baords
247-
continue;
246+
if (!delta_board_type_is_dv(delta_get_board_type(i), true)) {
247+
continue; // skip SDI-only boards
248248
}
249249
auto &card = (*available_cards)[*count];
250250
snprintf(card.dev, sizeof card.dev, ":device=%" PRIu_ULONG, i);

src/video_display/deltacast.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ static void display_deltacast_probe(struct device_info **available_cards, int *c
312312
/* Query DELTA boards information */
313313
for (ULONG i = 0; i < NbBoards; i++)
314314
{
315-
if (delta_board_type_is_dv(i, false)) { // skip DVI/HDMI-only boards
316-
continue;
315+
if (delta_board_type_is_dv(delta_get_board_type(i), false)) {
316+
continue; // skip DVI/HDMI-only boards
317317
}
318318
*count += 1;
319319
*available_cards = (struct device_info *)

0 commit comments

Comments
 (0)