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
26 #include <QDeclarativeItem>
30 class QtCamGraphicsViewfinder;
32 class VideoPlayer : public QDeclarativeItem {
35 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged);
36 Q_PROPERTY(CameraConfig *cameraConfig READ cameraConfig WRITE setCameraConfig NOTIFY cameraConfigChanged);
37 Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged);
38 Q_PROPERTY(qint64 position READ position WRITE setPosition NOTIFY positionChanged);
39 Q_PROPERTY(State state READ state NOTIFY stateChanged);
43 VideoPlayer(QDeclarativeItem *parent = 0);
46 virtual void componentComplete();
47 virtual void classBegin();
50 void setSource(const QUrl& source);
52 CameraConfig *cameraConfig() const;
53 void setCameraConfig(CameraConfig *config);
55 qint64 duration() const;
57 void setPosition(qint64 position);
59 Q_INVOKABLE bool pause();
60 Q_INVOKABLE bool play();
61 Q_INVOKABLE bool seek(qint64 offset);
62 Q_INVOKABLE bool stop();
74 void cameraConfigChanged();
76 void durationChanged();
77 void positionChanged();
78 void error(const QString& message, int code, const QString& debug);
82 void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
85 static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data);
87 bool setState(const State& state);
89 CameraConfig *m_config;
90 QtCamGraphicsViewfinder *m_vf;
99 #endif /* VIDEO_PLAYER_H */