src/multimedia/video/qvideoframe.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     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 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    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 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    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 numBytes() 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 equivalentPixelFormat(QImage::Format format);
       
   155     static QImage::Format equivalentImageFormat(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