| Home · All Classes · All Namespaces · Modules · Functions · Files

streamed-media-channel.h

    00001
    00023 #ifndef _TelepathyQt_streamed_media_channel_h_HEADER_GUARD_
    00024 #define _TelepathyQt_streamed_media_channel_h_HEADER_GUARD_
    00025
    00026 #ifndef IN_TP_QT_HEADER
    00027 #error IN_TP_QT_HEADER
    00028 #endif
    00029
    00030 #include <TelepathyQt/Channel>
    00031 #include <TelepathyQt/PendingOperation>
    00032 #include <TelepathyQt/Object>
    00033 #include <TelepathyQt/SharedPtr>
    00034 #include <TelepathyQt/Types>
    00035
    00036 namespace Tp
    00037 {
    00038
    00039 class StreamedMediaChannel;
    00040
    00041 typedef QList<StreamedMediaStreamPtr> StreamedMediaStreams;
    00042
    00043 class TP_QT_EXPORT PendingStreamedMediaStreams : public PendingOperation
    00044 {
    00045     Q_OBJECT
    00046     Q_DISABLE_COPY(PendingStreamedMediaStreams)
    00047
    00048 public:
    00049     ~PendingStreamedMediaStreams();
    00050
    00051     StreamedMediaChannelPtr channel() const;
    00052
    00053     StreamedMediaStreams streams() const;
    00054
    00055 private Q_SLOTS:
    00056     TP_QT_NO_EXPORT void gotStreams(QDBusPendingCallWatcher *op);
    00057
    00058     TP_QT_NO_EXPORT void onStreamRemoved(const Tp::StreamedMediaStreamPtr &stream);
    00059     TP_QT_NO_EXPORT void onStreamReady(Tp::PendingOperation *op);
    00060
    00061 private:
    00062     friend class StreamedMediaChannel;
    00063
    00064     TP_QT_NO_EXPORT PendingStreamedMediaStreams(const StreamedMediaChannelPtr &channel,
    00065             const ContactPtr &contact,
    00066             const QList<MediaStreamType> &types);
    00067
    00068     struct Private;
    00069     friend struct Private;
    00070     Private *mPriv;
    00071 };
    00072
    00073 class TP_QT_EXPORT StreamedMediaStream : public Object, private ReadyObject
    00074 {
    00075     Q_OBJECT
    00076     Q_DISABLE_COPY(StreamedMediaStream)
    00077
    00078 public:
    00079     enum SendingState {
    00080         SendingStateNone = 0,
    00081         SendingStatePendingSend = 1,
    00082         SendingStateSending = 2
    00083     };
    00084
    00085     ~StreamedMediaStream();
    00086
    00087     StreamedMediaChannelPtr channel() const;
    00088
    00089     uint id() const;
    00090
    00091     ContactPtr contact() const;
    00092
    00093     MediaStreamState state() const;
    00094     MediaStreamType type() const;
    00095
    00096     SendingState localSendingState() const;
    00097     SendingState remoteSendingState() const;
    00098
    00099     bool sending() const;
    00100     bool receiving() const;
    00101
    00102     bool localSendingRequested() const;
    00103     bool remoteSendingRequested() const;
    00104
    00105     MediaStreamDirection direction() const;
    00106     MediaStreamPendingSend pendingSend() const;
    00107
    00108     PendingOperation *requestSending(bool send);
    00109     PendingOperation *requestReceiving(bool receive);
    00110
    00111     PendingOperation *requestDirection(MediaStreamDirection direction);
    00112     PendingOperation *requestDirection(bool send, bool receive);
    00113
    00114     PendingOperation *startDTMFTone(DTMFEvent event);
    00115     PendingOperation *stopDTMFTone();
    00116
    00117 Q_SIGNALS:
    00118     void localSendingStateChanged(Tp::StreamedMediaStream::SendingState localSendingState);
    00119     void remoteSendingStateChanged(Tp::StreamedMediaStream::SendingState remoteSendingState);
    00120
    00121 private Q_SLOTS:
    00122     TP_QT_NO_EXPORT void gotContact(Tp::PendingOperation *op);
    00123
    00124 private:
    00125     friend class PendingStreamedMediaStreams;
    00126     friend class StreamedMediaChannel;
    00127
    00128     static const Feature FeatureCore;
    00129
    00130     TP_QT_NO_EXPORT StreamedMediaStream(const StreamedMediaChannelPtr &channel, const MediaStreamInfo &info);
    00131
    00132     TP_QT_NO_EXPORT void gotDirection(uint direction, uint pendingSend);
    00133     TP_QT_NO_EXPORT void gotStreamState(uint state);
    00134
    00135     struct Private;
    00136     friend struct Private;
    00137     Private *mPriv;
    00138 };
    00139
    00140 class TP_QT_EXPORT StreamedMediaChannel : public Channel
    00141 {
    00142     Q_OBJECT
    00143     Q_DISABLE_COPY(StreamedMediaChannel)
    00144     Q_ENUMS(StateChangeReason)
    00145
    00146 public:
    00147     static const Feature FeatureCore;
    00148     static const Feature FeatureStreams;
    00149     static const Feature FeatureLocalHoldState;
    00150
    00151     enum StateChangeReason {
    00152         StateChangeReasonUnknown = 0,
    00153         StateChangeReasonUserRequested = 1
    00154     };
    00155
    00156     static StreamedMediaChannelPtr create(const ConnectionPtr &connection,
    00157             const QString &objectPath, const QVariantMap &immutableProperties);
    00158
    00159     virtual ~StreamedMediaChannel();
    00160
    00161     bool awaitingLocalAnswer() const;
    00162     bool awaitingRemoteAnswer() const;
    00163
    00164     PendingOperation *acceptCall();
    00165     PendingOperation *hangupCall();
    00166
    00167     StreamedMediaStreams streams() const;
    00168     StreamedMediaStreams streamsForType(MediaStreamType type) const;
    00169
    00170     PendingStreamedMediaStreams *requestStream(const ContactPtr &contact, MediaStreamType type);
    00171     PendingStreamedMediaStreams *requestStreams(const ContactPtr &contact, QList<MediaStreamType> types);
    00172
    00173     PendingOperation *removeStream(const StreamedMediaStreamPtr &stream);
    00174     PendingOperation *removeStreams(const StreamedMediaStreams &streams);
    00175
    00176     bool handlerStreamingRequired() const;
    00177
    00178     LocalHoldState localHoldState() const;
    00179     LocalHoldStateReason localHoldStateReason() const;
    00180     PendingOperation *requestHold(bool hold);
    00181
    00182 Q_SIGNALS:
    00183     void streamAdded(const Tp::StreamedMediaStreamPtr &stream);
    00184     void streamRemoved(const Tp::StreamedMediaStreamPtr &stream);
    00185     void streamDirectionChanged(const Tp::StreamedMediaStreamPtr &stream,
    00186             Tp::MediaStreamDirection direction,
    00187             Tp::MediaStreamPendingSend pendingSend);
    00188     void streamStateChanged(const Tp::StreamedMediaStreamPtr &stream,
    00189             Tp::MediaStreamState state);
    00190     void streamError(const Tp::StreamedMediaStreamPtr &stream,
    00191             Tp::MediaStreamError errorCode,
    00192             const QString &errorMessage);
    00193
    00194     void localHoldStateChanged(Tp::LocalHoldState state,
    00195             Tp::LocalHoldStateReason reason);
    00196
    00197 protected:
    00198     StreamedMediaChannel(const ConnectionPtr &connection,
    00199             const QString &objectPath, const QVariantMap &immutableProperties,
    00200             const Feature &coreFeature = StreamedMediaChannel::FeatureCore);
    00201
    00202 private Q_SLOTS:
    00203     TP_QT_NO_EXPORT void onStreamReady(Tp::PendingOperation *op);
    00204
    00205     TP_QT_NO_EXPORT void gotStreams(QDBusPendingCallWatcher *);
    00206     TP_QT_NO_EXPORT void onStreamAdded(uint, uint, uint);
    00207     TP_QT_NO_EXPORT void onStreamRemoved(uint);
    00208     TP_QT_NO_EXPORT void onStreamDirectionChanged(uint, uint, uint);
    00209     TP_QT_NO_EXPORT void onStreamStateChanged(uint streamId, uint streamState);
    00210     TP_QT_NO_EXPORT void onStreamError(uint, uint, const QString &);
    00211
    00212     TP_QT_NO_EXPORT void gotLocalHoldState(QDBusPendingCallWatcher *);
    00213     TP_QT_NO_EXPORT void onLocalHoldStateChanged(uint, uint);
    00214
    00215 private:
    00216     friend class PendingStreamedMediaStreams;
    00217
    00218     StreamedMediaStreamPtr addStream(const MediaStreamInfo &streamInfo);
    00219     StreamedMediaStreamPtr lookupStreamById(uint streamId);
    00220
    00221     struct Private;
    00222     friend struct Private;
    00223     Private *mPriv;
    00224 };
    00225
    00226 } // Tp
    00227
    00228 #endif