9 changes: 9 additions & 0 deletions mythplugins/mythnews/mythnews/mythnewseditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
#define MYTHNEWSEDITOR_H

// Qt headers
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QString>

// MythTV headers
Expand Down Expand Up @@ -30,7 +35,11 @@ class MythNewsEditor : public MythScreenType
bool keyPressEvent(QKeyEvent *event) override; // MythScreenType

private:
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_lock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_lock;
#endif
NewsSite *m_site {nullptr};
QString m_siteName;
bool m_editing;
Expand Down
8 changes: 8 additions & 0 deletions mythplugins/mythnews/mythnews/newssite.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
#include <QVariant>
#include <QObject>
#include <QString>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QUrl>

// MythNews headers
Expand Down Expand Up @@ -109,7 +113,11 @@ class NewsSite : public QObject
private:
~NewsSite() override;

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_lock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_lock;
#endif
QString m_name;
QString m_sortName;
QString m_url;
Expand Down
9 changes: 9 additions & 0 deletions mythplugins/mythzoneminder/mythzoneminder/zmclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,22 @@ class MPUBLIC ZMClient : public QObject
bool readData(unsigned char *data, int dataSize);
bool sendReceiveStringList(QStringList &strList);

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_listLock {QMutex::Recursive};
QMutex m_commandLock {QMutex::Recursive};
#else
QRecursiveMutex m_listLock;
QRecursiveMutex m_commandLock;
#endif
QList<Monitor*> m_monitorList;
QMap<int, Monitor*> m_monitorMap;

MythSocket *m_socket {nullptr};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_socketLock {QMutex::Recursive};
#else
QRecursiveMutex m_socketLock;
#endif
QString m_hostname {"localhost"};
uint m_port {6548};
bool m_bConnected {false};
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class AudioOutputBase : public AudioOutput, public MThread
std::chrono::milliseconds m_audbufTimecode {0ms};
AsyncLooseLock m_resetActive;

QMutex m_killAudioLock {QMutex::NonRecursive};
QMutex m_killAudioLock;

std::chrono::seconds m_currentSeconds {-1s};

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputnull.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AudioOutputNULL : public AudioOutputBase
AudioOutputSettings* GetOutputSettings(bool digital) override; // AudioOutputBase

private:
QMutex m_pcmOutputBufferMutex {QMutex::NonRecursive};
QMutex m_pcmOutputBufferMutex;
std::vector<unsigned char> m_pcmOutputBuffer {0};
};

Expand Down
5 changes: 4 additions & 1 deletion mythtv/libs/libmyth/libmyth.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include ( ../../settings.pro )

QT += network xml sql script widgets
QT += network xml sql widgets
contains(QT_MAJOR_VERSION, 5): QT += script
android: QT += androidextras

TEMPLATE = lib
Expand Down Expand Up @@ -51,6 +52,7 @@ HEADERS += remoteutil.h
HEADERS += rawsettingseditor.h
HEADERS += programinfo.h programinfoupdater.h
HEADERS += programtypes.h recordingtypes.h
HEADERS += programtypeflags.h
HEADERS += rssparse.h
HEADERS += guistartup.h

Expand Down Expand Up @@ -140,6 +142,7 @@ inc.files += mythexp.h storagegroupeditor.h
inc.files += mythterminal.h remoteutil.h
inc.files += programinfo.h
inc.files += programtypes.h recordingtypes.h
inc.files += programtypeflags.h
inc.files += rssparse.h
inc.files += standardsettings.h

Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmyth/mythmediamonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ void MediaMonitor::AttemptEject(MythMediaDevice *device)
*/
MediaMonitor::MediaMonitor(QObject* par, unsigned long interval, bool allowEject)
: QObject(par),
m_devicesLock(QMutex::Recursive),
m_monitorPollingInterval(interval),
m_allowEject(allowEject)
{
Expand Down Expand Up @@ -663,7 +662,7 @@ void MediaMonitor::RegisterMediaHandler(const QString &destination,
QString msg = MythMediaDevice::MediaTypeString((MythMediaType)mediaType);

if (!extensions.isEmpty())
msg += QString(", ext(%1)").arg(extensions, 0, 16);
msg += QString(", ext(%1)").arg(extensions);

LOG(VB_MEDIA, LOG_INFO,
"Registering '" + destination + "' as a media handler for " +
Expand Down
10 changes: 9 additions & 1 deletion mythtv/libs/libmyth/mythmediamonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

#include <QStringList>
#include <QPointer>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QWaitCondition>
#include <QList>
#include <QDateTime>
Expand Down Expand Up @@ -113,7 +117,11 @@ class MPUBLIC MediaMonitor : public QObject
bool showUsable = false);

protected:
QMutex m_devicesLock;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_devicesLock {QMutex::Recursive};
#else
QRecursiveMutex m_devicesLock;
#endif
QList<MythMediaDevice*> m_devices;
QList<MythMediaDevice*> m_removedDevices;
QMap<MythMediaDevice*, int> m_useCount;
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmyth/mythrssmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

#include <QObject>
#include <QMetaType>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QTimer>
#include <QDateTime>
#include <QByteArray>
Expand Down Expand Up @@ -88,7 +92,11 @@ class MPUBLIC RSSSite : public QObject
bool m_download;
QDateTime m_updated;

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_lock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_lock;
#endif
QByteArray m_data;
QString m_imageURL;
bool m_podcast {false};
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmyth/mythterminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#include <QObject>
#include <QString>
#include <QProcess>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif

// MythTV headers
#include "mythexp.h"
Expand Down Expand Up @@ -44,7 +48,11 @@ class MPUBLIC MythTerminal : public MythScreenType
~MythTerminal() override { TeardownAll(); }
void TeardownAll(void);

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_lock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_lock;
#endif
bool m_running {false};
QProcess *m_process {nullptr};
QString m_program;
Expand Down
11 changes: 11 additions & 0 deletions mythtv/libs/libmyth/netgrabbermanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include "mthread.h"
#include <QMetaType>
#include <QMutex>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif
#include <QTimer>

#include "rssparse.h"
Expand Down Expand Up @@ -54,7 +57,11 @@ class MPUBLIC GrabberScript : public QObject, public MThread
void parseDBTree(const QString &feedtitle, const QString &path,
const QString &pathThumb, QDomElement& domElem,
ArticleType type);
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_lock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_lock;
#endif

QString m_title;
QString m_image;
Expand Down Expand Up @@ -88,7 +95,11 @@ class MPUBLIC GrabberManager : public QObject

private:

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_lock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_lock;
#endif
QTimer *m_timer {nullptr};
GrabberScript::scriptList m_scripts;
std::chrono::hours m_updateFreq {24h};
Expand Down
8 changes: 6 additions & 2 deletions mythtv/libs/libmyth/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ class MPUBLIC OutputEvent : public MythEvent
delete m_errorMsg;
}

OutputEvent &operator=(const OutputEvent&) = delete;

const QString *errorMessage() const { return m_errorMsg; }

const std::chrono::seconds &elapsedSeconds() const { return m_elaspedSeconds; }
Expand Down Expand Up @@ -82,6 +80,12 @@ class MPUBLIC OutputEvent : public MythEvent
}
}

// No implicit copying.
public:
OutputEvent &operator=(const OutputEvent &other) = delete;
OutputEvent(OutputEvent &&) = delete;
OutputEvent &operator=(OutputEvent &&) = delete;

private:
QString *m_errorMsg {nullptr};

Expand Down
168 changes: 107 additions & 61 deletions mythtv/libs/libmyth/programinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ bool ProgramInfo::s_usingProgIDAuth = true;

const static uint kInvalidDateTime = UINT_MAX;

#define DEFINE_FLAGS_NAMES
#include "programtypeflags.h"
#undef DEFINE_FLAGS_NAMES

const QString ProgramInfo::kFromRecordedQuery =
"SELECT r.title, r.subtitle, r.description, "// 0-2
Expand Down Expand Up @@ -201,7 +204,9 @@ ProgramInfo::ProgramInfo(const ProgramInfo &other) :

