diff options
author | Mateu Batle <mateu.batle@collabora.co.uk> | 2011-02-15 19:57:16 -0500 |
---|---|---|
committer | Mateu Batle <mateu.batle@collabora.co.uk> | 2011-02-15 19:59:08 -0500 |
commit | 8e172ebaf4f5fbac9ad0ab2c95535aa976a4a9d3 (patch) | |
tree | c10bb94e0e8c54485d53689620a1041791fa2b63 /TelepathyQt4Yell | |
parent | 8f7fae42cd5969b014c5ee176c817c4370f1b89b (diff) | |
parent | 54836606badea2f652a11d1f2c5923bd9f0ba417 (diff) |
Merge branch 'farstream'
Reviewed-by: Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk>
Diffstat (limited to 'TelepathyQt4Yell')
-rw-r--r-- | TelepathyQt4Yell/CMakeLists.txt | 9 | ||||
-rw-r--r-- | TelepathyQt4Yell/Farstream/CMakeLists.txt | 60 | ||||
-rw-r--r-- | TelepathyQt4Yell/Farstream/Channel | 13 | ||||
-rw-r--r-- | TelepathyQt4Yell/Farstream/Types | 13 | ||||
-rw-r--r-- | TelepathyQt4Yell/Farstream/channel.cpp | 149 | ||||
-rw-r--r-- | TelepathyQt4Yell/Farstream/channel.h | 82 | ||||
-rw-r--r-- | TelepathyQt4Yell/Farstream/global.h | 45 | ||||
-rw-r--r-- | TelepathyQt4Yell/Farstream/types.h | 39 | ||||
-rw-r--r-- | TelepathyQt4Yell/TelepathyQt4YellFarstream-uninstalled.pc.in | 11 | ||||
-rw-r--r-- | TelepathyQt4Yell/TelepathyQt4YellFarstream.pc.in | 11 |
10 files changed, 432 insertions, 0 deletions
diff --git a/TelepathyQt4Yell/CMakeLists.txt b/TelepathyQt4Yell/CMakeLists.txt index c40c859..bfc16b4 100644 --- a/TelepathyQt4Yell/CMakeLists.txt +++ b/TelepathyQt4Yell/CMakeLists.txt @@ -147,3 +147,12 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQt4Yell-uninstalled.pc.in ${ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt4Yell.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig COMPONENT headers) add_subdirectory(Models) + +# If Farstream was found, install its pkg-config files as well, and go into the subdirectory +if(FARSTREAM_COMPONENTS_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQt4YellFarstream.pc.in ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt4YellFarstream.pc) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQt4YellFarstream-uninstalled.pc.in ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt4YellFarstream-uninstalled.pc) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt4YellFarstream.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig COMPONENT farstream_headers) +endif(FARSTREAM_COMPONENTS_FOUND) + +add_subdirectory(Farstream) diff --git a/TelepathyQt4Yell/Farstream/CMakeLists.txt b/TelepathyQt4Yell/Farstream/CMakeLists.txt new file mode 100644 index 0000000..cf5b9e4 --- /dev/null +++ b/TelepathyQt4Yell/Farstream/CMakeLists.txt @@ -0,0 +1,60 @@ +if(FARSTREAM_COMPONENTS_FOUND) + include_directories(${TELEPATHY_FARSTREAM_INCLUDE_DIR} + ${GSTREAMER_INCLUDE_DIR} + ${GLIB2_INCLUDE_DIR} + ${LIBXML2_INCLUDE_DIR} + ${DBUS_INCLUDE_DIR}) + + # It gets inherited from the previous directory, hence it has to be removed explicitely + remove_definitions(-DBUILDING_TELEPATHY_QT4_YELL) + # We are building Telepathy-Qt4-Yell-Farstream + add_definitions(-DBUILDING_TELEPATHY_QT4_YELL_FARSTREAM -DQT_NO_KEYWORDS) + + set(telepathy_qt4_yell_farstream_SRCS + channel.cpp) + + set(telepathy_qt4_yell_farstream_HEADERS + Channel + channel.h + global.h + Types + types.h) + + set(telepathy_qt4_yell_farstream_MOC_SRCS + channel.h) + + # generate client moc files + tpqt4_generate_mocs(${telepathy_qt4_yell_farstream_MOC_SRCS}) + + # Create the library + if (ENABLE_COMPILER_COVERAGE) + add_library(telepathy-qt4-yell-farstream STATIC ${telepathy_qt4_yell_farstream_SRCS} ${telepathy_qt4_yell_farstream_MOC_SRCS}) + else (ENABLE_COMPILER_COVERAGE) + add_library(telepathy-qt4-yell-farstream SHARED ${telepathy_qt4_yell_farstream_SRCS} ${telepathy_qt4_yell_farstream_MOC_SRCS}) + endif (ENABLE_COMPILER_COVERAGE) + # Link + target_link_libraries(telepathy-qt4-yell-farstream + ${QT_QTDBUS_LIBRARY} + ${QT_QTCORE_LIBRARY} + ${TELEPATHY_FARSTREAM_LIBRARIES} + ${GSTREAMER_INTERFACE_LIBRARY} + telepathy-qt4-yell) + + # Set the correct version number + set_target_properties(telepathy-qt4-yell-farstream PROPERTIES + SOVERSION ${TP_QT4_YELL_ABI_VERSION} + VERSION ${TP_QT4_YELL_LIBRARY_VERSION}) + + # Install the library - watch out for the correct components + if (WIN32) + install(TARGETS telepathy-qt4-yell-farstream RUNTIME DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream_headers) + else (WIN32) + install(TARGETS telepathy-qt4-yell-farstream LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT farstream_headers) + endif (WIN32) + + # Install headers + install(FILES ${telepathy_qt4_yell_farstream_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/telepathy-1.0/TelepathyQt4Yell/Farstream + COMPONENT farstream_headers) +endif(FARSTREAM_COMPONENTS_FOUND) diff --git a/TelepathyQt4Yell/Farstream/Channel b/TelepathyQt4Yell/Farstream/Channel new file mode 100644 index 0000000..f6e8830 --- /dev/null +++ b/TelepathyQt4Yell/Farstream/Channel @@ -0,0 +1,13 @@ +#ifndef _TelepathyQt4_Yell_Farstream_Channel_HEADER_GUARD_ +#define _TelepathyQt4_Yell_Farstream_Channel_HEADER_GUARD_ + +#ifndef IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#define IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#endif + +#include <TelepathyQt4Yell/Farstream/channel.h> + +#undef IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER + +#endif +// vim:set ft=cpp: diff --git a/TelepathyQt4Yell/Farstream/Types b/TelepathyQt4Yell/Farstream/Types new file mode 100644 index 0000000..9f349c2 --- /dev/null +++ b/TelepathyQt4Yell/Farstream/Types @@ -0,0 +1,13 @@ +#ifndef _TelepathyQt4Yell_Farstream_Types_HEADER_GUARD_ +#define _TelepathyQt4Yell_Farstream_Types_HEADER_GUARD_ + +#ifndef IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#define IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#endif + +#include <TelepathyQt4Yell/Farstream/types.h> + +#undef IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER + +#endif +// vim:set ft=cpp: diff --git a/TelepathyQt4Yell/Farstream/channel.cpp b/TelepathyQt4Yell/Farstream/channel.cpp new file mode 100644 index 0000000..a0aeb1e --- /dev/null +++ b/TelepathyQt4Yell/Farstream/channel.cpp @@ -0,0 +1,149 @@ +/* + * This file is part of TelepathyQt4Yell + * + * Copyright © 2009-2011 Collabora Ltd. <http://www.collabora.co.uk/> + * Copyright © 2009 Nokia Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <TelepathyQt4Yell/Farstream/Channel> + +#include "TelepathyQt4Yell/Farstream/_gen/channel.moc.hpp" + +#include <TelepathyQt4/Channel> +#include <TelepathyQt4/Connection> +#include <TelepathyQt4Yell/CallChannel> +#include <TelepathyQt4Yell/Farstream/global.h> + +#include <telepathy-glib/channel.h> +#include <telepathy-glib/connection.h> +#include <telepathy-glib/dbus.h> + +namespace Tpy +{ + +struct TELEPATHY_QT4_YELL_FS_NO_EXPORT PendingTfChannel::Private +{ + Private(const CallChannelPtr &channel) + : mChannel(channel), + mTfChannel(0) + { + } + + static void onTfChannelNewFinish(GObject *sourceObject, GAsyncResult *res, gpointer userData); + + CallChannelPtr mChannel; + TfChannel *mTfChannel; +}; + +PendingTfChannel::PendingTfChannel(const FarstreamChannelFactoryPtr &fcf, const CallChannelPtr &channel) + : Tp::PendingOperation(fcf), + mPriv(new PendingTfChannel::Private(channel)) +{ + + if (!mPriv->mChannel->handlerStreamingRequired()) { + setFinishedWithError(TP_QT4_ERROR_NOT_AVAILABLE, QLatin1String("Handler streaming not required")); + return; + } + + TpDBusDaemon *dbus = tp_dbus_daemon_dup(0); + if (!dbus) { + setFinishedWithError(TP_QT4_ERROR_NOT_AVAILABLE, QLatin1String("Unable to connect to D-Bus")); + return; + } + + Tp::ConnectionPtr connection = mPriv->mChannel->connection(); + if (connection.isNull()) { + setFinishedWithError(TP_QT4_ERROR_NOT_AVAILABLE, QLatin1String("Connection not available")); + g_object_unref(dbus); + return; + } + + TpConnection *gconnection = tp_connection_new(dbus, + connection->busName().toAscii(), + connection->objectPath().toAscii(), + 0); + g_object_unref(dbus); + dbus = 0; + if (!gconnection) { + setFinishedWithError(TP_QT4_ERROR_NOT_AVAILABLE, QLatin1String("Unable to construct TpConnection")); + return; + } + + TpChannel *gchannel = tp_channel_new(gconnection, + channel->objectPath().toAscii(), + TP_QT4_YELL_IFACE_CHANNEL_TYPE_CALL.latin1(), + (TpHandleType) channel->targetHandleType(), + channel->targetHandle(), + 0); + g_object_unref(gconnection); + gconnection = 0; + if (!gchannel) { + setFinishedWithError(TP_QT4_ERROR_NOT_AVAILABLE, QLatin1String("Unable to construct TpChannel")); + return; + } + + tf_channel_new_async(gchannel, PendingTfChannel::Private::onTfChannelNewFinish, this); + g_object_unref(gchannel); +} + +PendingTfChannel::~PendingTfChannel() +{ + delete mPriv; +} + +void PendingTfChannel::Private::onTfChannelNewFinish(GObject *sourceObject, GAsyncResult *res, gpointer userData) +{ + qDebug() << "PendingTfChannel::Private::onTfChannelNewFinish: "; + qDebug() << " sourceObject=" << sourceObject; + qDebug() << " result=" << res; + + PendingTfChannel *self = reinterpret_cast<PendingTfChannel *>(userData); + + GError *error = NULL; + TfChannel *ret = TF_CHANNEL(g_async_initable_new_finish(G_ASYNC_INITABLE(sourceObject), res, &error)); + if (error) { + qDebug() << "FarstreamChannel::onTfChannelNewFinish: error " << error->message; + g_clear_error(&error); + self->setFinishedWithError(TP_QT4_ERROR_NOT_AVAILABLE, QLatin1String(error->message)); + return; + } + + self->mPriv->mTfChannel = ret; + self->setFinished(); +} + +TfChannel *PendingTfChannel::tfChannel() +{ + return mPriv->mTfChannel; +} + +FarstreamChannelFactory::FarstreamChannelFactory() + : mPriv(0) +{ +} + +FarstreamChannelFactory::~FarstreamChannelFactory() +{ +} + +PendingTfChannel *FarstreamChannelFactory::create(const CallChannelPtr &channel) +{ + PendingTfChannel *pendingOperation = new PendingTfChannel(FarstreamChannelFactoryPtr(this), channel); + return pendingOperation; +} + +} // Tpy diff --git a/TelepathyQt4Yell/Farstream/channel.h b/TelepathyQt4Yell/Farstream/channel.h new file mode 100644 index 0000000..b1c1c72 --- /dev/null +++ b/TelepathyQt4Yell/Farstream/channel.h @@ -0,0 +1,82 @@ +/* + * This file is part of TelepathyQt4Yell + * + * Copyright (C) 2009-2011 Collabora Ltd. <http://www.collabora.co.uk/> + * Copyright (C) 2009 Nokia Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _TelepathyQt4Yell_Farstream_channel_h_HEADER_GUARD_ +#define _TelepathyQt4Yell_Farstream_channel_h_HEADER_GUARD_ + +#ifndef IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#error IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#endif + +#include <QObject> + +#include <TelepathyQt4Yell/Farstream/global.h> +#include <TelepathyQt4Yell/Types> +#include <TelepathyQt4/PendingOperation> + +#include <gst/gst.h> +#include <telepathy-farstream/channel.h> + +namespace Tpy +{ + +class FarstreamChannelFactory; +typedef Tp::SharedPtr<FarstreamChannelFactory> FarstreamChannelFactoryPtr; + +class TELEPATHY_QT4_YELL_FS_EXPORT PendingTfChannel : public Tp::PendingOperation +{ + Q_OBJECT + Q_DISABLE_COPY(PendingTfChannel) + +public: + ~PendingTfChannel(); + + TfChannel *tfChannel(); + +private: + friend class FarstreamChannelFactory; + + PendingTfChannel(const FarstreamChannelFactoryPtr &fsc, const CallChannelPtr &channel); + + struct Private; + friend struct Private; + Private *mPriv; +}; + +class TELEPATHY_QT4_YELL_FS_EXPORT FarstreamChannelFactory : public Tp::RefCounted +{ + Q_DISABLE_COPY(FarstreamChannelFactory) + +public: + FarstreamChannelFactory(); + ~FarstreamChannelFactory(); + + PendingTfChannel *create(const CallChannelPtr &channel); + +private: + struct Private; + friend struct Private; + Private *mPriv; +}; + +} // Tpy + +#endif diff --git a/TelepathyQt4Yell/Farstream/global.h b/TelepathyQt4Yell/Farstream/global.h new file mode 100644 index 0000000..873fa4a --- /dev/null +++ b/TelepathyQt4Yell/Farstream/global.h @@ -0,0 +1,45 @@ +/* + * This file is part of TelepathyQt4Yell + * + * Copyright (C) 2009-2011 Collabora Ltd. <http://www.collabora.co.uk/> + * Copyright (C) 2009 Nokia Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _TelepathyQt4Yell_Farstream_global_h_HEADER_GUARD_ +#define _TelepathyQt4Yell_Farstream_global_h_HEADER_GUARD_ + +#ifndef IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#error IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#endif + +#include <QtGlobal> + +#ifdef BUILDING_TELEPATHY_QT4_YELL_FARSTREAM +# define TELEPATHY_QT4_YELL_FS_EXPORT Q_DECL_EXPORT +#else +# define TELEPATHY_QT4_YELL_FS_EXPORT Q_DECL_IMPORT +#endif + +#if !defined(Q_OS_WIN) && defined(QT_VISIBILITY_AVAILABLE) +# define TELEPATHY_QT4_YELL_FS_NO_EXPORT __attribute__((visibility("hidden"))) +#endif + +#ifndef TELEPATHY_QT4_YELL_FS_NO_EXPORT +# define TELEPATHY_QT4_YELL_FS_NO_EXPORT +#endif + +#endif diff --git a/TelepathyQt4Yell/Farstream/types.h b/TelepathyQt4Yell/Farstream/types.h new file mode 100644 index 0000000..fdd9fd0 --- /dev/null +++ b/TelepathyQt4Yell/Farstream/types.h @@ -0,0 +1,39 @@ +/* + * This file is part of TelepathyQt4Yell + * + * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _TelepathyQt4Yell_Farstream_types_h_HEADER_GUARD_ +#define _TelepathyQt4Yell_Farstream_types_h_HEADER_GUARD_ + +#ifndef IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#error IN_TELEPATHY_QT4_YELL_FARSTREAM_HEADER +#endif + +#include <TelepathyQt4/Types> + +namespace Tpy +{ + +class FarstreamChannelFactory; + +typedef Tp::SharedPtr<FarstreamChannelFactory> FarstreamChannelFactoryPtr; + +} // Tpy + +#endif diff --git a/TelepathyQt4Yell/TelepathyQt4YellFarstream-uninstalled.pc.in b/TelepathyQt4Yell/TelepathyQt4YellFarstream-uninstalled.pc.in new file mode 100644 index 0000000..03101ae --- /dev/null +++ b/TelepathyQt4Yell/TelepathyQt4YellFarstream-uninstalled.pc.in @@ -0,0 +1,11 @@ +prefix=/nonexistent +exec_prefix=/nonexistent +abs_top_builddir=${CMAKE_BINARY_DIR} +abs_top_srcdir=${CMAKE_SOURCE_DIR} + +Name: Telepathy-Qt4-Yell-Farstream (uninstalled copy) +Description: Qt4 Telepathy Yell Farstream utility library for the Telepathy Yell framework +Version: ${PACKAGE_VERSION} +Requires.private: QtCore >= 4.5, QtDBus >= 4.5, telepathy-glib >= 0.7.28, telepathy-farstream >= 0.0.1, TelepathyQt4Yell = ${PACKAGE_VERSION} +Libs: ${CMAKE_BINARY_DIR}/TelepathyQt4Yell/Farstream/libtelepathy-qt4-yell-farstream.so +Cflags: -I${CMAKE_SOURCE_DIR} -I${CMAKE_BINARY_DIR} diff --git a/TelepathyQt4Yell/TelepathyQt4YellFarstream.pc.in b/TelepathyQt4Yell/TelepathyQt4YellFarstream.pc.in new file mode 100644 index 0000000..252b7f9 --- /dev/null +++ b/TelepathyQt4Yell/TelepathyQt4YellFarstream.pc.in @@ -0,0 +1,11 @@ +prefix=${CMAKE_INSTALL_PREFIX} +exec_prefix=${CMAKE_INSTALL_PREFIX} +libdir=${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR} +includedir=${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR} + +Name: Telepathy-Qt4-Yell-Farstream +Description: Qt4 Telepathy Yell Farstream utility library for the Telepathy Yell framework +Version: ${PACKAGE_VERSION} +Requires.private: QtCore >= 4.5, QtDBus >= 4.5, telepathy-glib >= 0.7.28, telepathy-farstream >= 0.0.1, TelepathyQt4Yell = ${PACKAGE_VERSION} +Libs: -L${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR} -ltelepathy-qt4-yell-farstream +Cflags: -I${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}/telepathy-1.0 |