aja: Static analysis bug fixes
* aja: Use inline const for header initializations Avoids duplicating across compilation units. Detected by PVS Studio. * aja: Avoid unnecessary type conversions Detected by PVS Studio. * aja: Remove duplicate assignments Detected by PVS Studio. * aja: Fix return value of aja_output_create Detected by PVS Studio. * aja: Remove unused variable Detected by PVS Studio. * aja: Fix compiler warning * aja: Remove unreachable if branch in aja routing * aja; Cleanup return in card manager Co-authored-by: Colin Edwards <colin@recursivepenguin.com>
This commit is contained in:
parent
904083a259
commit
fad299f99f
@ -181,15 +181,13 @@ bool CardEntry::ChannelReady(NTV2Channel chan, const std::string &owner) const
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(mMutex);
|
||||
|
||||
bool found = false;
|
||||
|
||||
for (const auto &pwn : mChannelPwnz) {
|
||||
if (pwn.second & (1 << static_cast<int32_t>(chan))) {
|
||||
return pwn.first == owner;
|
||||
}
|
||||
}
|
||||
|
||||
return !found;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CardEntry::AcquireChannel(NTV2Channel chan, NTV2Mode mode,
|
||||
|
@ -237,7 +237,6 @@ void AJAOutput::QueueVideoFrame(struct video_data *frame, size_t size)
|
||||
vf.frame = *frame;
|
||||
vf.frameNum = mVideoWriteFrames;
|
||||
vf.size = size;
|
||||
vf.frame = *frame;
|
||||
|
||||
if (mVideoQueue->size() > kVideoQueueMaxSize) {
|
||||
auto &front = mVideoQueue->front();
|
||||
@ -259,7 +258,6 @@ void AJAOutput::QueueAudioFrames(struct audio_data *frames, size_t size)
|
||||
af.frames = *frames;
|
||||
af.offset = 0;
|
||||
af.size = size;
|
||||
af.frames = *frames;
|
||||
|
||||
if (mAudioQueue->size() > kAudioQueueMaxSize) {
|
||||
auto &front = mAudioQueue->front();
|
||||
@ -374,8 +372,8 @@ void AJAOutput::DMAAudioFromQueue(NTV2AudioSystem audioSys)
|
||||
"AJAOutput::DMAAudioFromQueue: Drop %d audio samples",
|
||||
adjustSamples);
|
||||
} else {
|
||||
uint32_t samples =
|
||||
sizeLeft / (kDefaultAudioSampleSize *
|
||||
uint32_t samples = (uint32_t)sizeLeft /
|
||||
(kDefaultAudioSampleSize *
|
||||
kDefaultAudioChannels);
|
||||
af.offset += sizeLeft;
|
||||
sizeLeft = 0;
|
||||
@ -915,7 +913,7 @@ static void *aja_output_create(obs_data_t *settings, obs_output_t *output)
|
||||
const char *cardID = obs_data_get_string(settings, kUIPropDevice.id);
|
||||
if (!cardID) {
|
||||
blog(LOG_ERROR, "aja_output_create: Card ID is null!");
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
const char *outputID =
|
||||
obs_data_get_string(settings, kUIPropAJAOutputID.id);
|
||||
|
@ -91,7 +91,6 @@ bool Routing::ParseRouteString(const std::string &route,
|
||||
* the route strings currently only come from a known set.
|
||||
*/
|
||||
NTV2StringList lines;
|
||||
NTV2StringList tokens;
|
||||
|
||||
lines = aja::split(route_strip, ';');
|
||||
if (lines.empty())
|
||||
@ -338,7 +337,6 @@ void Routing::StartSourceAudio(const SourceProps &props, CNTV2Card *card)
|
||||
// Fix for AJA NTV2 internal bug #11467
|
||||
ULWord magicAudioBits = 0;
|
||||
if (NTV2_INPUT_SOURCE_IS_HDMI(inputSrc)) {
|
||||
magicAudioBits = 0x00100000;
|
||||
switch (inputSrc) {
|
||||
default:
|
||||
case NTV2_INPUTSOURCE_HDMI1:
|
||||
@ -407,13 +405,7 @@ SDIWireFormat GuessSDIWireFormat(NTV2VideoFormat vf, IOSelection io,
|
||||
if (aja::IsSDIFourWireIOSelection(io)) {
|
||||
swf = SDIWireFormat::UHD4K_ST292_Quad_1_5_Squares;
|
||||
} else if (aja::IsSDITwoWireIOSelection(io)) {
|
||||
if (t4k == SDI4KTransport::Squares) {
|
||||
swf = SDIWireFormat::
|
||||
UHD4K_ST292_Dual_1_5_Squares;
|
||||
} else {
|
||||
swf = SDIWireFormat::
|
||||
UHD4K_ST425_Dual_3Gb_2SI;
|
||||
}
|
||||
swf = SDIWireFormat::UHD4K_ST292_Dual_1_5_Squares;
|
||||
}
|
||||
} else if (t4k == SDI4KTransport::TwoSampleInterleave) {
|
||||
if (aja::IsSDIOneWireIOSelection(io)) {
|
||||
|
@ -50,7 +50,7 @@ struct RoutingConfig {
|
||||
*/
|
||||
using VPIDSpec = std::pair<RasterDefinition, VPIDStandard>;
|
||||
|
||||
static const std::map<VPIDSpec, SDIWireFormat> kSDIWireFormats = {
|
||||
static inline const std::map<VPIDSpec, SDIWireFormat> kSDIWireFormats = {
|
||||
{{RasterDefinition::SD, VPIDStandard_483_576}, SDIWireFormat::SD_ST352},
|
||||
{{RasterDefinition::HD, VPIDStandard_720},
|
||||
SDIWireFormat::HD_720p_ST292},
|
||||
|
@ -919,8 +919,7 @@ static void aja_source_update(void *data, obs_data_t *settings)
|
||||
auto prevCardEntry = cardManager.GetCardEntry(currentCardID);
|
||||
if (prevCardEntry) {
|
||||
const std::string &ioSelectStr =
|
||||
aja::IOSelectionToString(curr_props.ioSelect)
|
||||
.c_str();
|
||||
aja::IOSelectionToString(curr_props.ioSelect);
|
||||
if (!prevCardEntry->ReleaseInputSelection(
|
||||
curr_props.ioSelect, curr_props.deviceID,
|
||||
ajaSource->GetName())) {
|
||||
@ -985,7 +984,7 @@ static void aja_source_update(void *data, obs_data_t *settings)
|
||||
// Release Channels if IOSelection changes
|
||||
if (want_props.ioSelect != curr_props.ioSelect) {
|
||||
const std::string &ioSelectStr =
|
||||
aja::IOSelectionToString(curr_props.ioSelect).c_str();
|
||||
aja::IOSelectionToString(curr_props.ioSelect);
|
||||
if (!cardEntry->ReleaseInputSelection(curr_props.ioSelect,
|
||||
curr_props.deviceID,
|
||||
ajaSource->GetName())) {
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
#include "../aja-routing.hpp"
|
||||
|
||||
static const std::map<HDMIWireFormat, RoutingConfig> kHDMIRGBCaptureConfigs = {
|
||||
{HDMIWireFormat::HD_RGB_LFR,
|
||||
static inline const std::map<HDMIWireFormat, RoutingConfig>
|
||||
kHDMIRGBCaptureConfigs = {{HDMIWireFormat::HD_RGB_LFR,
|
||||
{
|
||||
NTV2_MODE_CAPTURE,
|
||||
1,
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
#include "../aja-routing.hpp"
|
||||
|
||||
static const std::map<HDMIWireFormat, RoutingConfig> kHDMIRGBDisplayConfigs = {
|
||||
{HDMIWireFormat::HD_RGB_LFR,
|
||||
{NTV2_MODE_DISPLAY, 1, 1, true, false, false, false, false, false,
|
||||
false, false, false, false, "fb[{ch1}][0]->hdmi[0][0];"}},
|
||||
static inline const std::map<HDMIWireFormat, RoutingConfig>
|
||||
kHDMIRGBDisplayConfigs = {{HDMIWireFormat::HD_RGB_LFR,
|
||||
{NTV2_MODE_DISPLAY, 1, 1, true, false, false,
|
||||
false, false, false, false, false, false,
|
||||
false, "fb[{ch1}][0]->hdmi[0][0];"}},
|
||||
{HDMIWireFormat::TTAP_PRO,
|
||||
{
|
||||
NTV2_MODE_DISPLAY,
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include "../aja-routing.hpp"
|
||||
|
||||
static const std::map<HDMIWireFormat, RoutingConfig> kHDMIYCbCrCaptureConfigs = {
|
||||
static inline const std::map<HDMIWireFormat, RoutingConfig>
|
||||
kHDMIYCbCrCaptureConfigs = {
|
||||
{HDMIWireFormat::HD_YCBCR_LFR,
|
||||
{
|
||||
NTV2_MODE_CAPTURE,
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
#include "../aja-routing.hpp"
|
||||
|
||||
static const std::map<HDMIWireFormat, RoutingConfig> kHDMIYCbCrDisplayConfigs = {
|
||||
{HDMIWireFormat::HD_YCBCR_LFR,
|
||||
static inline const std::map<HDMIWireFormat, RoutingConfig>
|
||||
kHDMIYCbCrDisplayConfigs = {{HDMIWireFormat::HD_YCBCR_LFR,
|
||||
{
|
||||
NTV2_MODE_DISPLAY,
|
||||
1,
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include "../aja-routing.hpp"
|
||||
|
||||
static const std::map<SDIWireFormat, RoutingConfig> kSDIRGBCaptureConfigs = {
|
||||
static inline const std::map<SDIWireFormat, RoutingConfig>
|
||||
kSDIRGBCaptureConfigs = {
|
||||
{
|
||||
SDIWireFormat::SD_ST352,
|
||||
{
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include "../aja-routing.hpp"
|
||||
|
||||
static const std::map<SDIWireFormat, RoutingConfig> kSDIRGBDisplayConfigs = {
|
||||
static inline const std::map<SDIWireFormat, RoutingConfig>
|
||||
kSDIRGBDisplayConfigs = {
|
||||
{
|
||||
SDIWireFormat::SD_ST352,
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "../aja-routing.hpp"
|
||||
|
||||
static const std::map<SDIWireFormat, RoutingConfig> kSDIYCbCrCaptureConfigs = {
|
||||
static inline const std::map<SDIWireFormat, RoutingConfig> kSDIYCbCrCaptureConfigs = {
|
||||
{
|
||||
SDIWireFormat::SD_ST352,
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "../aja-routing.hpp"
|
||||
|
||||
static const std::map<SDIWireFormat, RoutingConfig> kSDIYCbCrDisplayConfigs = {
|
||||
static inline const std::map<SDIWireFormat, RoutingConfig> kSDIYCbCrDisplayConfigs = {
|
||||
{
|
||||
SDIWireFormat::SD_ST352,
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user