mirror of
https://github.com/jellyfin/jellyfin-media-player.git
synced 2024-11-23 05:59:43 +00:00
Use identifier-naming from clang-tidy and align all member names
This commit is contained in:
parent
2014be22cc
commit
78bcff222d
21
.clang-tidy
21
.clang-tidy
@ -1,3 +1,22 @@
|
||||
# Don't use the C++ new,delete check since it doesn't work with Qt.
|
||||
# Enable a bunch of modernization checks
|
||||
Checks: '-clang-analyzer-cplusplus.NewDeleteLeaks,misc-forward-declaration-namespace,modernize-use-auto,modernize-use-nullptr,modernize-redudant-void-arg,readability-inconsistent-declaration-parameter-name,readability-simplify-boolean-expr,readability-container-size-empty,performance-for-range-copy'
|
||||
Checks: '-clang-analyzer-cplusplus.NewDeleteLeaks,misc-forward-declaration-namespace,modernize-use-auto,modernize-use-nullptr,modernize-redudant-void-arg,readability-inconsistent-declaration-parameter-name,readability-simplify-boolean-expr,readability-container-size-empty,performance-for-range-copy,readability-identifier-naming'
|
||||
CheckOptions:
|
||||
- key: readability-identifier-naming.ClassCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.EnumCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.FunctionCase
|
||||
value: lowerCase
|
||||
- key: readability-identifier-naming.GlobalFunction
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.GlobalVarableCase
|
||||
value: camelBack
|
||||
- key: readability-identifier-naming.GlobalVariablePrefix
|
||||
value: g_
|
||||
- key: readability-identifier-naming.VariableCase
|
||||
value: camelBack
|
||||
- key: readability-identifier-naming.MemberPrefix
|
||||
value: m_
|
||||
- key: readability-identifier-naming.MemberCase
|
||||
value: camelBack
|
@ -6,7 +6,7 @@
|
||||
#include "SignalManager.h"
|
||||
#include "settings/SettingsComponent.h"
|
||||
|
||||
int SignalManager::sigtermFd[2];
|
||||
int SignalManager::g_sigtermFd[2];
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
SignalManager::SignalManager(QGuiApplication* app) : QObject(nullptr), m_app(app)
|
||||
@ -18,13 +18,13 @@ SignalManager::SignalManager(QGuiApplication* app) : QObject(nullptr), m_app(app
|
||||
|
||||
QLOG_DEBUG() << "Signal handlers installed successfully.";
|
||||
|
||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, SignalManager::sigtermFd))
|
||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, SignalManager::g_sigtermFd))
|
||||
{
|
||||
QLOG_ERROR() << "Couldn't create TERM socketpair";
|
||||
}
|
||||
|
||||
snTerm = new QSocketNotifier(SignalManager::sigtermFd[1], QSocketNotifier::Read, this);
|
||||
connect(snTerm, SIGNAL(activated(int)), this, SLOT(handleSignal()));
|
||||
m_snTerm = new QSocketNotifier(SignalManager::g_sigtermFd[1], QSocketNotifier::Read, this);
|
||||
connect(m_snTerm, SIGNAL(activated(int)), this, SLOT(handleSignal()));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -53,18 +53,18 @@ int SignalManager::setupHandlers()
|
||||
void SignalManager::signalHandler(int signal_num)
|
||||
{
|
||||
unsigned char a = signal_num < 255 ? signal_num : 0;
|
||||
write(sigtermFd[0], &a, sizeof(a));
|
||||
write(g_sigtermFd[0], &a, sizeof(a));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void SignalManager::handleSignal()
|
||||
{
|
||||
snTerm->setEnabled(false);
|
||||
unsigned char signal_number = 0;
|
||||
read(sigtermFd[1], &signal_number, sizeof(signal_number));
|
||||
m_snTerm->setEnabled(false);
|
||||
unsigned char signalNumber = 0;
|
||||
read(g_sigtermFd[1], &signalNumber, sizeof(signalNumber));
|
||||
|
||||
// do Qt stuff
|
||||
if (signal_number == SIGUSR1)
|
||||
if (signalNumber == SIGUSR1)
|
||||
{
|
||||
QLOG_DEBUG() << "Received SIGUSR1, reloading config file";
|
||||
SettingsComponent::Get().load();
|
||||
@ -75,7 +75,7 @@ void SignalManager::handleSignal()
|
||||
closeApplication();
|
||||
}
|
||||
|
||||
snTerm->setEnabled(true);
|
||||
m_snTerm->setEnabled(true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -24,9 +24,9 @@ public slots:
|
||||
void handleSignal();
|
||||
|
||||
private:
|
||||
static int sigtermFd[2];
|
||||
static int g_sigtermFd[2];
|
||||
|
||||
QSocketNotifier* snTerm;
|
||||
QSocketNotifier* m_snTerm;
|
||||
QGuiApplication* m_app;
|
||||
};
|
||||
|
||||
|
@ -131,7 +131,7 @@ bool DisplayComponent::switchToBestVideoMode(float frameRate)
|
||||
{
|
||||
QLOG_DEBUG()
|
||||
<< "Best video matching mode is "
|
||||
<< m_displayManager->displays[currentDisplay]->videoModes[bestmode]->getPrettyName()
|
||||
<< m_displayManager->m_displays[currentDisplay]->m_videoModes[bestmode]->getPrettyName()
|
||||
<< "on display" << currentDisplay;
|
||||
|
||||
if (!m_displayManager->setDisplayMode(currentDisplay, bestmode))
|
||||
@ -199,7 +199,7 @@ double DisplayComponent::currentRefreshRate()
|
||||
int mode = m_displayManager->getCurrentDisplayMode(currentDisplay);
|
||||
if (mode < 0)
|
||||
return 0;
|
||||
return m_displayManager->displays[currentDisplay]->videoModes[mode]->refreshRate;
|
||||
return m_displayManager->m_displays[currentDisplay]->m_videoModes[mode]->m_refreshRate;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -219,7 +219,7 @@ bool DisplayComponent::restorePreviousVideoMode()
|
||||
{
|
||||
QLOG_DEBUG()
|
||||
<< "Restoring VideoMode to"
|
||||
<< m_displayManager->displays[m_lastDisplay]->videoModes[m_lastVideoMode]->getPrettyName()
|
||||
<< m_displayManager->m_displays[m_lastDisplay]->m_videoModes[m_lastVideoMode]->getPrettyName()
|
||||
<< "on display" << m_lastDisplay;
|
||||
|
||||
ret = m_displayManager->setDisplayMode(m_lastDisplay, m_lastVideoMode);
|
||||
@ -262,7 +262,7 @@ QString DisplayComponent::displayName(int display)
|
||||
return "(not found)";
|
||||
QString id = QString("#%0 ").arg(display);
|
||||
if (m_displayManager->isValidDisplay(display))
|
||||
return id + m_displayManager->displays[display]->name;
|
||||
return id + m_displayManager->m_displays[display]->m_name;
|
||||
else
|
||||
return id + "(not valid)";
|
||||
}
|
||||
@ -274,7 +274,7 @@ QString DisplayComponent::modePretty(int display, int mode)
|
||||
return "(not found)";
|
||||
QString id = QString("#%0 ").arg(mode);
|
||||
if (m_displayManager->isValidDisplayMode(display, mode))
|
||||
return id + m_displayManager->displays[display]->videoModes[mode]->getPrettyName();
|
||||
return id + m_displayManager->m_displays[display]->m_videoModes[mode]->getPrettyName();
|
||||
else
|
||||
return id + "(not valid)";
|
||||
}
|
||||
@ -313,11 +313,11 @@ QString DisplayComponent::debugInformation()
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static float modeDistance(const DMVideoMode& m1, const DMVideoMode& m2)
|
||||
{
|
||||
if (m1.height == m2.height &&
|
||||
m1.width == m2.width &&
|
||||
m1.bitsPerPixel == m2.bitsPerPixel &&
|
||||
m1.interlaced == m2.interlaced)
|
||||
return fabs(m1.refreshRate - m2.refreshRate);
|
||||
if (m1.m_height == m2.m_height &&
|
||||
m1.m_width == m2.m_width &&
|
||||
m1.m_bitsPerPixel == m2.m_bitsPerPixel &&
|
||||
m1.m_interlaced == m2.m_interlaced)
|
||||
return fabs(m1.m_refreshRate - m2.m_refreshRate);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -348,20 +348,20 @@ void DisplayComponent::switchCommand(QString command)
|
||||
QLOG_ERROR() << "Current mode not found";
|
||||
return;
|
||||
}
|
||||
DMVideoMode current_mode = *m_displayManager->displays[currentDisplay]->videoModes[id];
|
||||
DMVideoMode mode = current_mode;
|
||||
int best_mode = -1; // if -1, select it by using the mode variable above
|
||||
DMVideoMode currentMode = *m_displayManager->m_displays[currentDisplay]->m_videoModes[id];
|
||||
DMVideoMode mode = currentMode;
|
||||
int bestMode = -1; // if -1, select it by using the mode variable above
|
||||
|
||||
foreach (QString a, command.split(" "))
|
||||
{
|
||||
a = a.trimmed();
|
||||
if (a == "p")
|
||||
{
|
||||
mode.interlaced = false;
|
||||
mode.m_interlaced = false;
|
||||
}
|
||||
else if (a == "i")
|
||||
{
|
||||
mode.interlaced = true;
|
||||
mode.m_interlaced = true;
|
||||
}
|
||||
else if (a.endsWith("hz"))
|
||||
{
|
||||
@ -369,15 +369,15 @@ void DisplayComponent::switchCommand(QString command)
|
||||
bool ok;
|
||||
float rate = a.toFloat(&ok);
|
||||
if (ok)
|
||||
mode.refreshRate = rate;
|
||||
mode.m_refreshRate = rate;
|
||||
}
|
||||
else if (a.startsWith("mode="))
|
||||
{
|
||||
a = a.mid(5);
|
||||
bool ok;
|
||||
int new_id = a.toInt(&ok);
|
||||
if (ok && m_displayManager->isValidDisplayMode(currentDisplay, new_id))
|
||||
best_mode = new_id;
|
||||
int newId = a.toInt(&ok);
|
||||
if (ok && m_displayManager->isValidDisplayMode(currentDisplay, newId))
|
||||
bestMode = newId;
|
||||
}
|
||||
else if (a.indexOf("x") >= 0)
|
||||
{
|
||||
@ -391,42 +391,42 @@ void DisplayComponent::switchCommand(QString command)
|
||||
int h = sub[1].toInt(&ok);
|
||||
if (!ok)
|
||||
continue;
|
||||
mode.width = w;
|
||||
mode.height = h;
|
||||
mode.m_width = w;
|
||||
mode.m_height = h;
|
||||
}
|
||||
}
|
||||
|
||||
QLOG_INFO() << "Current mode:" << current_mode.getPrettyName();
|
||||
QLOG_INFO() << "Current mode:" << currentMode.getPrettyName();
|
||||
|
||||
if (best_mode < 0)
|
||||
if (bestMode < 0)
|
||||
{
|
||||
QLOG_INFO() << "Mode requested by command:" << mode.getPrettyName();
|
||||
|
||||
foreach (auto cur, m_displayManager->displays[currentDisplay]->videoModes)
|
||||
foreach (auto cur, m_displayManager->m_displays[currentDisplay]->m_videoModes)
|
||||
{
|
||||
// "Score" according to what was requested
|
||||
float d_cur = modeDistance(*cur, mode);
|
||||
if (d_cur < 0)
|
||||
float dCur = modeDistance(*cur, mode);
|
||||
if (dCur < 0)
|
||||
continue;
|
||||
if (best_mode < 0)
|
||||
if (bestMode < 0)
|
||||
{
|
||||
best_mode = cur->id;
|
||||
bestMode = cur->m_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
// "Score" according to best mode
|
||||
float d_best = modeDistance(*m_displayManager->displays[currentDisplay]->videoModes[best_mode],
|
||||
float dBest = modeDistance(*m_displayManager->m_displays[currentDisplay]->m_videoModes[bestMode],
|
||||
mode);
|
||||
if (d_cur < d_best)
|
||||
best_mode = cur->id;
|
||||
if (dCur < dBest)
|
||||
bestMode = cur->m_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (best_mode >= 0)
|
||||
if (bestMode >= 0)
|
||||
{
|
||||
QLOG_INFO() << "Found mode to switch to:" << m_displayManager->displays[currentDisplay]->videoModes[best_mode]->getPrettyName();
|
||||
if (m_displayManager->setDisplayMode(currentDisplay, best_mode))
|
||||
QLOG_INFO() << "Found mode to switch to:" << m_displayManager->m_displays[currentDisplay]->m_videoModes[bestMode]->getPrettyName();
|
||||
if (m_displayManager->setDisplayMode(currentDisplay, bestMode))
|
||||
{
|
||||
m_lastDisplay = m_lastVideoMode = -1;
|
||||
}
|
||||
|
@ -16,16 +16,16 @@ DisplayManager::DisplayManager(QObject* parent) : QObject(parent) {}
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool DisplayManager::initialize()
|
||||
{
|
||||
QLOG_INFO() << QString("DisplayManager found %1 Display(s).").arg(displays.size());
|
||||
QLOG_INFO() << QString("DisplayManager found %1 Display(s).").arg(m_displays.size());
|
||||
|
||||
// list video modes
|
||||
foreach(int displayid, displays.keys())
|
||||
foreach(int displayid, m_displays.keys())
|
||||
{
|
||||
DMDisplayPtr display = displays[displayid];
|
||||
QLOG_INFO() << QString("Available modes for Display #%1 (%2)").arg(displayid).arg(display->name);
|
||||
for (int modeid = 0; modeid < display->videoModes.size(); modeid++)
|
||||
DMDisplayPtr display = m_displays[displayid];
|
||||
QLOG_INFO() << QString("Available modes for Display #%1 (%2)").arg(displayid).arg(display->m_name);
|
||||
for (int modeid = 0; modeid < display->m_videoModes.size(); modeid++)
|
||||
{
|
||||
DMVideoModePtr mode = display->videoModes[modeid];
|
||||
DMVideoModePtr mode = display->m_videoModes[modeid];
|
||||
QLOG_INFO() << QString("Mode %1: %2").arg(modeid, 2).arg(mode->getPrettyName());
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ bool DisplayManager::initialize()
|
||||
if (currentMode >= 0)
|
||||
QLOG_INFO() << QString("DisplayManager : Current Display Mode on Display #%1 is %2")
|
||||
.arg(mainDisplay)
|
||||
.arg(displays[mainDisplay]->videoModes[currentMode]->getPrettyName());
|
||||
.arg(m_displays[mainDisplay]->m_videoModes[currentMode]->getPrettyName());
|
||||
else
|
||||
QLOG_ERROR() << "DisplayManager : unable to retrieve current video mode";
|
||||
}
|
||||
@ -55,19 +55,19 @@ DMVideoModePtr DisplayManager::getCurrentVideoMode(int display)
|
||||
DMVideoModePtr currentVideoMode;
|
||||
|
||||
if (currentMode >= 0)
|
||||
currentVideoMode = displays[display]->videoModes[currentMode];
|
||||
currentVideoMode = m_displays[display]->m_videoModes[currentMode];
|
||||
|
||||
return currentVideoMode;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool DisplayManager::isValidDisplay(int display) { return displays.contains(display); }
|
||||
bool DisplayManager::isValidDisplay(int display) { return m_displays.contains(display); }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool DisplayManager::isValidDisplayMode(int display, int mode)
|
||||
{
|
||||
if (isValidDisplay(display))
|
||||
if (mode >= 0 && mode < displays[display]->videoModes.size())
|
||||
if (mode >= 0 && mode < m_displays[display]->m_videoModes.size())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -100,49 +100,49 @@ int DisplayManager::findBestMatch(int display, DMMatchMediaInfo& matchInfo)
|
||||
// then fill a list
|
||||
DMVideoModeWeightMap weights;
|
||||
|
||||
DMVideoModeMap::const_iterator modeit = displays[display]->videoModes.constBegin();
|
||||
DMVideoModeMap::const_iterator modeit = m_displays[display]->m_videoModes.constBegin();
|
||||
|
||||
while (modeit != displays[display]->videoModes.constEnd())
|
||||
while (modeit != m_displays[display]->m_videoModes.constEnd())
|
||||
{
|
||||
DMVideoModePtr candidate = modeit.value();
|
||||
|
||||
weights[candidate->id] = DMVideoModeWeightPtr(new DMVideoModeWeight);
|
||||
weights[candidate->id]->mode = candidate;
|
||||
weights[candidate->id]->weight = 0;
|
||||
weights[candidate->m_id] = DMVideoModeWeightPtr(new DMVideoModeWeight);
|
||||
weights[candidate->m_id]->m_mode = candidate;
|
||||
weights[candidate->m_id]->m_weight = 0;
|
||||
|
||||
// Weight Resolution match
|
||||
if ((candidate->width == currentVideoMode->width) &&
|
||||
(candidate->height == currentVideoMode->height) &&
|
||||
(candidate->bitsPerPixel == currentVideoMode->bitsPerPixel))
|
||||
if ((candidate->m_width == currentVideoMode->m_width) &&
|
||||
(candidate->m_height == currentVideoMode->m_height) &&
|
||||
(candidate->m_bitsPerPixel == currentVideoMode->m_bitsPerPixel))
|
||||
{
|
||||
weights[candidate->id]->weight += MATCH_WEIGHT_RES;
|
||||
weights[candidate->m_id]->m_weight += MATCH_WEIGHT_RES;
|
||||
}
|
||||
|
||||
// weight refresh rate
|
||||
// exact Match
|
||||
if (candidate->refreshRate == matchInfo.refreshRate)
|
||||
weights[candidate->id]->weight += MATCH_WEIGHT_REFRESH_RATE_EXACT;
|
||||
if (candidate->m_refreshRate == matchInfo.m_refreshRate)
|
||||
weights[candidate->m_id]->m_weight += MATCH_WEIGHT_REFRESH_RATE_EXACT;
|
||||
|
||||
// exact multiple refresh rate
|
||||
if (isRateMultipleOf(matchInfo.refreshRate, candidate->refreshRate, true))
|
||||
weights[candidate->id]->weight += MATCH_WEIGHT_REFRESH_RATE_MULTIPLE;
|
||||
if (isRateMultipleOf(matchInfo.m_refreshRate, candidate->m_refreshRate, true))
|
||||
weights[candidate->m_id]->m_weight += MATCH_WEIGHT_REFRESH_RATE_MULTIPLE;
|
||||
|
||||
// close refresh match (less than 1 hz diff to match all 23.xxx modes to 24p)
|
||||
if (fabs(candidate->refreshRate - matchInfo.refreshRate) <= 0.5)
|
||||
if (fabs(candidate->m_refreshRate - matchInfo.m_refreshRate) <= 0.5)
|
||||
{
|
||||
weights[candidate->id]->weight += MATCH_WEIGHT_REFRESH_RATE_CLOSE;
|
||||
weights[candidate->m_id]->m_weight += MATCH_WEIGHT_REFRESH_RATE_CLOSE;
|
||||
}
|
||||
|
||||
// approx multiple refresh rate
|
||||
if (isRateMultipleOf(matchInfo.refreshRate, candidate->refreshRate, false))
|
||||
weights[candidate->id]->weight += MATCH_WEIGHT_REFRESH_RATE_MULTIPLE_CLOSE;
|
||||
if (isRateMultipleOf(matchInfo.m_refreshRate, candidate->m_refreshRate, false))
|
||||
weights[candidate->m_id]->m_weight += MATCH_WEIGHT_REFRESH_RATE_MULTIPLE_CLOSE;
|
||||
|
||||
// weight interlacing
|
||||
if (candidate->interlaced == matchInfo.interlaced)
|
||||
weights[candidate->id]->weight += MATCH_WEIGHT_INTERLACE;
|
||||
if (candidate->m_interlaced == matchInfo.m_interlaced)
|
||||
weights[candidate->m_id]->m_weight += MATCH_WEIGHT_INTERLACE;
|
||||
|
||||
if (candidate->id == currentVideoMode->id)
|
||||
weights[candidate->id]->weight += MATCH_WEIGHT_CURRENT;
|
||||
if (candidate->m_id == currentVideoMode->m_id)
|
||||
weights[candidate->m_id]->m_weight += MATCH_WEIGHT_CURRENT;
|
||||
|
||||
modeit++;
|
||||
}
|
||||
@ -154,23 +154,23 @@ int DisplayManager::findBestMatch(int display, DMMatchMediaInfo& matchInfo)
|
||||
DMVideoModeWeightMap::const_iterator weightit = weights.constBegin();
|
||||
while (weightit != weights.constEnd())
|
||||
{
|
||||
QLOG_DEBUG() << "Mode " << weightit.value()->mode->id << "("
|
||||
<< weightit.value()->mode->getPrettyName() << ") has weight "
|
||||
<< weightit.value()->weight;
|
||||
if (weightit.value()->weight > maxWeight)
|
||||
QLOG_DEBUG() << "Mode " << weightit.value()->m_mode->m_id << "("
|
||||
<< weightit.value()->m_mode->getPrettyName() << ") has weight "
|
||||
<< weightit.value()->m_weight;
|
||||
if (weightit.value()->m_weight > maxWeight)
|
||||
{
|
||||
chosen = weightit.value();
|
||||
maxWeight = chosen->weight;
|
||||
maxWeight = chosen->m_weight;
|
||||
}
|
||||
|
||||
weightit++;
|
||||
}
|
||||
|
||||
if ((chosen) && (chosen->weight > MATCH_WEIGHT_RES))
|
||||
if ((chosen) && (chosen->m_weight > MATCH_WEIGHT_RES))
|
||||
{
|
||||
QLOG_INFO() << "DisplayManager RefreshMatch : found a suitable mode : "
|
||||
<< chosen->mode->getPrettyName();
|
||||
return chosen->mode->id;
|
||||
<< chosen->m_mode->getPrettyName();
|
||||
return chosen->m_mode->m_id;
|
||||
}
|
||||
|
||||
QLOG_INFO() << "DisplayManager RefreshMatch : found no suitable videomode";
|
||||
@ -180,40 +180,40 @@ int DisplayManager::findBestMatch(int display, DMMatchMediaInfo& matchInfo)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int DisplayManager::findBestMode(int display)
|
||||
{
|
||||
int best_mode = -1;
|
||||
int bestMode = -1;
|
||||
|
||||
foreach (auto mode, displays[display]->videoModes)
|
||||
foreach (auto mode, m_displays[display]->m_videoModes)
|
||||
{
|
||||
if (best_mode < 0)
|
||||
if (bestMode < 0)
|
||||
{
|
||||
best_mode = mode->id;
|
||||
bestMode = mode->m_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
DMVideoModePtr best = displays[display]->videoModes[best_mode];
|
||||
DMVideoModePtr best = m_displays[display]->m_videoModes[bestMode];
|
||||
DMVideoModePtr candidate = mode;
|
||||
|
||||
// Highest priority: prefer non-interlaced modes.
|
||||
if (!best->interlaced && candidate->interlaced)
|
||||
if (!best->m_interlaced && candidate->m_interlaced)
|
||||
continue;
|
||||
|
||||
if (best->bitsPerPixel > candidate->bitsPerPixel)
|
||||
if (best->m_bitsPerPixel > candidate->m_bitsPerPixel)
|
||||
continue;
|
||||
|
||||
if (best->width > candidate->width)
|
||||
if (best->m_width > candidate->m_width)
|
||||
continue;
|
||||
|
||||
if (best->height > candidate->height)
|
||||
if (best->m_height > candidate->m_height)
|
||||
continue;
|
||||
|
||||
if (best->refreshRate > candidate->refreshRate)
|
||||
if (best->m_refreshRate > candidate->m_refreshRate)
|
||||
continue;
|
||||
|
||||
best_mode = candidate->id;
|
||||
bestMode = candidate->m_id;
|
||||
}
|
||||
}
|
||||
|
||||
return best_mode;
|
||||
return bestMode;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -19,21 +19,21 @@
|
||||
class DMVideoMode
|
||||
{
|
||||
public:
|
||||
int id;
|
||||
int width;
|
||||
int height;
|
||||
int bitsPerPixel;
|
||||
float refreshRate;
|
||||
bool interlaced;
|
||||
int m_id;
|
||||
int m_width;
|
||||
int m_height;
|
||||
int m_bitsPerPixel;
|
||||
float m_refreshRate;
|
||||
bool m_interlaced;
|
||||
|
||||
int priv_id;
|
||||
int m_privId;
|
||||
|
||||
inline QString getPrettyName()
|
||||
{
|
||||
QString name;
|
||||
|
||||
name = QString("%1 x%2%3").arg(width, 5).arg(height, 5).arg((interlaced ? "i" : " "));
|
||||
name += QString("x %1bpp @%2Hz").arg(bitsPerPixel, 2).arg(refreshRate);
|
||||
name = QString("%1 x%2%3").arg(m_width, 5).arg(m_height, 5).arg((m_interlaced ? "i" : " "));
|
||||
name += QString("x %1bpp @%2Hz").arg(m_bitsPerPixel, 2).arg(m_refreshRate);
|
||||
return name;
|
||||
}
|
||||
};
|
||||
@ -46,12 +46,12 @@ typedef QMap<int, DMVideoModePtr> DMVideoModeMap;
|
||||
class DMDisplay
|
||||
{
|
||||
public:
|
||||
int id;
|
||||
QString name;
|
||||
int m_id;
|
||||
QString m_name;
|
||||
|
||||
int priv_id;
|
||||
int m_privId;
|
||||
|
||||
DMVideoModeMap videoModes;
|
||||
DMVideoModeMap m_videoModes;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<DMDisplay> DMDisplayPtr;
|
||||
@ -62,12 +62,12 @@ typedef QMap<int, DMDisplayPtr> DMDisplayMap;
|
||||
class DMMatchMediaInfo
|
||||
{
|
||||
public:
|
||||
DMMatchMediaInfo() : refreshRate(0), interlaced(false) {};
|
||||
DMMatchMediaInfo() : m_refreshRate(0), m_interlaced(false) {};
|
||||
DMMatchMediaInfo(float refreshRate, bool interlaced)
|
||||
: refreshRate(refreshRate), interlaced(interlaced) {};
|
||||
: m_refreshRate(refreshRate), m_interlaced(interlaced) {};
|
||||
|
||||
float refreshRate;
|
||||
bool interlaced;
|
||||
float m_refreshRate;
|
||||
bool m_interlaced;
|
||||
};
|
||||
|
||||
// Matching weights
|
||||
@ -87,8 +87,8 @@ public:
|
||||
class DMVideoModeWeight
|
||||
{
|
||||
public:
|
||||
float weight;
|
||||
DMVideoModePtr mode;
|
||||
float m_weight;
|
||||
DMVideoModePtr m_mode;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<DMVideoModeWeight> DMVideoModeWeightPtr;
|
||||
@ -103,7 +103,7 @@ public:
|
||||
DisplayManager(QObject* parent);
|
||||
virtual ~DisplayManager() {}
|
||||
|
||||
DMDisplayMap displays;
|
||||
DMDisplayMap m_displays;
|
||||
|
||||
// functions that should be implemented on each platform
|
||||
virtual bool initialize();
|
||||
|
@ -4,28 +4,28 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void DisplayManagerDummy::addMode(float rate)
|
||||
{
|
||||
if (!displays.size())
|
||||
if (!m_displays.size())
|
||||
return;
|
||||
|
||||
DMVideoModePtr mode = DMVideoModePtr(new DMVideoMode());
|
||||
mode->id = displays[0]->videoModes.size();
|
||||
mode->interlaced = false;
|
||||
mode->refreshRate = rate;
|
||||
mode->width = 1280;
|
||||
mode->height = 720;
|
||||
mode->bitsPerPixel = 0;
|
||||
displays[0]->videoModes[mode->id] = mode;
|
||||
mode->m_id = m_displays[0]->m_videoModes.size();
|
||||
mode->m_interlaced = false;
|
||||
mode->m_refreshRate = rate;
|
||||
mode->m_width = 1280;
|
||||
mode->m_height = 720;
|
||||
mode->m_bitsPerPixel = 0;
|
||||
m_displays[0]->m_videoModes[mode->m_id] = mode;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool DisplayManagerDummy::initialize()
|
||||
{
|
||||
displays.clear();
|
||||
m_displays.clear();
|
||||
|
||||
DMDisplayPtr display = DMDisplayPtr(new DMDisplay());
|
||||
display->id = displays.size();
|
||||
display->name = "Dummy display";
|
||||
displays[display->id] = display;
|
||||
display->m_id = m_displays.size();
|
||||
display->m_name = "Dummy display";
|
||||
m_displays[display->m_id] = display;
|
||||
|
||||
addMode(60);
|
||||
|
||||
@ -38,12 +38,12 @@ bool DisplayManagerDummy::setDisplayMode(int display, int mode)
|
||||
if (!isValidDisplayMode(display, mode))
|
||||
return false;
|
||||
|
||||
DMDisplayPtr displayptr = displays[display];
|
||||
DMVideoModePtr videomode = displayptr->videoModes[mode];
|
||||
DMDisplayPtr displayptr = m_displays[display];
|
||||
DMVideoModePtr videomode = displayptr->m_videoModes[mode];
|
||||
|
||||
QLOG_INFO() << "Switching to" << videomode->width << "x" << videomode->height << "@" << videomode->refreshRate;
|
||||
QLOG_INFO() << "Switching to" << videomode->m_width << "x" << videomode->m_height << "@" << videomode->m_refreshRate;
|
||||
|
||||
m_currentMode = videomode->id;
|
||||
m_currentMode = videomode->m_id;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -66,7 +66,7 @@ int DisplayManagerDummy::getMainDisplay()
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int DisplayManagerDummy::getDisplayFromPoint(int x, int y)
|
||||
{
|
||||
if (displays.size())
|
||||
if (m_displays.size())
|
||||
{
|
||||
if (x >= 0 && y >= 0 && x < 1280 && y < 720)
|
||||
return 0;
|
||||
|
@ -17,7 +17,7 @@ bool DisplayManagerOSX::initialize()
|
||||
{
|
||||
int totalModes = 0;
|
||||
|
||||
displays.clear();
|
||||
m_displays.clear();
|
||||
|
||||
for (int i = 0; i < m_osxDisplayModes.size(); i++)
|
||||
{
|
||||
@ -38,9 +38,9 @@ bool DisplayManagerOSX::initialize()
|
||||
{
|
||||
// add the display to the list
|
||||
DMDisplayPtr display = DMDisplayPtr(new DMDisplay);
|
||||
display->id = displayid;
|
||||
display->name = QString("Display %1").arg(displayid);
|
||||
displays[display->id] = display;
|
||||
display->m_id = displayid;
|
||||
display->m_name = QString("Display %1").arg(displayid);
|
||||
m_displays[display->m_id] = display;
|
||||
|
||||
m_osxDisplayModes[displayid] = CGDisplayCopyAllDisplayModes(m_osxDisplays[displayid], nullptr);
|
||||
if (!m_osxDisplayModes[displayid])
|
||||
@ -54,32 +54,32 @@ bool DisplayManagerOSX::initialize()
|
||||
|
||||
// add the videomode to the display
|
||||
DMVideoModePtr mode = DMVideoModePtr(new DMVideoMode);
|
||||
mode->id = modeid;
|
||||
display->videoModes[modeid] = mode;
|
||||
mode->m_id = modeid;
|
||||
display->m_videoModes[modeid] = mode;
|
||||
|
||||
// grab videomode info
|
||||
CGDisplayModeRef displayMode =
|
||||
(CGDisplayModeRef)CFArrayGetValueAtIndex(m_osxDisplayModes[displayid], modeid);
|
||||
|
||||
mode->height = CGDisplayModeGetHeight(displayMode);
|
||||
mode->width = CGDisplayModeGetWidth(displayMode);
|
||||
mode->refreshRate = CGDisplayModeGetRefreshRate(displayMode);
|
||||
mode->m_height = CGDisplayModeGetHeight(displayMode);
|
||||
mode->m_width = CGDisplayModeGetWidth(displayMode);
|
||||
mode->m_refreshRate = CGDisplayModeGetRefreshRate(displayMode);
|
||||
|
||||
CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(displayMode);
|
||||
|
||||
if (CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
mode->bitsPerPixel = 32;
|
||||
mode->m_bitsPerPixel = 32;
|
||||
else if (CFStringCompare(pixEnc, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
mode->bitsPerPixel = 16;
|
||||
mode->m_bitsPerPixel = 16;
|
||||
else if (CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
mode->bitsPerPixel = 8;
|
||||
mode->m_bitsPerPixel = 8;
|
||||
|
||||
CFRelease(pixEnc);
|
||||
|
||||
mode->interlaced = (CGDisplayModeGetIOFlags(displayMode) & kDisplayModeInterlacedFlag) > 0;
|
||||
mode->m_interlaced = (CGDisplayModeGetIOFlags(displayMode) & kDisplayModeInterlacedFlag) > 0;
|
||||
|
||||
if (mode->refreshRate == 0)
|
||||
mode->refreshRate = 60;
|
||||
if (mode->m_refreshRate == 0)
|
||||
mode->m_refreshRate = 60;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ bool DisplayManagerWin::initialize()
|
||||
int displayId = 0;
|
||||
|
||||
m_displayAdapters.clear();
|
||||
displays.clear();
|
||||
m_displays.clear();
|
||||
|
||||
while (getDisplayInfo(displayId, displayInfo))
|
||||
{
|
||||
@ -61,7 +61,7 @@ bool DisplayManagerWin::initialize()
|
||||
DMDisplayPtr display = DMDisplayPtr(new DMDisplay);
|
||||
display->id = displayId;
|
||||
display->name = QString::fromWCharArray(displayInfo.DeviceString);
|
||||
displays[display->id] = DMDisplayPtr(display);
|
||||
m_displays[display->m_id] = DMDisplayPtr(display);
|
||||
m_displayAdapters[display->id] = QString::fromWCharArray(displayInfo.DeviceName);
|
||||
|
||||
while (getModeInfo(displayId, modeId, modeInfo))
|
||||
@ -79,7 +79,7 @@ bool DisplayManagerWin::initialize()
|
||||
displayId++;
|
||||
}
|
||||
|
||||
if (displays.size() == 0)
|
||||
if (m_displays.isEmpty())
|
||||
{
|
||||
QLOG_DEBUG() << "No display found.";
|
||||
return false;
|
||||
@ -98,7 +98,7 @@ bool DisplayManagerWin::setDisplayMode(int display, int mode)
|
||||
|
||||
if (getModeInfo(display, mode, modeInfo))
|
||||
{
|
||||
QLOG_DEBUG() << "Switching to mode" << mode << "on display" << display << ":" << displays[display]->videoModes[mode]->getPrettyName();
|
||||
QLOG_DEBUG() << "Switching to mode" << mode << "on display" << display << ":" << m_displays[display]->m_videoModes[mode]->getPrettyName();
|
||||
|
||||
modeInfo.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY | DM_DISPLAYFLAGS;
|
||||
|
||||
|
@ -7,11 +7,11 @@
|
||||
class KeyAction
|
||||
{
|
||||
public:
|
||||
QString action;
|
||||
bool hasLongPress;
|
||||
QString m_action;
|
||||
bool m_hasLongPress;
|
||||
};
|
||||
|
||||
static QMap<int, KeyAction> cecKeyMap { \
|
||||
static QMap<int, KeyAction> g_cecKeyMap { \
|
||||
{ CEC_USER_CONTROL_CODE_SELECT , { INPUT_KEY_SELECT , false } } , \
|
||||
{ CEC_USER_CONTROL_CODE_UP , { INPUT_KEY_UP , false } } , \
|
||||
{ CEC_USER_CONTROL_CODE_DOWN , { INPUT_KEY_DOWN , false } } , \
|
||||
@ -195,12 +195,12 @@ QString InputCECWorker::getCommandString(cec_user_control_code code, unsigned in
|
||||
{
|
||||
QString key;
|
||||
|
||||
if (cecKeyMap.contains(code))
|
||||
if (g_cecKeyMap.contains(code))
|
||||
{
|
||||
KeyAction keyaction = cecKeyMap[code];
|
||||
key = keyaction.action;
|
||||
KeyAction keyaction = g_cecKeyMap[code];
|
||||
key = keyaction.m_action;
|
||||
|
||||
if ((duration > CEC_LONGPRESS_DURATION) && keyaction.hasLongPress)
|
||||
if ((duration > CEC_LONGPRESS_DURATION) && keyaction.m_hasLongPress)
|
||||
{
|
||||
key += "_LONG";
|
||||
}
|
||||
|
@ -117,11 +117,11 @@ void InputComponent::handleAction(const QString& action, bool autoRepeat)
|
||||
ReceiverSlot* recvSlot = m_hostCommands.value(hostCommand);
|
||||
if (recvSlot)
|
||||
{
|
||||
QLOG_DEBUG() << "Invoking slot" << qPrintable(recvSlot->slot.data());
|
||||
QLOG_DEBUG() << "Invoking slot" << qPrintable(recvSlot->m_slot.data());
|
||||
QGenericArgument arg0 = QGenericArgument();
|
||||
if (recvSlot->hasArguments)
|
||||
if (recvSlot->m_hasArguments)
|
||||
arg0 = Q_ARG(const QString&, hostArguments);
|
||||
QMetaObject::invokeMethod(recvSlot->receiver, recvSlot->slot.data(),
|
||||
QMetaObject::invokeMethod(recvSlot->m_receiver, recvSlot->m_slot.data(),
|
||||
Qt::AutoConnection, arg0);
|
||||
}
|
||||
}
|
||||
@ -197,22 +197,23 @@ void InputComponent::remapInput(const QString &source, const QString &keycode, b
|
||||
void InputComponent::registerHostCommand(const QString& command, QObject* receiver, const char* slot)
|
||||
{
|
||||
auto recvSlot = new ReceiverSlot;
|
||||
recvSlot->receiver = receiver;
|
||||
recvSlot->slot = QMetaObject::normalizedSignature(slot);
|
||||
recvSlot->hasArguments = false;
|
||||
recvSlot->m_receiver = receiver;
|
||||
recvSlot->m_slot = QMetaObject::normalizedSignature(slot);
|
||||
recvSlot->m_hasArguments = false;
|
||||
|
||||
QLOG_DEBUG() << "Adding host command:" << qPrintable(command) << "mapped to" << qPrintable(QString(receiver->metaObject()->className()) + "::" + recvSlot->slot);
|
||||
QLOG_DEBUG() << "Adding host command:" << qPrintable(command) << "mapped to"
|
||||
<< qPrintable(QString(receiver->metaObject()->className()) + "::" + recvSlot->m_slot);
|
||||
|
||||
m_hostCommands.insert(command, recvSlot);
|
||||
|
||||
auto slotWithArgs = QString("%1(QString)").arg(QString::fromLatin1(recvSlot->slot)).toLatin1();
|
||||
auto slotWithoutArgs = QString("%1()").arg(QString::fromLatin1(recvSlot->slot)).toLatin1();
|
||||
if (recvSlot->receiver->metaObject()->indexOfMethod(slotWithArgs.data()) != -1)
|
||||
auto slotWithArgs = QString("%1(QString)").arg(QString::fromLatin1(recvSlot->m_slot)).toLatin1();
|
||||
auto slotWithoutArgs = QString("%1()").arg(QString::fromLatin1(recvSlot->m_slot)).toLatin1();
|
||||
if (recvSlot->m_receiver->metaObject()->indexOfMethod(slotWithArgs.data()) != -1)
|
||||
{
|
||||
QLOG_DEBUG() << "Host command maps to method with an argument.";
|
||||
recvSlot->hasArguments = true;
|
||||
recvSlot->m_hasArguments = true;
|
||||
}
|
||||
else if (recvSlot->receiver->metaObject()->indexOfMethod(slotWithoutArgs.data()) != -1)
|
||||
else if (recvSlot->m_receiver->metaObject()->indexOfMethod(slotWithoutArgs.data()) != -1)
|
||||
{
|
||||
QLOG_DEBUG() << "Host command maps to method without arguments.";
|
||||
}
|
||||
|
@ -70,9 +70,9 @@ signals:
|
||||
|
||||
struct ReceiverSlot
|
||||
{
|
||||
QObject* receiver;
|
||||
QByteArray slot;
|
||||
bool hasArguments;
|
||||
QObject* m_receiver;
|
||||
QByteArray m_slot;
|
||||
bool m_hasArguments;
|
||||
};
|
||||
|
||||
class InputComponent : public ComponentBase
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
@interface MediaKeysDelegate : NSObject
|
||||
{
|
||||
SPMediaKeyTap* keyTap;
|
||||
SPMediaKeyTap* m_keyTap;
|
||||
InputAppleMediaKeys* m_input;
|
||||
}
|
||||
-(instancetype)initWithInput:(InputAppleMediaKeys*)input;
|
||||
@ -21,9 +21,9 @@
|
||||
self = [super init];
|
||||
if (self) {
|
||||
m_input = input;
|
||||
keyTap = [[SPMediaKeyTap alloc] initWithDelegate:self];
|
||||
m_keyTap = [[SPMediaKeyTap alloc] initWithDelegate:self];
|
||||
if ([SPMediaKeyTap usesGlobalMediaKeyTap])
|
||||
[keyTap startWatchingMediaKeys];
|
||||
[m_keyTap startWatchingMediaKeys];
|
||||
else
|
||||
QLOG_WARN() << "Could not grab global media keys";
|
||||
}
|
||||
@ -71,4 +71,4 @@ bool InputAppleMediaKeys::initInput()
|
||||
{
|
||||
m_delegate = [[MediaKeysDelegate alloc] initWithInput:this];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ void PlayerComponent::setRpiWindow(QQuickWindow* window)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void PlayerComponent::setWindow(QQuickWindow* window)
|
||||
{
|
||||
bool use_rpi = false;
|
||||
bool useRpi = false;
|
||||
#ifdef TARGET_RPI
|
||||
use_rpi = true;
|
||||
#endif
|
||||
@ -193,10 +193,10 @@ void PlayerComponent::setWindow(QQuickWindow* window)
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
QString force_vo = SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, "debug.force_vo").toString();
|
||||
if (force_vo.size())
|
||||
mpv::qt::set_option_variant(m_mpv, "vo", force_vo);
|
||||
else if (use_rpi)
|
||||
QString forceVo = SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, "debug.force_vo").toString();
|
||||
if (forceVo.size())
|
||||
mpv::qt::set_option_variant(m_mpv, "vo", forceVo);
|
||||
else if (useRpi)
|
||||
setRpiWindow(window);
|
||||
else
|
||||
setQtQuickWindow(window);
|
||||
@ -336,33 +336,33 @@ void PlayerComponent::handleMpvEvent(mpv_event *event)
|
||||
{
|
||||
case MPV_EVENT_START_FILE:
|
||||
{
|
||||
m_CurrentUrl = mpv::qt::get_property_variant(m_mpv, "path").toString();
|
||||
m_currentUrl = mpv::qt::get_property_variant(m_mpv, "path").toString();
|
||||
m_playbackStartSent = false;
|
||||
break;
|
||||
}
|
||||
case MPV_EVENT_FILE_LOADED:
|
||||
{
|
||||
emit playing(m_CurrentUrl);
|
||||
emit playing(m_currentUrl);
|
||||
break;
|
||||
}
|
||||
case MPV_EVENT_END_FILE:
|
||||
{
|
||||
mpv_event_end_file *end_file = (mpv_event_end_file *)event->data;
|
||||
switch (end_file->reason)
|
||||
mpv_event_end_file *endFile = (mpv_event_end_file *)event->data;
|
||||
switch (endFile->reason)
|
||||
{
|
||||
case MPV_END_FILE_REASON_EOF:
|
||||
emit finished(m_CurrentUrl);
|
||||
emit finished(m_currentUrl);
|
||||
break;
|
||||
case MPV_END_FILE_REASON_ERROR:
|
||||
emit error(end_file->error, mpv_error_string(end_file->error));
|
||||
emit error(endFile->error, mpv_error_string(endFile->error));
|
||||
break;
|
||||
default:
|
||||
emit stopped(m_CurrentUrl);
|
||||
emit stopped(m_currentUrl);
|
||||
break;
|
||||
}
|
||||
|
||||
emit playbackEnded(m_CurrentUrl);
|
||||
m_CurrentUrl = "";
|
||||
emit playbackEnded(m_currentUrl);
|
||||
m_currentUrl = "";
|
||||
|
||||
if (!m_streamSwitchImminent)
|
||||
m_restoreDisplayTimer.start(0);
|
||||
@ -450,11 +450,11 @@ void PlayerComponent::handleMpvEvent(mpv_event *event)
|
||||
// We use this to block loading until we explicitly tell it to continue.
|
||||
if (msg->num_args >= 3 && !strcmp(msg->args[0], "hook_run") && !strcmp(msg->args[1], "1"))
|
||||
{
|
||||
QString resume_id = QString::fromUtf8(msg->args[2]);
|
||||
QString resumeId = QString::fromUtf8(msg->args[2]);
|
||||
// Calling this lambda will instruct mpv to continue loading the file.
|
||||
auto resume = [=] {
|
||||
QLOG_INFO() << "resuming loading";
|
||||
mpv::qt::command_variant(m_mpv, QStringList() << "hook-ack" << resume_id);
|
||||
mpv::qt::command_variant(m_mpv, QStringList() << "hook-ack" << resumeId);
|
||||
};
|
||||
if (switchDisplayFrameRate())
|
||||
{
|
||||
@ -613,13 +613,13 @@ void PlayerComponent::setAudioDelay(qint64 milliseconds)
|
||||
{
|
||||
m_playbackAudioDelay = milliseconds;
|
||||
|
||||
double display_fps = DisplayComponent::Get().currentRefreshRate();
|
||||
const char *audio_delay_setting = "audio_delay.normal";
|
||||
if (fabs(display_fps - 24) < 1) // cover 24Hz, 23.976Hz, and values very close
|
||||
audio_delay_setting = "audio_delay.24hz";
|
||||
double displayFps = DisplayComponent::Get().currentRefreshRate();
|
||||
const char *audioDelaySetting = "audio_delay.normal";
|
||||
if (fabs(displayFps - 24) < 1) // cover 24Hz, 23.976Hz, and values very close
|
||||
audioDelaySetting = "audio_delay.24hz";
|
||||
|
||||
double fixed_delay = SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, audio_delay_setting).toFloat();
|
||||
mpv::qt::set_option_variant(m_mpv, "audio-delay", (fixed_delay + m_playbackAudioDelay) / 1000.0);
|
||||
double fixedDelay = SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, audioDelaySetting).toFloat();
|
||||
mpv::qt::set_option_variant(m_mpv, "audio-delay", (fixedDelay + m_playbackAudioDelay) / 1000.0);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -641,18 +641,18 @@ void PlayerComponent::onReloadAudio()
|
||||
// force the player and/or the OS to move audio output back to the user-selected device.
|
||||
void PlayerComponent::checkCurrentAudioDevice(const QSet<QString>& old_devs, const QSet<QString>& new_devs)
|
||||
{
|
||||
QString user_device = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "device").toString();
|
||||
QString userDevice = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "device").toString();
|
||||
|
||||
QSet<QString> removed = old_devs - new_devs;
|
||||
QSet<QString> added = new_devs - old_devs;
|
||||
|
||||
QLOG_DEBUG() << "Audio devices removed:" << removed;
|
||||
QLOG_DEBUG() << "Audio devices added:" << added;
|
||||
QLOG_DEBUG() << "Audio device selected:" << user_device;
|
||||
QLOG_DEBUG() << "Audio device selected:" << userDevice;
|
||||
|
||||
if (!mpv::qt::get_property_variant(m_mpv, "idle").toBool() && user_device.length())
|
||||
if (!mpv::qt::get_property_variant(m_mpv, "idle").toBool() && userDevice.length())
|
||||
{
|
||||
if (added.contains(user_device))
|
||||
if (added.contains(userDevice))
|
||||
{
|
||||
// The timer is for debouncing the reload. Several change notifications could
|
||||
// come in quick succession. Also, it's possible that trying to open the
|
||||
@ -691,17 +691,17 @@ void PlayerComponent::updateAudioDeviceList()
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void PlayerComponent::setAudioConfiguration()
|
||||
{
|
||||
QStringList ao_defaults;
|
||||
QStringList aoDefaults;
|
||||
|
||||
QString deviceType = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "devicetype").toString();
|
||||
|
||||
if (SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "exclusive").toBool())
|
||||
{
|
||||
ao_defaults << "wasapi:exclusive=yes";
|
||||
ao_defaults << "coreaudio:exclusive=yes";
|
||||
aoDefaults << "wasapi:exclusive=yes";
|
||||
aoDefaults << "coreaudio:exclusive=yes";
|
||||
}
|
||||
|
||||
mpv::qt::set_option_variant(m_mpv, "ao-defaults", ao_defaults.join(','));
|
||||
mpv::qt::set_option_variant(m_mpv, "ao-defaults", aoDefaults.join(','));
|
||||
|
||||
// set the audio device
|
||||
QVariant device = SettingsComponent::Get().value(SETTINGS_SECTION_AUDIO, "device");
|
||||
@ -788,16 +788,16 @@ void PlayerComponent::updateSubtitleSettings()
|
||||
QVariant size = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "size");
|
||||
mpv::qt::set_option_variant(m_mpv, "sub-text-font-size", size);
|
||||
|
||||
QVariant colors_string = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "color");
|
||||
auto colors = colors_string.toString().split(",");
|
||||
QVariant colorsString = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "color");
|
||||
auto colors = colorsString.toString().split(",");
|
||||
if (colors.length() == 2)
|
||||
{
|
||||
mpv::qt::set_option_variant(m_mpv, "sub-text-color", colors[0]);
|
||||
mpv::qt::set_option_variant(m_mpv, "sub-text-border-color", colors[1]);
|
||||
}
|
||||
|
||||
QVariant subpos_string = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "placement");
|
||||
auto subpos = subpos_string.toString().split(",");
|
||||
QVariant subposString = SettingsComponent::Get().value(SETTINGS_SECTION_SUBTITLES, "placement");
|
||||
auto subpos = subposString.toString().split(",");
|
||||
if (subpos.length() == 2)
|
||||
{
|
||||
mpv::qt::set_option_variant(m_mpv, "sub-text-align-x", subpos[0]);
|
||||
@ -808,16 +808,16 @@ void PlayerComponent::updateSubtitleSettings()
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void PlayerComponent::updateVideoSettings()
|
||||
{
|
||||
QVariant sync_mode = SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, "sync_mode");
|
||||
mpv::qt::set_option_variant(m_mpv, "video-sync", sync_mode);
|
||||
QVariant hardware_decoding = SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, "hardware_decoding");
|
||||
mpv::qt::set_property_variant(m_mpv, "hwdec", hardware_decoding.toBool() ? "auto" : "no");
|
||||
QVariant syncMode = SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, "sync_mode");
|
||||
mpv::qt::set_option_variant(m_mpv, "video-sync", syncMode);
|
||||
QVariant hardwareDecoding = SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, "hardware_decoding");
|
||||
mpv::qt::set_property_variant(m_mpv, "hwdec", hardwareDecoding.toBool() ? "auto" : "no");
|
||||
QVariant deinterlace = SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, "deinterlace");
|
||||
mpv::qt::set_option_variant(m_mpv, "deinterlace", deinterlace.toBool() ? "yes" : "no");
|
||||
|
||||
#ifndef TARGET_RPI
|
||||
double display_fps = DisplayComponent::Get().currentRefreshRate();
|
||||
mpv::qt::set_property_variant(m_mpv, "display-fps", display_fps);
|
||||
double displayFps = DisplayComponent::Get().currentRefreshRate();
|
||||
mpv::qt::set_property_variant(m_mpv, "display-fps", displayFps);
|
||||
#endif
|
||||
|
||||
setAudioDelay(m_playbackAudioDelay);
|
||||
@ -856,8 +856,8 @@ bool PlayerComponent::checkCodecSupport(const QString& codec)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
void PlayerComponent::userCommand(QString command)
|
||||
{
|
||||
QByteArray cmd_utf8 = command.toUtf8();
|
||||
mpv_command_string(m_mpv, cmd_utf8.data());
|
||||
QByteArray cmdUtf8 = command.toUtf8();
|
||||
mpv_command_string(m_mpv, cmdUtf8.data());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -879,10 +879,10 @@ void PlayerComponent::appendAudioFormat(QTextStream& info, const QString& proper
|
||||
{
|
||||
// Guess if it's a passthrough format. Don't show the channel layout in this
|
||||
// case, because it's confusing.
|
||||
QString audio_format = MPV_PROPERTY(property + "/format");
|
||||
if (audio_format.startsWith("spdif-"))
|
||||
QString audioFormat = MPV_PROPERTY(property + "/format");
|
||||
if (audioFormat.startsWith("spdif-"))
|
||||
{
|
||||
info << "passthrough (" << audio_format.mid(6) << ")";
|
||||
info << "passthrough (" << audioFormat.mid(6) << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -919,9 +919,9 @@ QString PlayerComponent::videoInformation() const
|
||||
info << "FPS (filters): " << MPV_PROPERTY("estimated-vf-fps") << endl;
|
||||
info << "Aspect: " << MPV_PROPERTY("video-aspect") << endl;
|
||||
info << "Bitrate: " << MPV_PROPERTY("video-bitrate") << endl;
|
||||
double display_fps = DisplayComponent::Get().currentRefreshRate();
|
||||
double displayFps = DisplayComponent::Get().currentRefreshRate();
|
||||
info << "Display FPS: " << MPV_PROPERTY("display-fps")
|
||||
<< " (" << display_fps << ")" << endl;
|
||||
<< " (" << displayFps << ")" << endl;
|
||||
info << "Hardware Decoding: " << MPV_PROPERTY("hwdec-active")
|
||||
<< " (" << MPV_PROPERTY("hwdec-detected") << ")" << endl;
|
||||
info << endl;
|
||||
@ -938,9 +938,9 @@ QString PlayerComponent::videoInformation() const
|
||||
info << "Performance: " << endl;
|
||||
info << "A/V: " << MPV_PROPERTY("avsync") << endl;
|
||||
info << "Dropped frames: " << MPV_PROPERTY("vo-drop-frame-count") << endl;
|
||||
bool disp_sync = MPV_PROPERTY_BOOL("display-sync-active");
|
||||
bool dispSync = MPV_PROPERTY_BOOL("display-sync-active");
|
||||
info << "Display Sync: ";
|
||||
if (!disp_sync)
|
||||
if (!dispSync)
|
||||
{
|
||||
info << "no" << endl;
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ private:
|
||||
|
||||
double m_lastPositionUpdate;
|
||||
qint64 m_playbackAudioDelay;
|
||||
QString m_CurrentUrl;
|
||||
QString m_currentUrl;
|
||||
bool m_playbackStartSent;
|
||||
QQuickWindow* m_window;
|
||||
float m_mediaFrameRate;
|
||||
|
@ -62,11 +62,11 @@ void PowerComponent::setFullscreenState(bool fullscreen)
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
void PowerComponent::redecideScreeensaverState()
|
||||
{
|
||||
bool enable_os_screensaver = !m_fullscreenState && !m_videoPlaying;
|
||||
if (m_currentScreensaverEnabled != enable_os_screensaver)
|
||||
bool enableOsScreensaver = !m_fullscreenState && !m_videoPlaying;
|
||||
if (m_currentScreensaverEnabled != enableOsScreensaver)
|
||||
{
|
||||
m_currentScreensaverEnabled = enable_os_screensaver;
|
||||
if (enable_os_screensaver)
|
||||
m_currentScreensaverEnabled = enableOsScreensaver;
|
||||
if (enableOsScreensaver)
|
||||
{
|
||||
QLOG_DEBUG() << "Enabling OS screensaver";
|
||||
doEnableScreensaver();
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "utils/Utils.h"
|
||||
#include "Version.h"
|
||||
|
||||
static QMap<QString, QString> resourceKeyMap = {
|
||||
static QMap<QString, QString> g_resourceKeyMap = {
|
||||
{ "Name", "title" },
|
||||
{ "Resource-Identifier", "machineIdentifier" },
|
||||
{ "Product", "product" },
|
||||
@ -22,7 +22,7 @@ static QMap<QString, QString> resourceKeyMap = {
|
||||
{ "Device-Class", "deviceClass" }
|
||||
};
|
||||
|
||||
static QMap<QString, QString> headerKeyMap = {
|
||||
static QMap<QString, QString> g_headerKeyMap = {
|
||||
{ "Name", "X-Plex-Device-Name" },
|
||||
{ "Resource-Identifier", "X-Plex-Client-Identifier" },
|
||||
{ "Product", "X-Plex-Product" },
|
||||
@ -60,8 +60,8 @@ QVariantMap RemoteComponent::HeaderInformation()
|
||||
|
||||
foreach (const QString& key, gdmInfo.keys())
|
||||
{
|
||||
if (headerKeyMap.contains(key))
|
||||
headerInfo[headerKeyMap[key]] = gdmInfo[key];
|
||||
if (g_headerKeyMap.contains(key))
|
||||
headerInfo[g_headerKeyMap[key]] = gdmInfo[key];
|
||||
}
|
||||
|
||||
headerInfo["X-Plex-Platform"] = QSysInfo::productType();
|
||||
@ -78,8 +78,8 @@ QVariantMap RemoteComponent::ResourceInformation()
|
||||
|
||||
foreach (const QString& key, gdmInfo.keys())
|
||||
{
|
||||
if (resourceKeyMap.contains(key))
|
||||
resourceInfo[resourceKeyMap[key]] = gdmInfo[key];
|
||||
if (g_resourceKeyMap.contains(key))
|
||||
resourceInfo[g_resourceKeyMap[key]] = gdmInfo[key];
|
||||
}
|
||||
|
||||
resourceInfo["platform"] = QSysInfo::productType();
|
||||
|
@ -303,7 +303,7 @@ void SettingsComponent::resetToDefault()
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct section_order_index
|
||||
struct SectionOrderIndex
|
||||
{
|
||||
inline bool operator ()(SettingsSection* a, SettingsSection* b)
|
||||
{
|
||||
@ -317,7 +317,7 @@ QVariantList SettingsComponent::settingDescriptions()
|
||||
QJsonArray desc;
|
||||
|
||||
QList<SettingsSection*> sectionList = m_sections.values();
|
||||
std::sort(sectionList.begin(), sectionList.end(), section_order_index());
|
||||
std::sort(sectionList.begin(), sectionList.end(), SectionOrderIndex());
|
||||
|
||||
foreach(SettingsSection* section, sectionList)
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ const QVariantMap SettingsSection::allValues() const
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
struct value_sort_order
|
||||
struct ValueSortOrder
|
||||
{
|
||||
inline bool operator()(SettingsValue* a, SettingsValue* b)
|
||||
{
|
||||
@ -138,7 +138,7 @@ const QVariantMap SettingsSection::descriptions() const
|
||||
map.insert("key", m_sectionID);
|
||||
|
||||
QList<SettingsValue*> list = m_values.values();
|
||||
std::sort(list.begin(), list.end(), value_sort_order());
|
||||
std::sort(list.begin(), list.end(), ValueSortOrder());
|
||||
|
||||
QVariantList settings;
|
||||
foreach(SettingsValue* value, list)
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define KONVERGO_PRODUCTID_OPENELEC 4
|
||||
|
||||
// Platform types map
|
||||
QMap<SystemComponent::PlatformType, QString> platformTypeNames = { \
|
||||
QMap<SystemComponent::PlatformType, QString> g_platformTypeNames = { \
|
||||
{ SystemComponent::platformTypeOsx, "macosx" }, \
|
||||
{ SystemComponent::platformTypeWindows, "windows" },
|
||||
{ SystemComponent::platformTypeLinux, "linux" },
|
||||
@ -30,7 +30,7 @@ QMap<SystemComponent::PlatformType, QString> platformTypeNames = { \
|
||||
};
|
||||
|
||||
// platform Archictecture map
|
||||
QMap<SystemComponent::PlatformArch, QString> platformArchNames = { \
|
||||
QMap<SystemComponent::PlatformArch, QString> g_platformArchNames = { \
|
||||
{ SystemComponent::platformArchX86_64, "x86_64" }, \
|
||||
{ SystemComponent::platformArchRpi2, "rpi2" },
|
||||
{ SystemComponent::platformArchUnknown, "unknown" }
|
||||
@ -91,13 +91,13 @@ void SystemComponent::componentPostInitialize()
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
QString SystemComponent::getPlatformTypeString() const
|
||||
{
|
||||
return platformTypeNames[m_platformType];
|
||||
return g_platformTypeNames[m_platformType];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
QString SystemComponent::getPlatformArchString() const
|
||||
{
|
||||
return platformArchNames[m_platformArch];
|
||||
return g_platformArchNames[m_platformArch];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user