Permalink
Browse files

Fix AirPlay compilation if RAOP isn't compiled in.

  • Loading branch information...
jyavenard committed Jun 13, 2012
1 parent f60a706 commit 604b4f7d717325de583d90478011414a997486e0
@@ -19,7 +19,6 @@
#include "bonjourregister.h"
#include "mythairplayserver.h"
#include "mythraopdevice.h"
MythAirplayServer* MythAirplayServer::gMythAirplayServer = NULL;
MThread* MythAirplayServer::gMythAirplayServerThread = NULL;
@@ -108,6 +107,23 @@ QMutex* MythAirplayServer::gMythAirplayServerMutex = new QMutex(QMute
"</dict>\r\n"\
"</plist>\r\n")
QString AirPlayHardwareId()
{
QString key = "AirPlayId";
QString id = gCoreContext->GetSetting(key);
int size = id.size();
if (size == 12)
return id;
QByteArray ba;
for (int i = 0; i < AIRPLAY_HARDWARE_ID_SIZE; i++)
ba.append((random() % 80) + 33);
id = ba.toHex();
gCoreContext->SaveSetting(key, id);
return id;
}
class APHTTPRequest
{
public:
@@ -825,7 +841,7 @@ void MythAirplayServer::GetPlayerStatus(bool &playing, float &speed,
QString MythAirplayServer::GetMacAddress()
{
QString id = MythRAOPDevice::HardwareId();
QString id = AirPlayHardwareId();
QString res;
for (int i = 1; i <= id.size(); i++)
@@ -12,6 +12,8 @@ class MThread;
class BonjourRegister;
#define AIRPLAY_PORT_RANGE 100
#define AIRPLAY_HARDWARE_ID_SIZE 6
QString AirPlayHardwareId();
enum AirplayEvent
{
@@ -12,6 +12,7 @@
#include "mythraopdevice.h"
#include "mythraopconnection.h"
#include "mythairplayserver.h"
#define LOC QString("RAOP Conn: ")
#define MAX_PACKET_SIZE 2048
@@ -915,8 +916,8 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header,
i += 16;
}
}
memcpy(from + i, m_hardwareId.constData(), RAOP_HARDWARE_ID_SIZE);
i += RAOP_HARDWARE_ID_SIZE;
memcpy(from + i, m_hardwareId.constData(), AIRPLAY_HARDWARE_ID_SIZE);
i += AIRPLAY_HARDWARE_ID_SIZE;
int pad = 32 - i;
if (pad > 0)
@@ -9,6 +9,7 @@
#include "bonjourregister.h"
#include "mythraopconnection.h"
#include "mythraopdevice.h"
#include "mythairplayserver.h"
MythRAOPDevice* MythRAOPDevice::gMythRAOPDevice = NULL;
MThread* MythRAOPDevice::gMythRAOPDeviceThread = NULL;
@@ -60,23 +61,6 @@ bool MythRAOPDevice::Create(void)
return true;
}
QString MythRAOPDevice::HardwareId()
{
QString key = "AirPlayId";
QString id = gCoreContext->GetSetting(key);
int size = id.size();
if (size == 12)
return id;
QByteArray ba;
for (int i = 0; i < RAOP_HARDWARE_ID_SIZE; i++)
ba.append((random() % 80) + 33);
id = ba.toHex();
gCoreContext->SaveSetting(key, id);
return id;
}
void MythRAOPDevice::Cleanup(void)
{
LOG(VB_GENERAL, LOG_INFO, LOC + "Cleaning up.");
@@ -101,7 +85,7 @@ MythRAOPDevice::MythRAOPDevice()
: ServerPool(), m_name(QString("MythTV")), m_bonjour(NULL), m_valid(false),
m_lock(new QMutex(QMutex::Recursive)), m_setupPort(5000)
{
m_hardwareId = QByteArray::fromHex(HardwareId().toAscii());
m_hardwareId = QByteArray::fromHex(AirPlayHardwareId().toAscii());
}
MythRAOPDevice::~MythRAOPDevice()
@@ -12,7 +12,6 @@ class BonjourRegister;
class MythRAOPConnection;
#define RAOP_PORT_RANGE 100
#define RAOP_HARDWARE_ID_SIZE 6
class MTV_PUBLIC MythRAOPDevice : public ServerPool
{
@@ -24,7 +23,6 @@ class MTV_PUBLIC MythRAOPDevice : public ServerPool
MythRAOPDevice();
bool NextInAudioQueue(MythRAOPConnection* conn);
static QString HardwareId();
private slots:
void Start();

0 comments on commit 604b4f7

Please sign in to comment.