From: Juho Vähä-Herttua Date: Thu, 31 May 2012 19:01:41 +0000 (+0300) Subject: Add log methods to Qt4 API, not implemented yet X-Git-Tag: upstream/0.9.0~4^2~54 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d433e0453fd716468d4d13d7acdd6879d6dc4c94;p=deb_shairplay.git Add log methods to Qt4 API, not implemented yet --- diff --git a/AirTV-Qt/audiocallbacks.cpp b/AirTV-Qt/audiocallbacks.cpp index 5a6d2a8..206b348 100644 --- a/AirTV-Qt/audiocallbacks.cpp +++ b/AirTV-Qt/audiocallbacks.cpp @@ -15,7 +15,7 @@ #include "audiocallbacks.h" AudioCallbacks::AudioCallbacks(QObject *parent) : - RaopCallbacks(parent) + RaopAudioHandler(parent) { } diff --git a/AirTV-Qt/audiocallbacks.h b/AirTV-Qt/audiocallbacks.h index af1daea..aa5389a 100644 --- a/AirTV-Qt/audiocallbacks.h +++ b/AirTV-Qt/audiocallbacks.h @@ -19,7 +19,7 @@ #include "audiooutput.h" -class AudioCallbacks : public RaopCallbacks +class AudioCallbacks : public RaopAudioHandler { Q_OBJECT public: diff --git a/src/bindings/qt4/raopcallbackhandler.cpp b/src/bindings/qt4/raopcallbackhandler.cpp index 60a44a7..8e18053 100644 --- a/src/bindings/qt4/raopcallbackhandler.cpp +++ b/src/bindings/qt4/raopcallbackhandler.cpp @@ -28,7 +28,7 @@ RaopCallbackHandler::RaopCallbackHandler(QObject *parent) : { } -void RaopCallbackHandler::init(RaopCallbacks *callbacks) +void RaopCallbackHandler::init(RaopAudioHandler *callbacks) { m_callbacks = callbacks; } diff --git a/src/bindings/qt4/raopcallbackhandler.h b/src/bindings/qt4/raopcallbackhandler.h index 33c1870..8ba3918 100644 --- a/src/bindings/qt4/raopcallbackhandler.h +++ b/src/bindings/qt4/raopcallbackhandler.h @@ -33,10 +33,10 @@ class RaopCallbackHandler : public QObject Q_OBJECT public: explicit RaopCallbackHandler(QObject *parent = 0); - void init(RaopCallbacks *callbacks); + void init(RaopAudioHandler *callbacks); private: - RaopCallbacks * m_callbacks; + RaopAudioHandler * m_callbacks; signals: diff --git a/src/bindings/qt4/raopcallbacks.h b/src/bindings/qt4/raopcallbacks.h index 2c4bf9a..2ad7104 100644 --- a/src/bindings/qt4/raopcallbacks.h +++ b/src/bindings/qt4/raopcallbacks.h @@ -26,11 +26,20 @@ #include -class RaopCallbacks : public QObject +class RaopLogHandler : public QObject { Q_OBJECT public: - explicit RaopCallbacks(QObject *parent = 0) : QObject(parent) {} + explicit RaopLogHandler(QObject *parent = 0) : QObject(parent) {} + + virtual void logCallback(int level, const char *msg) = 0; +}; + +class RaopAudioHandler : public QObject +{ + Q_OBJECT +public: + explicit RaopAudioHandler(QObject *parent = 0) : QObject(parent) {} virtual void *audioInit(int bits, int channels, int samplerate) = 0; virtual void audioProcess(void *session, const QByteArray & buffer) = 0; @@ -40,11 +49,6 @@ public: virtual void audioSetVolume(void *session, float volume) { Q_UNUSED(session) Q_UNUSED(volume) } virtual void audioSetMetadata(void *session, const QByteArray & buffer) { Q_UNUSED(session) Q_UNUSED(buffer) } virtual void audioSetCoverart(void *session, const QByteArray & buffer) { Q_UNUSED(session) Q_UNUSED(buffer) } - -signals: - -public slots: - }; #endif // RAOPCALLBACKS_H diff --git a/src/bindings/qt4/raopservice.cpp b/src/bindings/qt4/raopservice.cpp index f34008a..2250e2f 100644 --- a/src/bindings/qt4/raopservice.cpp +++ b/src/bindings/qt4/raopservice.cpp @@ -72,7 +72,7 @@ audio_init_cb(void *cls, int bits, int channels, int samplerate) * outside Qt are not allowed (they have no eventloop) */ audio_session->cb_handler = new RaopCallbackHandler(); audio_session->cb_handler->moveToThread(audio_session->cb_thread); - audio_session->cb_handler->init((RaopCallbacks *)cls); + audio_session->cb_handler->init((RaopAudioHandler *)cls); QMetaObject::invokeMethod(audio_session->cb_handler, "audioInit", Qt::BlockingQueuedConnection, @@ -171,7 +171,7 @@ RaopService::~RaopService() raop_destroy(m_raop); } -bool RaopService::init(int max_clients, RaopCallbacks *callbacks) +bool RaopService::init(int max_clients, RaopAudioHandler *callbacks) { raop_callbacks_t raop_cbs; @@ -191,6 +191,16 @@ bool RaopService::init(int max_clients, RaopCallbacks *callbacks) return true; } +void RaopService::setLogLevel(int level) +{ + Q_UNUSED(level) +} + +void RaopService::setLogHandler(RaopLogHandler *logger) +{ + Q_UNUSED(logger) +} + bool RaopService::isRunning() { return (raop_is_running(m_raop) != 0); @@ -206,6 +216,7 @@ bool RaopService::start(quint16 port, const QByteArray & hwaddr) return true; } + void RaopService::stop() { if (m_raop) { diff --git a/src/bindings/qt4/raopservice.h b/src/bindings/qt4/raopservice.h index 389e836..23ce112 100644 --- a/src/bindings/qt4/raopservice.h +++ b/src/bindings/qt4/raopservice.h @@ -37,7 +37,9 @@ public: explicit RaopService(QObject *parent = 0); ~RaopService(); - bool init(int max_clients, RaopCallbacks *callbacks); + bool init(int max_clients, RaopAudioHandler *callbacks); + void setLogLevel(int level); + void setLogHandler(RaopLogHandler *logger); bool start(quint16 port, const QByteArray & hwaddr); bool isRunning(); void stop();