Skip to content

Commit

Permalink
aja: print device informations as it was before
Browse files Browse the repository at this point in the history
approximate the output of now removed CNTV2DeviceScanner::GetDeviceInfoList()

(removed in commit 0ef9f00)
  • Loading branch information
MartinPulec committed Jul 25, 2024
1 parent a893667 commit 6730fda
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 15 deletions.
35 changes: 30 additions & 5 deletions src/aja_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Martin Pulec <[email protected]>
*/
/*
* 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
Expand Down Expand Up @@ -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 <cinttypes> // for PRIx64
#include <cstdint> // for uint64_t
#include <cstdio> // for printf
#include <ntv2card.h> // for CNTV2Card

#include "aja_common.hpp"
#include "utils/color_out.h" // for color_printf, TUNDERLINE

#ifndef BYTE_SWAP
#ifdef WORDS_BIGENDIAN
Expand Down Expand Up @@ -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());
}
9 changes: 6 additions & 3 deletions src/aja_common.h → src/aja_common.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* @file aja_common.h
* @file aja_common.hpp
* @author Martin Pulec <[email protected]>
*/
/*
* 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
Expand Down Expand Up @@ -35,12 +35,13 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <iostream>
#include <map>
#include <ntv2enums.h>

#include "types.h"

class CNTV2Card;

#ifdef _MSC_VER
#define log_msg(x, ...) fprintf(stderr, __VA_ARGS__)
#define color_printf printf
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/video_capture/aja.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

#define NTV2_AUDIOSIZE_MAX (401 * 1024)

#include "aja_common.h"
#include "aja_common.hpp"

#define MOD_NAME "[AJA cap.] "

Expand Down Expand Up @@ -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)) {
Expand Down
8 changes: 4 additions & 4 deletions src/video_display/aja.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @author Martin Pulec <[email protected]>
*/
/*
* 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
Expand Down Expand Up @@ -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] "
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 6730fda

Please sign in to comment.