| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.org>
|
|---|
| 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 | };
|
|---|
| 48 | #endif
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 | class QStringList;
|
|---|
| 52 |
|
|---|
| 53 | class MplayerProcess : public MyProcess
|
|---|
| 54 | {
|
|---|
| 55 | Q_OBJECT
|
|---|
| 56 |
|
|---|
| 57 | public:
|
|---|
| 58 | MplayerProcess(QObject * parent = 0);
|
|---|
| 59 | ~MplayerProcess();
|
|---|
| 60 |
|
|---|
| 61 | bool start();
|
|---|
| 62 | void writeToStdin(QString text);
|
|---|
| 63 |
|
|---|
| 64 | MediaData mediaData() { return md; };
|
|---|
| 65 |
|
|---|
| 66 | signals:
|
|---|
| 67 | void processExited();
|
|---|
| 68 | void lineAvailable(QString line);
|
|---|
| 69 |
|
|---|
| 70 | void receivedCurrentSec(double sec);
|
|---|
| 71 | void receivedCurrentFrame(int frame);
|
|---|
| 72 | void receivedPause();
|
|---|
| 73 | void receivedWindowResolution(int,int);
|
|---|
| 74 | void receivedNoVideo();
|
|---|
| 75 | void receivedVO(QString);
|
|---|
| 76 | void receivedAO(QString);
|
|---|
| 77 | void receivedEndOfFile();
|
|---|
| 78 | void mplayerFullyLoaded();
|
|---|
| 79 | void receivedStartingTime(double sec);
|
|---|
| 80 |
|
|---|
| 81 | void receivedCacheMessage(QString);
|
|---|
| 82 | void receivedCreatingIndex(QString);
|
|---|
| 83 | void receivedConnectingToMessage(QString);
|
|---|
| 84 | void receivedResolvingMessage(QString);
|
|---|
| 85 | void receivedScreenshot(QString);
|
|---|
| 86 | void receivedUpdatingFontCache();
|
|---|
| 87 | void receivedScanningFont(QString);
|
|---|
| 88 |
|
|---|
| 89 | void receivedStreamTitle(QString);
|
|---|
| 90 | void receivedStreamTitleAndUrl(QString,QString);
|
|---|
| 91 |
|
|---|
| 92 | void failedToParseMplayerVersion(QString line_with_mplayer_version);
|
|---|
| 93 |
|
|---|
| 94 | #if NOTIFY_SUB_CHANGES
|
|---|
| 95 | //! Emitted if a new subtitle has been added or an old one changed
|
|---|
| 96 | void subtitleInfoChanged(const SubTracks &);
|
|---|
| 97 |
|
|---|
| 98 | //! Emitted when subtitle info has been received but there wasn't anything new
|
|---|
| 99 | void subtitleInfoReceivedAgain(const SubTracks &);
|
|---|
| 100 | #endif
|
|---|
| 101 | #if NOTIFY_AUDIO_CHANGES
|
|---|
| 102 | //! Emitted if a new audio track been added or an old one changed
|
|---|
| 103 | void audioInfoChanged(const Tracks &);
|
|---|
| 104 | #endif
|
|---|
| 105 |
|
|---|
| 106 | #if DVDNAV_SUPPORT
|
|---|
| 107 | void receivedDVDTitle(int);
|
|---|
| 108 | void receivedDuration(double);
|
|---|
| 109 | void receivedTitleIsMenu();
|
|---|
| 110 | void receivedTitleIsMovie();
|
|---|
| 111 | #endif
|
|---|
| 112 |
|
|---|
| 113 | protected slots:
|
|---|
| 114 | void parseLine(QByteArray ba);
|
|---|
| 115 | void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|---|
| 116 | void gotError(QProcess::ProcessError);
|
|---|
| 117 |
|
|---|
| 118 | #if defined(Q_OS_OS2)
|
|---|
| 119 | void MPpipeOpen();
|
|---|
| 120 | void MPpipeClose();
|
|---|
| 121 | void MPpipeWrite(const QByteArray text);
|
|---|
| 122 | #endif
|
|---|
| 123 |
|
|---|
| 124 | private:
|
|---|
| 125 | bool notified_mplayer_is_running;
|
|---|
| 126 | bool received_end_of_file;
|
|---|
| 127 |
|
|---|
| 128 | MediaData md;
|
|---|
| 129 |
|
|---|
| 130 | int last_sub_id;
|
|---|
| 131 |
|
|---|
| 132 | #if defined(Q_OS_OS2)
|
|---|
| 133 | PipeThread *pipeThread;
|
|---|
| 134 | HPIPE hpipe;
|
|---|
| 135 | PID pidMP;
|
|---|
| 136 | #endif
|
|---|
| 137 |
|
|---|
| 138 | int mplayer_svn;
|
|---|
| 139 |
|
|---|
| 140 | #if NOTIFY_SUB_CHANGES
|
|---|
| 141 | SubTracks subs;
|
|---|
| 142 |
|
|---|
| 143 | bool subtitle_info_received;
|
|---|
| 144 | bool subtitle_info_changed;
|
|---|
| 145 | #endif
|
|---|
| 146 |
|
|---|
| 147 | #if NOTIFY_AUDIO_CHANGES
|
|---|
| 148 | Tracks audios;
|
|---|
| 149 | bool audio_info_changed;
|
|---|
| 150 | #endif
|
|---|
| 151 |
|
|---|
| 152 | #if GENERIC_CHAPTER_SUPPORT
|
|---|
| 153 | int dvd_current_title;
|
|---|
| 154 | #endif
|
|---|
| 155 | };
|
|---|
| 156 |
|
|---|
| 157 | #endif
|
|---|