m_findId(other.m_findId),
m_programFlags(other.m_programFlags),
m_properties(other.m_properties),
m_videoProperties(other.m_videoProperties),
m_audioProperties(other.m_audioProperties),
m_subtitleProperties(other.m_subtitleProperties),
m_year(other.m_year),
m_partNumber(other.m_partNumber),
m_partTotal(other.m_partTotal),
Expand Down Expand Up @@ -384,9 +389,9 @@ ProgramInfo::ProgramInfo(
m_findId(_findid),

m_programFlags(_programflags),
m_properties((_subtitleType << kSubtitlePropertyOffset) |
(_videoproperties << kVideoPropertyOffset) |
(_audioproperties << kAudioPropertyOffset)),
m_videoProperties(_videoproperties),
m_audioProperties(_audioproperties),
m_subtitleProperties(_subtitleType),
m_year(_year),
m_partNumber(_partnumber),
m_partTotal(_parttotal),
Expand Down Expand Up @@ -566,9 +571,9 @@ ProgramInfo::ProgramInfo(
m_recordId(_recordid),
m_findId(_findid),

m_properties((_subtitleType << kSubtitlePropertyOffset) |
(_videoproperties << kVideoPropertyOffset) |
(_audioproperties << kAudioPropertyOffset)),
m_videoProperties(_videoproperties),
m_audioProperties(_audioproperties),
m_subtitleProperties(_subtitleType),
m_year(_year),
m_partNumber(_partnumber),
m_partTotal(_parttotal),
Expand Down Expand Up @@ -912,7 +917,9 @@ void ProgramInfo::clone(const ProgramInfo &other,

m_findId = other.m_findId;
m_programFlags = other.m_programFlags;
m_properties = other.m_properties;
m_videoProperties = other.m_videoProperties;
m_audioProperties = other.m_audioProperties;
m_subtitleProperties= other.m_subtitleProperties;

if (!ignore_non_serialized_data)
{
Expand Down Expand Up @@ -997,7 +1004,9 @@ void ProgramInfo::clear(void)
m_findId = 0;

m_programFlags = FL_NONE;
m_properties = 0;
m_videoProperties = VID_UNKNOWN;
m_audioProperties = AUD_UNKNOWN;
m_subtitleProperties = SUB_UNKNOWN;

// everything below this line is not serialized
m_spread = -1;
Expand Down Expand Up @@ -1109,7 +1118,9 @@ bool ProgramInfo::operator==(const ProgramInfo& rhs)
return false;

if ((m_programFlags != rhs.m_programFlags) ||
(m_properties != rhs.m_properties) ||
(m_videoProperties != rhs.m_videoProperties) ||
(m_audioProperties != rhs.m_audioProperties) ||
(m_subtitleProperties != rhs.m_subtitleProperties) ||
(m_year != rhs.m_year) ||
(m_partNumber != rhs.m_partNumber) ||
(m_partTotal != rhs.m_partTotal))
Expand Down Expand Up @@ -1314,9 +1325,9 @@ void ProgramInfo::ToStringList(QStringList &list) const
INT_TO_LIST(m_recPriority2); // 39
INT_TO_LIST(m_parentId); // 40
STR_TO_LIST((!m_storageGroup.isEmpty()) ? m_storageGroup : "Default"); // 41
INT_TO_LIST(GetAudioProperties()); // 42
INT_TO_LIST(GetVideoProperties()); // 43
INT_TO_LIST(GetSubtitleType()); // 44
INT_TO_LIST(m_audioProperties); // 42
INT_TO_LIST(m_videoProperties); // 43
INT_TO_LIST(m_subtitleProperties); // 44

INT_TO_LIST(m_year); // 45
INT_TO_LIST(m_partNumber); // 46
Expand Down Expand Up @@ -1424,15 +1435,9 @@ bool ProgramInfo::FromStringList(QStringList::const_iterator &it,
INT_FROM_LIST(m_recPriority2); // 39
INT_FROM_LIST(m_parentId); // 40
STR_FROM_LIST(m_storageGroup); // 41
uint audioproperties = 0;
uint videoproperties = 0;
uint subtitleType = 0;
INT_FROM_LIST(audioproperties); // 42
INT_FROM_LIST(videoproperties); // 43
INT_FROM_LIST(subtitleType); // 44
m_properties = ((subtitleType << kSubtitlePropertyOffset) |
(videoproperties << kVideoPropertyOffset) |
(audioproperties << kAudioPropertyOffset));
INT_FROM_LIST(m_audioProperties); // 42
INT_FROM_LIST(m_videoProperties); // 43
INT_FROM_LIST(m_subtitleProperties);// 44

INT_FROM_LIST(m_year); // 45
INT_FROM_LIST(m_partNumber); // 46
Expand All @@ -1458,12 +1463,38 @@ bool ProgramInfo::FromStringList(QStringList::const_iterator &it,
return true;
}

template <typename T>
QString propsValueToString (const QString& name, QMap<T,QString> propNames, T props)
{
if (props == 0)
return propNames[0];

QStringList result;
for (uint i = 0; i < sizeof(T)*8 - 1; i++)
{
uint bit = 1<<i;
if ((props & bit) == 0)
continue;
if (propNames.contains(bit))
{
result += propNames[bit];
continue;
}
QString tmp = QString("0x%1").arg(bit, sizeof(T)*2,16,QChar('0'));
LOG(VB_GENERAL, LOG_ERR, QString("Unknown name for %1 flag 0x%2.")
.arg(name).arg(tmp));
result += tmp;
}
return result.join('|');
}

/** \brief Converts ProgramInfo into QString QHash containing each field
* in ProgramInfo converted into localized strings.
*/
void ProgramInfo::ToMap(InfoMap &progMap,
bool showrerecord,
uint star_range) const
uint star_range,
uint date_format) const
{
QLocale locale = gCoreContext->GetQLocale();
// NOTE: Format changes and relevant additions made here should be
Expand Down Expand Up @@ -1519,7 +1550,8 @@ void ProgramInfo::ToMap(InfoMap &progMap,
progMap["director"] = m_director;

progMap["callsign"] = m_chanSign;
progMap["commfree"] = (m_programFlags & FL_CHANCOMMFREE) ? 1 : 0;
progMap["commfree"] = QChar((m_programFlags & FL_CHANCOMMFREE) ? 1 : 0);
progMap["commfree_str"] = (m_programFlags & FL_CHANCOMMFREE) ? "1" : "0";
progMap["outputfilters"] = m_chanPlaybackFilters;
if (IsVideo())
{
Expand All @@ -1546,17 +1578,17 @@ void ProgramInfo::ToMap(InfoMap &progMap,
else // if (IsRecording())
{
using namespace MythDate;
progMap["starttime"] = MythDate::toString(m_startTs, kTime);
progMap["starttime"] = MythDate::toString(m_startTs, date_format | kTime);
progMap["startdate"] =
MythDate::toString(m_startTs, kDateFull | kSimplify);
progMap["shortstartdate"] = MythDate::toString(m_startTs, kDateShort);
progMap["endtime"] = MythDate::toString(m_endTs, kTime);
progMap["enddate"] = MythDate::toString(m_endTs, kDateFull | kSimplify);
progMap["shortenddate"] = MythDate::toString(m_endTs, kDateShort);
progMap["recstarttime"] = MythDate::toString(m_recStartTs, kTime);
progMap["recstartdate"] = MythDate::toString(m_recStartTs, kDateShort);
progMap["recendtime"] = MythDate::toString(m_recEndTs, kTime);
progMap["recenddate"] = MythDate::toString(m_recEndTs, kDateShort);
MythDate::toString(m_startTs, date_format | kDateFull | kSimplify);
progMap["shortstartdate"] = MythDate::toString(m_startTs, date_format | kDateShort);
progMap["endtime"] = MythDate::toString(m_endTs, date_format | kTime);
progMap["enddate"] = MythDate::toString(m_endTs, date_format | kDateFull | kSimplify);
progMap["shortenddate"] = MythDate::toString(m_endTs, date_format | kDateShort);
progMap["recstarttime"] = MythDate::toString(m_recStartTs, date_format | kTime);
progMap["recstartdate"] = MythDate::toString(m_recStartTs, date_format | kDateShort);
progMap["recendtime"] = MythDate::toString(m_recEndTs, date_format | kTime);
progMap["recenddate"] = MythDate::toString(m_recEndTs, date_format | kDateShort);
progMap["startts"] = QString::number(m_startTs.toSecsSinceEpoch());
progMap["endts"] = QString::number(m_endTs.toSecsSinceEpoch());
if (timeNow.toLocalTime().date().year() !=
Expand All @@ -1569,30 +1601,34 @@ void ProgramInfo::ToMap(InfoMap &progMap,

using namespace MythDate;
progMap["timedate"] =
MythDate::toString(m_recStartTs, kDateTimeFull | kSimplify) + " - " +
MythDate::toString(m_recEndTs, kTime);
MythDate::toString(m_recStartTs, date_format | kDateTimeFull | kSimplify) + " - " +
MythDate::toString(m_recEndTs, date_format | kTime);

progMap["shorttimedate"] =
MythDate::toString(m_recStartTs, kDateTimeShort | kSimplify) + " - " +
MythDate::toString(m_recEndTs, kTime);
MythDate::toString(m_recStartTs, date_format | kDateTimeShort | kSimplify) + " - " +
MythDate::toString(m_recEndTs, date_format | kTime);

progMap["starttimedate"] =
MythDate::toString(m_recStartTs, kDateTimeFull | kSimplify);
MythDate::toString(m_recStartTs, date_format | kDateTimeFull | kSimplify);

progMap["shortstarttimedate"] =
MythDate::toString(m_recStartTs, kDateTimeShort | kSimplify);
MythDate::toString(m_recStartTs, date_format | kDateTimeShort | kSimplify);

progMap["lastmodifiedtime"] = MythDate::toString(m_lastModified, kTime);
progMap["lastmodifiedtime"] = MythDate::toString(m_lastModified, date_format | kTime);
progMap["lastmodifieddate"] =
MythDate::toString(m_lastModified, kDateFull | kSimplify);
MythDate::toString(m_lastModified, date_format | kDateFull | kSimplify);
progMap["lastmodified"] =
MythDate::toString(m_lastModified, kDateTimeFull | kSimplify);
MythDate::toString(m_lastModified, date_format | kDateTimeFull | kSimplify);

if (m_recordedId)
progMap["recordedid"] = m_recordedId;
{
progMap["recordedid"] = QChar(m_recordedId);
progMap["recordedid_str"] = QString::number(m_recordedId);
}

progMap["channum"] = m_chanStr;
progMap["chanid"] = m_chanId;
progMap["chanid"] = QChar(m_chanId);
progMap["chanid_str"] = QString::number(m_chanId);
progMap["channame"] = m_chanName;
progMap["channel"] = ChannelText(channelFormat);
progMap["longchannel"] = ChannelText(longChannelFormat);
Expand Down Expand Up @@ -1624,6 +1660,8 @@ void ProgramInfo::ToMap(InfoMap &progMap,
progMap["lentime"] = QObject::tr("%n hour(s)","", hours);
}

// This is calling toChar from recordingtypes.cpp, not the QChar
// constructor.
progMap["rectypechar"] = toQChar(GetRecordingRuleType());
progMap["rectype"] = ::toString(GetRecordingRuleType());
QString tmp_rec = progMap["rectype"];
Expand Down Expand Up @@ -1659,8 +1697,10 @@ void ProgramInfo::ToMap(InfoMap &progMap,
progMap["inputname"] = m_inputName;
// Don't add bookmarkupdate to progMap, for now.

progMap["recpriority"] = m_recPriority;
progMap["recpriority2"] = m_recPriority2;
progMap["recpriority"] = QChar(m_recPriority);
progMap["recpriority2"] = QChar(m_recPriority2);
progMap["recpriority_str"] = QString::number(m_recPriority);
progMap["recpriority2_str"] = QString::number(m_recPriority2);
progMap["recordinggroup"] = (m_recGroup == "Default")
? QObject::tr("Default") : m_recGroup;
progMap["playgroup"] = m_playGroup;
Expand All @@ -1679,11 +1719,18 @@ void ProgramInfo::ToMap(InfoMap &progMap,
progMap["storagegroup"] = m_storageGroup;
}

progMap["programflags"] = m_programFlags;

progMap["audioproperties"] = GetAudioProperties();
progMap["videoproperties"] = GetVideoProperties();
progMap["subtitleType"] = GetSubtitleType();
progMap["programflags"] = QChar(m_programFlags);
progMap["audioproperties"] = QChar(m_audioProperties);
progMap["videoproperties"] = QChar(m_videoProperties);
progMap["subtitleType"] = QChar(m_subtitleProperties);
progMap["programflags_str"] = QString::number(m_programFlags);
progMap["audioproperties_str"] = QString::number(m_audioProperties);
progMap["videoproperties_str"] = QString::number(m_videoProperties);
progMap["subtitleType_str"] = QString::number(m_subtitleProperties);
progMap["programflags_names"] = propsValueToString("program", ProgramFlagNames, m_programFlags);
progMap["audioproperties_names"] = propsValueToString("audio", AudioPropsNames, m_audioProperties);
progMap["videoproperties_names"] = propsValueToString("video", VideoPropsNames, m_videoProperties);
progMap["subtitleType_names"] = propsValueToString("subtitle", SubtitlePropsNames, m_subtitleProperties);

progMap["recstatus"] = RecStatus::toString(GetRecordingStatus(),
GetRecordingRuleType());
Expand All @@ -1701,7 +1748,7 @@ void ProgramInfo::ToMap(InfoMap &progMap,
.arg(QObject::tr("Repeat"))
.arg(MythDate::toString(
m_originalAirDate,
MythDate::kDateFull | MythDate::kAddYear));
date_format | MythDate::kDateFull | MythDate::kAddYear));
}
}
else
Expand Down Expand Up @@ -1743,9 +1790,9 @@ void ProgramInfo::ToMap(InfoMap &progMap,
else
{
progMap["originalairdate"] = MythDate::toString(
m_originalAirDate, MythDate::kDateFull);
m_originalAirDate, date_format | MythDate::kDateFull);
progMap["shortoriginalairdate"] = MythDate::toString(
m_originalAirDate, MythDate::kDateShort);
m_originalAirDate, date_format | MythDate::kDateShort);
}

// 'mediatype' for a statetype, so untranslated
Expand Down Expand Up @@ -2044,9 +2091,9 @@ bool ProgramInfo::LoadProgramFromRecorded(
((m_programFlags & FL_REALLYEDITING) != 0U) ||
((m_programFlags & FL_COMMPROCESSING) != 0U));

m_properties = ((query.value(44).toUInt() << kSubtitlePropertyOffset) |
(query.value(43).toUInt() << kVideoPropertyOffset) |
(query.value(42).toUInt() << kAudioPropertyOffset));
m_audioProperties = query.value(42).toUInt();
m_videoProperties = query.value(43).toUInt();
m_subtitleProperties = query.value(44).toUInt();
// ancillary data -- end

if (m_originalAirDate.isValid() && m_originalAirDate < QDate(1895, 12, 28))
Expand Down Expand Up @@ -4672,11 +4719,10 @@ void ProgramInfo::SaveVideoProperties(uint mask, uint video_property_flags)
return;
}

uint videoproperties = GetVideoProperties();
uint videoproperties = m_videoProperties;
videoproperties &= ~mask;
videoproperties |= video_property_flags;
m_properties &= ~kVideoPropertyMask;
m_properties |= videoproperties << kVideoPropertyOffset;
m_videoProperties = videoproperties;

SendUpdateEvent();
}
Expand Down
17 changes: 8 additions & 9 deletions mythtv/libs/libmyth/programinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ class MPUBLIC ProgramInfo
void ToStringList(QStringList &list) const;
virtual void ToMap(InfoMap &progMap,
bool showrerecord = false,
uint star_range = 10) const;
uint star_range = 10,
uint date_format = 0) const;
virtual void SubstituteMatches(QString &str);

// Used for scheduling recordings
Expand Down Expand Up @@ -487,12 +488,9 @@ class MPUBLIC ProgramInfo
bool IsDeletePending(void) const
{ return (m_programFlags & FL_DELETEPENDING) != 0U; }

uint GetSubtitleType(void) const
{ return (m_properties&kSubtitlePropertyMask)>>kSubtitlePropertyOffset; }
uint GetVideoProperties(void) const
{ return (m_properties & kVideoPropertyMask) >> kVideoPropertyOffset; }
uint GetAudioProperties(void) const
{ return (m_properties & kAudioPropertyMask) >> kAudioPropertyOffset; }
uint GetSubtitleType(void) const { return m_subtitleProperties; }
uint GetVideoProperties(void) const { return m_videoProperties; }
uint GetAudioProperties(void) const { return m_audioProperties; }

enum Verbosity
{
Expand Down Expand Up @@ -795,8 +793,9 @@ class MPUBLIC ProgramInfo
uint32_t m_findId {0};

uint32_t m_programFlags {FL_NONE}; ///< ProgramFlag
/// SubtitleType,VideoProperty,AudioProperty
uint16_t m_properties {0};
VideoPropsType m_videoProperties {VID_UNKNOWN};
AudioPropsType m_audioProperties {AUD_UNKNOWN};
SubtitlePropsType m_subtitleProperties {SUB_UNKNOWN};
uint16_t m_year {0};
uint16_t m_partNumber {0};
uint16_t m_partTotal {0};
Expand Down
104 changes: 104 additions & 0 deletions mythtv/libs/libmyth/programtypeflags.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//
// Define flags/names for various ProgramInfo values.
//
// This file should be included once from programtypes.h with
// DEFINE_FLAGS_ENUM set to create the enums, and included again from
// programinfo.cpp with DEFINE_FLAGS_NAMES set to create the enum
// value to string mappings.
//
#undef FLAGS_PREAMBLE
#undef FLAGS_POSTAMBLE
#undef FLAGS_DATA

#ifdef DEFINE_FLAGS_ENUM
#define FLAGS_PREAMBLE(NAME, TYPE) \
enum NAME {
#define FLAGS_POSTAMBLE(NAME, TYPE) \
}; \
using NAME##Type = TYPE;
#define FLAGS_DATA(PREFIX, NAME, VALUE) \
PREFIX##_##NAME = (VALUE),
#endif

#ifdef DEFINE_FLAGS_NAMES
#define FLAGS_PREAMBLE(NAME, TYPE) \
static const QMap<TYPE,QString> NAME##Names {
#define FLAGS_POSTAMBLE(NAME, TYPE) \
};
#define FLAGS_DATA(PREFIX, NAME, VALUE) \
{ VALUE, #NAME },
#endif


/// If you change these please update:
/// mythplugins/mythweb/modules/tv/classes/Program.php
/// mythtv/bindings/perl/MythTV/Program.pm
/// (search for "Assign the program flags" in both)
FLAGS_PREAMBLE(ProgramFlag, uint32_t)
FLAGS_DATA(FL, NONE, 0x00000000)
FLAGS_DATA(FL, COMMFLAG, 0x00000001)
FLAGS_DATA(FL, CUTLIST, 0x00000002)
FLAGS_DATA(FL, AUTOEXP, 0x00000004)
FLAGS_DATA(FL, EDITING, 0x00000008)
FLAGS_DATA(FL, BOOKMARK, 0x00000010)
FLAGS_DATA(FL, REALLYEDITING, 0x00000020)
FLAGS_DATA(FL, COMMPROCESSING, 0x00000040)
FLAGS_DATA(FL, DELETEPENDING, 0x00000080)
FLAGS_DATA(FL, TRANSCODED, 0x00000100)
FLAGS_DATA(FL, WATCHED, 0x00000200)
FLAGS_DATA(FL, PRESERVED, 0x00000400)
FLAGS_DATA(FL, CHANCOMMFREE, 0x00000800)
FLAGS_DATA(FL, REPEAT, 0x00001000)
FLAGS_DATA(FL, DUPLICATE, 0x00002000)
FLAGS_DATA(FL, REACTIVATE, 0x00004000)
FLAGS_DATA(FL, IGNOREBOOKMARK, 0x00008000)
FLAGS_DATA(FL, IGNOREPROGSTART, 0x00010000)
FLAGS_DATA(FL, ALLOWLASTPLAYPOS, 0x00020000)
// if you move the type mask please edit {Set,Get}ProgramInfoType()
FLAGS_DATA(FL, TYPEMASK, 0x00F00000)
FLAGS_DATA(FL, INUSERECORDING, 0x01000000)
FLAGS_DATA(FL, INUSEPLAYING, 0x02000000)
FLAGS_DATA(FL, INUSEOTHER, 0x04000000)
FLAGS_POSTAMBLE(ProgramFlag, uint32_t)

/// if AudioProps changes, the audioprop column in program and
/// recordedprogram has to changed accordingly
// For backwards compatibility do not change 0 or 1
FLAGS_PREAMBLE(AudioProps, uint8_t)
FLAGS_DATA(AUD, UNKNOWN, 0x00)
FLAGS_DATA(AUD, STEREO, 0x01)
FLAGS_DATA(AUD, MONO, 0x02)
FLAGS_DATA(AUD, SURROUND, 0x04)
FLAGS_DATA(AUD, DOLBY, 0x08)
FLAGS_DATA(AUD, HARDHEAR, 0x10)
FLAGS_DATA(AUD, VISUALIMPAIR, 0x20)
FLAGS_POSTAMBLE(AudioProps, uint8_t)

/// if VideoProps changes, the videoprop column in program and
/// recordedprogram has to changed accordingly
// For backwards compatibility do not change 0 or 1
FLAGS_PREAMBLE(VideoProps, uint16_t)
FLAGS_DATA(VID, UNKNOWN, 0x000)
FLAGS_DATA(VID, WIDESCREEN, 0x001)
FLAGS_DATA(VID, HDTV, 0x002)
FLAGS_DATA(VID, MPEG2, 0x004)
FLAGS_DATA(VID, AVC, 0x008)
FLAGS_DATA(VID, HEVC, 0x010)
FLAGS_DATA(VID, 720, 0x020)
FLAGS_DATA(VID, 1080, 0x040)
FLAGS_DATA(VID, 4K, 0x080)
FLAGS_DATA(VID, 3DTV, 0x100)
FLAGS_DATA(VID, PROGRESSIVE, 0x200)
FLAGS_DATA(VID, DAMAGED, 0x400)
FLAGS_POSTAMBLE(VideoProps, uint16_t)

/// if SubtitleTypes changes, the subtitletypes column in program and
/// recordedprogram has to changed accordingly
// For backwards compatibility do not change 0 or 1
FLAGS_PREAMBLE(SubtitleProps, uint8_t)
FLAGS_DATA(SUB, UNKNOWN, 0x00)
FLAGS_DATA(SUB, HARDHEAR, 0x01)
FLAGS_DATA(SUB, NORMAL, 0x02)
FLAGS_DATA(SUB, ONSCREEN, 0x04)
FLAGS_DATA(SUB, SIGNED, 0x08)
FLAGS_POSTAMBLE(SubtitleProps, uint8_t)
84 changes: 3 additions & 81 deletions mythtv/libs/libmyth/programtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,36 +124,9 @@ enum TranscodingStatus {
TRANSCODING_RUNNING = 2
};

/// If you change these please update:
/// mythplugins/mythweb/modules/tv/classes/Program.php
/// mythtv/bindings/perl/MythTV/Program.pm
/// (search for "Assign the program flags" in both)
enum ProgramFlag {
FL_NONE = 0x00000000,
FL_COMMFLAG = 0x00000001,
FL_CUTLIST = 0x00000002,
FL_AUTOEXP = 0x00000004,
FL_EDITING = 0x00000008,
FL_BOOKMARK = 0x00000010,
FL_REALLYEDITING = 0x00000020,
FL_COMMPROCESSING = 0x00000040,
FL_DELETEPENDING = 0x00000080,
FL_TRANSCODED = 0x00000100,
FL_WATCHED = 0x00000200,
FL_PRESERVED = 0x00000400,
FL_CHANCOMMFREE = 0x00000800,
FL_REPEAT = 0x00001000,
FL_DUPLICATE = 0x00002000,
FL_REACTIVATE = 0x00004000,
FL_IGNOREBOOKMARK = 0x00008000,
FL_IGNOREPROGSTART = 0x00010000,
FL_ALLOWLASTPLAYPOS = 0x00020000,
// if you move the type mask please edit {Set,Get}ProgramInfoType()
FL_TYPEMASK = 0x00F00000,
FL_INUSERECORDING = 0x01000000,
FL_INUSEPLAYING = 0x02000000,
FL_INUSEOTHER = 0x04000000,
};
#define DEFINE_FLAGS_ENUM
#include "programtypeflags.h"
#undef DEFINE_FLAGS_ENUM

enum ProgramInfoType {
kProgramInfoTypeRecording = 0,
Expand All @@ -164,57 +137,6 @@ enum ProgramInfoType {
kProgramInfoTypeVideoBD,
};

/// if AudioProps changes, the audioprop column in program and
/// recordedprogram has to changed accordingly
enum AudioProps {
AUD_UNKNOWN = 0x00, // For backwards compatibility do not change 0 or 1
AUD_STEREO = 0x01,
AUD_MONO = 0x02,
AUD_SURROUND = 0x04,
AUD_DOLBY = 0x08,
AUD_HARDHEAR = 0x10,
AUD_VISUALIMPAIR = 0x20,
}; // has 6 bits in ProgramInfo::properties
#define kAudioPropertyBits 6
#define kAudioPropertyOffset 0
#define kAudioPropertyMask (0x3f<<kAudioPropertyOffset)

/// if VideoProps changes, the videoprop column in program and
/// recordedprogram has to changed accordingly
enum VideoProps {
// For backwards compatibility do not change 0 or 1
VID_UNKNOWN = 0x000,
VID_WIDESCREEN = 0x001,
VID_HDTV = 0x002,
VID_MPEG2 = 0x004,
VID_AVC = 0x008,
VID_HEVC = 0x010,
VID_720 = 0x020,
VID_1080 = 0x040,
VID_4K = 0x080,
VID_3DTV = 0x100,
VID_PROGRESSIVE = 0x200,
VID_DAMAGED = 0x400,
}; // has 11 bits in ProgramInfo::properties
#define kVideoPropertyBits 11
#define kVideoPropertyOffset kAudioPropertyBits
#define kVideoPropertyMask (0x7ff<<kVideoPropertyOffset)

/// if SubtitleTypes changes, the subtitletypes column in program and
/// recordedprogram has to changed accordingly
enum SubtitleType {
// For backwards compatibility do not change 0 or 1
SUB_UNKNOWN = 0x00,
SUB_HARDHEAR = 0x01,
SUB_NORMAL = 0x02,
SUB_ONSCREEN = 0x04,
SUB_SIGNED = 0x08
}; // has 4 bits in ProgramInfo::properties
#define kSubtitlePropertyBits 4
#define kSubtitlePropertyOffset (kAudioPropertyBits+kVideoPropertyBits)
#define kSubtitlePropertyMask (0x0f<<kSubtitlePropertyOffset)


enum AvailableStatusType {
asAvailable = 0,
asNotYetAvailable,
Expand Down
12 changes: 8 additions & 4 deletions mythtv/libs/libmyth/rssparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
#include "programinfo.h" // for format_season_and_episode()
#include "mythsorthelper.h"

#if QT_VERSION < QT_VERSION_CHECK(5,15,2)
#define capturedView capturedRef
#endif

ResultItem::ResultItem(const QString& title, const QString& sortTitle,
const QString& subtitle, const QString& sortSubtitle,
const QString& desc, const QString& URL,
Expand Down Expand Up @@ -1080,7 +1084,7 @@ QDateTime Parse::FromRFC3339(const QString& t)
if (match.hasMatch())
{
bool ok = false;
int fractional = match.capturedRef(1).toInt(&ok);
int fractional = match.capturedView(1).toInt(&ok);
if (ok)
{
if (fractional < 100)
Expand All @@ -1095,10 +1099,10 @@ QDateTime Parse::FromRFC3339(const QString& t)
if (match.hasMatch())
{
short int multiplier = -1;
if (match.capturedRef(1) == "-")
if (match.captured(1) == "-")
multiplier = 1;
int hoursShift = match.capturedRef(2).toInt();
int minutesShift = match.capturedRef(3).toInt();
int hoursShift = match.capturedView(2).toInt();
int minutesShift = match.capturedView(3).toInt();
result = result.addSecs(hoursShift * 3600 * multiplier + minutesShift * 60 * multiplier);
}
result.setTimeSpec(Qt::UTC);
Expand Down
322 changes: 306 additions & 16 deletions mythtv/libs/libmyth/test/test_programinfo/test_programinfo.h

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions mythtv/libs/libmythbase/bonjourregister.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ class MBASE_PUBLIC BonjourRegister : public QObject

DNSServiceRef m_dnssref {nullptr};
QSocketNotifier *m_socket {nullptr};
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QMutexLocker *m_lock {nullptr};
#else
QMutexLocker<QMutex> *m_lock {nullptr};
#endif
static QMutex g_lock;
QByteArray m_data;
};
Expand Down
10 changes: 7 additions & 3 deletions mythtv/libs/libmythbase/dbutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

#define LOC QString("DBUtil: ")

#if QT_VERSION < QT_VERSION_CHECK(5,15,2)
#define capturedView capturedRef
#endif

const int DBUtil::kUnknownVersionNumber = INT_MIN;

/** \fn DBUtil::GetDBMSVersion(void)
Expand Down Expand Up @@ -787,9 +791,9 @@ bool DBUtil::ParseDBMSVersion()

// If any of these wasn't matched, the captured string will be
// empty and toInt will parse it as a zero.
m_versionMajor = match.capturedRef(1).toInt(nullptr);
m_versionMinor = match.capturedRef(2).toInt(nullptr);
m_versionPoint = match.capturedRef(3).toInt(nullptr);
m_versionMajor = match.capturedView(1).toInt(nullptr);
m_versionMinor = match.capturedView(2).toInt(nullptr);
m_versionPoint = match.capturedView(3).toInt(nullptr);

return m_versionMajor > -1;
}
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythbase/iso639.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <QMap>
#include <QString>

class QStringList;

#include "mythbaseexp.h"

extern MBASE_PUBLIC QMap<int, QString> iso639_key_to_english_name;
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythbase/lcddevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include <QTextStream>
#include <QTextCodec>
#include <QByteArray>
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
#include <QStringConverter>
#endif
#include <QTcpSocket>
#include <QTimer>

Expand Down Expand Up @@ -212,7 +215,11 @@ void LCD::sendToServerSlot(const QString &someText)
}

QTextStream os(m_socket);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
os.setCodec(QTextCodec::codecForName("ISO 8859-1"));
#else
os.setEncoding(QStringConverter::Latin1);
#endif

m_lastCommand = someText;

Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythbase/lcddevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

// Qt headers
#include <QList>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QObject>
#include <QStringList>

Expand Down Expand Up @@ -316,7 +320,11 @@ class MBASE_PUBLIC LCD : public QObject

private:
QTcpSocket *m_socket {nullptr};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_socketLock {QMutex::Recursive};
#else
QRecursiveMutex m_socketLock;
#endif
QString m_hostname {"localhost"};
uint m_port {6545};
bool m_connected {false};
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythbase/mthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

#include <climits>

#include <QRunnable>
#include <QThread>

#include "mythbaseexp.h"
#include "mythchrono.h"

class MThreadInternal;
class QStringList;
class QRunnable;
class MThread;

/// Use this to determine if you are in the named thread.
Expand Down
11 changes: 11 additions & 0 deletions mythtv/libs/libmythbase/mthreadpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
#include <QMutexLocker>
#include <QPair>
#include <QRunnable>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif
#include <QSet>
#include <QWaitCondition>
#include <utility>
Expand Down Expand Up @@ -233,12 +236,20 @@ class MThreadPoolPrivate
QSet<MPoolThread*> m_runningThreads;
QList<MPoolThread*> m_deleteThreads;

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex s_pool_lock;
#else
static QRecursiveMutex s_pool_lock;
#endif
static MThreadPool *s_pool;
static QList<MThreadPool*> s_all_pools;
};

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex MThreadPoolPrivate::s_pool_lock(QMutex::Recursive);
#else
QRecursiveMutex MThreadPoolPrivate::s_pool_lock;
#endif
MThreadPool *MThreadPoolPrivate::s_pool = nullptr;
QList<MThreadPool*> MThreadPoolPrivate::s_all_pools;

Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythbase/mythbinaryplist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

// Qt
#include <QDateTime>
#include <QSequentialIterable>
#include <QTextStream>
#include <QBuffer>

Expand Down
9 changes: 7 additions & 2 deletions mythtv/libs/libmythbase/mythcorecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ MythCoreContextPrivate::MythCoreContextPrivate(MythCoreContext *lparent,
m_guiContext(guicontext),
m_guiObject(nullptr),
m_appBinaryVersion(std::move(binversion)),
m_sockLock(QMutex::NonRecursive),
m_serverSock(nullptr),
m_eventSock(nullptr),
m_wolInProgress(false),
Expand All @@ -159,7 +158,13 @@ MythCoreContextPrivate::MythCoreContextPrivate(MythCoreContext *lparent,
#endif
}

static void delete_sock(QMutexLocker &locker, MythSocket **s)
static void delete_sock(
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QMutexLocker &locker,
#else
QMutexLocker<QMutex> &locker,
#endif
MythSocket **s)
{
if (*s)
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythdownloadmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ bool MythDownloadManager::downloadNowLinkLocal(MythDownloadInfo *dlInfo, bool de
QByteArray requestMessage;
QString path (url.path());
requestMessage.append("POST ");
requestMessage.append(path);
requestMessage.append(path.toLatin1());
requestMessage.append(" HTTP/1.1\r\n");
QHashIterator<QByteArray, QByteArray> it(headers);
while (it.hasNext())
Expand Down
14 changes: 13 additions & 1 deletion mythtv/libs/libmythbase/mythdownloadmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#include <QNetworkDiskCache>
#include <QNetworkProxy>
#include <QNetworkReply>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif
#include <QString>
#include <QTimer>
#include <QWaitCondition>
Expand Down Expand Up @@ -54,7 +57,12 @@ class MBASE_PUBLIC MythDownloadManager : public QObject, public MThread
*/
MythDownloadManager()
: MThread("DownloadManager"),
m_infoLock(new QMutex(QMutex::Recursive)) {}
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
m_infoLock(new QMutex(QMutex::Recursive))
#else
m_infoLock(new QRecursiveMutex())
#endif
{}

~MythDownloadManager() override;

Expand Down Expand Up @@ -161,7 +169,11 @@ class MBASE_PUBLIC MythDownloadManager : public QObject, public MThread
QWaitCondition m_queueWaitCond;
QMutex m_queueWaitLock;

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex *m_infoLock {nullptr};
#else
QRecursiveMutex *m_infoLock {nullptr};
#endif
QMap <QString, MythDownloadInfo*> m_downloadInfos;
QMap <QNetworkReply*, MythDownloadInfo*> m_downloadReplies;
QList <MythDownloadInfo*> m_downloadQueue;
Expand Down
13 changes: 13 additions & 0 deletions mythtv/libs/libmythbase/mythevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ class MBASE_PUBLIC MythEvent : public QEvent
const QStringList& ExtraDataList() const { return m_extradata; }
int ExtraDataCount() const { return m_extradata.size(); }

#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
virtual MythEvent *clone() const
{ return new MythEvent(m_message, m_extradata); }
#else
MythEvent *clone() const override
{ return new MythEvent(type(), m_message, m_extradata); }
#endif

static Type MythEventMessage;
static Type MythUserMessage;
Expand All @@ -83,6 +88,14 @@ class MBASE_PUBLIC MythEvent : public QEvent
static Type kDisableUDPListenerEventType;
static Type kEnableUDPListenerEventType;

// No implicit copying.
protected:
MythEvent(const MythEvent &other) = default;
MythEvent &operator=(const MythEvent &other) = default;
public:
MythEvent(MythEvent &&) = delete;
MythEvent &operator=(MythEvent &&) = delete;

protected:
QString m_message;
QStringList m_extradata;
Expand Down
8 changes: 7 additions & 1 deletion mythtv/libs/libmythbase/mythmiscutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ bool getMemStats(int &totalMB, int &freeMB, int &totalVM, int &freeVM)
loadArray getLoadAvgs (void)
{
#if !defined(_WIN32) && !defined(Q_OS_ANDROID)
loadArray loads;
loadArray loads {};
if (getloadavg(loads.data(), loads.size()) != -1)
return loads;
#endif
Expand Down Expand Up @@ -1110,9 +1110,15 @@ int naturalCompare(const QString &_a, const QString &_b, Qt::CaseSensitivity cas
}

// compare these sequences
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
const QStringRef& subA(a.midRef(begSeqA - a.unicode(), currA - begSeqA));
const QStringRef& subB(b.midRef(begSeqB - b.unicode(), currB - begSeqB));
const int cmp = QStringRef::localeAwareCompare(subA, subB);
#else
const QString& subA(a.sliced(begSeqA - a.unicode(), currA - begSeqA));
const QString& subB(b.sliced(begSeqB - b.unicode(), currB - begSeqB));
const int cmp = QString::localeAwareCompare(subA, subB);
#endif

if (cmp != 0)
{
Expand Down
3 changes: 0 additions & 3 deletions mythtv/libs/libmythbase/mythmiscutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
#include "mythbaseexp.h"
#include "mythsystem.h"

class QStringList;
class QFile;

#if QT_VERSION < QT_VERSION_CHECK(5,10,0)
#include <QtGlobal>
#else
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythbase/mythpower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

#define LOC QString("Power: ")

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex MythPower::s_lock(QMutex::Recursive);
#else
QRecursiveMutex MythPower::s_lock;
#endif

/*! \class MythPower
*
Expand Down
9 changes: 9 additions & 0 deletions mythtv/libs/libmythbase/mythpower.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
#define MYTHPOWER_H

// Qt
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QObject>
#include <QDateTime>
#include <QTimer>
Expand Down Expand Up @@ -72,7 +77,11 @@ class MBASE_PUBLIC MythPower : public QObject, public ReferenceCounter
virtual void Refresh (void) { }

protected:
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex s_lock;
#else
static QRecursiveMutex s_lock;
#endif

MythPower();
~MythPower() override = default;
Expand Down
4 changes: 1 addition & 3 deletions mythtv/libs/libmythbase/mythsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define MYTHSYSTEM_H_

// Qt headers
#include <QIODevice>
#include <QString>

// MythTV headers
Expand Down Expand Up @@ -67,9 +68,6 @@ enum MythSignal {
kSignalStop,
};

class QStringList;
class QIODevice;

/** \brief class for managing sub-processes.
*
* This is a hopefully simple interface for managing sub-processes.
Expand Down
4 changes: 0 additions & 4 deletions mythtv/libs/libmythbase/mythsystemprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
#include "mythbaseexp.h"
#include "mythsystemlegacy.h"

class QStringList;
class QString;
class QBuffer;

// FIXME: do we really need reference counting?
// it shouldn't be difficult to track the lifetime of a private object.
// FIXME: This should not live in the same header as MythSystemLegacy
Expand Down
32 changes: 29 additions & 3 deletions mythtv/libs/libmythbase/mythsystemunix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ void MythSystemLegacyIOHandler::run(void)
}
else if( retval > 0 )
{
#if QT_VERSION < QT_VERSION_CHECK(5,10,0)
PMap_t::iterator i;
PMap_t::iterator next;
for( i = m_pMap.begin(); i != m_pMap.end(); i = next )
Expand All @@ -136,6 +137,21 @@ void MythSystemLegacyIOHandler::run(void)
HandleWrite(i.key(), i.value());
}
}
#else
auto it = m_pMap.keyValueBegin();
while (it != m_pMap.keyValueEnd())
{
auto [fd, buffer] = *it;
++it;
if( FD_ISSET(fd, &fds) )
{
if( m_read )
HandleRead(fd, buffer);
else
HandleWrite(fd, buffer);
}
}
#endif
}
m_pLock.unlock();
}
Expand Down Expand Up @@ -378,11 +394,21 @@ void MythSystemLegacyManager::run(void)

m_mapLock.lock();
m_jumpLock.lock();
#if QT_VERSION < QT_VERSION_CHECK(5,10,0)
for( i = m_pMap.begin(); i != m_pMap.end(); i = next )
#else
auto it = m_pMap.keyValueBegin();
while (it != m_pMap.keyValueEnd())
#endif
{
#if QT_VERSION < QT_VERSION_CHECK(5,10,0)
next = i + 1;
pid = i.key();
auto pid2 = i.key();
MythSystemLegacyUnix *ms = i.value();
#else
auto [pid2, ms] = *it;
++it;
#endif
if (!ms)
continue;

Expand All @@ -394,7 +420,7 @@ void MythSystemLegacyManager::run(void)
{
LOG(VB_SYSTEM, LOG_INFO,
QString("Managed child (PID: %1) timed out"
", issuing KILL signal").arg(pid));
", issuing KILL signal").arg(pid2));
// Prevent constant attempts to kill an obstinate child
ms->m_timeout = SystemTime(0s);
ms->Signal(SIGKILL);
Expand All @@ -405,7 +431,7 @@ void MythSystemLegacyManager::run(void)
{
LOG(VB_SYSTEM, LOG_INFO,
QString("Managed child (PID: %1) timed out"
", issuing TERM signal").arg(pid));
", issuing TERM signal").arg(pid2));
ms->SetStatus( GENERIC_EXIT_TIMEOUT );
ms->m_timeout = now + 1s;
ms->Term();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/remotefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class MBASE_PUBLIC RemoteFile
bool m_canResume {false};
int m_recorderNum {0};

mutable QMutex m_lock {QMutex::NonRecursive};
mutable QMutex m_lock;
MythSocket *m_controlSock {nullptr};
MythSocket *m_sock {nullptr};
QString m_query {"QUERY_FILETRANSFER %1"};
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/storagegroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ QStringList StorageGroup::GetFileInfo(const QString &lfilename)
if (fInfo.lastModified().isValid()) {
details << QString("%1").arg(fInfo.lastModified().toSecsSinceEpoch());
} else {
details << QString(UINT_MAX);
details << QString::number(UINT_MAX);
}
details << QString("%1").arg(fInfo.size());
}
Expand Down
3 changes: 0 additions & 3 deletions mythtv/libs/libmythbase/unzip.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ class UnzipPrivate;
class QIODevice;
class QFile;
class QDir;
class QStringList;
class QString;


class MBASE_PUBLIC UnZip
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythfreemheg/Programs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void MHResidentProgram::CallProgram(bool fIsFork, const MHObjectRef &success, co

for (int i = 0; i < format.Size(); i++)
{
unsigned char ch = format.GetAt(i);
char ch = format.GetAt(i);
QString buffer {};

if (ch == '%')
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythmetadata/bluraymetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include "mythmetaexp.h"
#include "libbluray/bluray.h"

class QStringList;

using BlurayTitles = QList< QPair < uint,QString > >;

struct meta_dl;
Expand Down
12 changes: 8 additions & 4 deletions mythtv/libs/libmythmetadata/lyricsdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
// libmythmetadata
#include "lyricsdata.h"

#if QT_VERSION < QT_VERSION_CHECK(5,15,2)
#define capturedView capturedRef
#endif

static const QRegularExpression kTimeCode { R"(^(\[(\d\d):(\d\d)(?:\.(\d\d))?\])(.*))" };

/*************************************************************************/
Expand Down Expand Up @@ -311,7 +315,7 @@ void LyricsData::setLyrics(const QStringList &lyrics)
static const QRegularExpression kOffset { R"(^\[offset:(.+)\])" };
auto match = kOffset.match(lyric);
if (match.hasMatch())
offset = std::chrono::milliseconds(match.capturedRef(1).toInt());
offset = std::chrono::milliseconds(match.capturedView(1).toInt());

if (m_syncronized)
{
Expand All @@ -321,9 +325,9 @@ void LyricsData::setLyrics(const QStringList &lyrics)
match = kTimeCode.match(lyric);
if (match.hasMatch())
{
int minutes = match.capturedRef(2).toInt();
int seconds = match.capturedRef(3).toInt();
int hundredths = match.capturedRef(4).toInt();
int minutes = match.capturedView(2).toInt();
int seconds = match.capturedView(3).toInt();
int hundredths = match.capturedView(4).toInt();

line->m_lyric = match.captured(5).trimmed();
line->m_time = millisecondsFromParts(0, minutes, seconds, hundredths * 10);
Expand Down
12 changes: 6 additions & 6 deletions mythtv/libs/libmythmetadata/musicutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,21 @@ QString filenameFromMetadata(MusicMetadata *track)
{
filename += match.captured(1);

if ((match.capturedRef(2) == "GENRE") &&
if ((match.captured(2) == "GENRE") &&
(!track->Genre().isEmpty()))
filename += fixFilename(track->Genre());
else if ((match.capturedRef(2) == "ARTIST") &&
else if ((match.captured(2) == "ARTIST") &&
(!track->FormatArtist().isEmpty()))
filename += fixFilename(track->FormatArtist());
else if ((match.capturedRef(2) == "ALBUM") &&
else if ((match.captured(2) == "ALBUM") &&
(!track->Album().isEmpty()))
filename += fixFilename(track->Album());
else if ((match.capturedRef(2) == "TRACK") && (track->Track() >= 0))
else if ((match.captured(2) == "TRACK") && (track->Track() >= 0))
filename += fixFilename(QString("%1").arg(track->Track(), 2,10,QChar('0')));
else if ((match.capturedRef(2) == "TITLE") &&
else if ((match.captured(2) == "TITLE") &&
(!track->FormatTitle().isEmpty()))
filename += fixFilename(track->FormatTitle());
else if ((match.capturedRef(2) == "YEAR") && (track->Year() >= 0))
else if ((match.captured(2) == "YEAR") && (track->Year() >= 0))
filename += fixFilename(QString::number(track->Year(), 10));
fntempl.remove(0, match.capturedLength());
match = rx.match(fntempl);
Expand Down
6 changes: 5 additions & 1 deletion mythtv/libs/libmythmetadata/videometadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "programinfo.h" // for format_season_and_episode
#include "mythsorthelper.h"

#if QT_VERSION < QT_VERSION_CHECK(5,15,2)
#define capturedView capturedRef
#endif

class VideoMetadataImp
{
public:
Expand Down Expand Up @@ -1116,7 +1120,7 @@ QString VideoMetadata::FilenameToMeta(const QString &file_name, int position)
if (match.hasMatch())
{
// Return requested value
if (position == 1 && !match.capturedRef(1).isEmpty())
if (position == 1 && !match.capturedView(1).isEmpty())
{
// Clean up the title
QString title = match.captured(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class FileTransfer : public SocketHandler

std::vector<char> m_requestBuffer;

QMutex m_lock {QMutex::NonRecursive};
QMutex m_lock;

bool m_writemode {false};
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include ( ../../settings.pro )

QT += script
contains(QT_MAJOR_VERSION, 5): QT += script

TEMPLATE = lib
TARGET = mythservicecontracts-$$LIBVERSION
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythservicecontracts/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void* Service::ConvertToParameterPtr( int nTypeId,

case QMetaType::Char : *(( char *)pParam) = ( sValue.length() > 0) ? sValue.at( 0 ).toLatin1() : 0; break;
case QMetaType::UChar : *(( unsigned char *)pParam) = ( sValue.length() > 0) ? sValue.at( 0 ).toLatin1() : 0; break;
case QMetaType::QChar : *(( QChar *)pParam) = ( sValue.length() > 0) ? sValue.at( 0 ) : 0; break;
case QMetaType::QChar : *(( QChar *)pParam) = ( sValue.length() > 0) ? sValue.at( 0 ) : QChar(0); break;

case QMetaType::Short : *(( short *)pParam) = sValue.toShort (); break;
case QMetaType::UShort : *(( ushort *)pParam) = sValue.toUShort (); break;
Expand Down
31 changes: 23 additions & 8 deletions mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <QCoreApplication>
#include <QKeyEvent>
#include <QCryptographicHash>
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
#include <QStringConverter>
#endif
#include <QTimer>
#include <QUrlQuery>

Expand All @@ -30,7 +33,11 @@

MythAirplayServer* MythAirplayServer::gMythAirplayServer = nullptr;
MThread* MythAirplayServer::gMythAirplayServerThread = nullptr;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex* MythAirplayServer::gMythAirplayServerMutex = new QMutex(QMutex::Recursive);
#else
QRecursiveMutex* MythAirplayServer::gMythAirplayServerMutex = new QRecursiveMutex();
#endif

#define LOC QString("AirPlay: ")

Expand Down Expand Up @@ -482,10 +489,10 @@ void MythAirplayServer::Start(void)

QByteArray name = m_name.toUtf8();
name.append(" on ");
name.append(gCoreContext->GetHostName());
name.append(gCoreContext->GetHostName().toUtf8());
QByteArray type = "_airplay._tcp";
QByteArray txt;
txt.append(26); txt.append("deviceid="); txt.append(GetMacAddress());
txt.append(26); txt.append("deviceid="); txt.append(GetMacAddress().toUtf8());
// supposed to be: 0: video, 1:Phone, 3: Volume Control, 4: HLS
// 9: Audio, 10: ? (but important without it it fails) 11: Audio redundant
txt.append(13); txt.append("features=0xF7");
Expand Down Expand Up @@ -982,15 +989,19 @@ void MythAirplayServer::SendResponse(QTcpSocket *socket,
socket->state() != QAbstractSocket::ConnectedState)
return;
QTextStream response(socket);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
response.setCodec("UTF-8");
#else
response.setEncoding(QStringConverter::Utf8);
#endif
QByteArray reply;
reply.append("HTTP/1.1 ");
reply.append(QString::number(status));
reply.append(QString::number(status).toUtf8());
reply.append(" ");
reply.append(StatusToString(status));
reply.append("\r\n");
reply.append("DATE: ");
reply.append(MythDate::current().toString("ddd, d MMM yyyy hh:mm:ss"));
reply.append(MythDate::current().toString("ddd, d MMM yyyy hh:mm:ss").toUtf8());
reply.append(" GMT\r\n");
if (!header.isEmpty())
reply.append(header);
Expand All @@ -1000,7 +1011,7 @@ void MythAirplayServer::SendResponse(QTcpSocket *socket,
reply.append("Content-Type: ");
reply.append(content_type);
reply.append("Content-Length: ");
reply.append(QString::number(body.size()));
reply.append(QString::number(body.size()).toUtf8());
}
else
{
Expand All @@ -1009,7 +1020,7 @@ void MythAirplayServer::SendResponse(QTcpSocket *socket,
reply.append("\r\n\r\n");

if (!body.isEmpty())
reply.append(body);
reply.append(body.toUtf8());

response << reply;
response.flush();
Expand Down Expand Up @@ -1040,18 +1051,22 @@ bool MythAirplayServer::SendReverseEvent(QByteArray &session,

m_connections[session].m_lastEvent = event;
QTextStream response(m_connections[session].m_reverseSocket);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
response.setCodec("UTF-8");
#else
response.setEncoding(QStringConverter::Utf8);
#endif
QByteArray reply;
reply.append("POST /event HTTP/1.1\r\n");
reply.append("Content-Type: text/x-apple-plist+xml\r\n");
reply.append("Content-Length: ");
reply.append(QString::number(body.size()));
reply.append(QString::number(body.size()).toUtf8());
reply.append("\r\n");
reply.append("x-apple-session-id: ");
reply.append(session);
reply.append("\r\n\r\n");
if (!body.isEmpty())
reply.append(body);
reply.append(body.toUtf8());

response << reply;
response.flush();
Expand Down
23 changes: 20 additions & 3 deletions mythtv/libs/libmythtv/AirPlay/mythairplayserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
#define MYTHAIRPLAYSERVER_H

#include <QObject>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QUrl>
#include <cstdint> // for uintxx_t

#include "serverpool.h"
#include "mythtvexp.h"
#include "mythmainwindow.h"

class QMutex;
class QTimer;
class MThread;
class BonjourRegister;
Expand Down Expand Up @@ -74,8 +78,13 @@ class MTV_PUBLIC MythAirplayServer : public ServerPool
static MythAirplayServer *AirplaySharedInstance(void)
{ return gMythAirplayServer; }

MythAirplayServer()
: m_lock(new QMutex(QMutex::Recursive)) {}
MythAirplayServer() :
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
m_lock(new QMutex(QMutex::Recursive))
#else
m_lock(new QRecursiveMutex())
#endif
{}

private slots:
void Start();
Expand Down Expand Up @@ -112,14 +121,22 @@ class MTV_PUBLIC MythAirplayServer : public ServerPool

// Globals
static MythAirplayServer *gMythAirplayServer;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex *gMythAirplayServerMutex;
#else
static QRecursiveMutex *gMythAirplayServerMutex;
#endif
static MThread *gMythAirplayServerThread;

// Members
QString m_name {"MythTV"};
BonjourRegister *m_bonjour {nullptr};
bool m_valid {false};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex *m_lock {nullptr};
#else
QRecursiveMutex *m_lock {nullptr};
#endif
int m_setupPort {5100};
QList<QTcpSocket*> m_sockets;
QHash<QByteArray,AirplayConnection> m_connections;
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include <QTextStream>
#include <QTimer>
#include <QtEndian>
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
#include <QStringConverter>
#endif

#include "mythlogging.h"
#include "mythcorecontext.h"
Expand Down Expand Up @@ -177,7 +180,11 @@ bool MythRAOPConnection::Init(void)
{
// connect up the request socket
m_textStream = new RaopNetStream(m_socket);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
m_textStream->setCodec("UTF-8");
#else
m_textStream->setEncoding(QStringConverter::Utf8);
#endif
if (!connect(m_socket, &QIODevice::readyRead, this, &MythRAOPConnection::readClient))
{
LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to connect client socket signal.");
Expand Down
12 changes: 10 additions & 2 deletions mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

MythRAOPDevice *MythRAOPDevice::gMythRAOPDevice = nullptr;
MThread *MythRAOPDevice::gMythRAOPDeviceThread = nullptr;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex *MythRAOPDevice::gMythRAOPDeviceMutex = new QMutex(QMutex::Recursive);
#else
QRecursiveMutex *MythRAOPDevice::gMythRAOPDeviceMutex = new QRecursiveMutex();
#endif

#define LOC QString("RAOP Device: ")

Expand Down Expand Up @@ -85,7 +89,11 @@ void MythRAOPDevice::Cleanup(void)
}

MythRAOPDevice::MythRAOPDevice()
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
: m_lock(new QMutex(QMutex::Recursive))
#else
: m_lock(new QRecursiveMutex())
#endif
{
m_hardwareId = QByteArray::fromHex(AirPlayHardwareId().toLatin1());
}
Expand Down Expand Up @@ -163,9 +171,9 @@ bool MythRAOPDevice::RegisterForBonjour(void)

QByteArray name = m_hardwareId.toHex();
name.append("@");
name.append(m_name);
name.append(m_name.toUtf8());
name.append(" on ");
name.append(gCoreContext->GetHostName());
name.append(gCoreContext->GetHostName().toUtf8());
QByteArray type = "_raop._tcp";
QByteArray txt;
txt.append(6); txt.append("tp=UDP");
Expand Down
14 changes: 13 additions & 1 deletion mythtv/libs/libmythtv/AirPlay/mythraopdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
#define MYTHRAOPDEVICE_H

#include <QObject>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif

#include "serverpool.h"
#include "mythtvexp.h"

class QMutex;
class MThread;
class BonjourRegister;
class MythRAOPConnection;
Expand Down Expand Up @@ -41,15 +45,23 @@ class MTV_PUBLIC MythRAOPDevice : public ServerPool

// Globals
static MythRAOPDevice *gMythRAOPDevice;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex *gMythRAOPDeviceMutex;
#else
static QRecursiveMutex *gMythRAOPDeviceMutex;
#endif
static MThread *gMythRAOPDeviceThread;

// Members
QString m_name {"MythTV"};
QByteArray m_hardwareId;
BonjourRegister *m_bonjour {nullptr};
bool m_valid {false};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex *m_lock {nullptr};
#else
QRecursiveMutex *m_lock {nullptr};
#endif
int m_setupPort {5000};
int m_basePort {0};
QList<MythRAOPConnection*> m_clients;
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/Bluray/mythbdbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ class MTV_PUBLIC MythBDBuffer : public MythOpticalBuffer
int64_t m_timeDiff { 0 };
QHash<uint32_t,BLURAY_TITLE_INFO*> m_cachedTitleInfo;
QHash<uint32_t,BLURAY_TITLE_INFO*> m_cachedPlaylistInfo;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_infoLock { QMutex::Recursive };
#else
QRecursiveMutex m_infoLock;
#endif
QThread *m_mainThread { nullptr };
};
#endif
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/DVD/mythdvdbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1817,7 +1817,7 @@ uint MythDVDBuffer::ConvertLangCode(uint16_t Code)
if (Code == 0)
return 0;

std::array<QChar,2> str2 { Code >> 8, Code & 0xff };
std::array<QChar,2> str2 { QChar(Code >> 8), QChar(Code & 0xff) };
QString str3 = iso639_str2_to_str3(QString(str2.data(), str2.size()));

LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("code: %1; iso639: %2").arg(Code).arg(str3));
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/DVD/mythdvdbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#include <QString>
#include <QMutex>
#include <QRect>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif
#include <QCoreApplication>

// MythTV
Expand Down Expand Up @@ -196,7 +199,11 @@ class MTV_PUBLIC MythDVDBuffer : public MythOpticalBuffer
QMap<int, QList<std::chrono::seconds> > m_chapterMap;
MythDVDPlayer *m_parent { nullptr };
float m_forcedAspect { -1.0F };
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_contextLock { QMutex::Recursive };
#else
QRecursiveMutex m_contextLock;
#endif
MythDVDContext *m_context { nullptr };
dvdnav_status_t m_dvdStat { DVDNAV_STATUS_OK };
int32_t m_dvdEvent { 0 };
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/DVD/mythdvdplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ class MythDVDPlayer : public MythPlayerUI
// still frame timing
MythTimer m_stillFrameTimer { };
std::chrono::seconds m_stillFrameLength { 0s };
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_stillFrameTimerLock { QMutex::Recursive };
#else
QRecursiveMutex m_stillFrameTimerLock;
#endif
};

#endif // MYTHDVDPLAYER_H
10 changes: 9 additions & 1 deletion mythtv/libs/libmythtv/HLS/httplivestreambuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include <QString>
#include <QStringList>
#include <QtAlgorithms>
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
#include <QStringConverter>
#endif
#include <QUrl>

// C++
Expand Down Expand Up @@ -2111,7 +2114,12 @@ int HLSRingBuffer::ParseM3U8(const QByteArray *buffer, StreamsList *streams)
{
streams = &m_streams;
}
QTextStream stream(*buffer); stream.setCodec("UTF-8");
QTextStream stream(*buffer);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
stream.setCodec("UTF-8");
#else
stream.setEncoding(QStringConverter::Utf8);
#endif

QString line = stream.readLine();
if (line.isNull())
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/audioplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#include "mythplayerstate.h"

#include <QCoreApplication>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif

#include <cstdint>
#include <vector>
Expand Down Expand Up @@ -113,7 +117,11 @@ class MTV_PUBLIC AudioPlayer : public QObject
AudioOutput *m_audioOutput {nullptr};
MythAudioPlayerState m_state { };
float m_stretchFactor {1.0F};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_lock {QMutex::Recursive};
#else
QRecursiveMutex m_lock;
#endif
bool m_mutedOnCreation {false};
QString m_mainDevice;
QString m_passthruDevice;
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythtv/captions/cc608decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CC608Decoder::CC608Decoder(CC608Input *ccr)
m_stdChar[124] = QLatin1Char(0xF7); // ÷
m_stdChar[125] = QLatin1Char(0xD1); // Ñ
m_stdChar[126] = QLatin1Char(0xF1); // ñ
m_stdChar[127] = 0x2588; /* full block */
m_stdChar[127] = QChar(0x2588); // full block

init_xds_program_type(m_xdsProgramTypeString);
}
Expand Down Expand Up @@ -68,7 +68,7 @@ static const std::array<const int,16> rowdata =
static const std::array<const QChar,16> specialchar =
{
QLatin1Char(0xAE), QLatin1Char(0xB0), QLatin1Char(0xBD), QLatin1Char(0xBF), // ®°½¿
0x2122, QLatin1Char(0xA2), QLatin1Char(0xA3), 0x266A, // ™¢£♪
QChar(0x2122), QLatin1Char(0xA2), QLatin1Char(0xA3), QChar(0x266A), // ™¢£♪
QLatin1Char(0xE0), QLatin1Char(' '), QLatin1Char(0xE8), QLatin1Char(0xE2), // à èâ
QLatin1Char(0xEA), QLatin1Char(0xEE), QLatin1Char(0xF4), QLatin1Char(0xFB) // êîôû
};
Expand All @@ -77,8 +77,8 @@ static const std::array<const QChar,32> extendedchar2 =
{
QLatin1Char(0xC1), QLatin1Char(0xC9), QLatin1Char(0xD3), QLatin1Char(0xDA), // ÁÉÓÚ
QLatin1Char(0xDC), QLatin1Char(0xFC), QLatin1Char('`'), QLatin1Char(0xA1), // Üü`¡
QLatin1Char('*'), QLatin1Char('\''), 0x2014, QLatin1Char(0xA9), // *'-©
0x2120, QLatin1Char(0xB7), 0x201C, 0x201D, // ℠·“”
QLatin1Char('*'), QLatin1Char('\''), QChar(0x2014), QLatin1Char(0xA9), // *'-©
QChar(0x2120), QLatin1Char(0xB7), QChar(0x201C), QChar(0x201D), // ℠·“”
QLatin1Char(0xC0), QLatin1Char(0xC2), QLatin1Char(0xC7), QLatin1Char(0xC8), // ÀÂÇÈ
QLatin1Char(0xCA), QLatin1Char(0xCB), QLatin1Char(0xEB), QLatin1Char(0xCE), // ÊËëÎ
QLatin1Char(0xCF), QLatin1Char(0xEF), QLatin1Char(0xD4), QLatin1Char(0xD9), // ÏïÔÙ
Expand All @@ -94,7 +94,7 @@ static const std::array<const QChar,32> extendedchar3 =
QLatin1Char(0xC4), QLatin1Char(0xE4), QLatin1Char(0xD6), QLatin1Char(0xF6), // ÄäÖö
QLatin1Char(0xDF), QLatin1Char(0xA5), QLatin1Char(0xA4), QLatin1Char('|'), // ߥ¤|
QLatin1Char(0xC5), QLatin1Char(0xE5), QLatin1Char(0xD8), QLatin1Char(0xF8), // Å娸
0x250C, 0x2510, 0x2514, 0x2518 // ┌┐└┘
QChar(0x250C), QChar(0x2510), QChar(0x2514), QChar(0x2518) // ┌┐└┘
};

void CC608Decoder::FormatCCField(std::chrono::milliseconds tc, int field, int data)
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/captions/cc608decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
#include <vector>

#include <QString>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QChar>

#include "format.h"
Expand Down Expand Up @@ -142,7 +146,11 @@ class CC608Decoder
uint m_xdsCrcPassed {0};
uint m_xdsCrcFailed {0};

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_xdsLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_xdsLock;
#endif
std::array<uint,2> m_xdsRatingSystems {0};
std::array<std::array<uint,4>,2> m_xdsRating {{}};
std::array<QString,2> m_xdsProgramName;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/captions/cc608reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ CC608Buffer *CC608Reader::GetOutputText(bool &changed)
last_changed = false;
int streamIdx = -1;
CC608Buffer *tmp = GetOutputText(last_changed, streamIdx);
if (last_changed && (streamIdx == m_ccMode))
if (last_changed && (((streamIdx << 4) & CC_MODE_MASK) == m_ccMode))
{
changed = true;
return tmp;
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/captions/cc708window.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

// Qt headers
#include <QString>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QColor>

// MythTV headers
Expand Down Expand Up @@ -306,7 +310,11 @@ class MTV_PUBLIC CC708Window
{
m_changed = false;
}
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_lock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_lock;
#endif
};

class CC708Service
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/captions/srtwriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include <QImage>
#include <QPoint>
#include <QHash>
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
#include <QStringConverter>
#endif
#include <QTime>

#include <QtXml/QDomDocument>
Expand All @@ -30,7 +33,11 @@ class MTV_PUBLIC SRTWriter
explicit SRTWriter(const QString &fileName) :
m_outFile(fileName), m_outStream(&m_outFile)
{
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
m_outStream.setCodec("UTF-8");
#else
m_outStream.setEncoding(QStringConverter::Utf8);
#endif
if (!m_outFile.open(QFile::WriteOnly))
{
LOG(VB_GENERAL, LOG_ERR, QString("Failed to create '%1'")
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/captions/subtitlescreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ static QString extract_cc608(QString &text, int &color,
QString result;

// Handle an initial control sequence.
if (text.length() >= 1 && text[0] >= 0x7000)
if (text.length() >= 1 && text[0] >= QChar(0x7000))
{
int op = text[0].unicode() - 0x7000;
isUnderline = ((op & 0x1) != 0);
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/captions/teletextscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,9 @@ void TeletextScreen::DrawStatus()
DrawBackground(i, 0);

DrawCharacter(1, 0, 'P', false);
DrawCharacter(2, 0, m_teletextReader->GetPageInput(0), false);
DrawCharacter(3, 0, m_teletextReader->GetPageInput(1), false);
DrawCharacter(4, 0, m_teletextReader->GetPageInput(2), false);
DrawCharacter(2, 0, QChar(m_teletextReader->GetPageInput(0)), false);
DrawCharacter(3, 0, QChar(m_teletextReader->GetPageInput(1)), false);
DrawCharacter(4, 0, QChar(m_teletextReader->GetPageInput(2)), false);

const TeletextSubPage *ttpage = m_teletextReader->FindSubPage();

Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/captions/textsubtitleparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ class TextSubtitles : public QObject
// because none have yet been written for an in-progress
// recording, so use m_hasSubtitles instead of m_subtitles.size().
bool m_hasSubtitles {false};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_lock {QMutex::Recursive};
#else
QRecursiveMutex m_lock;
#endif
};

class TextSubtitleParser
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/channelutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static uint get_dtv_multiplex(uint db_source_id, const QString& sistandard,
{
query.bindValue(":TRANSPORTID", transport_id);
query.bindValue(":NETWORKID", network_id);
query.bindValue(":POLARITY", QString(polarity));
query.bindValue(":POLARITY", QChar(polarity));
}

if (!query.exec() || !query.isActive())
Expand Down Expand Up @@ -204,7 +204,7 @@ static uint insert_dtv_multiplex(
{
query.bindValue(":TRANSPORTID", transport_id);
query.bindValue(":NETWORKID", network_id);
query.bindValue(":WHEREPOLARITY", QString(polarity));
query.bindValue(":WHEREPOLARITY", QChar(polarity));
}
else
{
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/commbreakmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#include "playercontext.h"

// Qt headers
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QMap>
#include <QCoreApplication>

Expand Down Expand Up @@ -46,7 +50,11 @@ class CommBreakMap
private:
void MergeShortCommercials(double video_frame_rate);

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_commBreakMapLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_commBreakMapLock;
#endif
int m_skipcommercials {0};
CommSkipMode m_autocommercialskip {kCommSkipOff};
std::chrono::seconds m_commrewindamount {0s};
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2853,7 +2853,7 @@ void AvFormatDecoder::DecodeCCx08(const uint8_t *buf, uint buf_size, bool scte)

bool had_608 = false;
bool had_708 = false;
for (uint cur = 0; cur + 3 < buf_size; cur += 3)
for (uint cur = 0; cur + 2 < buf_size; cur += 3)
{
uint cc_code = buf[cur];
bool cc_valid = (cc_code & 0x04) != 0U;
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/decoders/avformatdecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,11 @@ class AvFormatDecoder : public DecoderBase
// Value in milliseconds, from setting AudioReadAhead
std::chrono::milliseconds m_audioReadAhead {100ms};

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_avCodecLock { QMutex::Recursive };
#else
QRecursiveMutex m_avCodecLock;
#endif
};

#endif
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/decoders/decoderbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ class DecoderBase
bool m_posmapStarted {false};
MarkTypes m_positionMapType {MARK_UNSET};

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_positionMapLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_positionMapLock;
#endif
std::vector<PosMapEntry> m_positionMap;
frm_pos_map_t m_frameToDurMap; // guarded by m_positionMapLock
frm_pos_map_t m_durToFrameMap; // guarded by m_positionMapLock
Expand All @@ -346,7 +350,11 @@ class DecoderBase
uint m_stereo3D {0};

// Audio/Subtitle/EIA-608/EIA-708 stream selection
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_trackLock { QMutex::Recursive };
#else
QRecursiveMutex m_trackLock;
#endif
bool m_decodeAllSubtitles { false };
std::array<int, kTrackTypeCount> m_currentTrack {};
std::array<sinfo_vec_t,kTrackTypeCount> m_tracks;
Expand Down
4 changes: 3 additions & 1 deletion mythtv/libs/libmythtv/decoders/mythcodeccontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#define MYTHCODECONTEXT_H

// Qt
#include <QMutex>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif
#include <QStringList>
#include <QAtomicInt>

Expand Down
5 changes: 5 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythdrmprimecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

#define LOC QString("DRMPRIMECtx: ")

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex MythDRMPRIMEContext::s_drmPrimeLock(QMutex::Recursive);
#else
QRecursiveMutex MythDRMPRIMEContext::s_drmPrimeLock;
#endif

QStringList MythDRMPRIMEContext::s_drmPrimeDecoders;

/*! \class MythDRMPRIMEContext
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythdrmprimecontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ class MythDRMPRIMEContext : public MythCodecContext
MythCodecID Failure,
const QString &CodecName,
AVPixelFormat Format);
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex s_drmPrimeLock;
#else
static QRecursiveMutex s_drmPrimeLock;
#endif
static QStringList s_drmPrimeDecoders;
MythOpenGLInterop *m_interop { nullptr };
};
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythmediacodeccontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,11 @@ bool MythMediaCodecContext::IsDeinterlacing(bool &DoubleRate, bool)
MCProfiles &MythMediaCodecContext::GetProfiles(void)
{
// TODO Something tells me this is leakier than a leaky thing
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
static bool s_initialised = false;
static MCProfiles s_profiles;

Expand Down Expand Up @@ -494,7 +498,11 @@ void MythMediaCodecContext::GetDecoderList(QStringList &Decoders)

bool MythMediaCodecContext::HaveMediaCodec(bool Reinit /*=false*/)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
static bool s_initialised = false;
static bool s_available = false;

Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythmmalcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ AVPixelFormat MythMMALContext::GetFormat(AVCodecContext*, const AVPixelFormat *P

bool MythMMALContext::HaveMMAL(bool Reinit /*=false*/)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
QMutexLocker locker(&lock);
static bool s_checked = false;
static bool s_available = false;
Expand Down Expand Up @@ -283,7 +287,11 @@ extern "C" {

const MMALProfiles& MythMMALContext::GetProfiles(void)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
static bool s_initialised = false;
static MMALProfiles s_profiles;

Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythnvdeccontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,11 @@ bool MythNVDECContext::MythNVDECCaps::Supports(cudaVideoCodec Codec, cudaVideoCh

bool MythNVDECContext::HaveNVDEC(bool Reinit /*=false*/)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
QMutexLocker locker(&lock);
static bool s_checked = false;
static bool s_available = false;
Expand Down Expand Up @@ -562,7 +566,11 @@ void MythNVDECContext::GetDecoderList(QStringList &Decoders)

const std::vector<MythNVDECContext::MythNVDECCaps> &MythNVDECContext::GetProfiles(void)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
static bool s_initialised = false;
static std::vector<MythNVDECContext::MythNVDECCaps> s_profiles;

Expand Down
12 changes: 12 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythv4l2m2mcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ const V4L2Profiles& MythV4L2M2MContext::GetStandardProfiles()
{ V4L2_PIX_FMT_HEVC, MythCodecContext::HEVC }
}};

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
static bool s_initialised = false;
static V4L2Profiles s_profiles;

Expand Down Expand Up @@ -414,7 +418,11 @@ void MythV4L2M2MContext::GetDecoderList(QStringList &Decoders)

bool MythV4L2M2MContext::HaveV4L2Codecs(bool Reinit /*=false*/)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
QMutexLocker locker(&lock);
static bool s_checked = false;
static bool s_available = false;
Expand Down Expand Up @@ -472,7 +480,11 @@ const V4L2Profiles& MythV4L2M2MContext::GetRequestProfiles()
{ V4L2_PIX_FMT_HEVC_SLICE, MythCodecContext::HEVC }
}};

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
static bool s_initialised = false;
static V4L2Profiles s_profiles;

Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythvaapicontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,11 @@ QString MythVAAPIContext::HaveVAAPI(bool ReCheck /*= false*/)

const VAAPIProfiles& MythVAAPIContext::GetProfiles()
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
static bool s_initialised = false;
static VAAPIProfiles s_profiles;

Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythvdpauhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ const VDPAUProfiles& MythVDPAUHelper::GetProfiles(void)
return MythCodecContext::NoProfile;
};

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
static bool s_initialised = false;
static VDPAUProfiles s_profiles;

Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/decoders/mythvtbcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ enum AVPixelFormat MythVTBContext::GetFormat(struct AVCodecContext* Context, con

const VTBProfiles& MythVTBContext::GetProfiles(void)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
static bool s_initialised = false;
static VTBProfiles s_profiles;

Expand Down Expand Up @@ -234,7 +238,11 @@ const VTBProfiles& MythVTBContext::GetProfiles(void)

bool MythVTBContext::HaveVTB(bool Reinit /*=false*/)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex lock(QMutex::Recursive);
#else
static QRecursiveMutex lock;
#endif
QMutexLocker locker(&lock);
static bool s_checked = false;
static bool s_available = false;
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythtv/dtvconfparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
// MythTV headers
#include "dtvmultiplex.h"

class QStringList;

class DTVChannelInfo
{
public:
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythtv/dtvconfparserhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class DTVInversion : public DTVParamHelper
{
if (toString().length() > 0)
return toString().at(0);
return {0};
return QChar(0);
}

static QString toString(int _value)
Expand Down Expand Up @@ -270,7 +270,7 @@ class DTVBandwidth : public DTVParamHelper
{
if (toString().length() > 0)
return toString().at(0);
return {0};
return QChar(0);
}

static QString toString(int _value)
Expand Down Expand Up @@ -477,7 +477,7 @@ class DTVTransmitMode : public DTVParamHelper
{
if (toString().length() > 0)
return toString().at(0);
return {0};
return QChar(0);
}

static QString toString(int _value)
Expand Down Expand Up @@ -595,7 +595,7 @@ class DTVHierarchy : public DTVParamHelper
{
if (toString().length() > 0)
return toString().at(0);
return {0};
return QChar(0);
}

static QString toString(int _value)
Expand Down Expand Up @@ -634,7 +634,7 @@ class DTVPolarity : public DTVParamHelper
{
if (toString().length() > 0)
return toString().at(0);
return {0};
return QChar(0);
}

static QString toString(int _value)
Expand Down
130 changes: 67 additions & 63 deletions mythtv/libs/libmythtv/eitfixup.cpp

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/io/mythavformatbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ int64_t MythAVFormatBuffer::SeekPacket(void *Context, int64_t Offset, int Whence

URLProtocol *MythAVFormatBuffer::GetURLProtocol(void)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex s_avringbufferLock(QMutex::Recursive);
#else
static QRecursiveMutex s_avringbufferLock;
#endif
static bool s_avringbufferInitialised = false;

QMutexLocker lock(&s_avringbufferLock);
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/io/mythmediabuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,11 @@ MythBDBuffer *MythMediaBuffer::BD(void)

void MythMediaBuffer::AVFormatInitNetwork(void)
{
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static QMutex s_avnetworkLock(QMutex::Recursive);
#else
static QRecursiveMutex s_avnetworkLock;
#endif
static bool s_avnetworkInitialised = false;
QMutexLocker lock(&s_avnetworkLock);
if (!s_avnetworkInitialised)
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/iptvtuningdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// Qt headers
#include <QApplication>
#include <QString>
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
#include <QStringConverter>
#endif
#include <QUrl>

// MythTV headers
Expand Down Expand Up @@ -259,7 +262,11 @@ class MTV_PUBLIC IPTVTuningData
}

QTextStream text(&buffer);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
text.setCodec("UTF-8");
#else
text.setEncoding(QStringConverter::Utf8);
#endif
return (HLSReader::IsValidPlaylist(text));
}

Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/jobqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@

JobQueue::JobQueue(bool master) :
m_hostname(gCoreContext->GetHostName()),
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
m_runningJobsLock(new QMutex(QMutex::Recursive)),
#else
m_runningJobsLock(new QRecursiveMutex()),
#endif
m_isMaster(master),
m_queueThread(new MThread("JobQueue", this))
{
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/jobqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#include <QObject>
#include <QEvent>
#include <QMutex>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif
#include <QMap>

#include "mythtvexp.h"
Expand Down Expand Up @@ -260,7 +263,11 @@ class MTV_PUBLIC JobQueue : public QObject, public QRunnable
// QMutex m_controlFlagsLock;
// QMap<QString, int *> m_jobControlFlags;

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex *m_runningJobsLock {nullptr};
#else
QRecursiveMutex *m_runningJobsLock {nullptr};
#endif
QMap<int, RunningJobInfo> m_runningJobs;

bool m_isMaster;
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/livetvchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <QDateTime>
#include <QMutex>
#include <QList>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif

#include "mythtvexp.h"
#include "referencecounter.h"
Expand Down Expand Up @@ -106,7 +109,11 @@ class MTV_PUBLIC LiveTVChain : public ReferenceCounter
QString m_id;
QList<LiveTVChainEntry> m_chain;
int m_maxPos {0};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_lock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_lock;
#endif

QString m_hostPrefix;
QString m_inputType;
Expand Down
11 changes: 11 additions & 0 deletions mythtv/libs/libmythtv/mheg/netstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include <QThread>
#include <QNetworkRequest>
#include <QNetworkReply>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif
#include <QSslError>
#include <QWaitCondition>
#include <QQueue>
Expand Down Expand Up @@ -124,7 +127,11 @@ class NAMThread : public QThread
static inline void PostEvent(QEvent *e) { manager().Post(e); }
void Post(QEvent *event);

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static inline QMutex* GetMutex() { return &manager().m_mutexNAM; }
#else
static inline QRecursiveMutex* GetMutex() { return &manager().m_mutexNAM; }
#endif

static bool isAvailable(); // is network usable
static QDateTime GetLastModified(const QUrl &url);
Expand All @@ -147,7 +154,11 @@ private slots:

volatile bool m_bQuit {false};
QSemaphore m_running;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_mutexNAM {QMutex::Recursive}; // Provides recursive access to m_nam
#else
mutable QRecursiveMutex m_mutexNAM; // Provides recursive access to m_nam
#endif
QNetworkAccessManager *m_nam {nullptr};
mutable QMutex m_mutex; // Protects r/w access to the following data
QQueue< QEvent * > m_workQ;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/atsc_huffman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,7 @@ QString atsc_huffman2_to_string(const unsigned char *compressed,
uint key = lookup[bits];
if (key && (ptrTable[key].m_numberOfBits == cur_size))
{
decompressed += ptrTable[key].m_character;
decompressed += QChar(ptrTable[key].m_character);
current_bit += cur_size;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/dvbdescriptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ QString dvb_decode_text(const unsigned char *src, uint raw_length,
size_t length = (raw_length - 1) / 2;
auto *to = new QChar[length];
for (size_t i=0; i<length; i++)
to[i] = (src[1 + i*2] << 8) + src[1 + i*2 + 1];
to[i] = QChar((src[1 + i*2] << 8) + src[1 + i*2 + 1]);
QString to2(to, length);
delete [] to;
return to2;
Expand Down
20 changes: 14 additions & 6 deletions mythtv/libs/libmythtv/mpeg/dvbdescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,9 @@ class TargetRegionDescriptor : public MPEGDescriptor
}
QString CountryCodeString(void) const
{
return QString(m_data[3]) + QChar(m_data[4]) + QChar(m_data[5]);
std::array<QChar,3> code
{ QChar(m_data[3]), QChar(m_data[4]), QChar(m_data[5]) };
return QString(code.data(), 3);
}
//
// TBD
Expand Down Expand Up @@ -1394,7 +1396,9 @@ class TargetRegionNameDescriptor : public MPEGDescriptor
}
QString CountryCodeString(void) const
{
return QString(m_data[3]) + QChar(m_data[4]) + QChar(m_data[5]);
std::array<QChar,3> code
{ QChar(m_data[3]), QChar(m_data[4]), QChar(m_data[5]) };
return QString(code.data(), 3);
}

// ISO_639_language_code 24 6.0
Expand Down Expand Up @@ -1634,7 +1638,9 @@ class LocalTimeOffsetDescriptor : public MPEGDescriptor
QString CountryCodeString(uint i) const
{
int o = 2 + i*13;
return QString(m_data[o]) + QChar(m_data[o+1]) + QChar(m_data[o+2]);
std::array<QChar,3> code
{ QChar(m_data[o]), QChar(m_data[o+1]), QChar(m_data[o+2]) };
return QString(code.data(), 3);
}
// country_region_id 6 3.0+p
uint CountryRegionId(uint i) const { return m_data[2 + i*13 + 3] >> 2; }
Expand Down Expand Up @@ -1816,9 +1822,11 @@ class ParentalRatingDescriptor : public MPEGDescriptor
QString CountryCodeString(uint i) const
{
int o = 2 + i*4;
if (i < Count())
return QString(m_data[o]) + QChar(m_data[o+1]) + QChar(m_data[o+2]);
return QString("");
if (i >= Count())
return QString("");
std::array<QChar,3> code
{ QChar(m_data[o]), QChar(m_data[o+1]), QChar(m_data[o+2]) };
return QString(code.data(), 3);
}
int Rating(uint i) const
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/mpegdescriptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ QString MPEGDescriptor::toStringXML(uint level) const
str += indent_1 + QString("<Tag>0x%1</Tag>\n")
.arg(DescriptorTag(),2,16,QChar('0'));
str += indent_1 + QString("<Description>%1</Description>\n")
.arg(DescriptorTagString(),0,16);
.arg(DescriptorTagString());

str += indent_1 + "<Data>";
for (uint i = 0; i < DescriptorLength(); i++)
Expand Down
12 changes: 12 additions & 0 deletions mythtv/libs/libmythtv/mpeg/mpegstreamdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,22 @@ class MTV_PUBLIC MPEGStreamData : public EITSource
bool m_listeningDisabled {false};

// Encryption monitoring
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_encryptionLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_encryptionLock;
#endif
QMap<uint, CryptInfo> m_encryptionPidToInfo;
QMap<uint, uint_vec_t> m_encryptionPnumToPids;
QMap<uint, uint_vec_t> m_encryptionPidToPnums;
QMap<uint, CryptStatus> m_encryptionPnumToStatus;

// Signals
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_listenerLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_listenerLock;
#endif
mpeg_listener_vec_t m_mpegListeners;
mpeg_sp_listener_vec_t m_mpegSpListeners;
ts_listener_vec_t m_tsWritingListeners;
Expand All @@ -351,7 +359,11 @@ class MTV_PUBLIC MPEGStreamData : public EITSource

// Caching
bool m_cacheTables;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_cacheLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_cacheLock;
#endif
mutable pat_cache_t m_cachedPats;
mutable cat_cache_t m_cachedCats;
mutable pmt_cache_t m_cachedPmts;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/splicedescriptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ QString SpliceDescriptor::toStringXML(uint level) const
str += indent_1 + QString("<TAG>0x%1</TAG>\n")
.arg(DescriptorTag(),2,16,QChar('0'));
str += indent_1 + QString("<DESCRIPTION>%1</DESCRIPTION>\n")
.arg(DescriptorTagString(),0,16);
.arg(DescriptorTagString());

str += indent_1 + "<DATA>";
for (uint i = 0; i < DescriptorLength(); i++)
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/mythavutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

// Qt
#include <QMap>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QVector>

// MythTV
Expand Down Expand Up @@ -33,7 +37,11 @@ class MTV_PUBLIC MythCodecMap

private:
QMap<const AVStream*, AVCodecContext*> m_streamMap;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_mapLock { QMutex::Recursive };
#else
QRecursiveMutex m_mapLock;
#endif
};

class MTV_PUBLIC MythAVCopy
Expand Down
11 changes: 11 additions & 0 deletions mythtv/libs/libmythtv/mythplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include <QCoreApplication>
#include <QList>
#include <QMutex>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif
#include <QTime>
#include <QString>
#include <QRect>
Expand Down Expand Up @@ -361,7 +364,11 @@ class MTV_PUBLIC MythPlayer : public QObject

protected:
DecoderBase *m_decoder {nullptr};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_decoderChangeLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_decoderChangeLock;
#endif
MythVideoOutput *m_videoOutput {nullptr};
const VideoFrameTypes* m_renderFormats { &MythVideoFrame::kDefaultRenderFormats };
PlayerContext *m_playerCtx {nullptr};
Expand Down Expand Up @@ -480,7 +487,11 @@ class MTV_PUBLIC MythPlayer : public QObject

// Playback (output) speed control
/// Lock for next_play_speed and next_normal_speed
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_decoderLock {QMutex::Recursive};
#else
QRecursiveMutex m_decoderLock;
#endif
float m_nextPlaySpeed {1.0F};
float m_playSpeed {1.0F};
std::chrono::microseconds m_frameInterval
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/mythplayeroverlayui.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class MTV_PUBLIC MythPlayerOverlayUI : public MythPlayerUIBase
std::chrono::seconds GetTotalSeconds(bool HonorCutList) const;

OSD m_osd;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_osdLock { QMutex::Recursive };
#else
QRecursiveMutex m_osdLock;
#endif
bool m_browsing { false };
bool m_editing { false };
// Set in the decoder thread
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/mythvideooutgpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ MythVideoOutputGPU *MythVideoOutputGPU::Create(MythMainWindow* MainWindow, MythR
video = new VideoOutputD3D();
#endif
#ifdef USING_OPENGL
if (renderer.contains("opengl") && openglrender)
if (!video && renderer.contains("opengl") && openglrender)
{
video = new MythVideoOutputOpenGL(MainWindow, openglrender,
openglpainter, Display,
videoprofile, renderer);
}
#endif
#ifdef USING_VULKAN
if (renderer.contains(VULKAN_RENDERER))
if (!video && renderer.contains(VULKAN_RENDERER))
{
video = new MythVideoOutputVulkan(MainWindow, vulkanrender,
vulkanpainter, Display,
Expand Down
12 changes: 12 additions & 0 deletions mythtv/libs/libmythtv/mythvideoprofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

// Qt
#include <QStringList>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QSize>
#include <QMap>

Expand Down Expand Up @@ -148,14 +152,22 @@ class MTV_PUBLIC MythVideoProfile : public QObject
void SetPreference(const QString &Key, const QString &Value);

private:
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_lock { QMutex::Recursive };
#else
mutable QRecursiveMutex m_lock;
#endif
QSize m_lastSize { 0, 0 };
float m_lastRate { 0.0F };
QString m_lastCodecName { };
QMap<QString,QString> m_currentPreferences { };
std::vector<MythVideoProfileItem> m_allowedPreferences { };

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
static inline QMutex kSafeLock = QMutex(QMutex::Recursive);
#else
static inline QRecursiveMutex kSafeLock;
#endif
static inline bool kSafeInitialized = false;
static inline QMap<QString,QStringList> kSafeRenderer = {};
static inline QMap<QString,QStringList> kSafeRendererGroup = {};
Expand Down
10 changes: 10 additions & 0 deletions mythtv/libs/libmythtv/playercontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
// Qt headers
#include <QWidget>
#include <QString>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QHash>
#include <QRect>
#include <QObject>
Expand Down Expand Up @@ -145,9 +149,15 @@ class MTV_PUBLIC PlayerContext
float m_tsNormal {1.0F};
float m_tsAlt {1.5F};

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_playingInfoLock {QMutex::Recursive};
mutable QMutex m_deletePlayerLock {QMutex::Recursive};
mutable QMutex m_stateLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_playingInfoLock;
mutable QRecursiveMutex m_deletePlayerLock;
mutable QRecursiveMutex m_stateLock;
#endif

// Signal info
mutable QStringList m_lastSignalMsg;
Expand Down
9 changes: 9 additions & 0 deletions mythtv/libs/libmythtv/recorders/HLS/HLSReader.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#include <sys/time.h>
#include <unistd.h>

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
#include <QStringConverter>
#endif

#include "HLSReader.h"
#include "HLS/m3u.h"

Expand Down Expand Up @@ -60,7 +65,11 @@ bool HLSReader::Open(const QString & m3u, int bitrate_index)
#endif

QTextStream text(&buffer);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
text.setCodec("UTF-8");
#else
text.setEncoding(QStringConverter::Utf8);
#endif

if (!IsValidPlaylist(text))
{
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/recorders/dtvrecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ class DTVRecorder :
std::vector<unsigned char> m_payloadBuffer;

// general recorder stuff
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_pidLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_pidLock;
#endif
/// PAT on input side
ProgramAssociationTable *m_inputPat {nullptr};
/// PMT on input side
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/recorders/dvbchannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ class DVBChannel : public DTVChannel

// Tuning State
mutable QMutex m_tuneLock;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_hwLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_hwLock;
#endif

DTVMultiplex m_desiredTuning; // Last tuning options Tune() attempted to send to hardware
DTVMultiplex m_prevTuning; // Last tuning options Tune() succesfully sent to hardware
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/recorders/hdhrstreamhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <QString>
#include <QMutex>
#include <QMap>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif

#include "mythdate.h"
#include "DeviceReadBuffer.h"
Expand Down Expand Up @@ -93,7 +96,11 @@ class HDHRStreamHandler : public StreamHandler
HDHRTuneMode m_tuneMode {hdhrTuneModeNone}; // debug self check
int m_majorId;

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_hdhrLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_hdhrLock;
#endif

// for implementing Get & Return
static QMutex s_handlersLock;
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/recorders/mpegrecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ class MpegRecorder : public V4LRecorder,
bool m_supportsSlicedVbi {false};

// State
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_startStopEncodingLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_startStopEncodingLock;
#endif

// Pausing state
bool m_clearTimeOnPause {false};
Expand Down
6 changes: 5 additions & 1 deletion mythtv/libs/libmythtv/recorders/satiprtsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include "rtcpdatapacket.h"
#include "satiprtcppacket.h"

#if QT_VERSION < QT_VERSION_CHECK(5,15,2)
#define capturedView capturedRef
#endif

#define LOC QString("SatIPRTSP[%1]: ").arg(m_streamHandler->m_inputId)
#define LOC2 QString("SatIPRTSP[%1](%2): ").arg(m_streamHandler->m_inputId).arg(m_requestUrl.toString())

Expand Down Expand Up @@ -148,7 +152,7 @@ bool SatIPRTSP::Setup(const QUrl& url)

m_sessionid = match.captured(1);
m_timeout = match.capturedLength(2) > 0
? std::chrono::seconds(match.capturedRef(2).toInt() / 2)
? std::chrono::seconds(match.capturedView(2).toInt() / 2)
: 30s;

LOG(VB_RECORD, LOG_DEBUG, LOC + QString("Sat>IP protocol timeout:%1 ms")
Expand Down
8 changes: 8 additions & 0 deletions mythtv/libs/libmythtv/recorders/satipstreamhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
// Qt headers
#include <QString>
#include <QStringList>
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
#include <QMutex>
#else
#include <QRecursiveMutex>
#endif
#include <QMap>

// MythTV headers
Expand Down Expand Up @@ -66,7 +70,11 @@ class SatIPStreamHandler : public StreamHandler
QUrl m_tuningurl;
QUrl m_oldtuningurl;
bool m_setupinvoked {false};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_tunelock {QMutex::Recursive};
#else
QRecursiveMutex m_tunelock;
#endif
QStringList m_oldpids;

protected:
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/recorders/signalmonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include <QWaitCondition>
#include <QMutex>
#include <QCoreApplication>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif

// MythTV headers
#include "signalmonitorlistener.h"
Expand Down Expand Up @@ -225,7 +228,11 @@ class SignalMonitor : protected MThread
volatile bool m_running {false}; // protected by startStopLock
volatile bool m_exit {false}; // protected by startStopLock

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_statusLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_statusLock;
#endif
mutable QMutex m_listenerLock;
};

Expand Down
11 changes: 11 additions & 0 deletions mythtv/libs/libmythtv/recorders/streamhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <QString>
#include <QMutex>
#include <QMap>
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
#include <QRecursiveMutex>
#endif

// MythTV headers
#include "DeviceReadBuffer.h" // for ReaderPausedCB
Expand Down Expand Up @@ -126,7 +129,11 @@ class StreamHandler : protected MThread, public DeviceReaderCB
bool m_usingSectionReader {false};
QWaitCondition m_runningStateChanged;

#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_pidLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_pidLock;
#endif
std::vector<uint> m_eitPids;
PIDInfoMap m_pidInfo;
uint m_openPidFilters {0};
Expand All @@ -138,7 +145,11 @@ class StreamHandler : protected MThread, public DeviceReaderCB
QMutex m_mptsLock;

using StreamDataList = QHash<MPEGStreamData*,QString>;
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
mutable QMutex m_listenerLock {QMutex::Recursive};
#else
mutable QRecursiveMutex m_listenerLock;
#endif
StreamDataList m_streamDataList;
};

Expand Down
10 changes: 7 additions & 3 deletions mythtv/libs/libmythtv/recordinginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#define LOC QString("RecordingInfo(%1): ").arg(GetBasename())

const QRegularExpression RecordingInfo::kReSearchTypeName { R"(\s*\(.*\)$)" };
const QRegularExpression RecordingInfo::kReLeadingAnd
{ R"(^\s*AND\s*)", QRegularExpression::CaseInsensitiveOption };

static inline QString null_to_empty(const QString &str)
{
return str.isEmpty() ? "" : str;
Expand Down Expand Up @@ -146,9 +150,9 @@ RecordingInfo::RecordingInfo(
m_inputId = _inputid;
m_findId = _findid;

m_properties = ((_subtitleType << kSubtitlePropertyOffset) |
(_videoproperties << kVideoPropertyOffset) |
_audioproperties);
m_videoProperties = _videoproperties;
m_audioProperties = _audioproperties;
m_subtitleProperties = _subtitleType;

if (m_recStartTs >= m_recEndTs)
{
Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythtv/recordinginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define RECORDING_INFO_H

#include <QDateTime>
#include <QRegularExpression>
#include <QString>

#include "mythtvexp.h"
Expand Down Expand Up @@ -192,6 +193,12 @@ class MTV_PUBLIC RecordingInfo : public ProgramInfo
kDeletedRecGroup = 3,
};

// For removing the search type from the end of a title.
static const QRegularExpression kReSearchTypeName;

// For removing the string "AND" from the start of an sql fragment.
static const QRegularExpression kReLeadingAnd;

public:
RecordingInfo &operator=(const RecordingInfo &other)
{ if (this==&other) return *this; RecordingInfo::clone(other); return *this; }
Expand Down
Loading