From 6730fda4d44e5605c27e9986b07247ae46def53e Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 25 Jul 2024 15:30:32 +0200 Subject: [PATCH] aja: print device informations as it was before approximate the output of now removed CNTV2DeviceScanner::GetDeviceInfoList() (removed in commit 0ef9f00a4) --- src/aja_common.cpp | 35 ++++++++++++++++++++++++---- src/{aja_common.h => aja_common.hpp} | 9 ++++--- src/video_capture/aja.cpp | 6 ++--- src/video_display/aja.cpp | 8 +++---- 4 files changed, 43 insertions(+), 15 deletions(-) rename src/{aja_common.h => aja_common.hpp} (95%) diff --git a/src/aja_common.cpp b/src/aja_common.cpp index 8521d21cb8..f1c0cd2381 100644 --- a/src/aja_common.cpp +++ b/src/aja_common.cpp @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2020 CESNET, z. s. p. o. + * Copyright (c) 2020-2024 CESNET * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,11 +38,15 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include "config_msvc.h" -#include "config_unix.h" -#include "config_win32.h" +#include "config_msvc.h" // coompat - __attribute__ etc. -#include "aja_common.h" +#include // for PRIx64 +#include // for uint64_t +#include // for printf +#include // for CNTV2Card + +#include "aja_common.hpp" +#include "utils/color_out.h" // for color_printf, TUNDERLINE #ifndef BYTE_SWAP #ifdef WORDS_BIGENDIAN @@ -159,3 +163,24 @@ vc_copylineR12AtoR12L(unsigned char * __restrict dst, const unsigned char * __re } } +void +print_aja_device_details(CNTV2Card *device) +{ + printf("\t%s\n", device->GetDescription().c_str()); + + color_printf("\t" TUNDERLINE("Device ID:") " 0x%08x\n", + device->GetBaseDeviceID()); + + ULWord dev_pci_id = 0; + device->GetPCIDeviceID(dev_pci_id); + color_printf("\t" TUNDERLINE("Device PCI ID:") " 0x%08x\n", dev_pci_id); + + uint64_t serial_nr = device->GetSerialNumber(); + color_printf("\t" TUNDERLINE("Serial Number:") " 0x%" PRIx64 "\n", + serial_nr); + + color_printf("\t" TUNDERLINE("Video Inputs:") " %hu\n", + device->features().GetNumVideoInputs()); + printf("\t" TUNDERLINE("Video Outputs:") " %hu\n", + device->features().GetNumVideoOutputs()); +} diff --git a/src/aja_common.h b/src/aja_common.hpp similarity index 95% rename from src/aja_common.h rename to src/aja_common.hpp index 97a27cbad2..474c1fcd15 100644 --- a/src/aja_common.h +++ b/src/aja_common.hpp @@ -1,9 +1,9 @@ /** - * @file aja_common.h + * @file aja_common.hpp * @author Martin Pulec */ /* - * Copyright (c) 2018 CESNET, z. s. p. o. + * Copyright (c) 2018-2024 CESNET * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,12 +35,13 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include #include #include "types.h" +class CNTV2Card; + #ifdef _MSC_VER #define log_msg(x, ...) fprintf(stderr, __VA_ARGS__) #define color_printf printf @@ -81,6 +82,8 @@ void vc_copylineR12LtoR12A(unsigned char * __restrict dst, const unsigned char * __restrict src, int dstlen, int rshift, int gshift, int bshift); +void print_aja_device_details(CNTV2Card *device); + #ifdef __cplusplus } #endif diff --git a/src/video_capture/aja.cpp b/src/video_capture/aja.cpp index 30c21dfad3..4d27da9731 100644 --- a/src/video_capture/aja.cpp +++ b/src/video_capture/aja.cpp @@ -113,7 +113,7 @@ #define NTV2_AUDIOSIZE_MAX (401 * 1024) -#include "aja_common.h" +#include "aja_common.hpp" #define MOD_NAME "[AJA cap.] " @@ -1064,8 +1064,8 @@ static void show_help() { } col() << "\t" << SBOLD(i) << ") " - << SBOLD(device.GetDisplayName()) << ". " - << device.GetDescription() << "\n"; + << SBOLD(device.GetDisplayName()); + print_aja_device_details(&device); const NTV2DeviceID deviceID = device.GetBaseDeviceID(); NTV2VideoFormatSet fmt_set; if (NTV2DeviceGetSupportedVideoFormats(deviceID, fmt_set)) { diff --git a/src/video_display/aja.cpp b/src/video_display/aja.cpp index 18c3a4c66a..02aa612069 100644 --- a/src/video_display/aja.cpp +++ b/src/video_display/aja.cpp @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2018-2023 CESNET, z. s. p. o. + * Copyright (c) 2018-2024 CESNET * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -91,7 +91,7 @@ #include "video_display.h" #include "video.h" -#include "aja_common.h" // should be included last (overrides log_msg etc.) +#include "aja_common.hpp" // should be included last (overrides log_msg etc.) #define DEFAULT_MAX_FRAME_QUEUE_LEN 1 #define MOD_NAME "[AJA display] " @@ -793,8 +793,8 @@ void aja::display::show_help() { } col() << "\t" << SBOLD(i) << ") " - << SBOLD(device.GetDisplayName()) << ". " - << device.GetDescription() << "\n"; + << SBOLD(device.GetDisplayName()); + print_aja_device_details(&device); col() << "\n"; } if (deviceScanner.GetNumDevices() == 0) {