Phonon  4.7.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
videographicsobject.h
1 /*
2  Copyright (C) 2011 Harald Sitter <sitter@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) version 3, or any
8  later version accepted by the membership of KDE e.V. (or its
9  successor approved by the membership of KDE e.V.), Nokia Corporation
10  (or its successors, if any) and the KDE Free Qt Foundation, which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef PHONON_VIDEOGRAPHICSOBJECT_H
23 #define PHONON_VIDEOGRAPHICSOBJECT_H
24 
25 #include <QGraphicsObject>
26 #include <QMap>
27 
28 #include "medianode.h"
29 
30 // FIXME: I really do not want a videoframe include :(
31 #include "videoframe.h"
32 
33 // FIXME: review symbol exposure of QGV stuff
34 
35 namespace Phonon {
36 
37 class VideoFrame;
38 class VideoGraphicsFormatSpy;
39 class VideoGraphicsObjectPrivate;
40 
41 enum GraphicsPainterType {
42  GraphicsPainterNone,
43  GraphicsPainterGlsl,
44  GraphicsPainterGlArb,
45  GraphicsPainterQPainter
46 };
47 
49 {
50 public:
51  static QMap<GraphicsPainterType, QList<VideoFrame::Format> > detectTypes();
52 };
53 
96 class PHONON_EXPORT VideoGraphicsObject : public QGraphicsObject, public MediaNode
97 {
98  P_DECLARE_PRIVATE(VideoGraphicsObject)
99  Q_OBJECT
100 public:
102  explicit VideoGraphicsObject(QGraphicsItem *parent = 0);
103 
105  virtual ~VideoGraphicsObject();
106 
111  virtual QRectF boundingRect() const;
112 
114  void setGeometry(const QRectF &newGeometry);
115 
117  void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
118 
119 
132  bool isReady() const;
133 
134  // FIXME: q_invoke?
135  bool canNegotiate() const;
136 
137 public slots:
138  // FIXME: q_invoke?
139  void setSpyFormats(QMap<GraphicsPainterType, QList<VideoFrame::Format> > formats);
140 
141 signals:
142  void ready();
143 
144  // FIXME: ew?!
145  void gotPaint();
146 
147  // TODO: make Q_PRIVATE
148 private slots:
149  void frameReady();
150  void reset();
151 
152 private:
153  Q_PRIVATE_SLOT(k_func(), void _p_negotiateFormat())
154 };
155 
156 } // namespace Phonon
157 
158 #endif // PHONON_VIDEOGRAPHICSOBJECT_H