~ubuntu-branches/ubuntu/lucid/kmplayer/lucid

« back to all changes in this revision

Viewing changes to src/kmplayerprocess.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-03-05 08:35:53 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20100305083553-dcjpc21lpto3oemy
Tags: 1:0.11.2-1ubuntu1
* Merge from Debian unstable, remaining change:
  - Keep kmplayer-base transitional package for 8.04 upgrades

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <qobject.h>
25
25
#include <qstring.h>
 
26
#include <qlist.h>
26
27
#include <qbytearray.h>
27
28
#include <qstringlist.h>
28
29
#include <qregexp.h>
 
30
#include <qprocess.h>
29
31
 
30
32
#include <kurl.h>
31
33
#include <kio/global.h>
32
34
 
33
35
#include "kmplayer_def.h"
34
36
#include "kmplayerplaylist.h"
 
37
#include "kmplayersource.h"
35
38
#include "mediaobject.h"
36
39
 
37
40
class QWidget;
38
 
class K3Process;
39
41
class KJob;
40
42
 
41
43
namespace KIO {
72
74
    virtual void setAudioLang (int, const QString &);
73
75
    virtual void setSubtitle (int, const QString &);
74
76
    virtual bool running () const;
75
 
    KDE_NO_EXPORT K3Process * process () const { return m_process; }
 
77
    KDE_NO_EXPORT QProcess * process () const { return m_process; }
76
78
    KDE_NO_EXPORT Source * source () const { return m_source; }
77
79
    View *view () const;
78
80
    WId widget ();
100
102
protected slots:
101
103
    void rescheduledStateChanged ();
102
104
    void result (KJob *);
 
105
    void processStateChanged (QProcess::ProcessState);
103
106
protected:
104
107
    virtual bool deMediafiedPlay ();
105
108
    virtual void terminateJobs ();
 
109
    void startProcess (const QString &program, const QStringList &args);
106
110
 
107
111
    Source * m_source;
108
112
    Settings * m_settings;
109
113
    State m_old_state;
110
 
    K3Process * m_process;
 
114
    QProcess * m_process;
111
115
    KIO::Job * m_job;
112
116
    QString m_url;
113
117
    int m_request_seek;
 
118
    QProcess::ProcessState m_process_state;
114
119
};
115
120
 
116
121
 
128
133
    virtual void quit ();
129
134
protected:
130
135
    bool sendCommand (const QString &);
131
 
    QStringList commands;
132
 
    bool m_use_slave : 1;
 
136
    QList<QByteArray> commands;
 
137
    bool m_needs_restarted;
133
138
protected slots:
134
 
    virtual void processStopped (K3Process *);
 
139
    virtual void processStopped ();
135
140
private slots:
136
 
    void dataWritten (K3Process *);
 
141
    void dataWritten (qint64);
 
142
    void processStopped (int, QProcess::ExitStatus);
137
143
};
138
144
 
139
145
/*
155
161
    virtual bool grabPicture (const QString &file, int pos);
156
162
    virtual void setAudioLang (int, const QString &);
157
163
    virtual void setSubtitle (int, const QString &);
158
 
    bool run (const char * args, const char * pipe = 0L);
159
164
public slots:
160
165
    virtual bool deMediafiedPlay ();
161
166
    virtual void stop ();
167
172
    virtual bool contrast (int pos, bool absolute);
168
173
    virtual bool brightness (int pos, bool absolute);
169
174
    bool ready ();
170
 
protected slots:
171
 
    void processStopped (K3Process *);
 
175
protected:
 
176
    void processStopped ();
172
177
private slots:
173
 
    void processOutput (K3Process *, char *, int);
 
178
    void processOutput ();
174
179
private:
175
180
    QString m_process_output;
176
181
    QString m_grab_file;
187
192
    WeakPtr <LangInfo> slanglist_end;
188
193
    int aid, sid;
189
194
    int old_volume;
190
 
    bool m_needs_restarted;
191
195
};
192
196
 
193
197
#ifdef _KMPLAYERCONFIG_H_
224
228
/*
225
229
 * Base class for all recorders
226
230
 */
