![]() |
VLC-Qt 0.8.0- (Different version)
|
00001 /**************************************************************************** 00002 * VLC-Qt - Qt and libvlc connector library 00003 * Copyright (C) 2012 Tadej Novak <tadej@tano.si> 00004 * 00005 * This library is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU Lesser General Public License as published 00007 * by the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this library. If not, see <http://www.gnu.org/licenses/>. 00017 *****************************************************************************/ 00018 00019 #ifndef VLCQT_QMLVIDEOPLAYER_H_ 00020 #define VLCQT_QMLVIDEOPLAYER_H_ 00021 00022 #include <QtCore/QMutex> 00023 #include <QtCore/QTimer> 00024 #include <QtDeclarative/QDeclarativeItem> 00025 00026 #include "SharedExportQml.h" 00027 00028 class VlcAudio; 00029 class VlcInstance; 00030 class VlcMedia; 00031 class VlcMediaPlayer; 00032 00033 class VLCQT_QML_EXPORT VlcQmlVideoPlayer : public QDeclarativeItem 00034 { 00035 Q_OBJECT 00036 public: 00037 explicit VlcQmlVideoPlayer(QDeclarativeItem *parent = 0); 00038 ~VlcQmlVideoPlayer(); 00039 00040 Q_INVOKABLE void close(); 00041 Q_INVOKABLE void openFile(const QString &file); 00042 Q_INVOKABLE void openStream(const QString &stream); 00043 Q_INVOKABLE void pause(); 00044 Q_INVOKABLE void play(); 00045 Q_INVOKABLE void stop(); 00046 00047 QImage *_frame; 00048 QMutex _mutex; 00049 00050 protected: 00051 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); 00052 void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); 00053 00054 private slots: 00055 void updateFrame(); 00056 00057 private: 00058 void openInternal(); 00059 00060 VlcInstance *_instance; 00061 VlcMediaPlayer *_player; 00062 VlcMedia *_media; 00063 00064 VlcAudio *_audioManager; 00065 00066 bool _hasMedia; 00067 int _currentTime; 00068 QTimer *_timer; 00069 }; 00070 00071 #endif // VLCQT_QMLVIDEOPLAYER_H_