1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2012 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
3 |
|
---|
4 | This program is free software; you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU General Public License as published by
|
---|
6 | the Free Software Foundation; either version 2 of the License, or
|
---|
7 | (at your option) any later version.
|
---|
8 |
|
---|
9 | This program is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this program; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef _MPLAYERPROCESS_H_
|
---|
20 | #define _MPLAYERPROCESS_H_
|
---|
21 |
|
---|
22 | #include <QString>
|
---|
23 | #include "myprocess.h"
|
---|
24 | #include "mediadata.h"
|
---|
25 | #include "config.h"
|
---|
26 |
|
---|
27 | #ifdef Q_OS_OS2
|
---|
28 | #include <QThread>
|
---|
29 | #include <qt_os2.h>
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #define NOTIFY_SUB_CHANGES 1
|
---|
33 | #define NOTIFY_AUDIO_CHANGES 1
|
---|
34 |
|
---|
35 | #ifdef Q_OS_OS2
|
---|
36 | class PipeThread : public QThread
|
---|
37 | {
|
---|
38 | public:
|
---|
39 | PipeThread(const QByteArray t, const HPIPE pipe);
|
---|
40 | ~PipeThread();
|
---|
41 | void run();
|
---|
42 |
|
---|
43 | private:
|
---|
44 | HPIPE hpipe;
|
---|
45 | QByteArray text;
|
---|
46 | };
|
---|
47 | #endif
|
---|
48 |
|
---|
49 |
|
---|
50 | class QStringList;
|
---|
51 |
|
---|
52 | class MplayerProcess : public MyProcess
|
---|
53 | {
|
---|
54 | Q_OBJECT
|
---|
55 |
|
---|
56 | public:
|
---|
57 | MplayerProcess(QObject * parent = 0);
|
---|
58 | ~MplayerProcess();
|
---|
59 |
|
---|
60 | bool start();
|
---|
61 | void writeToStdin(QString text);
|
---|
62 |
|
---|
63 | MediaData mediaData() { return md; };
|
---|
64 |
|
---|
65 | signals:
|
---|
66 | void processExited();
|
---|
67 | void lineAvailable(QString line);
|
---|
68 |
|
---|
69 | void receivedCurrentSec(double sec);
|
---|
70 | void receivedCurrentFrame(int frame);
|
---|
71 | void receivedPause();
|
---|
72 | void receivedWindowResolution(int,int);
|
---|
73 | void receivedNoVideo();
|
---|
74 | void receivedVO(QString);
|
---|
75 | void receivedAO(QString);
|
---|
76 | void receivedEndOfFile();
|
---|
77 | void mplayerFullyLoaded();
|
---|
78 | void receivedStartingTime(double sec);
|
---|
79 |
|
---|
80 | void receivedCacheMessage(QString);
|
---|
81 | void receivedCreatingIndex(QString);
|
---|
82 | void receivedConnectingToMessage(QString);
|
---|
83 | void receivedResolvingMessage(QString);
|
---|
84 | void receivedScreenshot(QString);
|
---|
85 | void receivedUpdatingFontCache();
|
---|
86 | void receivedScanningFont(QString);
|
---|
87 |
|
---|
88 | void receivedStreamTitle(QString);
|
---|
89 | void receivedStreamTitleAndUrl(QString,QString);
|
---|
90 |
|
---|
91 | void failedToParseMplayerVersion(QString line_with_mplayer_version);
|
---|
92 |
|
---|
93 | #if NOTIFY_SUB_CHANGES
|
---|
94 | //! Emitted if a new subtitle has been added or an old one changed
|
---|
95 | void subtitleInfoChanged(const SubTracks &);
|
---|
96 |
|
---|
97 | //! Emitted when subtitle info has been received but there wasn't anything new
|
---|
98 | void subtitleInfoReceivedAgain(const SubTracks &);
|
---|
99 | #endif
|
---|
100 | #if NOTIFY_AUDIO_CHANGES
|
---|
101 | //! Emitted if a new audio track been added or an old one changed
|
---|
102 | void audioInfoChanged(const Tracks &);
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | #if DVDNAV_SUPPORT
|
---|
106 | void receivedDVDTitle(int);
|
---|
107 | void receivedDuration(double);
|
---|
108 | void receivedTitleIsMenu();
|
---|
109 | void receivedTitleIsMovie();
|
---|
110 | #endif
|
---|
111 |
|
---|
112 | protected slots:
|
---|
113 | void parseLine(QByteArray ba);
|
---|
114 | void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
---|
115 | void gotError(QProcess::ProcessError);
|
---|
116 |
|
---|
117 | #if defined(Q_OS_OS2)
|
---|
118 | void MPpipeOpen();
|
---|
119 | void MPpipeClose();
|
---|
120 | void MPpipeWrite(const QByteArray text);
|
---|
121 | #endif
|
---|
122 |
|
---|
123 | private:
|
---|
124 | bool notified_mplayer_is_running;
|
---|
125 | bool received_end_of_file;
|
---|
126 |
|
---|
127 | MediaData md;
|
---|
128 |
|
---|
129 | int last_sub_id;
|
---|
130 |
|
---|
131 | #if defined(Q_OS_OS2)
|
---|
132 | PipeThread *pipeThread;
|
---|
133 | HPIPE hpipe;
|
---|
134 | PID pidMP;
|
---|
135 | #endif
|
---|
136 |
|
---|
137 | int mplayer_svn;
|
---|
138 |
|
---|
139 | #if NOTIFY_SUB_CHANGES
|
---|
140 | SubTracks subs;
|
---|
141 |
|
---|
142 | bool subtitle_info_received;
|
---|
143 | bool subtitle_info_changed;
|
---|
144 | #endif
|
---|
145 |
|
---|
146 | #if NOTIFY_AUDIO_CHANGES
|
---|
147 | Tracks audios;
|
---|
148 | bool audio_info_changed;
|
---|
149 | #endif
|
---|
150 |
|
---|
151 | int dvd_current_title;
|
---|
152 | };
|
---|
153 |
|
---|
154 |
|
---|
155 | #endif
|
---|