227
 
class KMPLAYER_NO_EXPORT RecordDocument : public Document {
 
231
class KMPLAYER_NO_EXPORT RecordDocument : public SourceDocument {
228
232
public:
229
233
    RecordDocument (const QString &url, const QString &rurl, const QString &rec,
230
 
                    bool video, PlayListNotify *notify);
 
234
                    Source *source);
231
235
 
232
236
    virtual void begin ();
233
 
    virtual void endOfFile ();
 
237
    virtual void message (MessageType msg, void *);
234
238
    virtual void deactivate ();
235
239
 
236
240
    QString record_file;
237
241
    QString recorder;
238
 
    bool has_video;
239
242
};
240
243
 
241
244
/*
292
295
    QString m_service;
293
296
    QString m_path;
294
297
    QString m_slave_service;
295
 
    K3Process *m_slave;
 
298
    QProcess *m_slave;
296
299
 
297
300
private slots:
298
 
    void slaveStopped (K3Process *);
299
 
    void slaveOutput (K3Process *, char *, int);
 
301
    void slaveStopped (int, QProcess::ExitStatus);
 
302
    void slaveOutput ();
300
303
 
301
304
protected:
302
305
    virtual void initSlave ();
348
351
public slots:
349
352
    virtual bool ready ();
350
353
};
351
 
/*
352
 
 * Base class for backend processes having the KMPlayer::Backend interface
353
 
 */
354
 
/*
355
 
class KMPLAYER_EXPORT CallbackProcessInfo
356
 
 : public QObject, public ProcessInfo {
357
 
    Q_OBJECT
358
 
public:
359
 
    CallbackProcessInfo (const char *nm, const QString &lbl,
360
 
            const char **supported,MediaManager *, PreferencesPage *);
361
 
    ~CallbackProcessInfo ();
362
 
 
363
 
    QString dcopName ();
364
 
    virtual bool startBackend () = 0;
365
 
    virtual void quitProcesses ();
366
 
    void stopBackend ();
367
 
    void backendStarted (QCString dcopname, QByteArray & data);
368
 
 
369
 
    KDE_NO_EXPORT bool haveConfig () { return have_config == config_yes; }
370
 
    bool getConfigData ();
371
 
    void setChangedData (const QByteArray &);
372
 
    void changesReceived ();
373
 
 
374
 
    QByteArray changed_data;
375
 
    NodePtr config_doc;
376
 
    Backend_stub *backend;
377
 
    Callback *callback;
378
 
    KProcess *m_process;
379
 
 
380
 
signals:
381
 
    void configReceived ();
382
 
 
383
 
protected slots:
384
 
    void processStopped (KProcess *);
385
 
    void processOutput (KProcess *, char *, int);
386
 
 
387
 
protected:
388
 
    void initProcess ();
389
 
    enum { config_unknown, config_probe, config_yes, config_no } have_config;
390
 
    enum { send_no, send_try, send_new } send_config;
391
 
};
392
 
 
393
 
class KMPLAYER_EXPORT CallbackProcess : public Process {
394
 
    Q_OBJECT
395
 
    friend class CallbackProcessInfo;
396
 
public:
397
 
    CallbackProcess (QObject *, ProcessInfo *, Settings *, const char * n);
398
 
    ~CallbackProcess ();
399
 
    virtual void setStatusMessage (const QString & msg);
400
 
    virtual void setErrorMessage (int code, const QString & msg);
401
 
    virtual void setFinished ();
402
 
    virtual void setPlaying ();
403
 
    virtual void setMovieParams (int length, int width, int height, float aspect, const QStringList & alang, const QStringList & slang);
404
 
    virtual void setMoviePosition (int position);
405
 
    virtual void setLoadingProgress (int percentage);
406
 
    virtual void setAudioLang (int, const QString &);
407
 
    virtual void setSubtitle (int, const QString &);
408
 
    virtual bool deMediafiedPlay ();
409
 
    virtual bool running () const;
410
 
public slots:
411
 
    void stop ();
412
 
    void quit ();
413
 
    void pause ();
414
 
    bool seek (int pos, bool absolute);
415
 
    bool volume (int pos, bool absolute);
416
 
    bool saturation (int pos, bool absolute);
417
 
    bool hue (int pos, bool absolute);
418
 
    bool contrast (int pos, bool absolute);
419
 
    bool brightness (int pos, bool absolute);
420
 
protected:
421
 
    XMLPreferencesPage * m_configpage;
422
 
    bool in_gui_update;
423
 
};
424
 
*/
 
