Skip to content

Commit

Permalink
Adapt Airplay and RAOP to new playback registration mechanism.
Browse files Browse the repository at this point in the history
  • Loading branch information
jyavenard committed Jul 15, 2012
1 parent e4c5cfe commit 933bffc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 39 deletions.
20 changes: 0 additions & 20 deletions mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp
Expand Up @@ -20,9 +20,6 @@

#include "bonjourregister.h"
#include "mythairplayserver.h"
#ifdef USING_MYTHRAOP
#include "mythraopdevice.h"
#endif

MythAirplayServer* MythAirplayServer::gMythAirplayServer = NULL;
MThread* MythAirplayServer::gMythAirplayServerThread = NULL;
Expand Down Expand Up @@ -387,13 +384,6 @@ void MythAirplayServer::Start(void)
return;
}

void MythAirplayServer::GotNewConnection(void)
{
LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Receiving RAOP connection Message"));

DisconnectAllClients(QByteArray());
}

void MythAirplayServer::newConnection(QTcpSocket *client)
{
QMutexLocker locker(m_lock);
Expand Down Expand Up @@ -562,16 +552,6 @@ void MythAirplayServer::HandleResponse(APHTTPRequest *req,
!m_connections[session].initialized)
{
// Got a full connection, disconnect any other clients
#ifdef USING_MYTHRAOP
// Stop any RAOP (AirPlay audio) running
if (MythRAOPDevice::RAOPSharedInstance() != NULL)
{
QMetaObject::invokeMethod(MythRAOPDevice::RAOPSharedInstance(),
"GotNewConnection",
Qt::BlockingQueuedConnection);
LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Sent AirPlay connection Message"));
}
#endif
DisconnectAllClients(session);
m_connections[session].initialized = true;
}
Expand Down
6 changes: 0 additions & 6 deletions mythtv/libs/libmythtv/AirPlay/mythairplayserver.h
Expand Up @@ -16,9 +16,6 @@ class BonjourRegister;
#define AIRPLAY_HARDWARE_ID_SIZE 6
QString AirPlayHardwareId();

#define AIRPLAY_NEWCONNECTION "AIRPLAY_NEWCONNECTION"
#define AIRPLAY_DISCONNECTED "AIRPLAY_DISCONNECTED"

enum AirplayEvent
{
AP_EVENT_NONE = -1,
Expand Down Expand Up @@ -63,9 +60,6 @@ class MTV_PUBLIC MythAirplayServer : public ServerPool

MythAirplayServer();

public slots:
void GotNewConnection(void);

private slots:
void Start();
void newConnection(QTcpSocket *client);
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp
Expand Up @@ -1057,6 +1057,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header,
{
// New client is trying to play audio, disconnect all the other clients
((MythRAOPDevice*)parent())->DeleteAllClients(this);
gCoreContext->WantingPlayback(parent());

int control_port = 0;
int timing_port = 0;
Expand Down
15 changes: 3 additions & 12 deletions mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp
Expand Up @@ -187,11 +187,9 @@ bool MythRAOPDevice::RegisterForBonjour(void)
return m_bonjour->Register(m_setupPort, type, name, txt);
}

void MythRAOPDevice::GotNewConnection(void)
void MythRAOPDevice::TVPlaybackStarting(void)
{
QMutexLocker locker(m_lock);

LOG(VB_GENERAL, LOG_INFO, LOC + QString("Receiving AirPlay connection Message"));
LOG(VB_GENERAL, LOG_INFO, LOC + QString("Receiving new playback message"));
DeleteAllClients(NULL);
}

Expand All @@ -201,21 +199,14 @@ void MythRAOPDevice::newConnection(QTcpSocket *client)
LOG(VB_GENERAL, LOG_INFO, LOC + QString("New connection from %1:%2")
.arg(client->peerAddress().toString()).arg(client->peerPort()));

if (MythAirplayServer::AirplaySharedInstance() != NULL)
{
QMetaObject::invokeMethod(MythAirplayServer::AirplaySharedInstance(),
"GotNewConnection",
Qt::BlockingQueuedConnection);
LOG(VB_GENERAL, LOG_INFO, LOC + QString("Sent RAOP connection Message"));
}

MythRAOPConnection *obj =
new MythRAOPConnection(this, client, m_hardwareId, 6000);

if (obj->Init())
{
m_clients.append(obj);
connect(client, SIGNAL(disconnected()), this, SLOT(deleteClient()));
gCoreContext->RegisterForPlayback(this, SLOT(TVPlaybackStarting()));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/AirPlay/mythraopdevice.h
Expand Up @@ -26,7 +26,7 @@ class MTV_PUBLIC MythRAOPDevice : public ServerPool
void DeleteAllClients(MythRAOPConnection *keep);

public slots:
void GotNewConnection(void);
void TVPlaybackStarting(void);

private slots:
void Start();
Expand Down

0 comments on commit 933bffc

Please sign in to comment.