[556] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[556] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
| 6 | **
|
---|
| 7 | ** This file is part of the QtMultimedia module of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 15 | **
|
---|
| 16 | ** GNU Lesser General Public License Usage
|
---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
| 20 | ** packaging of this file. Please review the following information to
|
---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
| 23 | **
|
---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
| 27 | **
|
---|
| 28 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at qt-info@nokia.com.
|
---|
| 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | #ifndef QVIDEOFRAME_H
|
---|
| 43 | #define QVIDEOFRAME_H
|
---|
| 44 |
|
---|
| 45 | #include <QtCore/qmetatype.h>
|
---|
| 46 | #include <QtCore/qshareddata.h>
|
---|
| 47 | #include <QtGui/qimage.h>
|
---|
| 48 | #include <QtMultimedia/qabstractvideobuffer.h>
|
---|
| 49 |
|
---|
| 50 | QT_BEGIN_HEADER
|
---|
| 51 |
|
---|
| 52 | QT_BEGIN_NAMESPACE
|
---|
| 53 |
|
---|
| 54 | QT_MODULE(Multimedia)
|
---|
| 55 |
|
---|
| 56 | class QSize;
|
---|
| 57 | class QVariant;
|
---|
| 58 |
|
---|
| 59 | class QVideoFramePrivate;
|
---|
| 60 |
|
---|
| 61 | class Q_MULTIMEDIA_EXPORT QVideoFrame
|
---|
| 62 | {
|
---|
| 63 | public:
|
---|
| 64 | enum FieldType
|
---|
| 65 | {
|
---|
| 66 | ProgressiveFrame,
|
---|
| 67 | TopField,
|
---|
| 68 | BottomField,
|
---|
| 69 | InterlacedFrame
|
---|
| 70 | };
|
---|
| 71 |
|
---|
| 72 | enum PixelFormat
|
---|
| 73 | {
|
---|
| 74 | Format_Invalid,
|
---|
| 75 | Format_ARGB32,
|
---|
| 76 | Format_ARGB32_Premultiplied,
|
---|
| 77 | Format_RGB32,
|
---|
| 78 | Format_RGB24,
|
---|
| 79 | Format_RGB565,
|
---|
| 80 | Format_RGB555,
|
---|
| 81 | Format_ARGB8565_Premultiplied,
|
---|
| 82 | Format_BGRA32,
|
---|
| 83 | Format_BGRA32_Premultiplied,
|
---|
| 84 | Format_BGR32,
|
---|
| 85 | Format_BGR24,
|
---|
| 86 | Format_BGR565,
|
---|
| 87 | Format_BGR555,
|
---|
| 88 | Format_BGRA5658_Premultiplied,
|
---|
| 89 |
|
---|
| 90 | Format_AYUV444,
|
---|
| 91 | Format_AYUV444_Premultiplied,
|
---|
| 92 | Format_YUV444,
|
---|
| 93 | Format_YUV420P,
|
---|
| 94 | Format_YV12,
|
---|
| 95 | Format_UYVY,
|
---|
| 96 | Format_YUYV,
|
---|
| 97 | Format_NV12,
|
---|
| 98 | Format_NV21,
|
---|
| 99 | Format_IMC1,
|
---|
| 100 | Format_IMC2,
|
---|
| 101 | Format_IMC3,
|
---|
| 102 | Format_IMC4,
|
---|
| 103 | Format_Y8,
|
---|
| 104 | Format_Y16,
|
---|
| 105 |
|
---|
| 106 | Format_User = 1000
|
---|
| 107 | };
|
---|
| 108 |
|
---|
| 109 | QVideoFrame();
|
---|
| 110 | QVideoFrame(QAbstractVideoBuffer *buffer, const QSize &size, PixelFormat format);
|
---|
| 111 | QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format);
|
---|
| 112 | QVideoFrame(const QImage &image);
|
---|
| 113 | QVideoFrame(const QVideoFrame &other);
|
---|
| 114 | ~QVideoFrame();
|
---|
| 115 |
|
---|
| 116 | QVideoFrame &operator =(const QVideoFrame &other);
|
---|
| 117 |
|
---|
| 118 | bool isValid() const;
|
---|
| 119 |
|
---|
| 120 | PixelFormat pixelFormat() const;
|
---|
| 121 |
|
---|
| 122 | QAbstractVideoBuffer::HandleType handleType() const;
|
---|
| 123 |
|
---|
| 124 | QSize size() const;
|
---|
| 125 | int width() const;
|
---|
| 126 | int height() const;
|
---|
| 127 |
|
---|
| 128 | FieldType fieldType() const;
|
---|
| 129 | void setFieldType(FieldType);
|
---|
| 130 |
|
---|
| 131 | bool isMapped() const;
|
---|
| 132 | bool isReadable() const;
|
---|
| 133 | bool isWritable() const;
|
---|
| 134 |
|
---|
| 135 | QAbstractVideoBuffer::MapMode mapMode() const;
|
---|
| 136 |
|
---|
| 137 | bool map(QAbstractVideoBuffer::MapMode mode);
|
---|
| 138 | void unmap();
|
---|
| 139 |
|
---|
| 140 | int bytesPerLine() const;
|
---|
| 141 |
|
---|
| 142 | uchar *bits();
|
---|
| 143 | const uchar *bits() const;
|
---|
| 144 | int mappedBytes() const;
|
---|
| 145 |
|
---|
| 146 | QVariant handle() const;
|
---|
| 147 |
|
---|
| 148 | qint64 startTime() const;
|
---|
| 149 | void setStartTime(qint64 time);
|
---|
| 150 |
|
---|
| 151 | qint64 endTime() const;
|
---|
| 152 | void setEndTime(qint64 time);
|
---|
| 153 |
|
---|
| 154 | static PixelFormat pixelFormatFromImageFormat(QImage::Format format);
|
---|
| 155 | static QImage::Format imageFormatFromPixelFormat(PixelFormat format);
|
---|
| 156 |
|
---|
| 157 | private:
|
---|
| 158 | QExplicitlySharedDataPointer<QVideoFramePrivate> d;
|
---|
| 159 | };
|
---|
| 160 |
|
---|
| 161 | QT_END_NAMESPACE
|
---|
| 162 |
|
---|
| 163 | Q_DECLARE_METATYPE(QVideoFrame::FieldType)
|
---|
| 164 | Q_DECLARE_METATYPE(QVideoFrame::PixelFormat)
|
---|
| 165 |
|
---|
| 166 | QT_END_HEADER
|
---|
| 167 |
|
---|
| 168 | #endif
|
---|
| 169 |
|
---|