File indexing completed on 2024-04-21 04:53:51

0001 /*
0002     This file is part of the KMPlayer application
0003     SPDX-FileCopyrightText: 2004 Koos Vriezen <koos.vriezen@xs4all.nl>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KMPLAYER_VDR_SOURCE_H
0009 #define KMPLAYER_VDR_SOURCE_H
0010 
0011 #include "config-kmplayer.h"
0012 
0013 #include <QFrame>
0014 
0015 #include "kmplayerappsource.h"
0016 #include "kmplayerconfig.h"
0017 #include "kmplayerprocess.h"
0018 
0019 
0020 class KMPlayerApp;
0021 class VDRCommand;
0022 class KUrlRequester;
0023 class Q3ButtonGroup;
0024 class QLineEdit;
0025 class KAction;
0026 class QSocket;
0027 class QTimerEvent;
0028 class KListView;
0029 
0030 /*
0031  * Preference page for VDR
0032  */
0033 class KMPlayerPrefSourcePageVDR : public QFrame
0034 {
0035     Q_OBJECT
0036 public:
0037     KMPlayerPrefSourcePageVDR (QWidget * parent, KMPlayer::PartBase * player);
0038     ~KMPlayerPrefSourcePageVDR ();
0039     KUrlRequester * vcddevice;
0040     KListView * xv_port;
0041     QLineEdit * tcp_port;
0042     Q3ButtonGroup * scale;
0043 protected:
0044     void showEvent (QShowEvent *);
0045 private:
0046     KMPlayer::PartBase * m_player;
0047 };
0048 
0049 
0050 /*
0051  * Source from VDR (XVideo actually) and socket connection
0052  */
0053 class KMPlayerVDRSource : public KMPlayer::Source, public KMPlayer::PreferencesPage
0054 {
0055     Q_OBJECT
0056 public:
0057     KMPlayerVDRSource (KMPlayerApp * app);
0058     virtual ~KMPlayerVDRSource ();
0059     virtual bool hasLength ();
0060     virtual bool isSeekable ();
0061     virtual QString prettyName ();
0062     virtual void write (KConfig *);
0063     virtual void read (KConfig *);
0064     virtual void sync (bool);
0065     virtual void prefLocation (QString & item, QString & icon, QString & tab);
0066     virtual QFrame * prefPage (QWidget * parent);
0067     virtual void stateElementChanged (KMPlayer::Node * node, KMPlayer::Node::State os, KMPlayer::Node::State ns);
0068     void waitForConnectionClose ();
0069 public Q_SLOTS:
0070     void activate ();
0071     void deactivate ();
0072     void play (KMPlayer::Mrl *);
0073     void forward ();
0074     void backward ();
0075     void toggleConnected ();
0076     void volumeChanged (int);
0077 private Q_SLOTS:
0078     void keyUp ();
0079     void keyDown ();
0080     void keyBack ();
0081     void keyOk ();
0082     void keySetup ();
0083     void keyChannels ();
0084     void keyMenu ();
0085     void key0 ();
0086     void key1 ();
0087     void key2 ();
0088     void key3 ();
0089     void key4 ();
0090     void key5 ();
0091     void key6 ();
0092     void key7 ();
0093     void key8 ();
0094     void key9 ();
0095     void keyRed ();
0096     void keyGreen ();
0097     void keyYellow ();
0098     void keyBlue ();
0099     void customCmd ();
0100     void connected ();
0101     void disconnected ();
0102     void readyRead ();
0103     void socketError (int);
0104     void processStopped ();
0105     void processStarted ();
0106     void configReceived ();
0107 protected:
0108     void timerEvent (QTimerEvent *);
0109 private:
0110     enum {
0111         act_up = 0, act_down, act_back, act_ok,
0112         act_setup, act_channels, act_menu,
0113         act_red, act_green, act_yellow, act_blue,
0114         act_0, act_1, act_2, act_3, act_4, act_5, act_6, act_7, act_8, act_9,
0115         act_custom,
0116         act_last
0117     };
0118     void queueCommand (const char * cmd);
0119     void queueCommand (const char * cmd, int repeat_ms);
0120     void sendCommand ();
0121     void deleteCommands ();
0122     void jump (const QString & channel);
0123     KMPlayerApp * m_app;
0124     KMPlayerPrefSourcePageVDR * m_configpage;
0125     KAction * m_actions [act_last];
0126     KAction * m_fullscreen_actions [act_last];
0127     QSocket * m_socket;
0128     VDRCommand * commands;
0129     QString m_request_jump;
0130     KMPlayer::NodePtrW m_last_channel;
0131     int channel_timer;
0132     int timeout_timer;
0133     int finish_timer;
0134     int tcp_port;
0135     int m_stored_volume;
0136     int scale;
0137     int last_channel;
0138 };
0139 
0140 class XvProcessInfo : public KMPlayer::CallbackProcessInfo
0141 {
0142 public:
0143     XvProcessInfo (KMPlayer::MediaManager *);
0144 
0145     virtual KMPlayer::IProcess *create (KMPlayer::PartBase*,
0146             KMPlayer::AudioVideoMedia*);
0147     virtual bool startBackend ();
0148 };
0149 
0150 class XVideo : public KMPlayer::CallbackProcess {
0151     Q_OBJECT
0152 public:
0153     XVideo (QObject *, KMPlayer::ProcessInfo *, KMPlayer::Settings *);
0154     ~XVideo ();
0155 public Q_SLOTS:
0156     virtual bool ready ();
0157 };
0158 
0159 #endif // KMPLAYER_VDR_SOURCE_H