VLC-Qt 0.8.0- (Different version)
MediaPlayer.h
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_MEDIAPLAYER_H_
00020 #define VLCQT_MEDIAPLAYER_H_
00021 
00022 #include <QtCore/QObject>
00023 #include <QtCore/QString>
00024 #include <QtCore/QTimer>
00025 
00026 #include <QtGui/qwindowdefs.h>
00027 
00028 #include "Enums.h"
00029 #include "SharedExportCore.h"
00030 
00031 class VlcAudio;
00032 class VlcInstance;
00033 class VlcMedia;
00034 class VlcVideo;
00035 class VlcVideoDelegate;
00036 
00037 struct libvlc_event_t;
00038 struct libvlc_event_manager_t;
00039 struct libvlc_media_t;
00040 struct libvlc_media_player_t;
00041 
00049 class VLCQT_CORE_EXPORT VlcMediaPlayer : public QObject
00050 {
00051 Q_OBJECT
00052 public:
00060     explicit VlcMediaPlayer(VlcInstance *instance);
00061 
00065     ~VlcMediaPlayer();
00066 
00071     libvlc_media_player_t *core();
00072 
00077     VlcAudio *audio();
00078 
00083     VlcVideo *video();
00084 
00089     int length() const;
00090 
00095     VlcMedia *currentMedia();
00096 
00101     libvlc_media_t *currentMediaCore();
00102 
00107     void open(VlcMedia *media);
00108 
00113     void openOnly(VlcMedia *media);
00114 
00121     void setTime(const int &time);
00122 
00127     int time() const;
00128 
00135     void setVideoWidget(VlcVideoDelegate *widget);
00136 
00141     bool hasVout() const;
00142 
00147     Vlc::State state() const;
00148 
00153     VlcVideoDelegate *videoWidget();
00154 
00159     float position();
00160 
00167     void setPosition(const float &pos);
00168 
00169 public slots:
00173     void play();
00174 
00178     void pause();
00179 
00183     void togglePause();
00184 
00188     void resume();
00189 
00193     void stop();
00194 
00195 
00196 signals:
00200     void backward();
00201 
00206     void buffering(const float &);
00207 
00211     void end();
00212 
00216     void error();
00217 
00221     void forward();
00222 
00227     void lengthChanged(const int &);
00228 
00233     void mediaChanged(libvlc_media_t *);
00234 
00238     void nothingSpecial();
00239 
00243     void opening();
00244 
00249     void pausableChanged(const bool &);
00250 
00254     void paused();
00255 
00259     void playing();
00260 
00265     void positionChanged(const float &);
00266 
00271     void seekableChanged(const bool &);
00272 
00277     void snapshotTaken(const QString &);
00278 
00282     void stopped();
00283 
00288     void timeChanged(const int &);
00289 
00294     void titleChanged(const int &);
00295 
00300     void vout(const int &);
00301 
00305     void stateChanged();
00306 
00307 private:
00308     static void libvlc_callback(const libvlc_event_t *event,
00309                                 void *data);
00310 
00311     void createCoreConnections();
00312     void removeCoreConnections();
00313 
00314     libvlc_media_player_t *_vlcMediaPlayer;
00315     libvlc_event_manager_t *_vlcEvents;
00316 
00317     VlcMedia *_media;
00318 
00319     VlcAudio *_vlcAudio;
00320     VlcVideo *_vlcVideo;
00321 
00322     VlcVideoDelegate *_videoWidget;
00323     WId _currentWId;
00324 };
00325 
00326 #endif // VLCQT_MEDIAPLAYER_H_
 All Classes Namespaces Functions Enumerations