354
 
425
355
/*
426
356
 * Config document as used by kxineplayer backend
427
357
 */
455
385
};
456
386
 
457
387
/*
458
 
 * Preference page for XML type of docuement
459
 
 */
460
 
/*
461
 
class KMPLAYER_NO_EXPORT XMLPreferencesPage : public PreferencesPage {
462
 
public:
463
 
    XMLPreferencesPage (CallbackProcessInfo *);
464
 
    ~XMLPreferencesPage ();
465
 
    void write (KSharedConfigPtr);
466
 
    void read (KSharedConfigPtr);
467
 
    void sync (bool fromUI);
468
 
    void prefLocation (QString & item, QString & icon, QString & tab);
469
 
    QFrame * prefPage (QWidget * parent);
470
 
private:
471
 
    CallbackProcess *m_process_info;
472
 
    XMLPreferencesFrame * m_configframe;
473
 
};
474
 
*/
475
 
/*
476
 
 * Xine backend process
477
 
 */
478
 
/*
479
 
class KMPLAYER_NO_EXPORT XineProcessInfo : public CallbackProcessInfo {
480
 
public:
481
 
    XineProcessInfo (MediaManager *);
482
 
    virtual IProcess *create (PartBase*, AudioVideoMedia*);
483
 
 
484
 
    virtual bool startBackend ();
485
 
};
486
 
 
487
 
class KMPLAYER_NO_EXPORT Xine : public CallbackProcess {
488
 
    Q_OBJECT
489
 
public:
490
 
    Xine (QObject *parent, ProcessInfo*, Settings *settings);
491
 
    ~Xine ();
492
 
public slots:
493
 
    bool ready ();
494
 
};
495
 
*/
496
 
/*
497
 
 * GStreamer backend process
498
 
 */
499
 
/*
500
 
class KMPLAYER_NO_EXPORT GStreamer : public CallbackProcess {
501
 
    Q_OBJECT
502
 
public:
503
 
    GStreamer (QObject * parent, Settings * settings);
504
 
    ~GStreamer ();
505
 
public slots:
506
 
    virtual bool ready ();
507
 
};
508
 
*/
509
 
/*
510
388
 * ffmpeg backend recorder
511
389
 */
512
390
class KMPLAYER_NO_EXPORT FFMpegProcessInfo : public ProcessInfo {
526
404
    virtual void stop ();
527
405
    virtual void quit ();
528
406
private slots:
529
 
    void processStopped (K3Process *);
 
407
    void processStopped (int, QProcess::ExitStatus);
530
408
};
531
409
 
532
410
/*
614
492
public slots:
615
493
    bool ready ();
616
494
private slots:
617
 
    void processOutput (K3Process *, char *, int);
618
 
    void processStopped (K3Process *);
619
 
    void wroteStdin (K3Process *);
 
495
    void processOutput ();
 
496
    void processStopped (int, QProcess::ExitStatus);
 
497
    void wroteStdin (qint64);
620
498
    void streamStateChanged ();
621
499
    void streamRedirected (uint32_t, const KUrl &);
622
500
protected: