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
|
/* This file is part of the KDE project
*
* Copyright (C) 2003 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 as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* 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 KMPLAYERSOURCE_H
#define KMPLAYERSOURCE_H
#include <tqobject.h>
#include <tqstring.h>
#include <kurl.h>
#include "kmplayerplaylist.h"
#include "kmplayerprocess.h"
class KConfig;
class TQWidget;
class TQFrame;
namespace KMPlayer {
class PartBase;
/**
* Class for a certain media, like URL, DVD, TV etc
*/
class KMPLAYER_EXPORT Source : public TQObject, public PlayListNotify {
Q_OBJECT
TQ_OBJECT
public:
Source (const TQString & name, PartBase * player, const char * src);
virtual ~Source ();
virtual void init ();
virtual bool processOutput (const TQString & line);
bool identified () const { return m_identified; }
virtual bool hasLength ();
virtual bool isSeekable ();
KDE_NO_EXPORT int width () const { return m_width; }
KDE_NO_EXPORT int height () const { return m_height; }
virtual void dimensions (int & w, int & h) { w = m_width; h = m_height; }
/* length () returns length in deci-seconds */
KDE_NO_EXPORT int length () const { return m_length; }
/* position () returns position in deci-seconds */
KDE_NO_EXPORT int position () const { return m_position; }
KDE_NO_EXPORT float aspect () const { return m_aspect; }
KDE_NO_EXPORT const KURL & url () const { return m_url; }
KDE_NO_EXPORT const KURL & subUrl () const { return m_sub_url; }
PartBase * player () { return m_player; }
virtual void reset ();
TQString currentMrl ();
KDE_NO_EXPORT const TQString & audioDevice () const { return m_audiodevice; }
KDE_NO_EXPORT const TQString & videoDevice () const { return m_videodevice; }
KDE_NO_EXPORT const TQString & videoNorm () const { return m_videonorm; }
/* frequency() if set, returns frequency in kHz */
KDE_NO_EXPORT int frequency () const { return m_frequency; }
KDE_NO_EXPORT int xvPort () const { return m_xvport; }
KDE_NO_EXPORT int xvEncoding () const { return m_xvencoding; }
KDE_NO_EXPORT const TQString & pipeCmd () const { return m_pipecmd; }
KDE_NO_EXPORT const TQString & options () const { return m_options; }
KDE_NO_EXPORT const TQString & recordCmd () const { return m_recordcmd; }
KDE_NO_EXPORT const TQString & tuner () const { return m_tuner; }
KDE_NO_EXPORT NodePtr current () const { return m_current; }
TQString plugin (const TQString &mime) const;
virtual NodePtr document ();
virtual NodePtr root ();
virtual TQString filterOptions ();
virtual void setURL (const KURL & url);
void insertURL (NodePtr mrl, const TQString & url, const TQString & title=TQString());
KDE_NO_EXPORT void setSubURL (const KURL & url) { m_sub_url = url; }
void setLanguages (const TQStringList & alang, const TQStringList & slang);
KDE_NO_EXPORT void setWidth (int w) { m_width = w; }
KDE_NO_EXPORT void setHeight (int h) { m_height = h; }
virtual void setDimensions (NodePtr, int w, int h);
virtual void setAspect (NodePtr, float a);
/* setLength (len) set length in deci-seconds */
void setLength (NodePtr, int len);
/* setPosition (pos) set position in deci-seconds */
void setPosition (int pos);
virtual void setIdentified (bool b = true);
// backend process state changed
virtual void stateChange (Process *, Process::State os, Process::State ns);
KDE_NO_EXPORT void setAutoPlay (bool b) { m_auto_play = b; }
KDE_NO_EXPORT bool autoPlay () const { return m_auto_play; }
void setTitle (const TQString & title);
void setLoading (int percentage);
bool setCurrent (NodePtr mrl);
virtual TQString prettyName ();
signals:
void startPlaying ();
void stopPlaying ();
void startRecording ();
void stopRecording ();
/**
* Signal for notifying this source is at the end of play items
*/
void endOfPlayItems ();
void dimensionsChanged ();
void titleChanged (const TQString & title);
public slots:
virtual void activate () = 0;
virtual void deactivate () = 0;
virtual void forward ();
virtual void backward ();
virtual void play ();
/**
* Continuing playing where current is now
* May call play process if a video needs to play or
* emit endOfPlayItems when done
*/
virtual void playCurrent ();
virtual void jump (NodePtr e);
void setAudioLang (int);
void setSubtitle (int);
protected:
void timerEvent (TQTimerEvent *);
/**
* PlayListNotify implementation
*/
bool requestPlayURL (NodePtr mrl);
bool resolveURL (NodePtr mrl);
void stateElementChanged (Node * element, Node::State os, Node::State ns);
SurfacePtr getSurface (NodePtr node);
void setInfoMessage (const TQString & msg);
void bitRates (int & preferred, int & maximal);
void setTimeout (int ms);
NodePtr m_document;
NodePtrW m_current;
NodePtrW m_back_request;
TQString m_name;
PartBase * m_player;
TQString m_recordcmd;
bool m_identified;
bool m_auto_play;
KURL m_url;
KURL m_sub_url;
TQString m_audiodevice;
TQString m_videodevice;
TQString m_videonorm;
TQString m_tuner;
int m_frequency;
int m_xvport;
int m_xvencoding;
TQString m_pipecmd;
TQString m_options;
TQString m_plugin;
private:
int m_width;
int m_height;
float m_aspect;
int m_length;
int m_position;
int m_doc_timer;
};
} // namespace
#endif
|