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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
/**
* Copyright (C) 2002-2003 by Koos Vriezen <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef KMPLAYERPARTBASE_H
#define KMPLAYERPARTBASE_H
#include <config.h>
#include "kmplayer_def.h"
#include <tqobject.h>
#include <tqguardedptr.h>
#include <tqstringlist.h>
#include <tqmap.h>
#include <dcopobject.h>
#include <tdemediaplayer/player.h>
#include <kurl.h>
#include "kmplayerview.h"
#include "kmplayersource.h"
class TDEAboutData;
class TDEInstance;
class TDEActionCollection;
class KBookmarkMenu;
class TDEConfig;
class TQIODevice;
class TQTextStream;
class TQListViewItem;
namespace TDEIO {
class Job;
}
namespace KMPlayer {
class PartBase;
class Process;
class MPlayer;
class BookmarkOwner;
class BookmarkManager;
class MEncoder;
class MPlayerDumpstream;
class FFMpeg;
class Xine;
class Settings;
/*
* Source from URLs
*/
class KMPLAYER_EXPORT URLSource : public Source {
Q_OBJECT
//
public:
URLSource (PartBase * player, const KURL & url = KURL ());
virtual ~URLSource ();
virtual void dimensions (int & w, int & h);
virtual bool hasLength ();
virtual TQString prettyName ();
virtual void reset ();
virtual void setURL (const KURL & url);
public slots:
virtual void init ();
virtual void activate ();
virtual void deactivate ();
virtual void playCurrent ();
virtual void forward ();
virtual void backward ();
virtual void jump (NodePtr e);
void play ();
private slots:
void kioData (TDEIO::Job *, const TQByteArray &);
void kioMimetype (TDEIO::Job *, const TQString &);
void kioResult (TDEIO::Job *);
protected:
virtual bool requestPlayURL (NodePtr mrl);
virtual bool resolveURL (NodePtr mrl);
private:
void read (NodePtr mrl, TQTextStream &);
void stopResolving ();
struct ResolveInfo {
ResolveInfo (NodePtr mrl, TDEIO::Job * j, SharedPtr <ResolveInfo> & n)
: resolving_mrl (mrl), job (j), progress (0), next (n) {}
NodePtrW resolving_mrl;
TDEIO::Job * job;
TQByteArray data;
int progress;
SharedPtr <ResolveInfo> next;
};
SharedPtr <ResolveInfo> m_resolve_info;
bool activated; // 'solve' an singleShot race w/ cmdline url's
};
/*
* KDE's KMediaPlayer::Player implementation and base for KMPlayerPart
*/
class KMPLAYER_EXPORT PartBase : public KMediaPlayer::Player {
Q_OBJECT
//
K_DCOP
public:
typedef TQMap <TQString, Process *> ProcessMap;
PartBase (TQWidget * parent, const char * wname,TQObject * objectParent, const char * name, TDEConfig *);
~PartBase ();
void init (TDEActionCollection * = 0L);
virtual KMediaPlayer::View* view ();
static TDEAboutData* createAboutData ();
Settings * settings () const { return m_settings; }
void keepMovieAspect (bool);
KURL url () const { return m_sources ["urlsource"]->url (); }
void setURL (const KURL & url) { m_sources ["urlsource"]->setURL (url); }
/* Changes the backend process */
void setProcess (const char *);
bool setProcess (Mrl *mrl);
void setRecorder (const char *);
/* Changes the source,
* calls init() and reschedules an activate() on the source
* */
void setSource (Source * source);
void connectPanel (ControlPanel * panel);
void connectPlaylist (PlayListView * playlist);
void connectInfoPanel (InfoWindow * infopanel);
void connectSource (Source * old_source, Source * source);
Process * process () const { return m_process; }
Process * recorder () const { return m_recorder; }
Source * source () const { return m_source; }
TQMap <TQString, Process *> & players () { return m_players; }
TQMap <TQString, Process *> & recorders () { return m_recorders; }
TQMap <TQString, Source *> & sources () { return m_sources; }
TDEConfig * config () const { return m_config; }
bool mayResize () const { return !m_noresize; }
void updatePlayerMenu (ControlPanel *);
void updateInfo (const TQString & msg);
void updateStatus (const TQString & msg);
#ifdef HAVE_DBUS
void setServiceName (const TQString & srv) { m_service = srv; }
TQString serviceName () const { return m_service; }
#endif
// these are called from Process
void changeURL (const TQString & url);
void updateTree (bool full=true, bool force=false);
void setLanguages (const TQStringList & alang, const TQStringList & slang);
public slots:
virtual bool openURL (const KURL & url);
virtual bool openURL (const KURL::List & urls);
virtual bool closeURL ();
virtual void pause (void);
virtual void play (void);
virtual void stop (void);
void record ();
virtual void seek (unsigned long msec);
void adjustVolume (int incdec);
bool playing () const;
void showConfigDialog ();
void showPlayListWindow ();
void slotPlayerMenu (int);
void back ();
void forward ();
void addBookMark (const TQString & title, const TQString & url);
void volumeChanged (int);
void increaseVolume ();
void decreaseVolume ();
void setPosition (int position, int length);
virtual void setLoaded (int percentage);
public:
virtual bool isSeekable (void) const;
virtual unsigned long position (void) const;
virtual bool hasLength (void) const;
virtual unsigned long length (void) const;
k_dcop:
void toggleFullScreen ();
bool isPlaying ();
bool isPaused ();
signals:
void sourceChanged (KMPlayer::Source * old, KMPlayer::Source * nw);
void sourceDimensionChanged ();
void loading (int percentage);
void urlAdded (const TQString & url);
void urlChanged (const TQString & url);
void processChanged (const char *);
void treeChanged (int id, NodePtr root, NodePtr, bool select, bool open);
void treeUpdated ();
void infoUpdated (const TQString & msg);
void statusUpdated (const TQString & msg);
void languagesUpdated(const TQStringList & alang, const TQStringList & slang);
void audioIsSelected (int id);
void subtitleIsSelected (int id);
void positioned (int pos, int length);
void toggleMinimalMode ();
protected:
bool openFile();
virtual void timerEvent (TQTimerEvent *);
protected slots:
void posSliderPressed ();
void posSliderReleased ();
void positionValueChanged (int val);
void contrastValueChanged (int val);
void brightnessValueChanged (int val);
void hueValueChanged (int val);
void saturationValueChanged (int val);
void sourceHasChangedAspects ();
void fullScreen ();
void minimalMode ();
void playListItemClicked (TQListViewItem *);
void playListItemExecuted (TQListViewItem *);
virtual void playingStarted ();
virtual void playingStopped ();
void recordingStarted ();
void recordingStopped ();
void settingsChanged ();
void audioSelected (int);
void subtitleSelected (int);
protected:
TDEConfig * m_config;
TQGuardedPtr <View> m_view;
TQMap <TQString, TQString> temp_backends;
Settings * m_settings;
Process * m_process;
Process * m_recorder;
Source * m_source;
ProcessMap m_players;
ProcessMap m_recorders;
TQMap <TQString, Source *> m_sources;
BookmarkManager * m_bookmark_manager;
BookmarkOwner * m_bookmark_owner;
KBookmarkMenu * m_bookmark_menu;
#ifdef HAVE_DBUS
TQString m_service;
#endif
int m_record_timer;
int m_update_tree_timer;
bool m_noresize : 1;
bool m_auto_controls : 1;
bool m_use_slave : 1;
bool m_bPosSliderPressed : 1;
bool m_in_update_tree : 1;
bool m_update_tree_full : 1;
};
class KMPLAYER_NO_EXPORT DataCache : public TQObject {
Q_OBJECT
//
typedef TQMap <TQString, TQByteArray> DataMap;
typedef TQMap <TQString, bool> PreserveMap;
DataMap cache_map;
PreserveMap preserve_map;
public:
DataCache () {}
~DataCache () {}
void add (const TQString &, const TQByteArray &);
bool get (const TQString &, TQByteArray &);
bool preserve (const TQString &);
bool unpreserve (const TQString &);
bool isPreserved (const TQString &);
signals:
void preserveRemoved (const TQString &); // ready or canceled
};
class KMPLAYER_NO_EXPORT RemoteObjectPrivate : public TQObject {
Q_OBJECT
//
public:
RemoteObjectPrivate (RemoteObject * r);
~RemoteObjectPrivate ();
bool download (const TQString &);
void clear ();
TDEIO::Job * job;
TQString url;
TQByteArray data;
TQString mime;
private slots:
void slotResult (TDEIO::Job*);
void slotData (TDEIO::Job*, const TQByteArray& qb);
void slotMimetype (TDEIO::Job * job, const TQString & mimestr);
void cachePreserveRemoved (const TQString &);
private:
RemoteObject * remote_object;
bool preserve_wait;
};
} // namespace
#endif
|