1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2017 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 PLAYERPROCESS_H
|
---|
20 | #define PLAYERPROCESS_H
|
---|
21 |
|
---|
22 | #include "myprocess.h"
|
---|
23 | #include "mediadata.h"
|
---|
24 | #include "playerid.h"
|
---|
25 | #include "config.h"
|
---|
26 | #include "assstyles.h"
|
---|
27 | #include <QVariant>
|
---|
28 |
|
---|
29 | class PlayerProcess : public MyProcess
|
---|
30 | {
|
---|
31 | Q_OBJECT
|
---|
32 |
|
---|
33 | public:
|
---|
34 | enum ScreenshotType { Single = 0, Multiple = 1 };
|
---|
35 |
|
---|
36 | PlayerProcess(QObject * parent = 0);
|
---|
37 |
|
---|
38 | PlayerID::Player player() { return player_id; }
|
---|
39 | bool isMPlayer() { return (player_id == PlayerID::MPLAYER); }
|
---|
40 | bool isMPV() { return (player_id == PlayerID::MPV); }
|
---|
41 |
|
---|
42 | virtual bool start() = 0;
|
---|
43 |
|
---|
44 | void writeToStdin(QString text);
|
---|
45 | MediaData mediaData() { return md; };
|
---|
46 |
|
---|
47 | // Command line options
|
---|
48 | virtual void setMedia(const QString & media, bool is_playlist = false) = 0;
|
---|
49 | virtual void setFixedOptions() = 0;
|
---|
50 | virtual void disableInput() = 0;
|
---|
51 | virtual void setOption(const QString & option_name, const QVariant & value = QVariant()) = 0;
|
---|
52 | virtual void addUserOption(const QString & option) = 0;
|
---|
53 | virtual void addVF(const QString & filter_name, const QVariant & value = QVariant()) = 0;
|
---|
54 | virtual void addAF(const QString & filter_name, const QVariant & value = QVariant()) = 0;
|
---|
55 | virtual void addStereo3DFilter(const QString & in, const QString & out) = 0;
|
---|
56 | virtual void setSubStyles(const AssStyles & styles, const QString & assStylesFile = QString::null) = 0;
|
---|
57 |
|
---|
58 | // Slave commands
|
---|
59 | virtual void quit() = 0;
|
---|
60 | virtual void setVolume(int v) = 0;
|
---|
61 | virtual void setOSD(int o) = 0;
|
---|
62 | virtual void setAudio(int ID) = 0;
|
---|
63 | virtual void setVideo(int ID) = 0;
|
---|
64 | virtual void setSubtitle(int type, int ID) = 0;
|
---|
65 | virtual void disableSubtitles() = 0;
|
---|
66 | virtual void setSecondarySubtitle(int ID) = 0;
|
---|
67 | virtual void disableSecondarySubtitles() = 0;
|
---|
68 | virtual void setSubtitlesVisibility(bool b) = 0;
|
---|
69 | virtual void seek(double secs, int mode, bool precise) = 0;
|
---|
70 | virtual void mute(bool b) = 0;
|
---|
71 | virtual void setPause(bool b) = 0;
|
---|
72 | virtual void frameStep() = 0;
|
---|
73 | virtual void frameBackStep() = 0;
|
---|
74 | virtual void showOSDText(const QString & text, int duration, int level) = 0;
|
---|
75 | virtual void showFilenameOnOSD() = 0;
|
---|
76 | virtual void showTimeOnOSD() = 0;
|
---|
77 | virtual void setContrast(int value) = 0;
|
---|
78 | virtual void setBrightness(int value) = 0;
|
---|
79 | virtual void setHue(int value) = 0;
|
---|
80 | virtual void setSaturation(int value) = 0;
|
---|
81 | virtual void setGamma(int value) = 0;
|
---|
82 | virtual void setChapter(int ID) = 0;
|
---|
83 | virtual void nextChapter() = 0;
|
---|
84 | virtual void previousChapter() = 0;
|
---|
85 | virtual void setExternalSubtitleFile(const QString & filename) = 0;
|
---|
86 | virtual void setSubPos(int pos) = 0;
|
---|
87 | virtual void setSubScale(double value) = 0;
|
---|
88 | virtual void setSubStep(int value) = 0;
|
---|
89 | #ifdef MPV_SUPPORT
|
---|
90 | virtual void seekSub(int value) = 0;
|
---|
91 | #endif
|
---|
92 | virtual void setSubForcedOnly(bool b) = 0;
|
---|
93 | virtual void setSpeed(double value) = 0;
|
---|
94 | #ifdef MPLAYER_SUPPORT
|
---|
95 | virtual void enableKaraoke(bool b) = 0;
|
---|
96 | #endif
|
---|
97 | virtual void enableExtrastereo(bool b) = 0;
|
---|
98 | virtual void enableVolnorm(bool b, const QString & option) = 0;
|
---|
99 | virtual void setAudioEqualizer(const QString & values) = 0;
|
---|
100 | virtual void setAudioDelay(double delay) = 0;
|
---|
101 | virtual void setSubDelay(double delay) = 0;
|
---|
102 | virtual void setLoop(int v) = 0;
|
---|
103 | virtual void setAMarker(int sec) = 0;
|
---|
104 | virtual void setBMarker(int sec) = 0;
|
---|
105 | virtual void clearABMarkers() = 0;
|
---|
106 | virtual void takeScreenshot(ScreenshotType t, bool include_subtitles = false) = 0;
|
---|
107 | #ifdef CAPTURE_STREAM
|
---|
108 | virtual void switchCapturing() = 0;
|
---|
109 | #endif
|
---|
110 | virtual void setTitle(int ID) = 0;
|
---|
111 | virtual void changeVF(const QString & filter, bool enable, const QVariant & option = QVariant()) = 0;
|
---|
112 | virtual void changeStereo3DFilter(bool enable, const QString & in, const QString & out) = 0;
|
---|
113 | #if DVDNAV_SUPPORT
|
---|
114 | virtual void discSetMousePos(int x, int y) = 0;
|
---|
115 | virtual void discButtonPressed(const QString & button_name) = 0;
|
---|
116 | #endif
|
---|
117 | virtual void setAspect(double aspect) = 0;
|
---|
118 | virtual void setFullscreen(bool b) = 0;
|
---|
119 | #if PROGRAM_SWITCH
|
---|
120 | virtual void setTSProgram(int ID) = 0;
|
---|
121 | #endif
|
---|
122 | virtual void toggleDeinterlace() = 0;
|
---|
123 | virtual void askForLength() = 0;
|
---|
124 | virtual void setOSDScale(double value) = 0;
|
---|
125 | virtual void setChannelsFile(const QString &) = 0;
|
---|
126 |
|
---|
127 | virtual void enableScreenshots(const QString & dir, const QString & templ = QString::null, const QString & format = QString::null) = 0;
|
---|
128 |
|
---|
129 | void setPausingPrefix(const QString & prefix) { pausing_prefix = prefix; };
|
---|
130 |
|
---|
131 | void setOSDMediaInfo(const QString & s) { osd_media_info = s; };
|
---|
132 | QString OSDMediaInfo() { return osd_media_info; };
|
---|
133 |
|
---|
134 | #ifdef CAPTURE_STREAM
|
---|
135 | virtual void setCaptureDirectory(const QString & dir);
|
---|
136 | #endif
|
---|
137 |
|
---|
138 | static PlayerProcess * createPlayerProcess(const QString & player_bin, QObject * parent = 0);
|
---|
139 |
|
---|
140 |
|
---|
141 | // Signals
|
---|
142 | signals:
|
---|
143 | void processExited();
|
---|
144 | void lineAvailable(QString line);
|
---|
145 |
|
---|
146 | void receivedCurrentSec(double sec);
|
---|
147 | void receivedCurrentFrame(int frame);
|
---|
148 | void receivedPause();
|
---|
149 | void receivedWindowResolution(int,int);
|
---|
150 | void receivedNoVideo();
|
---|
151 | void receivedVO(QString);
|
---|
152 | void receivedAO(QString);
|
---|
153 | void receivedEndOfFile();
|
---|
154 | void mplayerFullyLoaded();
|
---|
155 | void receivedStartingTime(double sec);
|
---|
156 |
|
---|
157 | void receivedCacheMessage(QString);
|
---|
158 | void receivedCacheEmptyMessage(QString);
|
---|
159 | void receivedCreatingIndex(QString);
|
---|
160 | void receivedConnectingToMessage(QString);
|
---|
161 | void receivedResolvingMessage(QString);
|
---|
162 | void receivedBuffering();
|
---|
163 | void receivedPlaying();
|
---|
164 | void receivedScreenshot(QString);
|
---|
165 | void receivedUpdatingFontCache();
|
---|
166 | void receivedScanningFont(QString);
|
---|
167 | void receivedForbiddenText();
|
---|
168 |
|
---|
169 | void receivedStreamTitle(QString);
|
---|
170 | void receivedStreamTitleAndUrl(QString,QString);
|
---|
171 |
|
---|
172 | void failedToParseMplayerVersion(QString line_with_mplayer_version);
|
---|
173 |
|
---|
174 | #if NOTIFY_SUB_CHANGES
|
---|
175 | //! Emitted if a new subtitle has been added or an old one changed
|
---|
176 | void subtitleInfoChanged(const SubTracks &);
|
---|
177 |
|
---|
178 | //! Emitted when subtitle info has been received but there wasn't anything new
|
---|
179 | void subtitleInfoReceivedAgain(const SubTracks &);
|
---|
180 | #endif
|
---|
181 | #if NOTIFY_AUDIO_CHANGES
|
---|
182 | //! Emitted if a new audio track been added or an old one changed
|
---|
183 | void audioInfoChanged(const Tracks &);
|
---|
184 | #endif
|
---|
185 | #if NOTIFY_VIDEO_CHANGES
|
---|
186 | //! Emitted if a new video track been added or an old one changed
|
---|
187 | void videoInfoChanged(const Tracks &);
|
---|
188 | #endif
|
---|
189 | #if NOTIFY_CHAPTER_CHANGES
|
---|
190 | void chaptersChanged(const Chapters &);
|
---|
191 | #endif
|
---|
192 |
|
---|
193 | #if DVDNAV_SUPPORT
|
---|
194 | void receivedDVDTitle(int);
|
---|
195 | void receivedDuration(double);
|
---|
196 | void receivedTitleIsMenu();
|
---|
197 | void receivedTitleIsMovie();
|
---|
198 | #endif
|
---|
199 |
|
---|
200 | void receivedVideoBitrate(int);
|
---|
201 | void receivedAudioBitrate(int);
|
---|
202 |
|
---|
203 | protected:
|
---|
204 | MediaData md;
|
---|
205 | QString pausing_prefix;
|
---|
206 |
|
---|
207 | #ifdef CAPTURE_STREAM
|
---|
208 | QString capture_filename;
|
---|
209 | #endif
|
---|
210 |
|
---|
211 | PlayerID::Player player_id;
|
---|
212 |
|
---|
213 | QString osd_media_info;
|
---|
214 | };
|
---|
215 |
|
---|
216 | #endif
|
---|