qtmobility/src/multimedia/video/qvideoframe.h
changeset 14 6fbed849b4f4
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 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 Qt Mobility Components.
       
     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 <qabstractvideobuffer.h>
       
    49 
       
    50 QT_BEGIN_HEADER
       
    51 
       
    52 QT_BEGIN_NAMESPACE
       
    53 
       
    54 class QSize;
       
    55 class QVariant;
       
    56 
       
    57 class QVideoFramePrivate;
       
    58 
       
    59 class Q_MULTIMEDIA_EXPORT QVideoFrame
       
    60 {
       
    61 public:
       
    62     enum FieldType
       
    63     {
       
    64         ProgressiveFrame,
       
    65         TopField,
       
    66         BottomField,
       
    67         InterlacedFrame
       
    68     };
       
    69 
       
    70     enum PixelFormat
       
    71     {
       
    72         Format_Invalid,
       
    73         Format_ARGB32,
       
    74         Format_ARGB32_Premultiplied,
       
    75         Format_RGB32,
       
    76         Format_RGB24,
       
    77         Format_RGB565,
       
    78         Format_RGB555,
       
    79         Format_ARGB8565_Premultiplied,
       
    80         Format_BGRA32,
       
    81         Format_BGRA32_Premultiplied,
       
    82         Format_BGR32,
       
    83         Format_BGR24,
       
    84         Format_BGR565,
       
    85         Format_BGR555,
       
    86         Format_BGRA5658_Premultiplied,
       
    87 
       
    88         Format_AYUV444,
       
    89         Format_AYUV444_Premultiplied,
       
    90         Format_YUV444,
       
    91         Format_YUV420P,
       
    92         Format_YV12,
       
    93         Format_UYVY,
       
    94         Format_YUYV,
       
    95         Format_NV12,
       
    96         Format_NV21,
       
    97         Format_IMC1,
       
    98         Format_IMC2,
       
    99         Format_IMC3,
       
   100         Format_IMC4,
       
   101         Format_Y8,
       
   102         Format_Y16,
       
   103 
       
   104         Format_User = 1000
       
   105     };
       
   106 
       
   107     QVideoFrame();
       
   108     QVideoFrame(QAbstractVideoBuffer *buffer, const QSize &size, PixelFormat format);
       
   109     QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format);
       
   110     QVideoFrame(const QImage &image);
       
   111     QVideoFrame(const QVideoFrame &other);
       
   112     ~QVideoFrame();
       
   113 
       
   114     QVideoFrame &operator =(const QVideoFrame &other);
       
   115 
       
   116     bool isValid() const;
       
   117 
       
   118     PixelFormat pixelFormat() const;
       
   119 
       
   120     QAbstractVideoBuffer::HandleType handleType() const;
       
   121 
       
   122     QSize size() const;
       
   123     int width() const;
       
   124     int height() const;
       
   125 
       
   126     FieldType fieldType() const;
       
   127     void setFieldType(FieldType);
       
   128 
       
   129     bool isMapped() const;
       
   130     bool isReadable() const;
       
   131     bool isWritable() const;
       
   132 
       
   133     QAbstractVideoBuffer::MapMode mapMode() const;
       
   134 
       
   135     bool map(QAbstractVideoBuffer::MapMode mode);
       
   136     void unmap();
       
   137 
       
   138     int bytesPerLine() const;
       
   139 
       
   140     uchar *bits();
       
   141     const uchar *bits() const;
       
   142     int mappedBytes() const;
       
   143 
       
   144     QVariant handle() const;
       
   145 
       
   146     qint64 startTime() const;
       
   147     void setStartTime(qint64 time);
       
   148 
       
   149     qint64 endTime() const;
       
   150     void setEndTime(qint64 time);
       
   151 
       
   152     static PixelFormat pixelFormatFromImageFormat(QImage::Format format);
       
   153     static QImage::Format imageFormatFromPixelFormat(PixelFormat format);
       
   154 
       
   155 private:
       
   156     QExplicitlySharedDataPointer<QVideoFramePrivate> d;
       
   157 };
       
   158 
       
   159 QT_END_NAMESPACE
       
   160 
       
   161 Q_DECLARE_METATYPE(QVideoFrame::FieldType)
       
   162 Q_DECLARE_METATYPE(QVideoFrame::PixelFormat)
       
   163 
       
   164 QT_END_HEADER
       
   165 
       
   166 #endif
       
   167