30 changes: 18 additions & 12 deletions mythtv/libs/libmythtv/diseqc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ using uint_to_dbl_t = QMap<uint, double>;
using dbl_to_uint_t = QMap<double, uint>;
using cardid_to_diseqc_tree_t = QMap<uint, DiSEqCDevTree*>;
using dvbdev_vec_t = vector<DiSEqCDevDevice*>;
using cmd_vec_t = std::vector<uint8_t>;

class DiSEqCDevSettings
{
Expand Down Expand Up @@ -93,8 +94,13 @@ class DiSEqCDevTree
DiSEqCDevDevice *Root(void) { return m_root; }
void SetRoot(DiSEqCDevDevice *root);

bool SendCommand(uint adr, uint cmd, uint repeats = 0,
uint data_len = 0, unsigned char *data = nullptr) const;
bool SendCommand(uint adr, uint cmd, uint repeats,
cmd_vec_t &data) const;
bool SendCommand(uint adr, uint cmd, uint repeats = 0) const
{
cmd_vec_t nada;
return SendCommand(adr, cmd, repeats, nada);
}

bool ResetDiseqc(bool hard_reset, bool is_SCR);

Expand Down Expand Up @@ -206,12 +212,13 @@ class DiSEqCDevDevice
uint m_repeat {1};

struct TypeTable { QString name; uint value; };
static QString TableToString(uint type, const TypeTable *table);
static uint TableFromString(const QString &type,
const TypeTable *table);
using TypeTableVec = std::vector<TypeTable>;
static QString TableToString(uint type, const TypeTableVec &table);
static uint TableFromString(const QString &type,
const TypeTableVec &table);

private:
static const TypeTable kDvbdevLookup[5];
static const TypeTableVec kDvbdevLookup;
};

class DiSEqCDevSwitch : public DiSEqCDevDevice
Expand Down Expand Up @@ -290,7 +297,7 @@ class DiSEqCDevSwitch : public DiSEqCDevDevice
uint m_lastHorizontal {UINT_MAX};
dvbdev_vec_t m_children;

static const TypeTable kSwitchTypeTable[9];
static const TypeTableVec kSwitchTypeTable;
};

class DiSEqCDevRotor : public DiSEqCDevDevice
Expand Down Expand Up @@ -370,7 +377,7 @@ class DiSEqCDevRotor : public DiSEqCDevDevice
mutable double m_lastAzimuth {0.0};

// statics
static const TypeTable kRotorTypeTable[3];
static const TypeTableVec kRotorTypeTable;
};

class DiSEqCDevSCR : public DiSEqCDevDevice
Expand Down Expand Up @@ -425,8 +432,7 @@ class DiSEqCDevSCR : public DiSEqCDevDevice
{ return (dvbdev_pos_t) TableFromString(pos, kSCRPositionTable); }

protected:
bool SendCommand(uint cmd, uint repeats, uint data_len = 0,
unsigned char *data = nullptr) const;
bool SendCommand(uint cmd, uint repeats, cmd_vec_t &data) const;

private:
uint m_scrUserband {0}; /* 0-7 */
Expand All @@ -435,7 +441,7 @@ class DiSEqCDevSCR : public DiSEqCDevDevice

DiSEqCDevDevice *m_child {nullptr};

static const TypeTable kSCRPositionTable[3];
static const TypeTableVec kSCRPositionTable;
};

class DiSEqCDevLNB : public DiSEqCDevDevice
Expand Down Expand Up @@ -493,7 +499,7 @@ class DiSEqCDevLNB : public DiSEqCDevDevice
/// of reflectors will need to set this value.
bool m_polInv {false};

static const TypeTable kLNBTypeTable[5];
static const TypeTableVec kLNBTypeTable;
};

#endif // DISEQC_H
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#define MYTH_PACKED
#endif

