diff --git a/mythplugins/mythmusic/mythmusic/main.cpp b/mythplugins/mythmusic/mythmusic/main.cpp index 57b0ab9876c..c0adc2fb50f 100644 --- a/mythplugins/mythmusic/mythmusic/main.cpp +++ b/mythplugins/mythmusic/mythmusic/main.cpp @@ -196,9 +196,9 @@ static void startRipper(void) delete rip; #else - ShowOkPopup(qApp->translate("(MythMusicMain)", + ShowOkPopup(qApp->translate("(MythMusicMain)", "MythMusic hasn't been built with libcdio " - "support so ripping CD's is not possible")); + "support so ripping CDs is not possible")); #endif } diff --git a/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp b/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp index 7b664351ec5..cbafbdb3e08 100644 --- a/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp +++ b/mythtv/libs/libmythtv/AirPlay/mythraopconnection.cpp @@ -49,7 +49,7 @@ class _NetStream : public QTextStream }; _NetStream &operator<<(const QString &str) { - LOG(VB_GENERAL, LOG_DEBUG, + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Sending(%1): ").arg(str.length()) + str); QTextStream *q = this; *q << str; @@ -196,7 +196,7 @@ bool MythRAOPConnection::Init(void) m_textStream->setCodec("UTF-8"); if (!connect(m_socket, SIGNAL(readyRead()), this, SLOT(readClient()))) { - LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to connect client socket signal."); + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to connect client socket signal."); return false; } @@ -205,7 +205,7 @@ bool MythRAOPConnection::Init(void) if (!connect(m_dataSocket, SIGNAL(newDatagram(QByteArray, QHostAddress, quint16)), this, SLOT(udpDataReady(QByteArray, QHostAddress, quint16)))) { - LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to connect data socket signal."); + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to connect data socket signal."); return false; } @@ -213,11 +213,11 @@ bool MythRAOPConnection::Init(void) m_dataPort = m_dataSocket->tryBindingPort(m_dataPort, RAOP_PORT_RANGE); if (m_dataPort < 0) { - LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to bind to a port for data."); + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to bind to a port for data."); return false; } - LOG(VB_GENERAL, LOG_INFO, LOC + + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Bound to port %1 for incoming data").arg(m_dataPort)); // load the private key @@ -258,7 +258,7 @@ void MythRAOPConnection::udpDataReady(QByteArray buf, QHostAddress peer, if (!GetPacketType(buf, type, seq, timestamp)) { - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Packet doesn't start with valid Rtp Header (0x%1)") .arg((uint8_t)buf[0], 0, 16)); return; @@ -290,7 +290,7 @@ void MythRAOPConnection::udpDataReady(QByteArray buf, QHostAddress peer, return; default: - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Packet type (0x%1) not handled") .arg(type, 0, 16)); return; @@ -299,7 +299,7 @@ void MythRAOPConnection::udpDataReady(QByteArray buf, QHostAddress peer, timestamp = framesToMs(timestamp); if (timestamp < m_currentTimestamp) { - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Received packet %1 too late, ignoring") .arg(seq)); return; @@ -323,13 +323,13 @@ void MythRAOPConnection::udpDataReady(QByteArray buf, QHostAddress peer, { if (m_resends.contains(seq)) { - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Received required resend %1 (with ts:%2 last:%3)") .arg(seq).arg(timestamp).arg(m_nextSequence)); m_resends.remove(seq); } else - LOG(VB_GENERAL, LOG_WARNING, LOC + + LOG(VB_PLAYBACK, LOG_WARNING, LOC + QString("Received unexpected resent packet %1") .arg(seq)); } @@ -341,7 +341,7 @@ void MythRAOPConnection::udpDataReady(QByteArray buf, QHostAddress peer, if (numframes < 0) { // an error occurred, ask for the audio packet once again. - LOG(VB_GENERAL, LOG_ERR, LOC + QString("Error decoding audio")); + LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("Error decoding audio")); SendResendRequest(timestamp, seq, seq+1); return; } @@ -374,17 +374,17 @@ void MythRAOPConnection::ProcessSync(const QByteArray &buf) if (first) { - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Receiving first SYNC packet")); + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Receiving first SYNC packet")); } else { - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Receiving SYNC packet")); + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Receiving SYNC packet")); } timeval t; gettimeofday(&t, NULL); m_timeLastSync = t.tv_sec * 1000 + t.tv_usec / 1000; - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("SYNC: cur:%1 next:%2 time:%3") + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("SYNC: cur:%1 next:%2 time:%3") .arg(m_currentTimestamp).arg(m_nextTimestamp).arg(m_timeLastSync)); int64_t delay = framesToMs(m_audioQueue.size() * m_framesPerPacket); @@ -396,7 +396,7 @@ void MythRAOPConnection::ProcessSync(const QByteArray &buf) currentLatency = (int64_t)audiots - (int64_t)m_currentTimestamp; } - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("RAOP timestamps: about to play:%1 desired:%2 latency:%3") .arg(audiots).arg(m_currentTimestamp) .arg(currentLatency)); @@ -404,7 +404,7 @@ void MythRAOPConnection::ProcessSync(const QByteArray &buf) delay += m_audio->GetAudioBufferedTime(); delay += currentLatency; - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Queue=%1 buffer=%2ms ideal=%3ms diffts:%4ms") .arg(m_audioQueue.size()) .arg(delay) @@ -430,7 +430,7 @@ void MythRAOPConnection::ProcessSync(const QByteArray &buf) int res = ExpireAudio(m_currentTimestamp - m_adjustedLatency); if (res > 0) { - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Drop %1 packets").arg(res)); + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Drop %1 packets").arg(res)); } m_audioStarted = false; @@ -451,7 +451,7 @@ void MythRAOPConnection::SendResendRequest(uint64_t timestamp, (int16_t)(((int32_t)got + UINT16_MAX + 1) - expected) : got - expected; - LOG(VB_GENERAL, LOG_INFO, LOC + + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Missed %1 packet(s): expected %2 got %3 ts:%4") .arg(missed).arg(expected).arg(got).arg(timestamp)); @@ -468,13 +468,13 @@ void MythRAOPConnection::SendResendRequest(uint64_t timestamp, { for (uint16_t count = 0; count < missed; count++) { - LOG(VB_GENERAL, LOG_INFO, LOC + QString("Sent resend for %1") + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Sent resend for %1") .arg(expected + count)); m_resends.insert(expected + count, timestamp); } } else - LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to send resend request."); + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to send resend request."); } /** @@ -493,7 +493,7 @@ void MythRAOPConnection::ExpireResendRequests(uint64_t timestamp) it.next(); if (it.value() < timestamp && m_streamingStarted) { - LOG(VB_GENERAL, LOG_WARNING, LOC + + LOG(VB_PLAYBACK, LOG_WARNING, LOC + QString("Never received resend packet %1").arg(it.key())); m_resends.remove(it.key()); } @@ -527,10 +527,10 @@ void MythRAOPConnection::SendTimeRequest(void) if (m_clientTimingSocket->writeDatagram(req, sizeof(req), m_peerAddress, m_clientTimingPort) != sizeof(req)) { - LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to send resend time request."); + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to send resend time request."); return; } - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Requesting master time (Local %1.%2)") .arg(t.tv_sec).arg(t.tv_usec)); } @@ -553,7 +553,7 @@ void MythRAOPConnection::ProcessTimeResponse(const QByteArray &buf) uint64_t time1, time2; time1 = t1.tv_sec * 1000 + t1.tv_usec / 1000; time2 = t2.tv_sec * 1000 + t2.tv_usec / 1000; - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Read back time (Local %1.%2)") + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Read back time (Local %1.%2)") .arg(t1.tv_sec).arg(t1.tv_usec)); // network latency equal time difference in ms between request and response // divide by two for approximate time of one way trip @@ -724,7 +724,7 @@ void MythRAOPConnection::ProcessAudio() if (m_lastSequence != frames.seq) { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("Audio discontinuity seen. Played %1 (%3) expected %2") .arg(frames.seq).arg(m_lastSequence).arg(timestamp)); m_lastSequence = frames.seq; @@ -812,7 +812,7 @@ void MythRAOPConnection::ResetAudio(void) void MythRAOPConnection::timeout(void) { - LOG(VB_GENERAL, LOG_INFO, LOC + "Closing connection after inactivity."); + LOG(VB_PLAYBACK, LOG_INFO, LOC + "Closing connection after inactivity."); m_socket->disconnectFromHost(); } @@ -840,7 +840,7 @@ void MythRAOPConnection::readClient(void) return; QByteArray data = socket->readAll(); - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("readClient(%1): ") + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("readClient(%1): ") .arg(data.size()) + data.constData()); // For big content, we may be called several times for a single packet @@ -857,7 +857,7 @@ void MythRAOPConnection::readClient(void) line = stream.readLine(); if (line.size() == 0) break; - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Header(%1) = %2") + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Header(%1) = %2") .arg(m_socket->peerAddress().toString()) .arg(line)); m_incomingHeaders.append(line); @@ -896,7 +896,7 @@ void MythRAOPConnection::readClient(void) { m_incomingPartial = false; } - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Content(%1) = %2") + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Content(%1) = %2") .arg(m_incomingContent.size()).arg(m_incomingContent.constData())); ProcessRequest(m_incomingHeaders, m_incomingContent); @@ -912,7 +912,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, if (!tags.contains("CSeq")) { - LOG(VB_GENERAL, LOG_ERR, LOC + "ProcessRequest: Didn't find CSeq"); + LOG(VB_PLAYBACK, LOG_ERR, LOC + "ProcessRequest: Didn't find CSeq"); return; } @@ -938,7 +938,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, RTPtimestamp = item.mid(item.indexOf("=") + 1).trimmed().toUInt(); } } - LOG(VB_GENERAL, LOG_INFO, LOC + QString("RTP-Info: seq=%1 rtptime=%2") + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("RTP-Info: seq=%1 rtptime=%2") .arg(RTPseq).arg(RTPtimestamp)); } @@ -961,11 +961,11 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, gCoreContext->GetSetting("AirPlayPassword"), auth) == auth) { - LOG(VB_GENERAL, LOG_INFO, LOC + "RAOP client authenticated"); + LOG(VB_PLAYBACK, LOG_INFO, LOC + "RAOP client authenticated"); } else { - LOG(VB_GENERAL, LOG_INFO, LOC + "RAOP authentication failed"); + LOG(VB_PLAYBACK, LOG_INFO, LOC + "RAOP authentication failed"); FinishAuthenticationResponse(m_textStream, m_socket, tags["CSeq"]); return; } @@ -974,7 +974,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, if (tags.contains("Apple-Challenge")) { - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Received Apple-Challenge")); + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Received Apple-Challenge")); *m_textStream << "Apple-Response: "; if (!LoadKey()) @@ -987,7 +987,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, int challenge_size = challenge.size(); if (challenge_size != 16) { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("Decoded challenge size %1, expected 16") .arg(challenge_size)); if (challenge_size > 16) @@ -1033,7 +1033,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, i += pad; } - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Full base64 response: '%1' size %2") .arg(QByteArray((const char *)from, i).toBase64().constData()) .arg(i)); @@ -1050,7 +1050,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, else break; } - LOG(VB_GENERAL, LOG_DEBUG, QString("tSize=%1 tLen=%2 tResponse=%3") + LOG(VB_PLAYBACK, LOG_DEBUG, QString("tSize=%1 tLen=%2 tResponse=%3") .arg(tosize).arg(base64.size()).arg(base64.constData())); *m_textStream << base64.trimmed() << "\r\n"; } @@ -1069,7 +1069,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, { QString key = line.mid(12).trimmed(); QByteArray decodedkey = QByteArray::fromBase64(key.toLatin1()); - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("RSAAESKey: %1 (decoded size %2)") .arg(key).arg(decodedkey.size())); @@ -1082,14 +1082,14 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, (unsigned char *)decryptedkey, LoadKey(), RSA_PKCS1_OAEP_PADDING)) { - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + "Successfully decrypted AES key from RSA."); AES_set_decrypt_key((const unsigned char *)decryptedkey, 128, &m_aesKey); } else { - LOG(VB_GENERAL, LOG_WARNING, LOC + + LOG(VB_PLAYBACK, LOG_WARNING, LOC + "Failed to decrypt AES key from RSA."); } delete [] decryptedkey; @@ -1099,7 +1099,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, { QString aesiv = line.mid(8).trimmed(); m_AESIV = QByteArray::fromBase64(aesiv.toLatin1()); - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("AESIV: %1 (decoded size %2)") .arg(aesiv).arg(m_AESIV.size())); } @@ -1112,7 +1112,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, m_audioFormat.append(fmt.toInt()); foreach (int fmt, m_audioFormat) - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Audio parameter: %1").arg(fmt)); m_framesPerPacket = m_audioFormat[1]; m_sampleSize = m_audioFormat[3]; @@ -1146,11 +1146,11 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, events = true; } - LOG(VB_GENERAL, LOG_INFO, LOC + + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Negotiated setup with client %1 on port %2") .arg(m_socket->peerAddress().toString()) .arg(m_socket->peerPort())); - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("control port: %1 timing port: %2") .arg(control_port).arg(timing_port)); @@ -1169,13 +1169,13 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, RAOP_PORT_RANGE); if (controlbind_port < 0) { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("Failed to bind to client control port. " "Control of audio stream may fail")); } else { - LOG(VB_GENERAL, LOG_INFO, LOC + + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Bound to client control port %1 on port %2") .arg(control_port).arg(controlbind_port)); } @@ -1198,13 +1198,13 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, RAOP_PORT_RANGE); if (timingbind_port < 0) { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("Failed to bind to client timing port. " "Timing of audio stream will be incorrect")); } else { - LOG(VB_GENERAL, LOG_INFO, LOC + + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Bound to client timing port %1 on port %2") .arg(timing_port).arg(timingbind_port)); } @@ -1238,12 +1238,12 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, RAOP_PORT_RANGE); if (m_eventPort < 0) { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to find a port for RAOP events server."); } else { - LOG(VB_GENERAL, LOG_INFO, LOC + + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Listening for RAOP events on port %1").arg(m_eventPort)); connect(m_eventServer, SIGNAL(newConnection(QTcpSocket *)), this, SLOT(newEventClient(QTcpSocket *))); @@ -1259,7 +1259,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, m_adjustedLatency = m_cardLatency = AudioCardLatency(); // if audio isn't started, start playing 500ms worth of silence // and measure timestamp difference - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Audio hardware latency: %1ms") .arg(m_cardLatency + m_networkLatency)); } @@ -1307,7 +1307,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, } else { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + "No Transport details found - Ignoring"); } } @@ -1350,7 +1350,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, QString name = content.left(content.indexOf(":")); QString param = content.mid(content.indexOf(":") + 1).trimmed(); - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("text/parameters: name=%1 parem=%2") .arg(name).arg(param)); @@ -1359,7 +1359,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, float volume = (param.toFloat() + 30.0f) * 100.0f / 30.0f; if (volume < 0.01f) volume = 0.0f; - LOG(VB_GENERAL, LOG_INFO, + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Setting volume to %1 (raw %3)") .arg(volume).arg(param)); m_audio->SetCurrentVolume((int)volume); @@ -1378,7 +1378,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, int current = (m_progressCurrent-m_progressStart) / m_frameRate; - LOG(VB_GENERAL, LOG_INFO, + LOG(VB_PLAYBACK, LOG_INFO, LOC +QString("Progress: %1/%2") .arg(stringFromSeconds(current)) .arg(stringFromSeconds(length))); @@ -1400,7 +1400,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, { // Receiving DMAP metadata m_dmap = decodeDMAP(content); - LOG(VB_GENERAL, LOG_INFO, + LOG(VB_PLAYBACK, LOG_INFO, QString("Receiving Title:%1 Artist:%2 Album:%3 Format:%4") .arg(m_dmap["minm"]).arg(m_dmap["asar"]) .arg(m_dmap["asal"]).arg(m_dmap["asfm"])); @@ -1415,7 +1415,7 @@ void MythRAOPConnection::ProcessRequest(const QStringList &header, } else { - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Command not handled: %1") + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Command not handled: %1") .arg(option)); } FinishResponse(m_textStream, m_socket, option, tags["CSeq"]); @@ -1434,7 +1434,7 @@ void MythRAOPConnection::FinishAuthenticationResponse(_NetStream *stream, *stream << "CSeq: " << cseq << "\r\n"; *stream << "\r\n"; stream->flush(); - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Finished Authentication request %2, Send: %3") .arg(cseq).arg(socket->flush())); } @@ -1448,7 +1448,7 @@ void MythRAOPConnection::FinishResponse(_NetStream *stream, QTcpSocket *socket, *stream << "CSeq: " << cseq << "\r\n"; *stream << "\r\n"; stream->flush(); - LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("Finished %1 %2 , Send: %3") + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Finished %1 %2 , Send: %3") .arg(option).arg(cseq).arg(socket->flush())); } @@ -1472,7 +1472,7 @@ RSA *MythRAOPConnection::LoadKey(void) { g_rsaLastError = QObject::tr("Failed to read key from: %1").arg(GetConfDir() + sName); g_rsa = NULL; - LOG(VB_GENERAL, LOG_ERR, LOC + g_rsaLastError); + LOG(VB_PLAYBACK, LOG_ERR, LOC + g_rsaLastError); return NULL; } @@ -1482,14 +1482,14 @@ RSA *MythRAOPConnection::LoadKey(void) if (g_rsa) { g_rsaLastError = ""; - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("Loaded RSA private key (%1)").arg(RSA_check_key(g_rsa))); return g_rsa; } g_rsaLastError = QObject::tr("Failed to load RSA private key."); g_rsa = NULL; - LOG(VB_GENERAL, LOG_ERR, LOC + g_rsaLastError); + LOG(VB_PLAYBACK, LOG_ERR, LOC + g_rsaLastError); return NULL; } @@ -1608,7 +1608,7 @@ bool MythRAOPConnection::CreateDecoder(void) m_codec = avcodec_find_decoder(CODEC_ID_ALAC); if (!m_codec) { - LOG(VB_GENERAL, LOG_ERR, LOC + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to create ALAC decoder- going silent..."); return false; } @@ -1620,7 +1620,7 @@ bool MythRAOPConnection::CreateDecoder(void) memset(extradata, 0, 36); if (m_audioFormat.size() < 12) { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Creating decoder but haven't seen audio format."); } else @@ -1641,12 +1641,12 @@ bool MythRAOPConnection::CreateDecoder(void) m_codeccontext->channels = m_channels; if (avcodec_open2(m_codeccontext, m_codec, NULL) < 0) { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to open ALAC decoder - going silent..."); DestroyDecoder(); return false; } - LOG(VB_GENERAL, LOG_DEBUG, LOC + "Opened ALAC decoder."); + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + "Opened ALAC decoder."); } return true; @@ -1676,7 +1676,7 @@ bool MythRAOPConnection::OpenAudioDevice(void) m_allowVolumeControl, false); if (!m_audio) { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + "Failed to open audio device. Going silent..."); CloseAudioDevice(); StartAudioTimer(); @@ -1686,7 +1686,7 @@ bool MythRAOPConnection::OpenAudioDevice(void) QString error = m_audio->GetError(); if (!error.isEmpty()) { - LOG(VB_GENERAL, LOG_ERR, LOC + + LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("Audio not initialised. Message was '%1'") .arg(error)); CloseAudioDevice(); @@ -1695,7 +1695,7 @@ bool MythRAOPConnection::OpenAudioDevice(void) } StopAudioTimer(); - LOG(VB_GENERAL, LOG_DEBUG, LOC + "Opened audio device."); + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + "Opened audio device."); return true; } @@ -1750,7 +1750,7 @@ int64_t MythRAOPConnection::AudioCardLatency(void) void MythRAOPConnection::newEventClient(QTcpSocket *client) { - LOG(VB_GENERAL, LOG_INFO, LOC + + LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("New connection from %1:%2 for RAOP events server.") .arg(client->peerAddress().toString()).arg(client->peerPort())); @@ -1763,7 +1763,7 @@ void MythRAOPConnection::deleteEventClient(void) { QTcpSocket *client = static_cast(sender()); - LOG(VB_GENERAL, LOG_DEBUG, LOC + + LOG(VB_PLAYBACK, LOG_DEBUG, LOC + QString("%1:%2 disconnected from RAOP events server.") .arg(client->peerAddress().toString()).arg(client->peerPort())); } diff --git a/mythtv/libs/libmythui/mythuinotificationcenter.cpp b/mythtv/libs/libmythui/mythuinotificationcenter.cpp index b433765db30..c3815122e92 100644 --- a/mythtv/libs/libmythui/mythuinotificationcenter.cpp +++ b/mythtv/libs/libmythui/mythuinotificationcenter.cpp @@ -46,7 +46,8 @@ MythUINotificationScreen::MythUINotificationScreen(MythScreenStack *stack, m_created(false), m_content(kNone), m_update(kAll), m_artworkImage(NULL), m_titleText(NULL), m_originText(NULL), m_descriptionText(NULL), m_extraText(NULL), m_progresstextText(NULL), - m_progressBar(NULL), m_errorState(NULL), m_index(0), + m_progressBar(NULL), m_errorState(NULL), m_mediaState(NULL), + m_index(0), m_timer(new QTimer(this)), m_visibility(MythNotification::kAll), m_priority(MythNotification::kDefault) @@ -65,7 +66,8 @@ MythUINotificationScreen::MythUINotificationScreen(MythScreenStack *stack, m_update(kAll), m_artworkImage(NULL), m_titleText(NULL), m_originText(NULL), m_descriptionText(NULL), m_extraText(NULL), m_progresstextText(NULL), - m_progressBar(NULL), m_errorState(NULL), m_index(0), + m_progressBar(NULL), m_errorState(NULL), m_mediaState(NULL), + m_index(0), m_timer(new QTimer(this)), m_visibility(MythNotification::kAll), m_priority(MythNotification::kDefault) @@ -82,7 +84,7 @@ MythUINotificationScreen::MythUINotificationScreen(MythScreenStack *stack, m_created(false), m_content(kNone), m_update(kAll), m_artworkImage(NULL), m_titleText(NULL), m_originText(NULL), m_descriptionText(NULL), m_extraText(NULL), m_progresstextText(NULL), - m_progressBar(NULL), m_errorState(NULL), + m_progressBar(NULL), m_errorState(NULL), m_mediaState(NULL), m_timer(new QTimer(this)), m_visibility(MythNotification::kAll), m_priority(MythNotification::kDefault) @@ -140,6 +142,13 @@ void MythUINotificationScreen::SetNotification(MythNotification ¬ification) m_update |= kDuration; } + MythMediaNotification *media = + dynamic_cast(¬ification); + if (media && m_imagePath.isEmpty() && m_image.isNull()) + { + m_update |= kNoArtwork; + } + if (!notification.GetMetaData().isEmpty()) { UpdateMetaData(notification.GetMetaData()); @@ -215,6 +224,16 @@ bool MythUINotificationScreen::Create(void) m_progresstextText = dynamic_cast(GetChild("progress_text")); m_progressBar = dynamic_cast(GetChild("progress")); m_errorState = dynamic_cast(GetChild("errorstate")); + m_mediaState = dynamic_cast(GetChild("mediastate")); + + if (m_errorState) + { + m_errorState->DisplayState(m_content & kError ? "error" : "ok"); + } + if (m_mediaState && (m_update & kImage)) + { + m_mediaState->DisplayState(m_content & kNoArtwork ? "noartwork" : "ok"); + } // store original position m_position = GetPosition(); @@ -334,6 +353,10 @@ void MythUINotificationScreen::Init(void) { m_errorState->DisplayState(m_update & kError ? "error" : "ok"); } + if (m_mediaState && (m_update & kImage)) + { + m_mediaState->DisplayState(m_update & kNoArtwork ? "noartwork" : "ok"); + } // No field will be refreshed the next time unless specified otherwise m_update = kNone; diff --git a/mythtv/libs/libmythui/mythuinotificationcenter_private.h b/mythtv/libs/libmythui/mythuinotificationcenter_private.h index 20c71e9afb0..a6cb865284b 100644 --- a/mythtv/libs/libmythui/mythuinotificationcenter_private.h +++ b/mythtv/libs/libmythui/mythuinotificationcenter_private.h @@ -185,6 +185,7 @@ class MythUINotificationScreen : public MythScreenType kMetaData = 1 << 2, kStyle = 1 << 3, kError = 1 << 4, + kNoArtwork = 1 << 5, kAll = ~kNone, }; @@ -220,6 +221,7 @@ public slots: MythUIText *m_progresstextText; MythUIProgressBar *m_progressBar; MythUIStateType *m_errorState; + MythUIStateType *m_mediaState; QDateTime m_creation, m_expiry; int m_index; MythPoint m_position; diff --git a/mythtv/libs/libmythui/mythuitype.cpp b/mythtv/libs/libmythui/mythuitype.cpp index 9accc4575d6..eab13db3ae1 100644 --- a/mythtv/libs/libmythui/mythuitype.cpp +++ b/mythtv/libs/libmythui/mythuitype.cpp @@ -47,7 +47,6 @@ MythUIType::MythUIType(QObject *parent, const QString &name) m_XYSpeed = QPoint(0, 0); m_deferload = false; m_IsDependDefault = false; - m_ReverseDepend = false; m_Parent = NULL; @@ -1037,13 +1036,52 @@ void MythUIType::Refresh(void) SetRedraw(); } -void MythUIType::UpdateDependState(bool isDefault) +void MythUIType::UpdateDependState(MythUIType *dependee, bool isDefault) { - m_IsDependDefault = m_ReverseDepend ? !isDefault : isDefault; + bool visible; + + if (dependee) + { + bool reverse = m_ReverseDepend[dependee]; + visible = reverse ? !isDefault : isDefault; + for (int i = 0; i < m_dependsValue.size(); i++) + { + if (m_dependsValue[i].first != dependee) + continue; + m_dependsValue[i].second = visible; + break; + } + } + + visible = m_dependsValue[0].second; + for (int i = 1; i < m_dependsValue.size(); i++) + { + bool v = m_dependsValue[i].second; + + if (m_dependOperator[i-1] == 1) + { + // OR operator + visible = visible && v; + } + else + { + // AND operator + visible = visible || v; + } + } + + m_IsDependDefault = visible; SetVisible(!m_IsDependDefault); } +void MythUIType::UpdateDependState(bool isDefault) +{ + MythUIType *dependee = static_cast(sender()); + + UpdateDependState(dependee, isDefault); +} + void MythUIType::SetVisible(bool visible) { if (visible == m_Visible) @@ -1159,7 +1197,6 @@ void MythUIType::CopyFrom(MythUIType *base) } m_dependsMap = base->m_dependsMap; - m_ReverseDepend = base->m_ReverseDepend; SetMinArea(base->m_MinArea); } @@ -1372,34 +1409,64 @@ void MythUIType::SetDependsMap(QMap dependsMap) m_dependsMap = dependsMap; } -void MythUIType::SetReverseDependence(bool reverse) +void MythUIType::SetReverseDependence(MythUIType *dependee, bool reverse) { - m_ReverseDepend = reverse; + m_ReverseDepend.insert(dependee, reverse); } void MythUIType::ConnectDependants(bool recurse) { - - QMapIterator i(m_dependsMap); - while(i.hasNext()) + QMapIterator it(m_dependsMap); + while(it.hasNext()) { - i.next(); - QString dependeeName = i.value(); - bool reverse = false; - if (dependeeName.startsWith('!')) + it.next(); + + // build list of operators and dependeees. + QStringList dependees; + QList operators; + QString name = it.value(); + QStringList tmp1 = name.split("&"); + for (int i = 0; i < tmp1.size(); i++) { - reverse = true; - dependeeName.remove(0,1); + QStringList tmp2 = tmp1[i].split("|"); + + dependees.append(tmp2[0]); + for (int j = 1; j < tmp2.size(); j++) + { + dependees.append(tmp2[j]); + operators.append(1); // 1 is OR + } + operators.append(2); // 2 is AND } - MythUIType *dependee = GetChild(dependeeName); - MythUIType *dependant = GetChild(i.key()); - if (dependee && dependant) + MythUIType *dependant = GetChild(it.key()); + if (dependant) { - QObject::connect(dependee, SIGNAL(DependChanged(bool)), - dependant, SLOT(UpdateDependState(bool))); - dependant->SetReverseDependence(reverse); - dependant->UpdateDependState(true); + dependant->m_dependOperator = operators; + foreach (QString dependeeName, dependees) + { + bool reverse = false; + if (dependeeName.startsWith('!')) + { + reverse = true; + dependeeName.remove(0,1); + } + MythUIType *dependee = GetChild(dependeeName); + + if (dependee) + { + QObject::connect(dependee, SIGNAL(DependChanged(bool)), + dependant, SLOT(UpdateDependState(bool))); + dependant->SetReverseDependence(dependee, reverse); + dependant->m_dependsValue.append(QPair(dependee, false)); + dependant->UpdateDependState(dependee, true); + } + else + { + dependant->m_dependsValue.append(QPair(dependee, !reverse)); + dependant->UpdateDependState(dependee, reverse); + } + } } } diff --git a/mythtv/libs/libmythui/mythuitype.h b/mythtv/libs/libmythui/mythuitype.h index 82ce7636aff..7c8d43803c6 100644 --- a/mythtv/libs/libmythui/mythuitype.h +++ b/mythtv/libs/libmythui/mythuitype.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -174,7 +175,7 @@ class MUI_PUBLIC MythUIType : public QObject, public XMLParseBase void SetVerticalZoom(float zoom); void SetAngle(float angle); void SetDependIsDefault(bool isDefault); - void SetReverseDependence(bool reverse); + void SetReverseDependence(MythUIType *dependee, bool reverse); void SetDependsMap(QMap dependsMap); QMap GetDependsMap() const { return m_dependsMap; } @@ -190,6 +191,7 @@ class MUI_PUBLIC MythUIType : public QObject, public XMLParseBase void Show(void); void Refresh(void); void UpdateDependState(bool isDefault); + void UpdateDependState(MythUIType *dependee, bool isDefault); signals: void RequestUpdate(); @@ -228,6 +230,11 @@ class MUI_PUBLIC MythUIType : public QObject, public XMLParseBase QList m_ChildrenList; QMap m_dependsMap; + // the number of dependencies is assumed to be small (1 or 2 elements on average) + // so we use a QList as we want the element ordered in the order they were defined + // and speed isn't going to be a factor + QList< QPair >m_dependsValue; + QList m_dependOperator; bool m_Visible; bool m_HasFocus; @@ -238,7 +245,7 @@ class MUI_PUBLIC MythUIType : public QObject, public XMLParseBase bool m_Vanish; bool m_Vanished; bool m_IsDependDefault; - bool m_ReverseDepend; + QMap m_ReverseDepend; int m_focusOrder; diff --git a/mythtv/themes/default/noartwork.png b/mythtv/themes/default/noartwork.png new file mode 100644 index 00000000000..1e41a0353fc Binary files /dev/null and b/mythtv/themes/default/noartwork.png differ diff --git a/mythtv/themes/default/notification-ui.xml b/mythtv/themes/default/notification-ui.xml index b68eeb13115..5fe706a13f0 100644 --- a/mythtv/themes/default/notification-ui.xml +++ b/mythtv/themes/default/notification-ui.xml @@ -80,6 +80,19 @@ 0,0,100%,100% + + 0,0,100%,100% + + + 0,0,100%,100% + + + noartwork.png + 18,18,144,144 + + + + 0,0,100%,100% @@ -93,7 +106,7 @@ - + damaged.png 18,18,144,144