X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=AirTV-Qt%2Fraopservice.cpp;h=1c3519dbeb567a0876f796e88b65b825cc77d1f5;hb=23ab90afeb29b103194a86d963be6f26af880d9c;hp=43689c3e7118c42a54e2f28d5d1332db57a2f1e1;hpb=23e7e3ae2b2adfa49635495c0950b76e17987c93;p=deb_shairplay.git diff --git a/AirTV-Qt/raopservice.cpp b/AirTV-Qt/raopservice.cpp index 43689c3..1c3519d 100644 --- a/AirTV-Qt/raopservice.cpp +++ b/AirTV-Qt/raopservice.cpp @@ -17,14 +17,16 @@ #include #include -static void -audio_init(void *cls, void **session, int bits, int channels, int samplerate) +static void* +audio_init(void *cls, int bits, int channels, int samplerate) { + void *session; QMetaObject::invokeMethod((QObject*)cls, "audioInit", Qt::BlockingQueuedConnection, - Q_ARG(void*, (void*)session), + Q_ARG(void*, (void*)&session), Q_ARG(int, bits), Q_ARG(int, channels), Q_ARG(int, samplerate)); + return session; } static void @@ -79,7 +81,6 @@ RaopService::~RaopService() bool RaopService::init() { - const char hwaddr[] = { 0x48, 0x5d, 0x60, 0x7c, 0xee, 0x22 }; raop_callbacks_t raop_cbs; int error; @@ -106,12 +107,12 @@ bool RaopService::init() QByteArray array = file.read(file.size()); array.append('\0'); - m_raop = raop_init(&raop_cbs, array.data(), hwaddr, sizeof(hwaddr)); + m_raop = raop_init(&raop_cbs, array.data()); if (!m_raop) { return false; } - m_dnssd = dnssd_init(hwaddr, sizeof(hwaddr), &error); + m_dnssd = dnssd_init(&error); if (!m_dnssd) { raop_destroy(m_raop); m_raop = NULL; @@ -123,17 +124,19 @@ bool RaopService::init() bool RaopService::start(const QString & name, quint16 port) { + const char hwaddr[] = { 0x48, 0x5d, 0x60, 0x7c, 0xee, 0x22 }; + if (!m_raop || !m_dnssd || m_thread.isRunning()) { return false; } m_thread.start(); - if (raop_start(m_raop, &port) < 0) { + if (raop_start(m_raop, &port, hwaddr, sizeof(hwaddr), NULL) < 0) { m_thread.quit(); m_thread.wait(); return false; } - if (dnssd_register_raop(m_dnssd, name.toUtf8(), port) < 0) { + if (dnssd_register_raop(m_dnssd, name.toUtf8(), port, hwaddr, sizeof(hwaddr), 0) < 0) { raop_stop(m_raop); m_thread.quit(); m_thread.wait();