1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
/* this file is part of the kmplayer application
copyright (c) 2003 koos vriezen <[email protected]>
this program is free software; you can redistribute it and/or
modify it under the terms of the gnu general public
license as published by the free software foundation; either
version 2 of the license, or (at your option) any later version.
this program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose. see the gnu
general public license for more details.
you should have received a copy of the gnu general public license
along with this program; see the file copying. if not, write to
the free software foundation, inc., 59 temple place - suite 330,
boston, ma 02110-1301, usa.
*/
#ifndef _KMPLAYER_BROADCAST_SOURCE_H_
#define _KMPLAYER_BROADCAST_SOURCE_H_
#include <list>
#include <vector>
#include <qframe.h>
#include <qguardedptr.h>
#include "kmplayerappsource.h"
#include "kmplayerprocess.h"
#include "kmplayerconfig.h"
class KMPlayerPrefBroadcastPage; // broadcast
class KMPlayerPrefBroadcastFormatPage; // broadcast format
class QListBox;
class QComboBox;
class QLineEdit;
class QTable;
class QPushButton;
class KLed;
namespace KMPlayer {
class FFMpeg;
}
class KMPLAYER_NO_EXPORT FFServerSetting {
public:
KDE_NO_CDTOR_EXPORT FFServerSetting () {}
FFServerSetting (int i, const QString & n, const QString & f, const QString & ac, int abr, int asr, const QString & vc, int vbr, int q, int fr, int gs, int w, int h);
KDE_NO_CDTOR_EXPORT FFServerSetting (const QStringList & sl) { *this = sl; }
KDE_NO_CDTOR_EXPORT ~FFServerSetting () {}
int index;
QString name;
QString format;
QString audiocodec;
QString audiobitrate;
QString audiosamplerate;
QString videocodec;
QString videobitrate;
QString quality;
QString framerate;
QString gopsize;
QString width;
QString height;
QStringList acl;
FFServerSetting & operator = (const QStringList &);
FFServerSetting & operator = (const FFServerSetting & fs);
const QStringList list ();
QString & ffconfig (QString & buf);
};
typedef std::vector <FFServerSetting *> FFServerSettingList;
class KMPLAYER_NO_EXPORT KMPlayerPrefBroadcastPage : public QFrame {
Q_OBJECT
public:
KMPlayerPrefBroadcastPage (QWidget * parent);
KDE_NO_CDTOR_EXPORT ~KMPlayerPrefBroadcastPage () {}
QLineEdit * bindaddress;
QLineEdit * port;
QLineEdit * maxclients;
QLineEdit * maxbandwidth;
QLineEdit * feedfile;
QLineEdit * feedfilesize;
};
class KMPLAYER_NO_EXPORT KMPlayerPrefBroadcastFormatPage : public QFrame {
Q_OBJECT
public:
KMPlayerPrefBroadcastFormatPage (QWidget * parent, FFServerSettingList &);
KDE_NO_CDTOR_EXPORT ~KMPlayerPrefBroadcastFormatPage () {}
QListBox * profilelist;
QComboBox * format;
QLineEdit * audiocodec;
QLineEdit * audiobitrate;
QLineEdit * audiosamplerate;
QLineEdit * videocodec;
QLineEdit * videobitrate;
QLineEdit * quality;
QLineEdit * framerate;
QLineEdit * gopsize;
QLineEdit * moviewidth;
QLineEdit * movieheight;
QLineEdit * profile;
QPushButton * startbutton;
KLed * serverled;
KLed * feedled;
void setSettings (const FFServerSetting &);
void getSettings (FFServerSetting &);
private slots:
void slotIndexChanged (int index);
void slotItemHighlighted (int index);
void slotTextChanged (const QString &);
void slotLoad ();
void slotSave ();
void slotDelete ();
private:
QTable * accesslist;
QPushButton * load;
QPushButton * save;
QPushButton * del;
FFServerSettingList & profiles;
};
/*
* Preference page for ffmpeg commandline arguments
*/
class KMPLAYER_NO_EXPORT KMPlayerFFServerConfig : public KMPlayer::PreferencesPage {
public:
KMPlayerFFServerConfig ();
KDE_NO_CDTOR_EXPORT ~KMPlayerFFServerConfig () {}
virtual void write (KConfig *);
virtual void read (KConfig *);
virtual void sync (bool fromUI);
virtual void prefLocation (QString & item, QString & icon, QString & tab);
virtual QFrame * prefPage (QWidget * parent);
int ffserverport;
int maxclients;
int maxbandwidth;
QString feedfile;
int feedfilesize;
QString bindaddress;
private:
QGuardedPtr <KMPlayerPrefBroadcastPage> m_configpage;
};
/*
* Preference page for ffserver
*/
class KMPLAYER_NO_EXPORT KMPlayerBroadcastConfig : public QObject, public KMPlayer::PreferencesPage {
Q_OBJECT
public:
KMPlayerBroadcastConfig (KMPlayer::PartBase * player, KMPlayerFFServerConfig * fsc);
KDE_NO_CDTOR_EXPORT ~KMPlayerBroadcastConfig ();
virtual void write (KConfig *);
virtual void read (KConfig *);
virtual void sync (bool fromUI);
virtual void prefLocation (QString & item, QString & icon, QString & tab);
virtual QFrame * prefPage (QWidget * parent);
bool broadcasting () const;
void stopServer ();
KDE_NO_EXPORT const QString & serverURL () const { return m_ffserver_url; }
FFServerSetting ffserversettings;
FFServerSettingList ffserversettingprofiles;
signals:
void broadcastStarted ();
void broadcastStopped ();
private slots:
void processOutput (KProcess *, char *, int);
void processStopped (KProcess * process);
void startServer ();
void startFeed ();
void stateChange (KMPlayer::Process::State, KMPlayer::Process::State);
void sourceChanged (KMPlayer::Source *, KMPlayer::Source *);
private:
KMPlayer::PartBase * m_player;
KMPlayerFFServerConfig * m_ffserverconfig;
QGuardedPtr <KMPlayerPrefBroadcastFormatPage> m_configpage;
KMPlayer::FFMpeg * m_ffmpeg_process;
KProcess * m_ffserver_process;
bool m_endserver;
QString m_ffserver_out;
QString m_ffserver_url;
};
#endif //_KMPLAYER_BROADCAST_SOURCE_H_
|