/usr/include/qxmpp/QXmppRtpChannel.h is in libqxmpp-dev 0.7.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | /*
* Copyright (C) 2008-2012 The QXmpp developers
*
* Author:
* Jeremy Lainé
*
* Source:
* http://code.google.com/p/qxmpp
*
* This file is a part of QXmpp library.
*
* 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.
*
*/
#ifndef QXMPPRTPCHANNEL_H
#define QXMPPRTPCHANNEL_H
#include <QIODevice>
#include <QSize>
#include "QXmppJingleIq.h"
#include "QXmppLogger.h"
class QXmppCodec;
class QXmppJinglePayloadType;
class QXmppRtpAudioChannelPrivate;
class QXmppRtpVideoChannelPrivate;
/// \brief The QXmppRtpPacket class represents an RTP packet.
///
class QXMPP_EXPORT QXmppRtpPacket
{
public:
bool decode(const QByteArray &ba);
QByteArray encode() const;
QString toString() const;
/// RTP version.
quint8 version;
/// Marker flag.
bool marker;
/// Payload type.
quint8 type;
/// Synchronization source.
quint32 ssrc;
/// Contributing sources.
QList<quint32> csrc;
/// Sequence number.
quint16 sequence;
/// Timestamp.
quint32 stamp;
/// Raw payload data.
QByteArray payload;
};
class QXMPP_EXPORT QXmppRtpChannel
{
public:
QXmppRtpChannel();
/// Closes the RTP channel.
virtual void close() = 0;
/// Returns the mode in which the channel has been opened.
virtual QIODevice::OpenMode openMode() const = 0;
QList<QXmppJinglePayloadType> localPayloadTypes();
void setRemotePayloadTypes(const QList<QXmppJinglePayloadType> &remotePayloadTypes);
protected:
/// \cond
virtual void payloadTypesChanged() = 0;
QList<QXmppJinglePayloadType> m_incomingPayloadTypes;
QList<QXmppJinglePayloadType> m_outgoingPayloadTypes;
bool m_outgoingPayloadNumbered;
/// \endcond
};
/// \brief The QXmppRtpAudioChannel class represents an RTP audio channel to a remote party.
///
/// It acts as a QIODevice so that you can read / write audio samples, for
/// instance using a QAudioOutput and a QAudioInput.
///
/// \note THIS API IS NOT FINALIZED YET
class QXMPP_EXPORT QXmppRtpAudioChannel : public QIODevice, public QXmppRtpChannel
{
Q_OBJECT
Q_ENUMS(Tone)
public:
/// This enum is used to describe a DTMF tone.
enum Tone {
Tone_0 = 0, ///< Tone for the 0 key.
Tone_1, ///< Tone for the 1 key.
Tone_2, ///< Tone for the 2 key.
Tone_3, ///< Tone for the 3 key.
Tone_4, ///< Tone for the 4 key.
Tone_5, ///< Tone for the 5 key.
Tone_6, ///< Tone for the 6 key.
Tone_7, ///< Tone for the 7 key.
Tone_8, ///< Tone for the 8 key.
Tone_9, ///< Tone for the 9 key.
Tone_Star, ///< Tone for the * key.
Tone_Pound, ///< Tone for the # key.
Tone_A, ///< Tone for the A key.
Tone_B, ///< Tone for the B key.
Tone_C, ///< Tone for the C key.
Tone_D ///< Tone for the D key.
};
QXmppRtpAudioChannel(QObject *parent = 0);
~QXmppRtpAudioChannel();
qint64 bytesAvailable() const;
void close();
bool isSequential() const;
QIODevice::OpenMode openMode() const;
QXmppJinglePayloadType payloadType() const;
qint64 pos() const;
bool seek(qint64 pos);
signals:
/// \brief This signal is emitted when a datagram needs to be sent.
void sendDatagram(const QByteArray &ba);
/// \brief This signal is emitted to send logging messages.
void logMessage(QXmppLogger::MessageType type, const QString &msg);
public slots:
void datagramReceived(const QByteArray &ba);
void startTone(QXmppRtpAudioChannel::Tone tone);
void stopTone(QXmppRtpAudioChannel::Tone tone);
protected:
/// \cond
void debug(const QString &message)
{
emit logMessage(QXmppLogger::DebugMessage, qxmpp_loggable_trace(message));
}
void warning(const QString &message)
{
emit logMessage(QXmppLogger::WarningMessage, qxmpp_loggable_trace(message));
}
void logReceived(const QString &message)
{
emit logMessage(QXmppLogger::ReceivedMessage, qxmpp_loggable_trace(message));
}
void logSent(const QString &message)
{
emit logMessage(QXmppLogger::SentMessage, qxmpp_loggable_trace(message));
}
void payloadTypesChanged();
qint64 readData(char * data, qint64 maxSize);
qint64 writeData(const char * data, qint64 maxSize);
/// \endcond
private slots:
void emitSignals();
void writeDatagram();
private:
friend class QXmppRtpAudioChannelPrivate;
QXmppRtpAudioChannelPrivate * d;
};
/// \brief The QXmppVideoFrame class provides a representation of a frame of video data.
///
/// \note THIS API IS NOT FINALIZED YET
class QXMPP_EXPORT QXmppVideoFrame
{
public:
/// This enum describes a pixel format.
enum PixelFormat {
Format_Invalid = 0, ///< The frame is invalid.
Format_RGB32 = 3, ///< The frame stored using a 32-bit RGB format (0xffRRGGBB).
Format_RGB24 = 4, ///< The frame is stored using a 24-bit RGB format (8-8-8).
Format_YUV420P = 18, ///< The frame is stored using an 8-bit per component planar
///< YUV format with the U and V planes horizontally and
///< vertically sub-sampled, i.e. the height and width of the
///< U and V planes are half that of the Y plane.
Format_UYVY = 20, ///< The frame is stored using an 8-bit per component packed
///< YUV format with the U and V planes horizontally
///< sub-sampled (U-Y-V-Y), i.e. two horizontally adjacent
///< pixels are stored as a 32-bit macropixel which has a Y
///< value for each pixel and common U and V values.
Format_YUYV = 21, ///< The frame is stored using an 8-bit per component packed
///< YUV format with the U and V planes horizontally
///< sub-sampled (Y-U-Y-V), i.e. two horizontally adjacent
///< pixels are stored as a 32-bit macropixel which has a Y
///< value for each pixel and common U and V values.
};
QXmppVideoFrame();
QXmppVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format);
uchar *bits();
const uchar *bits() const;
int bytesPerLine() const;
int height() const;
bool isValid() const;
int mappedBytes() const;
PixelFormat pixelFormat() const;
QSize size() const;
int width() const;
private:
int m_bytesPerLine;
QByteArray m_data;
int m_height;
int m_mappedBytes;
PixelFormat m_pixelFormat;
int m_width;
};
class QXMPP_EXPORT QXmppVideoFormat
{
public:
int frameHeight() const {
return m_frameSize.height();
}
int frameWidth() const {
return m_frameSize.width();
}
qreal frameRate() const {
return m_frameRate;
}
void setFrameRate(qreal frameRate) {
m_frameRate = frameRate;
}
QSize frameSize() const {
return m_frameSize;
}
void setFrameSize(const QSize &frameSize) {
m_frameSize = frameSize;
}
QXmppVideoFrame::PixelFormat pixelFormat() const {
return m_pixelFormat;
}
void setPixelFormat(QXmppVideoFrame::PixelFormat pixelFormat) {
m_pixelFormat = pixelFormat;
}
private:
qreal m_frameRate;
QSize m_frameSize;
QXmppVideoFrame::PixelFormat m_pixelFormat;
};
/// \brief The QXmppRtpVideoChannel class represents an RTP video channel to a remote party.
///
/// \note THIS API IS NOT FINALIZED YET
class QXMPP_EXPORT QXmppRtpVideoChannel : public QXmppLoggable, public QXmppRtpChannel
{
Q_OBJECT
public:
QXmppRtpVideoChannel(QObject *parent = 0);
~QXmppRtpVideoChannel();
void close();
QIODevice::OpenMode openMode() const;
// incoming stream
QXmppVideoFormat decoderFormat() const;
QList<QXmppVideoFrame> readFrames();
// outgoing stream
QXmppVideoFormat encoderFormat() const;
void setEncoderFormat(const QXmppVideoFormat &format);
void writeFrame(const QXmppVideoFrame &frame);
signals:
/// \brief This signal is emitted when a datagram needs to be sent.
void sendDatagram(const QByteArray &ba);
public slots:
void datagramReceived(const QByteArray &ba);
protected:
/// \cond
void payloadTypesChanged();
/// \endcond
private:
friend class QXmppRtpVideoChannelPrivate;
QXmppRtpVideoChannelPrivate * d;
};
#endif
|