4 * This file is part of CameraPlus.
6 * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
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.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef VIDEO_PLAYER_H
24 #define VIDEO_PLAYER_H
27 #include <QDeclarativeItem>
29 #include <QQuickPaintedItem>
34 class QtCamViewfinderRenderer;
37 class VideoPlayer : public QDeclarativeItem {
39 class VideoPlayer : public QQuickPaintedItem {
44 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged);
45 Q_PROPERTY(CameraConfig *cameraConfig READ cameraConfig WRITE setCameraConfig NOTIFY cameraConfigChanged);
46 Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged);
47 Q_PROPERTY(qint64 position READ position WRITE setPosition NOTIFY positionChanged);
48 Q_PROPERTY(State state READ state NOTIFY stateChanged);
54 VideoPlayer(QDeclarativeItem *parent = 0);
56 VideoPlayer(QQuickItem *parent = 0);
61 virtual void componentComplete();
62 virtual void classBegin();
65 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
67 void paint(QPainter *painter);
71 void setSource(const QUrl& source);
73 CameraConfig *cameraConfig() const;
74 void setCameraConfig(CameraConfig *config);
76 qint64 duration() const;
78 void setPosition(qint64 position);
80 Q_INVOKABLE bool pause();
81 Q_INVOKABLE bool play();
82 Q_INVOKABLE bool seek(qint64 offset);
83 Q_INVOKABLE bool stop();
95 void cameraConfigChanged();
97 void durationChanged();
98 void positionChanged();
99 void error(const QString& message, int code, const QString& debug);
103 void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
106 void updateRequested();
109 static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data);
111 bool setState(const State& state);
113 CameraConfig *m_config;
114 QtCamViewfinderRenderer *m_renderer;
123 #endif /* VIDEO_PLAYER_H */