#include <mythraopconnection.h>
Public Slots | |
| void | readClient (void) |
| readClient: signal handler for RAOP client connection Handle initialisation of session | |
| void | udpDataReady (QByteArray buf, QHostAddress peer, quint16 port) |
| Socket incoming data signal handler use for audio, control and timing socket. | |
| void | timeout (void) |
| void | audioRetry (void) |
Public Member Functions | |
| MythRAOPConnection (QObject *parent, QTcpSocket *socket, QByteArray id, int port) | |
| ~MythRAOPConnection () | |
| bool | Init (void) |
| QTcpSocket * | GetSocket () |
| int | GetDataPort () |
| bool | HasAudio () |
Static Public Member Functions | |
| static QMap< QString, QString > | decodeDMAP (const QByteArray &dmap) |
| decodeDMAP: | |
Static Protected Member Functions | |
| static RSA * | LoadKey (void) |
| LoadKey. | |
Private Slots | |
| void | ProcessAudio (void) |
Private Member Functions | |
| void | ProcessSync (const QByteArray &buf) |
| void | SendResendRequest (uint64_t timestamp, uint16_t expected, uint16_t got) |
| SendResendRequest: Request RAOP client to resend missed RTP packets. | |
| void | ExpireResendRequests (uint64_t timestamp) |
| ExpireResendRequests: Expire resend requests that are older than timestamp. | |
| uint32_t | decodeAudioPacket (uint8_t type, const QByteArray *buf, QList< AudioData > *dest) |
| int | ExpireAudio (uint64_t timestamp) |
| void | ResetAudio (void) |
| void | ProcessRequest (const QStringList &header, const QByteArray &content) |
| void | StartResponse (NetStream *stream, QString &option, QString &cseq) |
| void | FinishResponse (NetStream *stream, QTcpSocket *socket, QString &option, QString &cseq) |
| RawHash | FindTags (const QStringList &lines) |
| bool | CreateDecoder (void) |
| void | DestroyDecoder (void) |
| bool | OpenAudioDevice (void) |
| void | CloseAudioDevice (void) |
| void | StartAudioTimer (void) |
| void | StopAudioTimer (void) |
| void | SendTimeRequest (void) |
| SendTimeRequest: Send a time request to the RAOP client. | |
| void | ProcessTimeResponse (const QByteArray &buf) |
| ProcessTimeResponse: Calculate the network latency, we do not use the reference time send by itunes instead we measure the time lapsed between the request and the response the latency is calculated in ms. | |
| uint64_t | NTPToLocal (uint32_t sec, uint32_t ticks) |
| bool | GetPacketType (const QByteArray &buf, uint8_t &type, uint16_t &seq, uint64_t ×tamp) |
| int64_t | AudioCardLatency (void) |
| AudioCardLatency: Description: Play silence and calculate audio latency between input / output. | |
| QStringList | splitLines (const QByteArray &lines) |
| QString | stringFromSeconds (int seconds) |
| stringFromSeconds: | |
| uint64_t | framesToMs (uint64_t frames) |
| framesDuration Description: return the duration in ms of frames | |
Private Attributes | |
| QTimer * | m_watchdogTimer |
| QTcpSocket * | m_socket |
| NetStream * | m_textStream |
| QByteArray | m_hardwareId |
| QStringList | m_incomingHeaders |
| QByteArray | m_incomingContent |
| bool | m_incomingPartial |
| int32_t | m_incomingSize |
| QHostAddress | m_peerAddress |
| ServerPool * | m_dataSocket |
| int | m_dataPort |
| ServerPool * | m_clientControlSocket |
| int | m_clientControlPort |
| ServerPool * | m_clientTimingSocket |
| int | m_clientTimingPort |
| QMap< uint16_t, uint64_t > | m_resends |
| QByteArray | m_AESIV |
| AES_KEY | m_aesKey |
| AudioOutput * | m_audio |
| AVCodec * | m_codec |
| AVCodecContext * | m_codeccontext |
| QList< int > | m_audioFormat |
| int | m_channels |
| int | m_sampleSize |
| int | m_frameRate |
| int | m_framesPerPacket |
| QTimer * | m_dequeueAudioTimer |
| QMap< uint64_t, AudioPacket > | m_audioQueue |
| uint32_t | m_queueLength |
| bool | m_streamingStarted |
| bool | m_allowVolumeControl |
| uint16_t | m_seqNum |
| uint16_t | m_lastSequence |
| uint64_t | m_lastTimestamp |
| uint64_t | m_currentTimestamp |
| uint16_t | m_nextSequence |
| uint64_t | m_nextTimestamp |
| uint64_t | m_bufferLength |
| uint64_t | m_timeLastSync |
| int64_t | m_cardLatency |
| int64_t | m_adjustedLatency |
| bool | m_audioStarted |
| uint64_t | m_masterTimeStamp |
| uint64_t | m_deviceTimeStamp |
| uint64_t | m_networkLatency |
| int64_t | m_clockSkew |
| QTimer * | m_audioTimer |
| uint32_t | m_progressStart |
| uint32_t | m_progressCurrent |
| uint32_t | m_progressEnd |
| QByteArray | m_artwork |
| QByteArray | m_dmap |
Static Private Attributes | |
| static RSA * | g_rsa = NULL |
Friends | |
| class | MythRAOPDevice |
Definition at line 41 of file mythraopconnection.h.
| MythRAOPConnection::MythRAOPConnection | ( | QObject * | parent, | |
| QTcpSocket * | socket, | |||
| QByteArray | id, | |||
| int | port | |||
| ) |
Definition at line 55 of file mythraopconnection.cpp.
| MythRAOPConnection::~MythRAOPConnection | ( | ) |
Definition at line 83 of file mythraopconnection.cpp.
| bool MythRAOPConnection::Init | ( | void | ) |
Definition at line 134 of file mythraopconnection.cpp.
Referenced by MythRAOPDevice::newConnection().
| QTcpSocket* MythRAOPConnection::GetSocket | ( | void | ) | [inline] |
Definition at line 52 of file mythraopconnection.h.
Referenced by MythRAOPDevice::Teardown().
| int MythRAOPConnection::GetDataPort | ( | ) | [inline] |
Definition at line 53 of file mythraopconnection.h.
Referenced by MythRAOPDevice::newConnection().
| bool MythRAOPConnection::HasAudio | ( | ) | [inline] |
Definition at line 54 of file mythraopconnection.h.
| QMap< QString, QString > MythRAOPConnection::decodeDMAP | ( | const QByteArray & | dmap | ) | [static] |
decodeDMAP:
Usage: decodeDMAP(QByteArray &dmap) Description: decode the DMAP (Digital Media Access Protocol) object. The object returned is a map of the dmap tags and their associated content
Definition at line 1389 of file mythraopconnection.cpp.
Referenced by ProcessRequest().
| void MythRAOPConnection::readClient | ( | void | ) | [slot] |
readClient: signal handler for RAOP client connection Handle initialisation of session
Definition at line 756 of file mythraopconnection.cpp.
Referenced by Init().
| void MythRAOPConnection::udpDataReady | ( | QByteArray | buf, | |
| QHostAddress | peer, | |||
| quint16 | port | |||
| ) | [slot] |
Socket incoming data signal handler use for audio, control and timing socket.
Definition at line 187 of file mythraopconnection.cpp.
Referenced by Init(), and ProcessRequest().
| void MythRAOPConnection::timeout | ( | void | ) | [slot] |
Definition at line 729 of file mythraopconnection.cpp.
Referenced by Init(), and StartAudioTimer().
| void MythRAOPConnection::audioRetry | ( | void | ) | [slot] |
Definition at line 735 of file mythraopconnection.cpp.
Referenced by StartAudioTimer().
| RSA * MythRAOPConnection::LoadKey | ( | void | ) | [static, protected] |
LoadKey.
Load RSA key into static variable for re-using it later The RSA key is resident in memory for the entire duration of the application as such RSA_free is never called on it.
Definition at line 1270 of file mythraopconnection.cpp.
Referenced by MythRAOPDevice::Create(), Init(), and ProcessRequest().
| void MythRAOPConnection::ProcessSync | ( | const QByteArray & | buf | ) | [private] |
Definition at line 297 of file mythraopconnection.cpp.
Referenced by udpDataReady().
| void MythRAOPConnection::SendResendRequest | ( | uint64_t | timestamp, | |
| uint16_t | expected, | |||
| uint16_t | got | |||
| ) | [private] |
SendResendRequest: Request RAOP client to resend missed RTP packets.
Definition at line 375 of file mythraopconnection.cpp.
Referenced by udpDataReady().
| void MythRAOPConnection::ExpireResendRequests | ( | uint64_t | timestamp | ) | [private] |
ExpireResendRequests: Expire resend requests that are older than timestamp.
Those requests are expired when audio with older timestamp has already been played
Definition at line 416 of file mythraopconnection.cpp.
Referenced by ProcessSync(), and ResetAudio().
| uint32_t MythRAOPConnection::decodeAudioPacket | ( | uint8_t | type, | |
| const QByteArray * | buf, | |||
| QList< AudioData > * | dest | |||
| ) | [private] |
Definition at line 542 of file mythraopconnection.cpp.
Referenced by udpDataReady().
| int MythRAOPConnection::ExpireAudio | ( | uint64_t | timestamp | ) | [private] |
Definition at line 692 of file mythraopconnection.cpp.
Referenced by ProcessAudio(), ProcessSync(), and ResetAudio().
| void MythRAOPConnection::ResetAudio | ( | void | ) | [private] |
Definition at line 718 of file mythraopconnection.cpp.
Referenced by ProcessRequest(), and ~MythRAOPConnection().
| void MythRAOPConnection::ProcessRequest | ( | const QStringList & | header, | |
| const QByteArray & | content | |||
| ) | [private] |
Definition at line 823 of file mythraopconnection.cpp.
Referenced by readClient().
| void MythRAOPConnection::StartResponse | ( | NetStream * | stream, | |
| QString & | option, | |||
| QString & | cseq | |||
| ) | [private] |
Definition at line 1245 of file mythraopconnection.cpp.
Referenced by ProcessRequest().
| void MythRAOPConnection::FinishResponse | ( | NetStream * | stream, | |
| QTcpSocket * | socket, | |||
| QString & | option, | |||
| QString & | cseq | |||
| ) | [private] |
Definition at line 1256 of file mythraopconnection.cpp.
Referenced by ProcessRequest().
| RawHash MythRAOPConnection::FindTags | ( | const QStringList & | lines | ) | [private] |
Definition at line 1304 of file mythraopconnection.cpp.
Referenced by ProcessRequest().
| bool MythRAOPConnection::CreateDecoder | ( | void | ) | [private] |
Definition at line 1407 of file mythraopconnection.cpp.
Referenced by audioRetry(), and ProcessRequest().
| void MythRAOPConnection::DestroyDecoder | ( | void | ) | [private] |
Definition at line 1463 of file mythraopconnection.cpp.
Referenced by CreateDecoder(), and ~MythRAOPConnection().
| bool MythRAOPConnection::OpenAudioDevice | ( | void | ) | [private] |
Definition at line 1474 of file mythraopconnection.cpp.
Referenced by audioRetry(), and ProcessRequest().
| void MythRAOPConnection::CloseAudioDevice | ( | void | ) | [private] |
Definition at line 1510 of file mythraopconnection.cpp.
Referenced by OpenAudioDevice(), and ~MythRAOPConnection().
| void MythRAOPConnection::StartAudioTimer | ( | void | ) | [private] |
Definition at line 1516 of file mythraopconnection.cpp.
Referenced by OpenAudioDevice().
| void MythRAOPConnection::StopAudioTimer | ( | void | ) | [private] |
Definition at line 1526 of file mythraopconnection.cpp.
Referenced by audioRetry(), OpenAudioDevice(), and ~MythRAOPConnection().
| void MythRAOPConnection::SendTimeRequest | ( | void | ) | [private] |
SendTimeRequest: Send a time request to the RAOP client.
Definition at line 438 of file mythraopconnection.cpp.
Referenced by ProcessRequest().
| void MythRAOPConnection::ProcessTimeResponse | ( | const QByteArray & | buf | ) | [private] |
ProcessTimeResponse: Calculate the network latency, we do not use the reference time send by itunes instead we measure the time lapsed between the request and the response the latency is calculated in ms.
Definition at line 475 of file mythraopconnection.cpp.
Referenced by udpDataReady().
Definition at line 502 of file mythraopconnection.cpp.
Referenced by ProcessTimeResponse().
| bool MythRAOPConnection::GetPacketType | ( | const QByteArray & | buf, | |
| uint8_t & | type, | |||
| uint16_t & | seq, | |||
| uint64_t & | timestamp | |||
| ) | [private] |
Definition at line 507 of file mythraopconnection.cpp.
Referenced by udpDataReady().
| int64_t MythRAOPConnection::AudioCardLatency | ( | void | ) | [private] |
AudioCardLatency: Description: Play silence and calculate audio latency between input / output.
Definition at line 1540 of file mythraopconnection.cpp.
Referenced by ProcessSync().
| QStringList MythRAOPConnection::splitLines | ( | const QByteArray & | lines | ) | [private] |
Definition at line 1322 of file mythraopconnection.cpp.
Referenced by ProcessRequest().
| QString MythRAOPConnection::stringFromSeconds | ( | int | time | ) | [private] |
stringFromSeconds:
Usage: stringFromSeconds(seconds) Description: create a string in the format HH:mm:ss from a duration in seconds HH: will not be displayed if there's less than one hour
Definition at line 1348 of file mythraopconnection.cpp.
Referenced by ProcessRequest().
framesDuration Description: return the duration in ms of frames
Definition at line 1377 of file mythraopconnection.cpp.
Referenced by ProcessAudio(), ProcessSync(), and udpDataReady().
| void MythRAOPConnection::ProcessAudio | ( | void | ) | [private, slot] |
Definition at line 610 of file mythraopconnection.cpp.
Referenced by Init(), and udpDataReady().
friend class MythRAOPDevice [friend] |
Definition at line 45 of file mythraopconnection.h.
QTimer* MythRAOPConnection::m_watchdogTimer [private] |
Definition at line 104 of file mythraopconnection.h.
Referenced by Init(), udpDataReady(), and ~MythRAOPConnection().
QTcpSocket* MythRAOPConnection::m_socket [private] |
Definition at line 106 of file mythraopconnection.h.
Referenced by GetSocket(), Init(), ProcessRequest(), timeout(), and ~MythRAOPConnection().
NetStream* MythRAOPConnection::m_textStream [private] |
Definition at line 107 of file mythraopconnection.h.
Referenced by Init(), and ProcessRequest().
QByteArray MythRAOPConnection::m_hardwareId [private] |
Definition at line 108 of file mythraopconnection.h.
Referenced by ProcessRequest().
QStringList MythRAOPConnection::m_incomingHeaders [private] |
Definition at line 109 of file mythraopconnection.h.
Referenced by readClient().
QByteArray MythRAOPConnection::m_incomingContent [private] |
Definition at line 110 of file mythraopconnection.h.
Referenced by readClient().
bool MythRAOPConnection::m_incomingPartial [private] |
Definition at line 111 of file mythraopconnection.h.
Referenced by readClient().
int32_t MythRAOPConnection::m_incomingSize [private] |
Definition at line 112 of file mythraopconnection.h.
Referenced by readClient().
QHostAddress MythRAOPConnection::m_peerAddress [private] |
Definition at line 113 of file mythraopconnection.h.
Referenced by ProcessRequest(), SendResendRequest(), and SendTimeRequest().
ServerPool* MythRAOPConnection::m_dataSocket [private] |
Definition at line 114 of file mythraopconnection.h.
Referenced by Init(), and ~MythRAOPConnection().
int MythRAOPConnection::m_dataPort [private] |
Definition at line 115 of file mythraopconnection.h.
Referenced by GetDataPort(), Init(), and ProcessRequest().
Definition at line 116 of file mythraopconnection.h.
Referenced by ProcessRequest(), SendResendRequest(), SendTimeRequest(), and ~MythRAOPConnection().
int MythRAOPConnection::m_clientControlPort [private] |
Definition at line 117 of file mythraopconnection.h.
Referenced by ProcessRequest(), and SendResendRequest().
Definition at line 118 of file mythraopconnection.h.
Referenced by ProcessRequest(), and SendTimeRequest().
int MythRAOPConnection::m_clientTimingPort [private] |
Definition at line 119 of file mythraopconnection.h.
Referenced by ProcessRequest(), and SendTimeRequest().
QMap<uint16_t,uint64_t> MythRAOPConnection::m_resends [private] |
Definition at line 122 of file mythraopconnection.h.
Referenced by ExpireResendRequests(), SendResendRequest(), and udpDataReady().
QByteArray MythRAOPConnection::m_AESIV [private] |
Definition at line 124 of file mythraopconnection.h.
Referenced by decodeAudioPacket(), and ProcessRequest().
AES_KEY MythRAOPConnection::m_aesKey [private] |
Definition at line 125 of file mythraopconnection.h.
Referenced by decodeAudioPacket(), and ProcessRequest().
RSA * MythRAOPConnection::g_rsa = NULL [static, private] |
Definition at line 126 of file mythraopconnection.h.
Referenced by LoadKey().
AudioOutput* MythRAOPConnection::m_audio [private] |
Definition at line 128 of file mythraopconnection.h.
Referenced by AudioCardLatency(), audioRetry(), CloseAudioDevice(), HasAudio(), OpenAudioDevice(), ProcessAudio(), ProcessRequest(), ProcessSync(), ResetAudio(), and udpDataReady().
AVCodec* MythRAOPConnection::m_codec [private] |
Definition at line 129 of file mythraopconnection.h.
Referenced by audioRetry(), CreateDecoder(), DestroyDecoder(), and udpDataReady().
AVCodecContext* MythRAOPConnection::m_codeccontext [private] |
Definition at line 130 of file mythraopconnection.h.
Referenced by audioRetry(), CreateDecoder(), decodeAudioPacket(), DestroyDecoder(), and udpDataReady().
QList<int> MythRAOPConnection::m_audioFormat [private] |
Definition at line 131 of file mythraopconnection.h.
Referenced by CreateDecoder(), and ProcessRequest().
int MythRAOPConnection::m_channels [private] |
Definition at line 132 of file mythraopconnection.h.
Referenced by AudioCardLatency(), CreateDecoder(), OpenAudioDevice(), and ProcessRequest().
int MythRAOPConnection::m_sampleSize [private] |
Definition at line 133 of file mythraopconnection.h.
Referenced by AudioCardLatency(), and ProcessRequest().
int MythRAOPConnection::m_frameRate [private] |
Definition at line 134 of file mythraopconnection.h.
Referenced by AudioCardLatency(), framesToMs(), OpenAudioDevice(), ProcessAudio(), and ProcessRequest().
int MythRAOPConnection::m_framesPerPacket [private] |
Definition at line 135 of file mythraopconnection.h.
Referenced by ProcessAudio(), ProcessRequest(), and ProcessSync().
QTimer* MythRAOPConnection::m_dequeueAudioTimer [private] |
Definition at line 136 of file mythraopconnection.h.
Referenced by Init(), ProcessAudio(), and ~MythRAOPConnection().
QMap<uint64_t, AudioPacket> MythRAOPConnection::m_audioQueue [private] |
Definition at line 138 of file mythraopconnection.h.
Referenced by ExpireAudio(), ProcessAudio(), ProcessSync(), and udpDataReady().
uint32_t MythRAOPConnection::m_queueLength [private] |
Definition at line 139 of file mythraopconnection.h.
bool MythRAOPConnection::m_streamingStarted [private] |
Definition at line 140 of file mythraopconnection.h.
Referenced by ExpireResendRequests(), ProcessAudio(), ProcessRequest(), and udpDataReady().
bool MythRAOPConnection::m_allowVolumeControl [private] |
Definition at line 141 of file mythraopconnection.h.
Referenced by Init(), OpenAudioDevice(), and ProcessRequest().
uint16_t MythRAOPConnection::m_seqNum [private] |
Definition at line 144 of file mythraopconnection.h.
Referenced by SendResendRequest().
uint16_t MythRAOPConnection::m_lastSequence [private] |
Definition at line 146 of file mythraopconnection.h.
Referenced by ProcessAudio().
uint64_t MythRAOPConnection::m_lastTimestamp [private] |
Definition at line 147 of file mythraopconnection.h.
Referenced by ProcessAudio(), and ProcessRequest().
Definition at line 148 of file mythraopconnection.h.
Referenced by ProcessAudio(), ProcessRequest(), ProcessSync(), and udpDataReady().
uint16_t MythRAOPConnection::m_nextSequence [private] |
Definition at line 149 of file mythraopconnection.h.
Referenced by ProcessRequest(), and udpDataReady().
uint64_t MythRAOPConnection::m_nextTimestamp [private] |
Definition at line 150 of file mythraopconnection.h.
Referenced by ProcessRequest(), ProcessSync(), and udpDataReady().
uint64_t MythRAOPConnection::m_bufferLength [private] |
Definition at line 151 of file mythraopconnection.h.
Referenced by ProcessAudio(), ProcessRequest(), and ProcessSync().
uint64_t MythRAOPConnection::m_timeLastSync [private] |
Definition at line 152 of file mythraopconnection.h.
Referenced by ProcessAudio(), and ProcessSync().
int64_t MythRAOPConnection::m_cardLatency [private] |
Definition at line 153 of file mythraopconnection.h.
Referenced by ProcessAudio(), and ProcessSync().
int64_t MythRAOPConnection::m_adjustedLatency [private] |
Definition at line 154 of file mythraopconnection.h.
Referenced by ProcessSync().
bool MythRAOPConnection::m_audioStarted [private] |
Definition at line 155 of file mythraopconnection.h.
Referenced by ProcessAudio(), ProcessRequest(), ProcessSync(), and ResetAudio().
Definition at line 158 of file mythraopconnection.h.
Definition at line 159 of file mythraopconnection.h.
uint64_t MythRAOPConnection::m_networkLatency [private] |
Definition at line 160 of file mythraopconnection.h.
Referenced by ProcessAudio(), ProcessSync(), and ProcessTimeResponse().
int64_t MythRAOPConnection::m_clockSkew [private] |
Definition at line 161 of file mythraopconnection.h.
Referenced by ProcessTimeResponse().
QTimer* MythRAOPConnection::m_audioTimer [private] |
Definition at line 164 of file mythraopconnection.h.
Referenced by StartAudioTimer(), and StopAudioTimer().
uint32_t MythRAOPConnection::m_progressStart [private] |
Definition at line 167 of file mythraopconnection.h.
Referenced by ProcessRequest().
Definition at line 168 of file mythraopconnection.h.
Referenced by ProcessRequest().
uint32_t MythRAOPConnection::m_progressEnd [private] |
Definition at line 169 of file mythraopconnection.h.
Referenced by ProcessRequest().
QByteArray MythRAOPConnection::m_artwork [private] |
Definition at line 170 of file mythraopconnection.h.
Referenced by ProcessRequest().
QByteArray MythRAOPConnection::m_dmap [private] |
Definition at line 171 of file mythraopconnection.h.
1.6.3