File indexing completed on 2024-12-22 04:39:14
0001 /* 0002 This file belong to the KMPlayer project, a movie player plugin for Konqueror 0003 SPDX-FileCopyrightText: 2007 Koos Vriezen <koos.vriezen@gmail.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef _KMPLAYER_PHONON_PLAYER_H_ 0009 #define _KMPLAYER_PHONON_PLAYER_H_ 0010 0011 #include <stdint.h> 0012 0013 #include <QWidget> 0014 //#include <QX11EmbedWidget> 0015 typedef QWidget QX11EmbedWidget; 0016 0017 #include <phonon/phononnamespace.h> 0018 0019 0020 namespace Phonon 0021 { 0022 class VideoWidget; 0023 class AudioOutput; 0024 class MediaObject; 0025 } // namespace Phonon 0026 0027 class Agent : public QObject 0028 { 0029 Q_OBJECT 0030 public: 0031 Agent(); 0032 0033 void newStream (const QString &url, uint64_t wid); 0034 void quit (); 0035 0036 void streamDestroyed (uint64_t wid); 0037 0038 protected: 0039 void timerEvent (QTimerEvent *e) override; 0040 0041 private: 0042 int stay_alive_timer; 0043 }; 0044 0045 class Stream : public QX11EmbedWidget { // QWidget { 0046 Q_OBJECT 0047 public: 0048 Stream (QWidget *parent, const QString &url, unsigned long wid); 0049 ~Stream () override; 0050 0051 void play (); 0052 void pause (); 0053 void stop (); 0054 void seek (uint64_t position, bool absolute); 0055 void volume (int value); 0056 0057 //protected: 0058 // bool x11Event (XEvent *event); 0059 0060 private Q_SLOTS: 0061 void init (); 0062 0063 void hasVideoChanged (bool hasVideo); 0064 void bufferStatus (int percentFilled); 0065 void metaDataChanged (); 0066 void tick (qint64 time); 0067 void stateChanged (Phonon::State newstate, Phonon::State oldstate); 0068 void finished (); 0069 0070 private: 0071 Phonon::VideoWidget *m_vwidget; 0072 Phonon::AudioOutput *m_aoutput; 0073 Phonon::MediaObject *m_media; 0074 QString m_url; 0075 QString m_master_stream_path; 0076 unsigned long video_handle; 0077 }; 0078 0079 #endif