Skip to content

Commit

Permalink
Dismiss photo being currently displayed when video is about to start.
Browse files Browse the repository at this point in the history
Create the notification on demand when a photo is about to be displayed so we can discard it later.

There's still something not quite right when transitioning between photos and videos. The iPhone tends to disconnect the session. I suspect the delay we take in providing playback feedback to be the cause
  • Loading branch information
jyavenard committed Jul 17, 2013
1 parent ff1dc56 commit 4ad1700
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp
Expand Up @@ -558,10 +558,12 @@ void MythAirplayServer::deleteConnection(QTcpSocket *socket)
.arg(remove.data()));
m_connections.remove(remove);

// close any photos that could be displayed
MythUINotificationCenter::GetInstance()->UnRegister(this, m_id);
m_id = -1;

if (m_id > 0)
{
// close any photos that could be displayed
MythUINotificationCenter::GetInstance()->UnRegister(this, m_id);
m_id = -1;
}
MythNotification n(tr("Client disconnected"), tr("AirPlay"),
tr("from %1").arg(socket->peerAddress().toString()));
MythUINotificationCenter::GetInstance()->Queue(n);
Expand Down Expand Up @@ -705,9 +707,6 @@ void MythAirplayServer::HandleResponse(APHTTPRequest *req,
MythNotification n(tr("New Connection"), tr("AirPlay"),
tr("from %1").arg(socket->peerAddress().toString()));
MythUINotificationCenter::GetInstance()->Queue(n);

m_id = MythUINotificationCenter::GetInstance()->Register(this);

}

double position = 0.0f;
Expand Down Expand Up @@ -829,6 +828,10 @@ void MythAirplayServer::HandleResponse(APHTTPRequest *req,
LOG(VB_GENERAL, LOG_INFO, LOC +
QString("Received %1 photo").arg(png ? "jpeg" : "png"));

if (m_id < 0)
{
m_id = MythUINotificationCenter::GetInstance()->Register(this);
}
// send full screen display notification
MythImageNotification n(MythNotification::New, image);
n.SetId(m_id);
Expand Down Expand Up @@ -1147,6 +1150,12 @@ void MythAirplayServer::StartPlayback(const QString &pathname)
gCoreContext->WaitUntilSignals(SIGNAL(TVPlaybackStarted()),
SIGNAL(TVPlaybackAborted()),
NULL);
if (TV::IsTVRunning() && m_id > 0)
{
// playback has started, dismiss the photo is we were showing one
MythUINotificationCenter::GetInstance()->UnRegister(this, m_id);
m_id = -1;
}
LOG(VB_PLAYBACK, LOG_DEBUG, LOC +
QString("ACTION_HANDLEMEDIA completed"));
}
Expand Down

0 comments on commit 4ad1700

Please sign in to comment.