// Prevent clang-tidy modernize-avoid-c-arrays warnings in these
// kernel structures
extern "C" {

struct rtfileheader
{
char finfo[12]; // "NuppelVideo" + \0
Expand Down Expand Up @@ -204,4 +208,7 @@ struct ccsubtitle
#define CC_TXT3 0x60
#define CC_TXT4 0x70

// end of kernel structures.
};

#endif
17 changes: 8 additions & 9 deletions mythtv/libs/libmythtv/fourcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*****************************************************************************/

#include "mythconfig.h"
#include <string>

#ifdef __cplusplus
extern "C" {
Expand All @@ -22,17 +23,15 @@ extern "C" {
#endif

/* Probably not thread safe */
static inline char * fourcc_str(int i)
static inline const char * fourcc_str(int i)
{
static char str[5];
static std::string str(5,'\0');

str[0] = ((char) (i & 0xFF)),
str[1] = ((char) ((i >> 8) & 0xFF)),
str[2] = ((char) ((i >> 16) & 0xFF)),
str[3] = ((char) ((i >> 24) & 0xFF)),
str[4] = '\0';

return str;
str[0] = ((char) (i & 0xFF));
str[1] = ((char) ((i >> 8) & 0xFF));
str[2] = ((char) ((i >> 16) & 0xFF));
str[3] = ((char) ((i >> 24) & 0xFF));
return str.c_str();
}


Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/io/mythfilebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ bool MythFileBuffer::OpenFile(const QString &Filename, uint Retry)

if (islocal)
{
char buf[kReadTestSize];
std::array<char,kReadTestSize> buf {};
int lasterror = 0;

MythTimer openTimer;
Expand All @@ -225,7 +225,7 @@ bool MythFileBuffer::OpenFile(const QString &Filename, uint Retry)
}
else
{
ssize_t ret = read(m_fd2, buf, kReadTestSize);
ssize_t ret = read(m_fd2, buf.data(), buf.size());
if (ret != kReadTestSize)
{
lasterror = 2;
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/iptvtuningdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class MTV_PUBLIC IPTVTuningData

IPTVTuningData()
{
memset(&m_bitrate, 0, sizeof(m_bitrate));
m_bitrate.fill(0);
}

IPTVTuningData(const QString &data_url, IPTVProtocol protocol) :
m_dataUrl(data_url), m_protocol(protocol)
{
memset(&m_bitrate, 0, sizeof(m_bitrate));
m_bitrate.fill(0);
}

IPTVTuningData(const QString &data_url, uint data_bitrate,
Expand Down Expand Up @@ -268,7 +268,7 @@ class MTV_PUBLIC IPTVTuningData
FECType m_fecType {kNone};
QUrl m_fecUrl0;
QUrl m_fecUrl1;
uint m_bitrate[3] {};
std::array<uint,3> m_bitrate {};
IPTVProtocol m_protocol {inValid};
};

Expand Down
12 changes: 5 additions & 7 deletions mythtv/libs/libmythtv/jitterometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "jitterometer.h"

// Std
#include <array>
#include <cmath>
#include <cstdlib>
#include <utility>
Expand Down Expand Up @@ -164,9 +165,7 @@ QString Jitterometer::GetCPUStat(void)
line = m_cpuStat->readLine(256);
while (!line.isEmpty() && cores < MAX_CORES)
{
static constexpr int kSize = sizeof(unsigned long long) * 9;
unsigned long long stats[9];
memset(stats, 0, kSize);
std::array<unsigned long long,9> stats {};
int num = 0;
if (sscanf(line.constData(),
"cpu%30d %30llu %30llu %30llu %30llu %30llu "
Expand All @@ -183,7 +182,7 @@ QString Jitterometer::GetCPUStat(void)
float total = load + stats[3] - m_lastStats[ptr + 3];
if (total > 0)
result += QString("%1% ").arg(load / total * 100, 0, 'f', 0);
memcpy(&m_lastStats[ptr], stats, kSize);
std::copy(stats.cbegin(), stats.cend(), &m_lastStats[ptr]);
}
line = m_cpuStat->readLine(256);
cores++;
Expand All @@ -203,16 +202,15 @@ QString Jitterometer::GetCPUStat(void)
int ptr = 0;
for (natural_t i = 0; i < processorcount && i < MAX_CORES; i++)
{
unsigned long long stats[9];
memset(stats, 0, sizeof(unsigned long long) * 2);
std::array<unsigned long long,2> stats {};
stats[0] = load[i].cpu_ticks[CPU_STATE_IDLE];
stats[1] = load[i].cpu_ticks[CPU_STATE_IDLE] + load[i].cpu_ticks[CPU_STATE_USER] +
load[i].cpu_ticks[CPU_STATE_SYSTEM] + load[i].cpu_ticks[CPU_STATE_NICE];
double idledelta = stats[0] - m_lastStats[ptr];
double totaldelta = stats[1] - m_lastStats[ptr + 1];
if (totaldelta > 0)
result += QString("%1% ").arg(((totaldelta - idledelta) / totaldelta) * 100.0, 0, 'f', 0);
memcpy(&m_lastStats[ptr], stats, sizeof(unsigned long long) * 2);
std::copy(stats.cbegin(), stats.cend(), &m_lastStats[ptr]);
ptr += 2;
}
}
Expand Down
28 changes: 18 additions & 10 deletions mythtv/libs/libmythtv/mythframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static bool has_sse4 = false;
#define cpuid __cpuid

#else
/* NOLINTNEXTLINE(readability-non-const-parameter) */
/* NOLINTNEXTLINE(modernize-avoid-c-arrays,readability-non-const-parameter) */
inline void cpuid(int CPUInfo[4],int InfoType)
{
__asm__ __volatile__ (
Expand All @@ -111,14 +111,14 @@ inline void cpuid(int CPUInfo[4],int InfoType)

static void cpu_detect_features()
{
int info[4];
cpuid(info, 0);
std::array<int,4> info {};
cpuid(info.data(), 0);
int nIds = info[0];

// Detect Features
if (nIds >= 0x00000001)
{
cpuid(info,0x00000001);
cpuid(info.data(),0x00000001);
has_sse2 = (info[3] & (1 << 26)) != 0;
has_sse3 = (info[2] & (1 << 0)) != 0;
has_ssse3 = (info[2] & (1 << 9)) != 0;
Expand Down Expand Up @@ -160,9 +160,9 @@ static inline void SSE_splitplanes(uint8_t* dstu, int dstu_pitch,
const uint8_t* src, int src_pitch,
int width, int height)
{
const uint8_t shuffle[] = { 0, 2, 4, 6, 8, 10, 12, 14,
const std::array<const uint8_t,16> shuffle { 0, 2, 4, 6, 8, 10, 12, 14,
1, 3, 5, 7, 9, 11, 13, 15 };
const uint8_t mask[] = { 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00,
const std::array<const uint8_t,16> mask { 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00,
0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00 };
const bool sse3 = sse3_check();
const bool ssse3 = ssse3_check();
Expand Down Expand Up @@ -209,7 +209,9 @@ static inline void SSE_splitplanes(uint8_t* dstu, int dstu_pitch,
"pshufb %%xmm7, %%xmm2\n"
"pshufb %%xmm7, %%xmm3\n"
STORE2X32
: : [dst1]"r"(&dstu[x]), [dst2]"r"(&dstv[x]), [src]"r"(&src[2*x]), [shuffle]"r"(shuffle) : "memory", "xmm0", "xmm1", "xmm2", "xmm3", "xmm7");
: : [dst1]"r"(&dstu[x]), [dst2]"r"(&dstv[x]),
[src]"r"(&src[2*x]), [shuffle]"r"(shuffle.data())
: "memory", "xmm0", "xmm1", "xmm2", "xmm3", "xmm7");
}
}
else
Expand All @@ -235,7 +237,9 @@ static inline void SSE_splitplanes(uint8_t* dstu, int dstu_pitch,
"packuswb %%xmm6, %%xmm2\n"
"packuswb %%xmm7, %%xmm3\n"
STORE2X32
: : [dst2]"r"(&dstu[x]), [dst1]"r"(&dstv[x]), [src]"r"(&src[2*x]), [mask]"r"(mask) : "memory", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
: : [dst2]"r"(&dstu[x]), [dst1]"r"(&dstv[x]),
[src]"r"(&src[2*x]), [mask]"r"(mask.data())
: "memory", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
}
}
}
Expand All @@ -253,7 +257,9 @@ static inline void SSE_splitplanes(uint8_t* dstu, int dstu_pitch,
"pshufb %%xmm7, %%xmm2\n"
"pshufb %%xmm7, %%xmm3\n"
STORE2X32
: : [dst1]"r"(&dstu[x]), [dst2]"r"(&dstv[x]), [src]"r"(&src[2*x]), [shuffle]"r"(shuffle) : "memory", "xmm0", "xmm1", "xmm2", "xmm3", "xmm7");
: : [dst1]"r"(&dstu[x]), [dst2]"r"(&dstv[x]),
[src]"r"(&src[2*x]), [shuffle]"r"(shuffle.data())
: "memory", "xmm0", "xmm1", "xmm2", "xmm3", "xmm7");
}
}
else
Expand All @@ -279,7 +285,9 @@ static inline void SSE_splitplanes(uint8_t* dstu, int dstu_pitch,
"packuswb %%xmm6, %%xmm2\n"
"packuswb %%xmm7, %%xmm3\n"
STORE2X32
: : [dst2]"r"(&dstu[x]), [dst1]"r"(&dstv[x]), [src]"r"(&src[2*x]), [mask]"r"(mask) : "memory", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
: : [dst2]"r"(&dstu[x]), [dst1]"r"(&dstv[x]),
[src]"r"(&src[2*x]), [mask]"r"(mask.data())
: "memory", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythtv/mythplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3490,10 +3490,10 @@ PIPLocation MythPlayer::GetNextPIPLocation(void) const
return m_pipDefaultLoc;

// order of preference, could be stored in db if we want it configurable
PIPLocation ols[] =
const std::array<const PIPLocation,4> ols
{ kPIPTopLeft, kPIPTopRight, kPIPBottomLeft, kPIPBottomRight };

for (auto & ol : ols)
for (const auto & ol : ols)
{
PIPMap::const_iterator it = m_pipPlayers.begin();
for (; it != m_pipPlayers.end() && (*it != ol); ++it);
Expand Down Expand Up @@ -4005,8 +4005,8 @@ void MythPlayer::ClearAfterSeek(bool clearvideobuffers)

int64_t savedTC = m_tcWrap[TC_AUDIO];

for (int j = 0; j < TCTYPESMAX; j++)
m_tcWrap[j] = m_tcLastVal[j] = 0;
m_tcWrap.fill(0);
m_tcLastVal.fill(0);

m_tcWrap[TC_AUDIO] = savedTC;

Expand Down
5 changes: 3 additions & 2 deletions mythtv/libs/libmythtv/mythplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ enum TCTypes
TC_CC
};
#define TCTYPESMAX 4
using tctype_arr = std::array<int64_t,TCTYPESMAX>;

// Caption Display modes
enum
Expand Down Expand Up @@ -863,8 +864,8 @@ class MTV_PUBLIC MythPlayer
// Time Code stuff
int m_prevTc {0}; ///< 32 bit timecode if last VideoFrame shown
int m_prevRp {0}; ///< repeat_pict of last frame
int64_t m_tcWrap[TCTYPESMAX] {};
int64_t m_tcLastVal[TCTYPESMAX] {};
tctype_arr m_tcWrap {};
tctype_arr m_tcLastVal {};
int64_t m_savedAudioTimecodeOffset {0};

// LiveTV
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythtv/sourceutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ QString SourceUtil::GetChannelSeparator(uint sourceid)
}
QString sep = "_";
uint max = counts["_"];
static const char *s_spacers[6] = { "", "-", "#", ".", "0", nullptr };
for (uint i=0; (s_spacers[i] != nullptr); ++i)
static const std::array<const QString,5> s_spacers { "", "-", "#", ".", "0" };
for (const auto & spacer : s_spacers)
{
if (counts[s_spacers[i]] > max)
if (counts[spacer] > max)
{
max = counts[s_spacers[i]];
sep = s_spacers[i];
max = counts[spacer];
sep = spacer;
}
}
return sep;
Expand Down
40 changes: 21 additions & 19 deletions mythtv/libs/libmythtv/videocolourspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ extern "C" {
#include <cmath>

const VideoColourSpace::ColourPrimaries VideoColourSpace::kBT709 =
{{{0.640F, 0.330F}, {0.300F, 0.600F}, {0.150F, 0.060F}}, {0.3127F, 0.3290F}};
{{{{0.640F, 0.330F}, {0.300F, 0.600F}, {0.150F, 0.060F}}}, {0.3127F, 0.3290F}};
const VideoColourSpace::ColourPrimaries VideoColourSpace::kBT610_525 =
{{{0.630F, 0.340F}, {0.310F, 0.595F}, {0.155F, 0.070F}}, {0.3127F, 0.3290F}};
{{{{0.630F, 0.340F}, {0.310F, 0.595F}, {0.155F, 0.070F}}}, {0.3127F, 0.3290F}};
const VideoColourSpace::ColourPrimaries VideoColourSpace::kBT610_625 =
{{{0.640F, 0.330F}, {0.290F, 0.600F}, {0.150F, 0.060F}}, {0.3127F, 0.3290F}};
{{{{0.640F, 0.330F}, {0.290F, 0.600F}, {0.150F, 0.060F}}}, {0.3127F, 0.3290F}};
const VideoColourSpace::ColourPrimaries VideoColourSpace::kBT2020 =
{{{0.708F, 0.292F}, {0.170F, 0.797F}, {0.131F, 0.046F}}, {0.3127F, 0.3290F}};
{{{{0.708F, 0.292F}, {0.170F, 0.797F}, {0.131F, 0.046F}}}, {0.3127F, 0.3290F}};

#define LOC QString("ColourSpace: ")

Expand Down Expand Up @@ -582,7 +582,7 @@ bool VideoColourSpace::Similar(const ColourPrimaries &First, const ColourPrimari
cmp(First.whitepoint[1], Second.whitepoint[1]);
}

inline float CalcBy(const float p[3][2], const float w[2])
inline float CalcBy(const PrimarySpace p, const WhiteSpace w)
{
float val = ((1-w[0])/w[1] - (1-p[0][0])/p[0][1]) * (p[1][0]/p[1][1] - p[0][0]/p[0][1]) -
(w[0]/w[1] - p[0][0]/p[0][1]) * ((1-p[1][0])/p[1][1] - (1-p[0][0])/p[0][1]);
Expand All @@ -591,7 +591,7 @@ inline float CalcBy(const float p[3][2], const float w[2])
return val;
}

inline float CalcGy(const float p[3][2], const float w[2], const float By)
inline float CalcGy(const PrimarySpace p, const WhiteSpace w, const float By)
{
float val = w[0]/w[1] - p[0][0]/p[0][1] - By * (p[2][0]/p[2][1] - p[0][0]/p[0][1]);
val /= p[1][0]/p[1][1] - p[0][0]/p[0][1];
Expand All @@ -616,17 +616,19 @@ QMatrix4x4 VideoColourSpace::RGBtoXYZ(ColourPrimaries Primaries)
float Gy = CalcGy(Primaries.primaries, Primaries.whitepoint, By);
float Ry = CalcRy(By, Gy);

float temp[4][4];
temp[0][0] = Ry * Primaries.primaries[0][0] / Primaries.primaries[0][1];
temp[0][1] = Gy * Primaries.primaries[1][0] / Primaries.primaries[1][1];
temp[0][2] = By * Primaries.primaries[2][0] / Primaries.primaries[2][1];
temp[1][0] = Ry;
temp[1][1] = Gy;
temp[1][2] = By;
temp[2][0] = Ry / Primaries.primaries[0][1] * (1- Primaries.primaries[0][0] - Primaries.primaries[0][1]);
temp[2][1] = Gy / Primaries.primaries[1][1] * (1- Primaries.primaries[1][0] - Primaries.primaries[1][1]);
temp[2][2] = By / Primaries.primaries[2][1] * (1- Primaries.primaries[2][0] - Primaries.primaries[2][1]);
temp[0][3] = temp[1][3] = temp[2][3] = temp[3][0] = temp[3][1] = temp[3][2] = 0.0F;
temp[3][3] = 1.0F;
return QMatrix4x4(temp[0]);
return {
// Row 0
Ry * Primaries.primaries[0][0] / Primaries.primaries[0][1],
Gy * Primaries.primaries[1][0] / Primaries.primaries[1][1],
By * Primaries.primaries[2][0] / Primaries.primaries[2][1],
0.0F,
// Row 1
Ry, Gy, By, 0.0F,
// Row 2
Ry / Primaries.primaries[0][1] * (1- Primaries.primaries[0][0] - Primaries.primaries[0][1]),
Gy / Primaries.primaries[1][1] * (1- Primaries.primaries[1][0] - Primaries.primaries[1][1]),
By / Primaries.primaries[2][1] * (1- Primaries.primaries[2][0] - Primaries.primaries[2][1]),
0.0F,
// Row 3
0.0F, 0.0F, 0.0F, 1.0F };
}
7 changes: 5 additions & 2 deletions mythtv/libs/libmythtv/videocolourspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
// FFmpeg
#include "libavutil/pixfmt.h" // For AVCOL_xxx defines

using PrimarySpace = std::array<std::array<float,2>,3>;
using WhiteSpace = std::array<float,2>;

class VideoColourSpace : public QObject, public QMatrix4x4, public ReferenceCounter
{
Q_OBJECT
Expand All @@ -36,8 +39,8 @@ class VideoColourSpace : public QObject, public QMatrix4x4, public ReferenceCoun

struct ColourPrimaries
{
float primaries[3][2];
float whitepoint[2];
PrimarySpace primaries;
WhiteSpace whitepoint;
};

static const ColourPrimaries kBT709;
Expand Down
14 changes: 12 additions & 2 deletions mythtv/libs/libmythtv/videodev2.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ using __s8 = int8_t;
#include <linux/v4l2-common.h>
#include <linux/v4l2-controls.h>

//
// All of the structures in this file are for communicating with the
// kernel. Wrap the entire thing in an 'extern C' declaration so
// that the clang-tidy modernize-avoid-c-arrays checker won't complain
// about the arrays.
//
extern "C" {

/*
* Common stuff for both V4L1 and V4L2
* Moved from videodev.h
Expand Down Expand Up @@ -1983,7 +1991,7 @@ struct v4l2_sliced_vbi_format {
service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
(equals frame lines 313-336 for 625 line video
standards, 263-286 for 525 line standards) */
__u16 service_lines[2][24];
__u16 service_lines[2][24]; /* NOLINT(modernize-avoid-c-arrays) */
__u32 io_size;
__u32 reserved[2]; /* must be zero */
};
Expand All @@ -2007,7 +2015,7 @@ struct v4l2_sliced_vbi_cap {
service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
(equals frame lines 313-336 for 625 line video
standards, 263-286 for 525 line standards) */
__u16 service_lines[2][24];
__u16 service_lines[2][24]; /* NOLINT(modernize-avoid-c-arrays) */
__u32 type; /* enum v4l2_buf_type */
__u32 reserved[3]; /* must be 0 */
};
Expand Down Expand Up @@ -2429,4 +2437,6 @@ struct v4l2_create_buffers {

#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */

} // extern "C"

#endif /* __LINUX_VIDEODEV2_H */
6 changes: 3 additions & 3 deletions mythtv/libs/libmythui/mythedid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ bool MythEDID::ParseBaseBlock(const quint8 *Data)
// to sRGB specs. If sRGB is set, the client should use the spec values - not
// the computed values
m_sRGB = ((Data[FEATURES_OFFSET] & 0x04) != 0);
static const unsigned char s_sRGB[10] =
static constexpr std::array<const uint8_t,10> s_sRGB =
{ 0xEE, 0x91, 0xA3, 0x54, 0x4C, 0x99, 0x26, 0x0F, 0x50, 0x54 };
bool srgb = memcmp(Data + 0x19, s_sRGB, sizeof(s_sRGB)) == 0;
bool srgb = std::equal(s_sRGB.cbegin(), s_sRGB.cend(), Data + 0x19);

if (!m_sRGB && srgb)
m_sRGB = true;
Expand All @@ -246,7 +246,7 @@ bool MythEDID::ParseBaseBlock(const quint8 *Data)

// As per VideoColourspace.
static const Primaries s_sRGBPrim =
{{{0.640F, 0.330F}, {0.300F, 0.600F}, {0.150F, 0.060F}}, {0.3127F, 0.3290F}};
{{{{0.640F, 0.330F}, {0.300F, 0.600F}, {0.150F, 0.060F}}}, {0.3127F, 0.3290F}};

auto like = [](const Primaries &First, const Primaries &Second, float Fuzz)
{
Expand Down
13 changes: 8 additions & 5 deletions mythtv/libs/libmythui/mythedid.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@
// MythTV
#include "mythuiexp.h"

using PrimarySpace = std::array<std::array<float,2>,3>;
using WhiteSpace = std::array<float,2>;

class MUI_PUBLIC MythEDID
{
public:
// This structure matches VideoColourSpace::ColourPrimaries
// TODO move ColourPrimaries into MythDisplay
struct Primaries
{
float primaries[3][2];
float whitepoint[2];
PrimarySpace primaries;
WhiteSpace whitepoint;
};

MythEDID(void) = default;
Expand Down Expand Up @@ -57,13 +60,13 @@ class MUI_PUBLIC MythEDID
float m_gamma { 0.0F }; // Invalid
bool m_sRGB { false };
bool m_likeSRGB { false }; // Temporary until Colourspace handling in libmythui
Primaries m_primaries { {{0.0F, 0.0F}, {0.0F, 0.0F}, {0.0F, 0.0F}}, {0.0F, 0.0F} };
Primaries m_primaries { {{{0.0F, 0.0F}, {0.0F, 0.0F}, {0.0F, 0.0F}}}, {0.0F, 0.0F} };
bool m_isHDMI { false };
uint16_t m_physicalAddress { 0 };
bool m_latencies { false };
bool m_interLatencies { false };
int m_audioLatency[2] { 0 };
int m_videoLatency[2] { 0 };
std::array<int,2> m_audioLatency { 0 };
std::array<int,2> m_videoLatency { 0 };
};

#endif // MYTHEDID_H