File indexing completed on 2024-04-14 15:01:14

0001 /**
0002   This file belong to the KMPlayer project, a movie player plugin for Konqueror
0003   Copyright (C) 2007  Koos Vriezen <koos.vriezen@gmail.com>
0004 
0005   This library is free software; you can redistribute it and/or
0006   modify it under the terms of the GNU Lesser General Public
0007   License as published by the Free Software Foundation; either
0008   version 2 of the License, or (at your option) any later version.
0009 
0010   This library is distributed in the hope that it will be useful,
0011   but WITHOUT ANY WARRANTY; without even the implied warranty of
0012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013   Lesser General Public License for more details.
0014 
0015   You should have received a copy of the GNU Lesser General Public
0016   License along with this library; if not, write to the Free Software
0017   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018 **/
0019 
0020 #ifndef _KMPLAYER_PHONON_PLAYER_H_
0021 #define _KMPLAYER_PHONON_PLAYER_H_
0022 
0023 #include <stdint.h>
0024 
0025 #include <QWidget>
0026 //#include <QX11EmbedWidget>
0027 typedef QWidget QX11EmbedWidget;
0028 
0029 #include <phonon/phononnamespace.h>
0030 
0031 
0032 namespace Phonon
0033 {
0034     class VideoWidget;
0035     class AudioOutput;
0036     class MediaObject;
0037 } // namespace Phonon
0038 
0039 class Slave : public QObject {
0040     Q_OBJECT
0041 public:
0042     Slave ();
0043 
0044     void newStream (const QString &url, uint64_t wid);
0045     void quit ();
0046 
0047     void streamDestroyed (uint64_t wid);
0048 
0049 protected:
0050     void timerEvent (QTimerEvent *e);
0051 
0052 private:
0053     int stay_alive_timer;
0054 };
0055 
0056 class Stream : public QX11EmbedWidget { // QWidget {
0057     Q_OBJECT
0058 public:
0059     Stream (QWidget *parent, const QString &url, unsigned long wid);
0060     ~Stream ();
0061 
0062     void play ();
0063     void pause ();
0064     void stop ();
0065     void seek (uint64_t position, bool absolute);
0066     void volume (int value);
0067 
0068 //protected:
0069 //    bool x11Event (XEvent *event);
0070 
0071 private Q_SLOTS:
0072     void init ();
0073 
0074     void hasVideoChanged (bool hasVideo);
0075     void bufferStatus (int percentFilled);
0076     void metaDataChanged ();
0077     void tick (qint64 time);
0078     void stateChanged (Phonon::State newstate, Phonon::State oldstate);
0079     void finished ();
0080 
0081 private:
0082     Phonon::VideoWidget *m_vwidget;
0083     Phonon::AudioOutput *m_aoutput;
0084     Phonon::MediaObject *m_media;
0085     QString m_url;
0086     QString m_master_stream_path;
0087     unsigned long video_handle;
0088 };
0089 
0090 #endif