[175] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[175] | 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 MPVPROCESS_H
|
---|
| 20 | #define MPVPROCESS_H
|
---|
| 21 |
|
---|
| 22 | #include <QString>
|
---|
| 23 | #include "playerprocess.h"
|
---|
| 24 | #include "config.h"
|
---|
| 25 |
|
---|
[188] | 26 | #define OSD_WITH_TIMER
|
---|
| 27 |
|
---|
[175] | 28 | class QStringList;
|
---|
| 29 |
|
---|
| 30 | class MPVProcess : public PlayerProcess
|
---|
| 31 | {
|
---|
| 32 | Q_OBJECT
|
---|
| 33 |
|
---|
| 34 | public:
|
---|
| 35 | MPVProcess(QObject * parent = 0);
|
---|
| 36 | ~MPVProcess();
|
---|
| 37 |
|
---|
| 38 | bool start();
|
---|
| 39 |
|
---|
| 40 | // Command line options
|
---|
| 41 | void addArgument(const QString & a);
|
---|
| 42 | void setMedia(const QString & media, bool is_playlist = false);
|
---|
| 43 | void disableInput();
|
---|
| 44 | void setFixedOptions();
|
---|
| 45 | void setOption(const QString & option_name, const QVariant & value = QVariant());
|
---|
| 46 | void addUserOption(const QString & option);
|
---|
| 47 | void addVF(const QString & filter_name, const QVariant & value = QVariant());
|
---|
| 48 | void addAF(const QString & filter_name, const QVariant & value = QVariant());
|
---|
| 49 | void addStereo3DFilter(const QString & in, const QString & out);
|
---|
| 50 | void setSubStyles(const AssStyles & styles, const QString & assStylesFile = QString::null);
|
---|
| 51 |
|
---|
| 52 | // Slave commands
|
---|
| 53 | void quit();
|
---|
| 54 | void setVolume(int v);
|
---|
| 55 | void setOSD(int o);
|
---|
| 56 | void setAudio(int ID);
|
---|
| 57 | void setVideo(int ID);
|
---|
| 58 | void setSubtitle(int type, int ID);
|
---|
| 59 | void disableSubtitles();
|
---|
| 60 | void setSecondarySubtitle(int ID);
|
---|
| 61 | void disableSecondarySubtitles();
|
---|
| 62 | void setSubtitlesVisibility(bool b);
|
---|
| 63 | void seek(double secs, int mode, bool precise);
|
---|
| 64 | void mute(bool b);
|
---|
| 65 | void setPause(bool b);
|
---|
| 66 | void frameStep();
|
---|
| 67 | void frameBackStep();
|
---|
| 68 | void showOSDText(const QString & text, int duration, int level);
|
---|
| 69 | void showFilenameOnOSD();
|
---|
| 70 | void showTimeOnOSD();
|
---|
| 71 | void setContrast(int value);
|
---|
| 72 | void setBrightness(int value);
|
---|
| 73 | void setHue(int value);
|
---|
| 74 | void setSaturation(int value);
|
---|
| 75 | void setGamma(int value);
|
---|
| 76 | void setChapter(int ID);
|
---|
| 77 | void nextChapter();
|
---|
| 78 | void previousChapter();
|
---|
| 79 | void setExternalSubtitleFile(const QString & filename);
|
---|
| 80 | void setSubPos(int pos);
|
---|
| 81 | void setSubScale(double value);
|
---|
| 82 | void setSubStep(int value);
|
---|
| 83 | void seekSub(int value);
|
---|
| 84 | void setSubForcedOnly(bool b);
|
---|
| 85 | void setSpeed(double value);
|
---|
| 86 | #ifdef MPLAYER_SUPPORT
|
---|
| 87 | void enableKaraoke(bool b);
|
---|
| 88 | #endif
|
---|
| 89 | void enableExtrastereo(bool b);
|
---|
| 90 | void enableVolnorm(bool b, const QString & option);
|
---|
| 91 | void setAudioEqualizer(const QString & values);
|
---|
| 92 | void setAudioDelay(double delay);
|
---|
| 93 | void setSubDelay(double delay);
|
---|
| 94 | void setLoop(int v);
|
---|
[181] | 95 | void setAMarker(int sec);
|
---|
| 96 | void setBMarker(int sec);
|
---|
| 97 | void clearABMarkers();
|
---|
[175] | 98 | void takeScreenshot(ScreenshotType t, bool include_subtitles = false);
|
---|
| 99 | #ifdef CAPTURE_STREAM
|
---|
| 100 | void switchCapturing();
|
---|
| 101 | #endif
|
---|
| 102 | void setTitle(int ID);
|
---|
| 103 | void changeVF(const QString & filter, bool enable, const QVariant & option = QVariant());
|
---|
| 104 | void changeStereo3DFilter(bool enable, const QString & in, const QString & out);
|
---|
| 105 | #if DVDNAV_SUPPORT
|
---|
| 106 | void discSetMousePos(int x, int y);
|
---|
| 107 | void discButtonPressed(const QString & button_name);
|
---|
| 108 | #endif
|
---|
| 109 | void setAspect(double aspect);
|
---|
| 110 | void setFullscreen(bool b);
|
---|
| 111 | #if PROGRAM_SWITCH
|
---|
| 112 | void setTSProgram(int ID);
|
---|
| 113 | #endif
|
---|
| 114 | void toggleDeinterlace();
|
---|
| 115 | void askForLength();
|
---|
| 116 | void setOSDScale(double value);
|
---|
| 117 | void setChannelsFile(const QString &);
|
---|
| 118 |
|
---|
| 119 | void enableScreenshots(const QString & dir, const QString & templ = QString::null, const QString & format = QString::null);
|
---|
| 120 |
|
---|
| 121 | QString mpvVersion() { return mpv_version; };
|
---|
| 122 |
|
---|
| 123 | protected:
|
---|
| 124 | bool isOptionAvailable(const QString & option);
|
---|
| 125 | void addVFIfAvailable(const QString & vf, const QString & value = QString::null);
|
---|
| 126 | void messageFilterNotSupported(const QString & filter_name);
|
---|
| 127 |
|
---|
[188] | 128 | #ifdef OSD_WITH_TIMER
|
---|
| 129 | void toggleInfoOnOSD();
|
---|
| 130 | #endif
|
---|
| 131 |
|
---|
[175] | 132 | protected slots:
|
---|
| 133 | void parseLine(QByteArray ba);
|
---|
| 134 | void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
---|
| 135 | void gotError(QProcess::ProcessError);
|
---|
| 136 | void requestChapterInfo();
|
---|
[188] | 137 | /* void requestBitrateInfo(); */
|
---|
[175] | 138 |
|
---|
[188] | 139 | #ifdef OSD_WITH_TIMER
|
---|
| 140 | void displayInfoOnOSD();
|
---|
| 141 | #endif
|
---|
| 142 |
|
---|
[175] | 143 | protected:
|
---|
| 144 | #if NOTIFY_AUDIO_CHANGES
|
---|
| 145 | void updateAudioTrack(int ID, const QString & name, const QString & lang);
|
---|
| 146 | #endif
|
---|
| 147 | #if NOTIFY_SUB_CHANGES
|
---|
| 148 | void updateSubtitleTrack(int ID, const QString & name, const QString & lang);
|
---|
| 149 | #endif
|
---|
| 150 |
|
---|
| 151 | private:
|
---|
[188] | 152 | #if 0
|
---|
| 153 | // For some reason lupdate doesn't get the translations from mpvoptions.cpp
|
---|
| 154 | void translations() {
|
---|
| 155 | QString s = tr("the '%1' filter is not supported by mpv");
|
---|
| 156 | s = tr("File:");
|
---|
| 157 | s = tr("Video:");
|
---|
| 158 | s = tr("Resolution:");
|
---|
| 159 | s = tr("Frames per second:");
|
---|
| 160 | s = tr("Estimated:");
|
---|
| 161 | s = tr("Aspect Ratio:");
|
---|
| 162 | s = tr("Bitrate:");
|
---|
| 163 | s = tr("Dropped frames:");
|
---|
| 164 | s = tr("Audio:");
|
---|
| 165 | s = tr("Bitrate:");
|
---|
| 166 | s = tr("Sample Rate:");
|
---|
| 167 | s = tr("Channels:");
|
---|
| 168 | s = tr("Audio/video synchronization:");
|
---|
| 169 | s = tr("Cache fill:");
|
---|
| 170 | s = tr("Used cache:");
|
---|
| 171 | }
|
---|
| 172 | #endif
|
---|
| 173 |
|
---|
| 174 | private:
|
---|
[175] | 175 | bool notified_mplayer_is_running;
|
---|
| 176 | bool notified_pause;
|
---|
| 177 | bool received_end_of_file;
|
---|
| 178 |
|
---|
| 179 | int last_sub_id;
|
---|
| 180 |
|
---|
| 181 | int mplayer_svn;
|
---|
| 182 |
|
---|
| 183 | QString mpv_version;
|
---|
| 184 | bool verbose;
|
---|
| 185 |
|
---|
| 186 | #if NOTIFY_SUB_CHANGES
|
---|
| 187 | SubTracks subs;
|
---|
| 188 |
|
---|
| 189 | bool subtitle_info_received;
|
---|
| 190 | bool subtitle_info_changed;
|
---|
| 191 | #endif
|
---|
| 192 |
|
---|
| 193 | #if NOTIFY_AUDIO_CHANGES
|
---|
| 194 | Tracks audios;
|
---|
| 195 | bool audio_info_changed;
|
---|
| 196 | #endif
|
---|
| 197 |
|
---|
| 198 | #if NOTIFY_VIDEO_CHANGES
|
---|
| 199 | Tracks videos;
|
---|
| 200 | bool video_info_changed;
|
---|
| 201 | #endif
|
---|
| 202 |
|
---|
| 203 | #if NOTIFY_CHAPTER_CHANGES
|
---|
| 204 | Chapters chapters;
|
---|
| 205 | bool chapter_info_changed;
|
---|
| 206 | #endif
|
---|
| 207 |
|
---|
| 208 | int dvd_current_title;
|
---|
| 209 | int br_current_title;
|
---|
| 210 |
|
---|
| 211 | QString previous_eq;
|
---|
| 212 |
|
---|
| 213 | #ifdef CAPTURE_STREAM
|
---|
| 214 | bool capturing;
|
---|
| 215 | #endif
|
---|
[188] | 216 |
|
---|
| 217 | #ifdef OSD_WITH_TIMER
|
---|
| 218 | QTimer * osd_timer;
|
---|
| 219 | #endif
|
---|
[175] | 220 | };
|
---|
| 221 |
|
---|
| 222 | #endif
|
---|