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

0001 /* This file is part of the KMPlayer application
0002    Copyright (C) 2004 Koos Vriezen <koos.vriezen@xs4all.nl>
0003 
0004    This program is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012     General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program; see the file COPYING.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KMPLAYER_VDR_SOURCE_H
0021 #define KMPLAYER_VDR_SOURCE_H
0022 
0023 #include "config-kmplayer.h"
0024 
0025 #include <qframe.h>
0026 
0027 #include <kurl.h>
0028 
0029 #include "kmplayerappsource.h"
0030 #include "kmplayerconfig.h"
0031 #include "kmplayerprocess.h"
0032 
0033 
0034 class KMPlayerApp;
0035 class VDRCommand;
0036 class KUrlRequester;
0037 class Q3ButtonGroup;
0038 class QLineEdit;
0039 class KAction;
0040 class QSocket;
0041 class QTimerEvent;
0042 class KListView;
0043 
0044 /*
0045  * Preference page for VDR
0046  */
0047 class KMPLAYER_NO_EXPORT KMPlayerPrefSourcePageVDR : public QFrame {
0048     Q_OBJECT
0049 public:
0050     KMPlayerPrefSourcePageVDR (QWidget * parent, KMPlayer::PartBase * player);
0051     ~KMPlayerPrefSourcePageVDR ();
0052     KUrlRequester * vcddevice;
0053     KListView * xv_port;
0054     QLineEdit * tcp_port;
0055     Q3ButtonGroup * scale;
0056 protected:
0057     void showEvent (QShowEvent *);
0058 private:
0059     KMPlayer::PartBase * m_player;
0060 };
0061 
0062 
0063 /*
0064  * Source from VDR (XVideo actually) and socket connection
0065  */
0066 class KMPLAYER_NO_EXPORT KMPlayerVDRSource : public KMPlayer::Source, public KMPlayer::PreferencesPage {
0067     Q_OBJECT
0068 public:
0069     KMPlayerVDRSource (KMPlayerApp * app);
0070     virtual ~KMPlayerVDRSource ();
0071     virtual bool hasLength ();
0072     virtual bool isSeekable ();
0073     virtual QString prettyName ();
0074     virtual void write (KConfig *);
0075     virtual void read (KConfig *);
0076     virtual void sync (bool);
0077     virtual void prefLocation (QString & item, QString & icon, QString & tab);
0078     virtual QFrame * prefPage (QWidget * parent);
0079     virtual void stateElementChanged (KMPlayer::Node * node, KMPlayer::Node::State os, KMPlayer::Node::State ns);
0080     void waitForConnectionClose ();
0081 public slots:
0082     void activate ();
0083     void deactivate ();
0084     void play (KMPlayer::Mrl *);
0085     void forward ();
0086     void backward ();
0087     void toggleConnected ();
0088     void volumeChanged (int);
0089 private slots:
0090     void keyUp ();
0091     void keyDown ();
0092     void keyBack ();
0093     void keyOk ();
0094     void keySetup ();
0095     void keyChannels ();
0096     void keyMenu ();
0097     void key0 ();
0098     void key1 ();
0099     void key2 ();
0100     void key3 ();
0101     void key4 ();
0102     void key5 ();
0103     void key6 ();
0104     void key7 ();
0105     void key8 ();
0106     void key9 ();
0107     void keyRed ();
0108     void keyGreen ();
0109     void keyYellow ();
0110     void keyBlue ();
0111     void customCmd ();
0112     void connected ();
0113     void disconnected ();
0114     void readyRead ();
0115     void socketError (int);
0116     void processStopped ();
0117     void processStarted ();
0118     void configReceived ();
0119 protected:
0120     void timerEvent (QTimerEvent *);
0121 private:
0122     enum {
0123         act_up = 0, act_down, act_back, act_ok,
0124         act_setup, act_channels, act_menu,
0125         act_red, act_green, act_yellow, act_blue,
0126         act_0, act_1, act_2, act_3, act_4, act_5, act_6, act_7, act_8, act_9,
0127         act_custom,
0128         act_last
0129     };
0130     void queueCommand (const char * cmd);
0131     void queueCommand (const char * cmd, int repeat_ms);
0132     void sendCommand ();
0133     void deleteCommands ();
0134     void jump (const QString & channel);
0135     KMPlayerApp * m_app;
0136     KMPlayerPrefSourcePageVDR * m_configpage;
0137     KAction * m_actions [act_last];
0138     KAction * m_fullscreen_actions [act_last];
0139     QSocket * m_socket;
0140     VDRCommand * commands;
0141     QString m_request_jump;
0142     KMPlayer::NodePtrW m_last_channel;
0143     int channel_timer;
0144     int timeout_timer;
0145     int finish_timer;
0146     int tcp_port;
0147     int m_stored_volume;
0148     int scale;
0149     int last_channel;
0150 };
0151 
0152 class KMPLAYER_NO_EXPORT XvProcessInfo : public KMPlayer::CallbackProcessInfo {
0153 public:
0154     XvProcessInfo (KMPlayer::MediaManager *);
0155 
0156     virtual KMPlayer::IProcess *create (KMPlayer::PartBase*,
0157             KMPlayer::AudioVideoMedia*);
0158     virtual bool startBackend ();
0159 };
0160 
0161 class XVideo : public KMPlayer::CallbackProcess {
0162     Q_OBJECT
0163 public:
0164     XVideo (QObject *, KMPlayer::ProcessInfo *, KMPlayer::Settings *);
0165     ~XVideo ();
0166 public slots:
0167     virtual bool ready ();
0168 };
0169 
0170 #endif // KMPLAYER_VDR_SOURCE_H