Permalink
Browse files

Adapt Airplay and RAOP to new playback registration mechanism.

  • Loading branch information...
1 parent e4c5cfe commit 933bffcc89d6c272cf53aa9891a720b9ffc49f7f @jyavenard jyavenard committed Jul 15, 2012
@@ -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;
@@ -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);
@@ -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;
}
@@ -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,
@@ -63,9 +60,6 @@ class MTV_PUBLIC MythAirplayServer : public ServerPool
MythAirplayServer();
- public slots:
- void GotNewConnection(void);
-
private slots:
void Start();
void newConnection(QTcpSocket *client);
@@ -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;
@@ -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);
}
@@ -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;
}
@@ -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();

0 comments on commit 933bffc

Please sign in to comment.