1 /*
2     Copyright (C) 2011 Collabora Ltd. <info@collabora.co.uk>
3       @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
4 
5     This library is free software; you can redistribute it and/or modify
6     it under the terms of the GNU Lesser General Public License as published
7     by the Free Software Foundation; either version 2.1 of the License, or
8     (at your option) any later version.
9 
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14 
15     You should have received a copy of the GNU Lesser General Public License
16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef QTF_H
19 #define QTF_H
20 
21 /* This module is a wrapper for telepathy-farstream that
22  * uses the QtGLib/QtGStreamer bindings as a base. It could
23  * be built standalone and used in other projects in the future.
24  */
25 
26 #include <QGlib/Object>
27 #include <QGst/Message>
28 #include <TelepathyQt/PendingOperation>
29 #include <TelepathyQt/CallChannel>
30 
31 typedef struct _TfChannel TfChannel;
32 typedef struct _TfContent TfContent;
33 
34 //for the moment, this is a static lib
35 #define QTF_EXPORT
36 
37 #define QTF_WRAPPER(Class) \
38     QGLIB_WRAPPER_DECLARATION_MACRO(Class, Class, Tf, Class)
39 
40 #define QTF_REGISTER_TYPE(Class) \
41     QGLIB_REGISTER_TYPE_WITH_EXPORT_MACRO(Class, QTF_EXPORT)
42 
43 namespace QTf {
44 
45 class Channel;
46 typedef QGlib::RefPointer<Channel> ChannelPtr;
47 class Content;
48 typedef QGlib::RefPointer<Content> ContentPtr;
49 
50 
51 /** Wrapper for TfChannel */
52 class QTF_EXPORT Channel : public QGlib::Object
53 {
54     QTF_WRAPPER(Channel)
55 public:
56     bool processBusMessage(const QGst::MessagePtr & message);
57 };
58 
59 
60 /** Wrapper for TfContent */
61 class QTF_EXPORT Content : public QGlib::Object
62 {
63     QTF_WRAPPER(Content)
64 };
65 
66 
67 /** Initializes telepathy-farstream and registers the
68  * QTf wrapper types with the QGlib type system */
69 QTF_EXPORT void init();
70 
71 
72 QTF_EXPORT QGlib::ObjectPtr loadFsElementAddedNotifier(
73             const QGst::ElementPtr & fsConference,
74             const QGst::BinPtr & pipeline);
75 
76 
77 /** Constructs a new QTf::Channel from a Tp::CallChannel */
78 class QTF_EXPORT PendingChannel : public Tp::PendingOperation
79 {
80     Q_OBJECT
81 public:
82     PendingChannel(const Tp::CallChannelPtr & callChannel);
83     virtual ~PendingChannel();
84 
85     QTf::ChannelPtr channel() const;
86 
87 private Q_SLOTS:
88     void onPendingTfChannelFinished(Tp::PendingOperation *op);
89 
90 private:
91     QTf::ChannelPtr m_channel;
92 };
93 
94 
95 } //namespace QTf
96 
97 QTF_REGISTER_TYPE(QTf::Channel)
98 QTF_REGISTER_TYPE(QTf::Content)
99 
100 #endif // QTF_H
101