| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2010 Ricardo Villalba <[email protected]>
|
|---|
| 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 | #define NOTIFY_SUB_CHANGES 1
|
|---|
| 28 | #define NOTIFY_AUDIO_CHANGES 1
|
|---|
| 29 |
|
|---|
| 30 | class QStringList;
|
|---|
| 31 |
|
|---|
| 32 | class MplayerProcess : public MyProcess
|
|---|
| 33 | {
|
|---|
| 34 | Q_OBJECT
|
|---|
| 35 |
|
|---|
| 36 | public:
|
|---|
| 37 | MplayerProcess(QObject * parent = 0);
|
|---|
| 38 | ~MplayerProcess();
|
|---|
| 39 |
|
|---|
| 40 | bool start();
|
|---|
| 41 | void writeToStdin(QString text);
|
|---|
| 42 |
|
|---|
| 43 | MediaData mediaData() { return md; };
|
|---|
| 44 |
|
|---|
| 45 | signals:
|
|---|
| 46 | void processExited();
|
|---|
| 47 | void lineAvailable(QString line);
|
|---|
| 48 |
|
|---|
| 49 | void receivedCurrentSec(double sec);
|
|---|
| 50 | void receivedCurrentFrame(int frame);
|
|---|
| 51 | void receivedPause();
|
|---|
| 52 | void receivedWindowResolution(int,int);
|
|---|
| 53 | void receivedNoVideo();
|
|---|
| 54 | void receivedVO(QString);
|
|---|
| 55 | void receivedAO(QString);
|
|---|
| 56 | void receivedEndOfFile();
|
|---|
| 57 | void mplayerFullyLoaded();
|
|---|
| 58 | void receivedStartingTime(double sec);
|
|---|
| 59 |
|
|---|
| 60 | void receivedCacheMessage(QString);
|
|---|
| 61 | void receivedCreatingIndex(QString);
|
|---|
| 62 | void receivedConnectingToMessage(QString);
|
|---|
| 63 | void receivedResolvingMessage(QString);
|
|---|
| 64 | void receivedScreenshot(QString);
|
|---|
| 65 | void receivedUpdatingFontCache();
|
|---|
| 66 | void receivedScanningFont(QString);
|
|---|
| 67 |
|
|---|
| 68 | void receivedStreamTitle(QString);
|
|---|
| 69 | void receivedStreamTitleAndUrl(QString,QString);
|
|---|
| 70 |
|
|---|
| 71 | void failedToParseMplayerVersion(QString line_with_mplayer_version);
|
|---|
| 72 |
|
|---|
| 73 | #if NOTIFY_SUB_CHANGES
|
|---|
| 74 | //! Emitted if a new subtitle has been added or an old one changed
|
|---|
| 75 | void subtitleInfoChanged(const SubTracks &);
|
|---|
| 76 |
|
|---|
| 77 | //! Emitted when subtitle info has been received but there wasn't anything new
|
|---|
| 78 | void subtitleInfoReceivedAgain(const SubTracks &);
|
|---|
| 79 | #endif
|
|---|
| 80 | #if NOTIFY_AUDIO_CHANGES
|
|---|
| 81 | //! Emitted if a new audio track been added or an old one changed
|
|---|
| 82 | void audioInfoChanged(const Tracks &);
|
|---|
| 83 | #endif
|
|---|
| 84 |
|
|---|
| 85 | #if DVDNAV_SUPPORT
|
|---|
| 86 | void receivedDVDTitle(int);
|
|---|
| 87 | void receivedDuration(double);
|
|---|
| 88 | void receivedTitleIsMenu();
|
|---|
| 89 | void receivedTitleIsMovie();
|
|---|
| 90 | #endif
|
|---|
| 91 |
|
|---|
| 92 | protected slots:
|
|---|
| 93 | void parseLine(QByteArray ba);
|
|---|
| 94 | void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|---|
| 95 | void gotError(QProcess::ProcessError);
|
|---|
| 96 |
|
|---|
| 97 | private:
|
|---|
| 98 | bool notified_mplayer_is_running;
|
|---|
| 99 | bool received_end_of_file;
|
|---|
| 100 |
|
|---|
| 101 | MediaData md;
|
|---|
| 102 |
|
|---|
| 103 | int last_sub_id;
|
|---|
| 104 |
|
|---|
| 105 | int mplayer_svn;
|
|---|
| 106 |
|
|---|
| 107 | #if NOTIFY_SUB_CHANGES
|
|---|
| 108 | SubTracks subs;
|
|---|
| 109 |
|
|---|
| 110 | bool subtitle_info_received;
|
|---|
| 111 | bool subtitle_info_changed;
|
|---|
| 112 | #endif
|
|---|
| 113 |
|
|---|
| 114 | #if NOTIFY_AUDIO_CHANGES
|
|---|
| 115 | Tracks audios;
|
|---|
| 116 | bool audio_info_changed;
|
|---|
| 117 | #endif
|
|---|
| 118 |
|
|---|
| 119 | #if GENERIC_CHAPTER_SUPPORT
|
|---|
| 120 | int dvd_current_title;
|
|---|
| 121 | #endif
|
|---|
| 122 | };
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 | #endif
|
|---|