aboutsummaryrefslogtreecommitdiff
path: root/src/QXmppRtpChannel.h
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2011-04-23 15:47:51 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2011-04-23 15:47:51 +0000
commit02ae50991c9d00f171bcc1ef105cbe52f37b39f7 (patch)
tree38b366313f4e91c0e2612f5f533d00dbee2b72c4 /src/QXmppRtpChannel.h
parentd0928bc5a77468731fc2067bfc1802e70932eb97 (diff)
downloadqxmpp-02ae50991c9d00f171bcc1ef105cbe52f37b39f7.tar.gz
* add a QXmppPacket class to avoid repeating RTP parsing code
* improve RTP video support
Diffstat (limited to 'src/QXmppRtpChannel.h')
-rw-r--r--src/QXmppRtpChannel.h70
1 files changed, 61 insertions, 9 deletions
diff --git a/src/QXmppRtpChannel.h b/src/QXmppRtpChannel.h
index 9b02aa2a..0407520d 100644
--- a/src/QXmppRtpChannel.h
+++ b/src/QXmppRtpChannel.h
@@ -35,6 +35,26 @@ class QXmppJinglePayloadType;
class QXmppRtpAudioChannelPrivate;
class QXmppRtpVideoChannelPrivate;
+/// \brief The QXmppRtpPacket class represents an RTP packet.
+///
+
+class QXmppRtpPacket
+{
+public:
+ bool decode(const QByteArray &ba);
+ QByteArray encode() const;
+ QString toString() const;
+
+ quint8 version;
+ bool marker;
+ quint8 type;
+ quint32 ssrc;
+ QList<quint32> csrc;
+ quint16 sequence;
+ quint32 stamp;
+ QByteArray payload;
+};
+
class QXmppRtpChannel
{
public:
@@ -147,28 +167,59 @@ private:
QXmppRtpAudioChannelPrivate * d;
};
-class QXmppVideoPlane
-{
-public:
- QByteArray data;
- int width;
- int height;
- int stride;
-};
+/// \brief The QXmppVideoFrame class provides a representation of a frame of video data.
+///
+/// \note THIS API IS NOT FINALIZED YET
class QXmppVideoFrame
{
public:
enum PixelFormat {
+ Format_Invalid = 0,
Format_YUV420P = 18,
+ Format_YUYV = 21,
};
- QXmppVideoPlane planes[3];
+ 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 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;
}
@@ -186,6 +237,7 @@ public:
}
private:
+ qreal m_frameRate;
QSize m_frameSize;
QXmppVideoFrame::PixelFormat m_pixelFormat;
};