src/multimedia/video/qabstractvideosurface_p.h
changeset 0 876b1a06bc25
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     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 QABSTRACTVIDEOSURFACE_P_H
       
    43 #define QABSTRACTVIDEOSURFACE_P_H
       
    44 
       
    45 //
       
    46 //  W A R N I N G
       
    47 //  -------------
       
    48 //
       
    49 // This file is not part of the Qt API.  It exists purely as an
       
    50 // implementation detail.  This header file may change from version to
       
    51 // version without notice, or even be removed.
       
    52 //
       
    53 // We mean it.
       
    54 //
       
    55 
       
    56 #include <qabstractvideosurface.h>
       
    57 #include <qvideosurfaceformat.h>
       
    58 
       
    59 #include <QtCore/qobject.h>
       
    60 #include <QtCore/qpointer.h>
       
    61 #include <QtCore/qcoreevent.h>
       
    62 #include <QtCore/qlist.h>
       
    63 #include <QtCore/qvector.h>
       
    64 #include <QtCore/qreadwritelock.h>
       
    65 #include <QtCore/qvariant.h>
       
    66 
       
    67 QT_BEGIN_NAMESPACE
       
    68 
       
    69 #ifndef QOBJECT_P_H
       
    70 #if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
       
    71 
       
    72 class QVariant;
       
    73 class QThreadData;
       
    74 class QObjectConnectionListVector;
       
    75 namespace QtSharedPointer { struct ExternalRefCountData; }
       
    76 
       
    77 enum { QObjectPrivateVersion = QT_VERSION };
       
    78 
       
    79 class QAbstractDeclarativeData;
       
    80 
       
    81 class Q_CORE_EXPORT QObjectPrivate : public QObjectData
       
    82 {
       
    83     Q_DECLARE_PUBLIC(QObject)
       
    84 
       
    85 public:
       
    86     struct ExtraData;
       
    87     struct Connection;
       
    88     // ConnectionList is a singly-linked list
       
    89     struct ConnectionList;
       
    90     struct Sender;
       
    91 
       
    92     QObjectPrivate(int version = QObjectPrivateVersion);
       
    93     virtual ~QObjectPrivate();
       
    94     void deleteChildren();
       
    95 
       
    96     void setParent_helper(QObject *);
       
    97     void moveToThread_helper();
       
    98     void setThreadData_helper(QThreadData *currentData, QThreadData *targetData);
       
    99     void _q_reregisterTimers(void *pointer);
       
   100 
       
   101     bool isSender(const QObject *receiver, const char *signal) const;
       
   102     QObjectList receiverList(const char *signal) const;
       
   103     QObjectList senderList() const;
       
   104 
       
   105     void addConnection(int signal, Connection *c);
       
   106     void cleanConnectionLists();
       
   107 
       
   108 #ifdef QT3_SUPPORT
       
   109     void sendPendingChildInsertedEvents();
       
   110     void removePendingChildInsertedEvents(QObject *child);
       
   111 #endif
       
   112 
       
   113     static inline Sender *setCurrentSender(QObject *receiver,
       
   114                                     Sender *sender);
       
   115     static inline void resetCurrentSender(QObject *receiver,
       
   116                                    Sender *currentSender,
       
   117                                    Sender *previousSender);
       
   118     static int *setDeleteWatch(QObjectPrivate *d, int *newWatch);
       
   119     static void resetDeleteWatch(QObjectPrivate *d, int *oldWatch, int deleteWatch);
       
   120     static void clearGuards(QObject *);
       
   121 
       
   122     static QObjectPrivate *get(QObject *o) {
       
   123         return o->d_func();
       
   124     }
       
   125 
       
   126     int signalIndex(const char *signalName) const;
       
   127     inline bool isSignalConnected(uint signalIdx) const;
       
   128 
       
   129 public:
       
   130     QString objectName;
       
   131     ExtraData *extraData;    // extra data set by the user
       
   132     QThreadData *threadData; // id of the thread that owns the object
       
   133 
       
   134     QObjectConnectionListVector *connectionLists;
       
   135 
       
   136     Connection *senders;     // linked list of connections connected to this object
       
   137     Sender *currentSender;   // object currently activating the object
       
   138     mutable quint32 connectedSignals[2];
       
   139 
       
   140 #ifdef QT3_SUPPORT
       
   141     QList<QObject *> pendingChildInsertedEvents;
       
   142 #else
       
   143     // preserve binary compatibility with code compiled without Qt 3 support
       
   144     // keeping the binary layout stable helps the Qt Creator debugger
       
   145     void *unused;
       
   146 #endif
       
   147 
       
   148     QList<QPointer<QObject> > eventFilters;
       
   149     union {
       
   150         QObject *currentChildBeingDeleted;
       
   151         QAbstractDeclarativeData *declarativeData; //extra data used by the declarative module
       
   152     };
       
   153 
       
   154     // these objects are all used to indicate that a QObject was deleted
       
   155     // plus QPointer, which keeps a separate list
       
   156     QAtomicPointer<QtSharedPointer::ExternalRefCountData> sharedRefcount;
       
   157     int *deleteWatch;
       
   158 };
       
   159 
       
   160 #elif (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0))
       
   161 
       
   162 class QVariant;
       
   163 class QThreadData;
       
   164 class QObjectConnectionListVector;
       
   165 namespace QtSharedPointer { struct ExternalRefCountData; }
       
   166 
       
   167 enum { QObjectPrivateVersion = QT_VERSION };
       
   168 
       
   169 class QDeclarativeData;
       
   170 
       
   171 class Q_CORE_EXPORT QObjectPrivate : public QObjectData
       
   172 {
       
   173     Q_DECLARE_PUBLIC(QObject)
       
   174 
       
   175 public:
       
   176     struct ExtraData;
       
   177 
       
   178     struct Connection;
       
   179     // ConnectionList is a singly-linked list
       
   180     struct ConnectionList;
       
   181     struct Sender;
       
   182 
       
   183 
       
   184     QObjectPrivate(int version = QObjectPrivateVersion);
       
   185     virtual ~QObjectPrivate();
       
   186     void deleteChildren();
       
   187 
       
   188     void setParent_helper(QObject *);
       
   189     void moveToThread_helper();
       
   190     void setThreadData_helper(QThreadData *currentData, QThreadData *targetData);
       
   191     void _q_reregisterTimers(void *pointer);
       
   192 
       
   193     bool isSender(const QObject *receiver, const char *signal) const;
       
   194     QObjectList receiverList(const char *signal) const;
       
   195     QObjectList senderList() const;
       
   196 
       
   197     void addConnection(int signal, Connection *c);
       
   198     void cleanConnectionLists();
       
   199 
       
   200 #ifdef QT3_SUPPORT
       
   201     void sendPendingChildInsertedEvents();
       
   202     void removePendingChildInsertedEvents(QObject *child);
       
   203 #endif
       
   204 
       
   205     static Sender *setCurrentSender(QObject *receiver,
       
   206                                     Sender *sender);
       
   207     static void resetCurrentSender(QObject *receiver,
       
   208                                    Sender *currentSender,
       
   209                                    Sender *previousSender);
       
   210     static int *setDeleteWatch(QObjectPrivate *d, int *newWatch);
       
   211     static void resetDeleteWatch(QObjectPrivate *d, int *oldWatch, int deleteWatch);
       
   212     static void clearGuards(QObject *);
       
   213 
       
   214     static QObjectPrivate *get(QObject *o) {
       
   215         return o->d_func();
       
   216     }
       
   217 
       
   218     int signalIndex(const char *signalName) const;
       
   219     inline bool isSignalConnected(uint signalIdx) const;
       
   220 
       
   221 public:
       
   222     QString objectName;
       
   223     ExtraData *extraData;    // extra data set by the user
       
   224     QThreadData *threadData; // id of the thread that owns the object
       
   225 
       
   226     QObjectConnectionListVector *connectionLists;
       
   227 
       
   228     Connection *senders;     // linked list of connections connected to this object
       
   229     Sender *currentSender;   // object currently activating the object
       
   230     mutable quint32 connectedSignals[2];
       
   231 
       
   232 #ifdef QT3_SUPPORT
       
   233     QList<QObject *> pendingChildInsertedEvents;
       
   234 #else
       
   235     // preserve binary compatibility with code compiled without Qt 3 support
       
   236     // ### why?
       
   237     QList<QObject *> unused;
       
   238 #endif
       
   239 
       
   240     QList<QPointer<QObject> > eventFilters;
       
   241     union {
       
   242         QObject *currentChildBeingDeleted;
       
   243         QDeclarativeData *declarativeData; //extra data used by the DeclarativeUI project.
       
   244     };
       
   245 
       
   246     // these objects are all used to indicate that a QObject was deleted
       
   247     // plus QPointer, which keeps a separate list
       
   248     QAtomicPointer<QtSharedPointer::ExternalRefCountData> sharedRefcount;
       
   249     int *deleteWatch;
       
   250 };
       
   251 
       
   252 #endif
       
   253 
       
   254 #endif
       
   255 
       
   256 class QAbstractVideoSurfacePrivate : public QObjectPrivate
       
   257 {
       
   258 public:
       
   259     QAbstractVideoSurfacePrivate()
       
   260         : error(QAbstractVideoSurface::NoError)
       
   261         , active(false)
       
   262     {
       
   263     }
       
   264 
       
   265     mutable QAbstractVideoSurface::Error error;
       
   266     QVideoSurfaceFormat format;
       
   267     bool active;
       
   268 };
       
   269 
       
   270 QT_END_NAMESPACE
       
   271 
       
   272 #endif